From 010d498807b08270f4cec432f2d735c234933740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gw=C3=A9nol=C3=A9=20MARTIN?= Date: Sat, 17 Aug 2024 18:42:22 +0900 Subject: [PATCH] feat: add ORA to Oracles doc --- docs/manta-pacific/ORA Oracles.md | 77 +++++++++++++++++++++++++++++ docs/manta-pacific/Tools/Oracles.md | 14 ++++++ 2 files changed, 91 insertions(+) create mode 100644 docs/manta-pacific/ORA Oracles.md diff --git a/docs/manta-pacific/ORA Oracles.md b/docs/manta-pacific/ORA Oracles.md new file mode 100644 index 00000000..1d3517c7 --- /dev/null +++ b/docs/manta-pacific/ORA Oracles.md @@ -0,0 +1,77 @@ +# ORA Oracle + +[ORA](https://ora.io) is Ethereum's Trustless AI. ORA is the verifiable oracle protocol that brings AI and complex compute onchain. +ORA’s main product, **Onchain AI Oracle (OAO)**, brings AI onchain. + +ORA breaks down the limitations of smart contracts by offering verifiable AI inference, so developers can innovate freely. + +## OAO Quickstart + +This quickstart is designed to help you to build a smart-contract on Manta able to interact with OAO. You can find more details in [our docs Quickstart.](https://docs.ora.io/doc/oao-onchain-ai-oracle/develop-guide) + +### Workflow + +1. The user contract sends the AI request to OAO on Manta, by calling `requestCallback` function on the OAO contract. +2. Each AI request will initiate an opML inference. +3. OAO will emit a `requestCallback` event which will be collected by opML node. +4. opML node will run the AI inference, and then upload the result on Manta, waiting for the challenge period. + 1. During the challenge period, the opML validators will check the result, and challenge it if the submitted result is incorrect. + 2. If the submitted result is successfully challenged by one of the validators, the submitted result will be updated on Manta. + 3. After the challenge period, the submitted result on chain is finalized. +5. When the result is uploaded or updated on Manta, the provided AI inference in opML will be dispatched to the user's smart contract via its specific callback function. + +## Integration + +### Overview + +To integrate with OAO, you will need to write your own contract. + +To build with AI models of OAO, we provided an example of contract using OAO: [Prompt](https://pacific-explorer.manta.network/address/0xBC24514E541d5CBAAC1DD155187A171a593e5CF6). + +### Smart Contract Integration + +1. Inherit `AIOracleCallbackReceiver` in your contract and bind with a specific OAO address: + +```solidity +constructor(IAIOracle _aiOracle) AIOracleCallbackReceiver(_aiOracle) {} +``` + +2. Write your callback function to handle the AI result from OAO. Note that only OAO can call this function: + +```solidity +function aiOracleCallback(uint256 requestId, bytes calldata output, bytes calldata callbackData) external override onlyAIOracleCallback() +``` + +3. When you want to initiate an AI inference request, call OAO as follows: + +```solidity +aiOracle.requestCallback(modelId, input, address(this), gas_limit, callbackData); +``` + +## Reference + +2 models are available on Manta: Stable Diffusion (ID: 50) and Llama3 8B Instruct (ID: 11). + +[Prompt](https://docs.ora.io/doc/oao-onchain-ai-oracle/reference) and [SimplePrompt](https://docs.ora.io/doc/oao-onchain-ai-oracle/reference) are both example smart contracts interacted with OAO. + +For simpler application scenarios (eg. Prompt Engineering based AI like GPTs), you can directly use Prompt or SimplePrompt. + +SimplePrompt saves gas by only emitting the event without storing historical data. + +Manta Pacific mainnet: + +- OAO Proxy: [0x0A0f4321214BB6C7811dD8a71cF587bdaF03f0A0](https://pacific-explorer.manta.network/address/0x0A0f4321214BB6C7811dD8a71cF587bdaF03f0A0) +- Prompt: [0xC20DeDbE8642b77EfDb4372915947c87b7a526bD](https://pacific-explorer.manta.network/address/0xBC24514E541d5CBAAC1DD155187A171a593e5CF6) +- SimplePrompt: [0xC3287BDEF03b925A7C7f54791EDADCD88e632CcD](https://pacific-explorer.manta.network/address/0x523622DfEd0243B0DF80CC9275764B0f432D33E3) + +Manta Sepolia testnet: + +- OAO Proxy: [0x0A0f4321214BB6C7811dD8a71cF587bdaF03f0A0](https://pacific-explorer.sepolia-testnet.manta.network/address/0x0A0f4321214BB6C7811dD8a71cF587bdaF03f0A0) +- Prompt: [0xC20DeDbE8642b77EfDb4372915947c87b7a526bD](https://pacific-explorer.sepolia-testnet.manta.network/address/0xC20DeDbE8642b77EfDb4372915947c87b7a526bD) +- SimplePrompt: [0xC3287BDEF03b925A7C7f54791EDADCD88e632CcD](https://pacific-explorer.sepolia-testnet.manta.network/address/0x3bfD1Cc919bfeC7795b600E764aDa001b58f122a) + +## Useful links: + +- Read [ORA documentation](https://docs.ora.io) +- [Join our Discord](https://discord.gg/ora-io) where our team can help you +- Follow us [on X](https://x.com/OraProtocol) \ No newline at end of file diff --git a/docs/manta-pacific/Tools/Oracles.md b/docs/manta-pacific/Tools/Oracles.md index 675ea163..54856aca 100644 --- a/docs/manta-pacific/Tools/Oracles.md +++ b/docs/manta-pacific/Tools/Oracles.md @@ -1,5 +1,19 @@ # Oracles +## ORA + +[ORA](https://ora.io) is Ethereum's Trustless AI. + +As a verifiable oracle protocol, ORA brings AI and complex compute onchain. Its main product, **Onchain AI Oracle (OAO)**, integrates AI capabilities directly onchain. + +Some useful links to build with OAO on Manta: + +- [ORA Doc](https://docs.ora.io) +- [Quickstart guide](https://docs.ora.io/doc/oao-onchain-ai-oracle/develop-guide/tutorials/interaction-with-oao-tutorial) +- The best way to contact our team, ORA [Discord](https://discord.gg/ora-io) + +You can also find a [Quickstart guide designed for Manta Pacific here](https://docs.manta.network/docs/manta-pacific/ORA%20Oracles)! + ## Pyth [Pyth](http://pyth.network/) offers 250+ [price feeds](https://pyth.network/price-feeds) for Manta Pacific.