🔴 How to achieve decentralization using Oracles in blockchain and why is it harder than most of the industry thinks?
🔴 Oracles allow you to read data from outside the blockchain in contracts (smart contracts). This is an important functionality practically, because building a web3 application using contracts without data from outside the blockchain (e.g., currency pair prices) severely limits the ability to implement complex business logic in contracts.
🔴 The industry unfortunately has a misconception about how oracle works. It is assumed that the mechanism is “decentralized,” while practically the opposite is very often true.
🔴 In the basic model of oracle use, the contract has the ability to query data from outside, and the oracle executes this query (e.g., reading from a database) and returns the result to the contract. However, this is a completely centralized model. Why? Because the result delivered to the contract comes only from one oracle. Using oracle creation technologies, we can literally run our own oracle, which, for our blockchain solution, will be responsible for providing data from outside the blockchain. This model is inexpensive and is the primary way to execute an oracle query using Chainlink – the largest blockchain project providing oracle technology for contracts.
🔴 So how do we create a decentralized oracle? The model is as follows: a contract should ask several oracles to execute the same query, get results from each oracle, and then determine the correct answer on its own based on multiple results (answers from multiple oracles). This is difficult and has a lot of challenges. First of all, the way to determine the target value based on multiple answers is not obvious – when asking, for example, the USD/BTC price of three oracles, we can count the average of the results in the contract. However, it is not always so simple.
🔴 The use of several oracles is a correspondingly higher cost. Each query costs money, so when deciding on a form of “decentralization” at this level, we have to reckon with a higher cost of handling contracts. Contract developers, therefore, often don’t do this, relying on a single oracle. When creating a thoughtful web3 solution, this is unfortunately unacceptable.
🔴 Do oracles have to return correct data? Even if I use several of them and achieve decentralization by relying on multiple oracles, how can I be sure that the data they return is correct? The answer is not simple. I will describe this topic in my next entry.
🔴 Article discussing the basic operation of Oracles: here.