Announcing The Relevant Oracle Module

Slava Balasanov
Relevant Community
Published in
3 min readMay 6, 2021

We are excited to release the open-source Relevant Oracle Module to be used with the Cosmos SDK. Developers can use this module to easily build oracles and off-chain worker processes and incorporate them into their apps. This opens up unlimited defi opportunities and integrations within the Cosmos ecosystem.

Delphic Epsilon Symbol

The development of the Relevant Oracle Module was funded by a grant from the Interchain Foundation.

The code: https://github.com/relevant-community/oracle

The docs: https://relevant-community.github.io/oracle/

What can be built with it?

  • Chainlink-like pricefeed oracle services
  • Pagerank-style graph analysis tools
  • AI algorithm integrations (off-chain workers can be used to run AI algorithms and commit results on-chain)

At Relevant we will be using this module to compute on-chain reputation rankings with our custom Reputation protocol.

Definitions:

Off-chain worker: a process that is run outside of the smart contract environment. It can be as simple as fetching some data from an API, or as involved as running an AI algorithm.

Oracle: a mechanism for reporting off-chain data to be included and used on-chain.

Why Oracles are Important:

In a decentralized setting, smart contracts have very strict limitations. They need to be deterministic, which means that they have to return consistent results, no matter who runs them, when they run them, or what type of computer is used. This requirement makes it impossible to fetch data via external APIs — there is no way to predict if the request will succeed or return consistent results. Smart contracts also need to execute fast in order to not halt the chain. You cannot execute long-running asynchronous computations inside a smart contract.

Oracles allow us to run non-deterministic and intensive computations outside of a smart contract and then write the results to a blockchain ledger. For blockchains using BFT Consensus (like Tendermint, used by the Cosmos SDK) oracles can be implemented by having all validators run an off-chain worker and then vote on final results to be committed on-chain. For example, the validators can fetch a price of a given asset from an exchange API, submit their results, and have the average of all submissions committed on-chain.

Relevant Oracle Module:

The Relevant Oracle Module makes it easy to add multiple custom oracles and off-chain processes to your Cosmos app. Off-chain workers run computation in response to blockchain events and submit the results as a blockchain transaction. The module includes helper methods that help developers tally the claim results and write the final data on-chian.

We have implemented a commit-reveal pattern to ensure that validators don’t simply copy what others have already submitted. At first, validators submit only the hash of their ‘claims’, and the actual results are submitted in the following round.

Check out the tutorial for an easy step-by-step guide on how to use the module.

*Keep in mind that this is an early version of the module and the code had not been audited or tested in production.

Future Work

There are a few features we plan on adding to the module in the future. Currently any validator rewards or punishments fall outside the scope of the module, but can be easily implemented externally. Another useful feature could be to allow validators to submit oracle transactions without having to pay gas.

--

--

Slava Balasanov
Relevant Community

Founder of Relevant - decentralized curation protocols based on human values