ORA
ORA 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.
ORA breaks down the limitations of smart contracts by offering verifiable AI inference so that developers can innovate freely.
OAO quickstart
This quickstart is designed to help you build a smart contract on Arbitrum able to interact with OAO. You can find more details in our docs Quickstart.
Workflow
- The user contract sends the AI request to OAO on Arbitrum, by calling
requestCallback
function on the OAO contract. - Each AI request will initiate an opML inference.
- OAO will emit a
requestCallback
event which will be collected by opML node. - opML node will run the AI inference, and then upload the result on Arbitrum, waiting for the challenge period.
- During the challenge period, the opML validators will check the result and challenge it if the submitted result is incorrect.
- If the submitted result is successfully challenged by one of the validators, the submitted result will be updated on Arbitrum.
- After the challenge period, the submitted result onchain is finalized.
- When the result is uploaded or updated on Arbitrum, 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.
Smart contract integration
- Inherit
AIOracleCallbackReceiver
in your contract and bind with a specific OAO address:
constructor(IAIOracle _aiOracle) AIOracleCallbackReceiver(_aiOracle) {}
- Write your callback function to handle the AI result from OAO. Note that only OAO can call this function:
function aiOracleCallback(uint256 requestId, bytes calldata output, bytes calldata callbackData) external override onlyAIOracleCallback()
- When you want to initiate an AI inference request, call OAO as follows:
aiOracle.requestCallback(modelId, input, address(this), gas_limit, callbackData);
Reference
4 models are available on Arbitrum One: Stable Diffusion (ID: 50), Llama3 8B Instruct (ID: 11), OpenLM Score 7B (ID: 14) and OpenLM Chat 7B (ID: 15).
Prompt and SimplePrompt 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.
Arbitrum One:
- OAO Proxy: 0x0A0f4321214BB6C7811dD8a71cF587bdaF03f0A0
- Prompt: 0xC20DeDbE8642b77EfDb4372915947c87b7a526bD
- SimplePrompt: 0xC3287BDEF03b925A7C7f54791EDADCD88e632CcD
Arbitrum Sepolia tesnet:
- OAO Proxy: 0x0A0f4321214BB6C7811dD8a71cF587bdaF03f0A0
- Prompt: 0xC3287BDEF03b925A7C7f54791EDADCD88e632CcD
- SimplePrompt: 0xBC24514E541d5CBAAC1DD155187A171a593e5CF6
Useful links:
- Read ORA documentation
- Join our Discord where our team can help you
- Follow us on X