The topic of oracles in the blockchain environment has been discussed from every possible perspective. The subject was summarized and made more approachable in the previous article. Today, we are proud to present a feature that we have recently added to the RedStone ecosystem, one which makes our oracles outstandingly flexible. We have called this portal Custom URL Oracles — and it is a powerful tool for Web3 projects that enables disruption and experimentation at an early stage, especially during hackathons.
The future is Custom
The first question with a new feature is often: why and what for. The same principle applies here. Currently, in the Web3 ecosystem, the vast majority of projects originate in the DeFi space. This means that most of the oracles concentrate on asset prices, tokens, stablecoins or synthetics. But what if someone comes up with a brilliant project idea that requires another type of data i.e. volume, weather or sports data? We all generate massive amounts of data every day and some part of it could be useful in Web3 projects. With this concept at the forefront of our minds, we have come up with the idea of RedStone Custom URL Oracles. The main goal behind this idea is to make oracles data agnostic and be able to provide as many kinds of data to the blockchain as possible. Naturally, we must impose some minor restrictions to keep the solution robust.
How it all works
Before we jump in, let’s briefly recall how RedStone oracles work (if you need more detailed information on that, be sure to check here). RedStone software is divided into two main parts. The first part is a network of nodes that are responsible for fetching data from external sources and broadcasting it to the decentralized cache layer. The second part is the EVM-connector, which takes data from the decentralized cache layer and adds signed and serialized information to a transaction that is later sent to any EVM blockchain that a user wants to, be it Ethereum, Avalanche, Polygon, Arbitrum, or Fantom. Next comes the flexibility of our infrastructure — our nodes can fetch data from any source and provide it to the EVM-connector. And this is exactly what Custom URL Oracles do. Users define what data is obtained and what could be used in smart contracts.
In order to make everything simpler, we’ve prepared a fancy UI for creating new custom URLs.
The only things required are the URL to API from which data would be fetched and a JSON path describing the way the desired value would be extracted from the API’s JSON response. As it can be seen, API response must be in JSON and formatted in a manner so that the JSON path can dig into the expected value. More detailed instructions on how to create a new Custom URL can be found at the end of this article. After creating a Custom URL it appears on the main page and is ready to be used with the EVM-connector like every other asset. The only difference is that the asset’s name would be the ID of the Custom URL which can be found after clicking on the Custom URLs list.
In this view, you can show a sample code that can be used in your Dapp by clicking Show sample code. An example is presented below:
Also, you can test specific Custom URL by clicking Test fetching now:
Additional information about Custom URLs values can be found here.
To sum up, Custom URL Oracles is a feature within RedStone oracles that makes it possible to fetch any data from a given URL, extract it using JSON path and make it available for our EVM-connector to use inside smart contracts. We encourage everyone to use the special UI prepared to create new Custom URL Oracles. So far we have seen projects related to weather, insurance, and e-commerce. The only limitation here is your imagination 😉
Instructions on how to create a new Custom URL
1. Click create new on Custom URL main page.
2. Provide necessary information (API URL, JSON path, comment) and click Evaluate.
3. After a few seconds you should see the result of the API call, and JSON patch data extraction.
4. Click Subscribe button and after a few moments (we need to send some transactions to the blockchain) you will see your freshly baked Custom URL on the main page. Now the only thing remaining is to integrate it with your dApp!
—
At RedStone we are on a mission to build the next generation of Oracles. Our solution has an unrivaled ability to exert significant control over any new data listings. Result? The flexibility to follow any emerging market trends, alongside substantial cost savings, allows us to stay at the frontier of a new wave of Decentralised Finance.
Join us on the journey!