Money on Chain is a system that provides a stablecoin platform collateralized with Bitcoin in the RSK blockchain therefore it needs a way to determine the DoC token value in rBTC. Consequently, it needs the price data for BTC/USD pair, among other pairs, inside the blockchain. Since this data cannot be directly accessed from the blockchain, external agents, called Oracles, must provide the necessary prices.
An oracle is a trusted source of data that acts as a bridge between a blockchain and real-world, off-chain, information that can be used by smart contracts.
Oracle services query price pair data from several crypto exchanges and send them into a smart contract on the blockchain being available for other smart contracts to use (call) them.
The Money on Chain Oracle System is a key aspect in the path to decentralization, which creates the possibility for stakeholders to run an oracle and participate in a consensus protocol for price feed publication.
The architecture of Money on Chain’s Oracle System contemplates the following aspects:
Oracles report the chosen price pairs, e.g. rBTC/USD, taken from various crypto exchanges. The same infrastructure can be easily extended to more than one price pair.
Anyone can become an Oracle, to do so, a stakeholder needs to have a minimum amount of 250,000 MoC tokens staked, being able to compete with other oracles to be selected as a price publisher. But only N (currently 10) number of oracles are selected to be part of the consensus depending on the amount of their stake. This feature is very important for the community since it helps the system to have honest oracles, because in the case one of them attacking the system will also be destroying the value of its own stake.
Oracles get revenue from the MoC Staking Rewards program for their staked MoC tokens, and in addition to this, they also get rewards for publishing prices. This compensates for the expenses of running an Oracle and pays an additional yield.
The Oracle system works in 30 days periods, also called rounds, in which the accounting for the Oracle rewards is determined.
When a new round starts, the protocol distributes the accumulated rewards in the previous round and sets the global reward counter to zero, from that point onwards the produced rewards are going to be used for the next round. Each round accounts for the locked stake and the price publications for the current month, i.e. in each round, the following data is saved: the list of N (10) Oracles that have more stake are selected to participate, they can publish prices and win rewards for that. When the round is closed the rewards are transferred directly to the account of each Oracle in proportion to the number of publications done during the round.
Oracles must register as such by publishing their public address and server URL to the RSK network. Oracles must also subscribe for each coin pair they are interested in, to be considered in the selection process for the next publishing round of these prices.
Oracles who want to withdraw their locked stake must first be inactive for one round by unsubscribing from all coin pairs. If there is a withdrawal without the tidy unsubscription the Oracle is punished by losing the points won in the current round so at the end of the round it won't receive rewards. Once successfully unsubscribed, the same withdrawal rules as for stakers apply to the Oracle.
Oracles have to find consensus about the correct price feeds, e.g. the rBTC/USD price pair. This is achieved by an off-chain consensus in which the N (currently 10) Oracles participate which locked the most stake. Oracle’s stake counts for all price pairs, but Oracles must subscribe for each price pair in order to participate. Then, during the round, proposer election and consensus works as follows:
For each publication, only one Oracle can succeed (only one transaction is accepted by the blockchain). After a successful publication, the block hash for the last publication changes, and a new consensus is started.
The Oracle system does have further important properties reflected:
Same way as with stakers, a percentage of the collected MoC tokens from the MOC protocol through fees and from selling data provided by the Oracles to other third parties is distributed among the Oracles. The income stream is accumulated during one month, i.e, one round, and distributed to each coin pair price module. Oracles also receive from the MoC Staking Rewards program for being a staker.
Reward Distribution: Every publication of a price pair yields one point for the publishing Oracle. The frequency to be allowed to publish is proportional to the Oracle stake, i.e. the larger the stake the more often an Oracle is elected to publish. At the end of the round, Oracles receive a payment proportional to their collected points. The profit gets transferred directly to the account of the Oracle owner once a new round starts. Per price pair the Oracle reward is calculated using the following formula:
Rewards (Points Won Total Points).
If an Oracle withdraws part of its stake in the middle of the round and the new amount is less than the minimum needed or if there is an Oracle with more stake outside the round waiting to participate, then the Oracle loses its place, losing at the same time the accumulated points and the corresponding rewards. On the other hand, if an Oracle that is not selected in the current round adds stake, surpassing an Oracle that is already selected, the Oracle must wait for the next round to participate anyway.
Oracles are pivotal to the Money on Chain protocol, not only they provide accurate pricing information, but they do so in a decentralized manner which allows the platform to be counterparty risk-free.
Do you want to run an oracle? https://docs.moneyonchain.com/omoc/