🔴 Does the data provided to smart contracts by oracles have to be correct? No 😉 What are the risks and what strategy to adopt when designing a web3 solution?
🔴 Oracles provide data from outside the blockchain to contracts (smart contract). This is an important functionality, because without it, contracts are limited to blockchain data only. Oracles therefore enable the implementation of complex business logic in web3 solutions.
🔴 In previous articles, I discussed the basic operation of oracles (links in the comments). The decentralized oracle model involves querying data from outside several independent oracles, and then determining the right one based on their answers (several). Asking, for example, the USD/BTC price of three oracles, the final value is perhaps the average of the 3 answers obtained.
🔴 But do the oracles have to return the correct result? If the correct operation of the contract depends on it, then this is one of the most important factors determining the sense of using oracles. Unfortunately, from a technical point of view, oracles do not have to return correct answers. The correctness of the data returned by oracles is based on cryptoeconomics – the most popular model for ensuring “correctness” used in the blockchain world.
🔴 This is the basis of blockchain cryptoeconomics: oracles return correct data because it pays them to do so, and an incorrect answer can be very costly. The oracle’s business model is to execute off-chain (off-blockchain) queries and return them to the contract in exchange for a fee, which the contract pays by asking oracles for off-chain data. The execution of a “bad” service by an oracle will result in a loss of reputation and, in extreme cases, may even end in the loss of a security deposit (e.g., one that the oracle must deposit at the beginning in order to start providing services on the network at all (analogous to staking).
🔴 However, it is worth knowing that an oracle has the possibility to return a wrong answer. Depending on the level of security of a given technology for the oracle (e.g. Chainlink) – such an oracle may incur a greater or lesser penalty, but technically it is very difficult to stop the oracle from “lying”. The model is the safer, the more severe the economic penalty (loss) the oracle will incur when it lies. Therefore, the strong token on which the oracle ecosystem is based should be “valuable”.
🔴 Using multiple oracles and relying on those with a good reputation – this is the optimal strategy for using oracles. However, this is an expensive strategy, are there any alternatives? Not necessarily, but for contracts there are many free data sources available that use the above strategy. We are talking about the so-called data feeds. I will describe them in the next article.