3. Kleros Oracle integration
A comprehensive guide for integrating Reality.eth + Kleros oracle system to access reliable real-world data through decentralized verification and arbitration.
Last updated
Was this helpful?
A comprehensive guide for integrating Reality.eth + Kleros oracle system to access reliable real-world data through decentralized verification and arbitration.
Last updated
Was this helpful?
Want your DApp to access reliable real-world information on-chain? The Reality.eth + Kleros oracle system provides a decentralized solution for subjective data verification through economic incentives and crowdsourced arbitration.
This system combines two key protocols:
- The underlying oracle and bond escalation mechanism
- The dispute resolution protocol
The integration consists of two main parts:
Your DApp
Your DApp only needs to interact with the Reality.eth contract directly
You submit questions with the appropriate arbitrator address
You retrieve final answers once they're available
No need to implement any arbitration logic in your code
Oracle System
The oracle system handles everything else behind the scenes:
Reality.eth: Manages questions, answers, and economic incentives through bond escalation
Arbitration Mechanism: When disputes arise, the Kleros Arbitrator Proxy creates a case in Kleros Court where jurors resolve the dispute, then reports the result back to Reality.eth
You have two ways to integrate with the Reality.eth + Kleros oracle:
Testing the system before full integration, learning how the system works
One-off questions that don't require automation
Implement direct smart contract interaction with Reality.eth to programmatically:
Submit questions from your DApp
Retrieve verified answers
React to oracle responses
The Reality.eth + Kleros system follows a push/pull model:
Push: Your DApp submits questions to Reality.eth
Pull: Your DApp later retrieves the verified answers
The question can be resolved through two paths:
Someone submits an answer with a bond
No one challenges within the timeout period
The answer is finalized automatically
Your DApp can retrieve the result
Someone submits an answer with a bond
Another user challenges with a higher bond
Bond escalation may continue until someone requests arbitration
The question gets frozen on Reality.eth
A dispute is created in Kleros Court
Jurors vote on the correct answer
The final ruling is submitted to Reality.eth
Your DApp can retrieve the arbitrated result
Your DApp only needs to interact with Reality.eth directly. Import the interface:
You can find the Reality.eth contract addresses under:
To submit a question to Reality.eth:
Parameter Explanations:
templateID: The question format template - commonly used values:
0
: Boolean (Yes/No) questions
1
: Numerical (uint) answers
2
: Single-select multiple choice
3
: Multiple-select multiple choice
4
: Datetime responses
5
: Hash type (new in v3.2)
question: The actual question with parameters matching the template format, separated by the unicode delimiter "␟":
Template 0 (bool): "Did event X happen?␟category␟en"
Template 1 (uint): "What was the price of ETH on April 16, 2025?␟crypto␟en"
Template 2 (single-select): "Which team won the 2024 NBA Finals?␟"Lakers","Celtics","Bucks","Other"␟sports␟en"
arbitrator: arbitrator: The address of the Kleros Arbitrator Proxy that will handle disputes.
timeout: Time in seconds the question will have after receiving an answer before it's automatically finalized. Typically around 1 day (86400 seconds). The contract enforces a maximum value of 365 days (31,536,000 seconds).
openingTimestamp: Unix timestamp defining the earliest time when answers can be submitted. Set to 0 if you want the question to be answerable immediately.
nonce: A user-supplied number to differentiate between identical questions with the same settings. Use 0 if you don't plan to ask the same question with identical parameters more than once.
Example
The system supports same chani and cross-chain deployments (question on one chain, arbitration on another).
Same-chain oracle and arbitration:
Ethereum Mainnet (General Court): 0xFf32eff53459485074b4Db14633252C9dcA3791A
Ethereum Mainnet (DAO Governance/Technical Court): 0xf72cfd1b34a91a64f9a98537fe63fbab7530adca
Sepolia Testnet: 0x05b942faecfb3924970e3a28e0f230910cedff45
Cross-chain oracle and arbitration:
Once your question has been answered (either through consensus or arbitration), retrieve the answer:
The Kleros Arbitrator Proxy:
Acts as an arbitrator for Reality.eth
Creates disputes in Kleros Court when arbitration is requested
Reports Kleros rulings back to Reality.eth in the proper format
The Kleros Court:
Adjudicates on disputes by drawing jurors
Manages the crowdfunded appeals process
Publishes final rulings that are transmitted back to Reality.eth
The Reality.eth + Kleros oracle supports various question types:
Bool
Yes/No questions
Did event X happen?
Uint
Numerical answers
How many votes did candidate Y receive?
Single-select
Multiple choice with one answer
Which team won the championship?
Multiple-select
Multiple choice with multiple possible answers
Which states voted Democrat?
Datetime
Date/time responses
When did the event occur?
Hash
Hash-based identification (new in v3.2)
Does hash X correspond to document Y?
Questions use templates to reduce gas costs. Built-in templates include:
Responses are returned as bytes32
. Depending on the question type:
Bool: 1
(Yes), 0
(No), or 0xff...ff
(Invalid)
Uint: The number as bytes32, divided by decimals
if specified
Single-select: Zero-indexed selection (0 for first option, 1 for second, etc.)
Multiple-select: One-indexed with bitwise addition (1 for first, 2 for second, 1+2=3 for both)
Datetime: Unix timestamp (seconds since 1970)
Hash: The submitted hash that matches the criteria
Special values you may encounter:
0xff...ff
(all f's): Invalid answer
0xff...fe
(all f's except last digit): "Answered too early" - when a question needs more time
The Reality.eth + Kleros system involves several types of fees and payments, each with a specific purpose in the incentive mechanism:
Fee type
Set by
Paid by
Deductions
Paid to
Question Reward
Asker
Asker
None
Highest-bonded correct answerer*
Answer Bond
Answerer
Answerer
None
Returned if correct, or to next correct answerer if incorrect
Takeover Fee
Previous answerer
Subsequent answerer
From answer rewards
Previous answerer
Arbitration Fee
Arbitrator
Anyone requesting arbitration
None
Arbitrator
Claim Fee
System (2.5%)
Claimer
From claimed amount
Burned
*Except when settled by arbitration
Set by sending ETH when calling askQuestion()
Any ETH or tokens provided with the askQuestion or askQuestionERC20 call will be used as a question reward, minus any fee the specified arbitrator requires when a new question is asked
Incentivizes correct answers
Paid to whoever provides the final accepted answer
If decided by arbitration, the arbitrator specifies who receives the reward
Higher rewards typically result in faster and more accurate answers
Backs the answerer's claim that their answer is correct
Set by the answerer, but must be at least twice the previous bond if there was a prior answer
Returned if the answer is correct
If incorrect, paid to the next answerer who supplies the correct answer
Compensates previous answerers when someone takes over a correct answer
Equal to the bond supplied by the last person who gave that answer
Paid to the last person who gave that answer
Deducted from payments that would otherwise be awarded for giving the correct answer
Paid to the arbitrator when requesting intervention
Set by the arbitrator
Paid by the user requesting arbitration (usually an answerer whose answer was replaced)
From Reality.eth v2.1 onwards
2.5% of claimed bonds (except the final bond) is burned
Prediction Markets: Seer, Polkamarkets/Foreland, and Omen use it to verify real-world event outcomes
When Is This Required?
A custom primary document becomes necessary when:
Your DApp has specific rules for how disputes should be judged
Resolving disputes requires specialized knowledge or context
You need a dedicated Kleros court for your application's disputes
The interpretation of answers in your context differs from standard interpretations
The Complete Scenario
If you need a custom primary document:
Initial Assessment: The Kleros team evaluates your use case to determine if standard arbitration guidelines are sufficient
Document Creation: You work with Kleros to create a document that:
Explains your application's context to jurors
Provides guidance on evaluating evidence
Defines specialized terminology
Establishes clear criteria for determining correct answers
Deployment: Kleros deploys a dedicated arbitrator proxy for your application with your primary document embedded as part of the proxy's metaevidence
Usage: When disputes go to arbitration, jurors use your guidelines to make decisions
Real-World Example: Seer Prediction Markets
If you think your application might need this level of customization, the Kleros team can guide you through the process.
Q: Does my DApp need to call the arbitrator proxy directly?
A: No! Your DApp only needs to interact with Reality.eth. The proxy handles communication between Reality.eth and Kleros.
Q: What happens if there's a dispute?
A: The dispute process is handled automatically between Reality.eth and Kleros via the arbitrator proxy.
Q: How can I make my question clearer for accurate answers?
A: Be specific, include resolution criteria, and specify a trusted information source if applicable. For example: "Did the S&P 500 close above 5,000 on April 10, 2025, according to the official S&P website?"
Q: If I don't want to use the Reality.eth frontend for my users, can I handle everything from my DApp
A: Yes, you can implement the full flow in your DApp, including submitting questions, providing answers, and requesting arbitration as needed.
A custom arbitrator proxy deployment
Help with Reality.eth integration
Assistance with complex use cases
Use the to submit questions and retrieve answers manually. This is ideal for:
For this approach, you'll need to thoroughly understand the Reality.eth interface. Check out the and
Question and arbitration on different chains, aka cross-chain proxies: list of deployments .
You can create custom templates with createTemplate()
or use the .
Optimistic Governance: implements it for secure DAO proposal execution
Content Moderation: leverages it for decentralized content policy enforcement
For most DApp integrations, the standard works perfectly fine without any customization. However, in some specialized cases, you may need a custom primary document for arbitration.
Seer required a because they needed specific rules for handling complex market outcomes, edge cases like delayed events, and wanted to specify which information sources should be considered authoritative for their prediction markets.
Contact the Kleros team at if you need: