📺 Watch the video version of this tutorial here ⏯
The iExec Oracle Factory is a developer interface allowing anyone to create their own oracles from scratch, in just a few minutes. No specialized blockchain or coding knowledge is needed and users can create oracles directly from their browser. This tutorial will walk you through this process.
If you haven’t already, check out the announcement blog post and learn more about the Oracle Factory.
Navigate to https://oracle-factory.iex.ec/builder and then log in with the appropriate wallet.
Tips:
Tips:
This phase requires knowledge in JSON analysis. Here are two examples of a JSON analysis.
Let’s start by building an oracle that pulls the gas price from Defipulse. If you’d like another example, see our Appendix on how to create an oracle for slippage data from the market data provider Kaiko.
DeFi Pulse is a site where you can find the various analytics and info for DeFi protocols. The API used here is an API for Defipulse’s demo purchase, with a cap on the daily number of calls.
If you want to create a pricing oracle using Defipulse data:
4. Then input “%API_KEY%” manually where you cut the API key in ②. Expected result:
This step allows you to replace your API key with %API_KEY%, so that you don’t need to reveal your key to malicious hackers.
5. For the Header & JSON path part, you will have to do a JSON analysis. Open an internet navigator. Input the API and obtain the below result.
6. Go to a JSON path finder such as: https://jsonpathfinder.com/ .
Paste all to analyze your API.
7. Choose one “Path” that interests you from the returned results. Remember that the Oracle Factory Beta can only return one point of data at a time. In the example above, average is chosen. Copy only the name of the Path you wish to use.
8. Go back to the Orale Factory , respect the “$.xx” format and input $.average
9. Choose the type of value returned (number, Boolean, string).
All right! Now let’s have a final look at what we’ve input so far. 🔥🔥
11. Click Test API.
If there is no error, click Next. If there is an error, you’ll have to debug to find out why.
Hooray! So far you’ve finished the biggest part of the work.
2. Wait for your oracle to be created.
3. View your oracle in your gallery. Your gallery is where you can manage or trigger your oracle to update the value. It can be found at https://oracle-factory.iex.ec/gallery
4. Click on Update to get the latest value.
One more thing:
If you’re curious, you can make a request to update your oracle, the ongoing transaction can be found in the explorer 🔎 ➡️https://explorer.iex.ec/viviani
Congratulations! Now you know everything about the iExec Oracle Factory!
Now, you may be interested in knowing how to integrate your newly created oracle into your Dapp: check out the tutorial!
APPENDIX
Kaiko is a leading market data provider, offering real-time and historical cryptocurrency trade data, order books, and aggregated prices through a cryptocurrency API.
For the creation of the oracle of slippage data, the format of API and the key is a little bit different: the key is given separately, so no need to seek the key in API URL, replace it with %API_KEY%. but to input it in the header.
Thanks for reading, and happy oracle creating!
Twitter •Youtube •iExec Roadmap •Github •Telegram •Slack