Blockchain decentralized account books and smart contracts solve the trust problem of P2P interaction for today’s society, and no longer need any centralized institutions to endorse, which is a major innovation of human social progress. But at present, smart contract can’t get the information out of the chain directly from the outside, so it can only perform tasks in isolation and closed in a specific environment, and disconnect the interconnection with the outside world.
However, blockchain also needs to process data, which is the work of any system. But at present, there are only two data sources of blockchain, one is on the chain itself, and the other is off the chain. For example, the issue quantity of any digital currency is the data on the chain, and the price of each currency is the data off the chain. So, how can blockchain obtain data outside the chain?
Oracle is designed to solve the above problems of blockchain. As the bridge between smart contract and real world, it opens a broad road to the outside world for blockchain.
So it seems that the Oracle is still crucial. Without it, the blockchain data may be limited by the range of assets on the chain. Obviously, this is not what we expect from blockchain technology.
It is not hard to find that Internet data sources are just the opposite of blockchain. But Internet data is almost obtained from the outside. In terms of structure, the Internet belongs to the centralized structure. Since users choose such a centralized organization, they have to trust the data provided by such organization, and the data is completed by the centralized server. Of course, users can also distrust. Due to the need for consensus, the application of blockchain must read in a data consistent with the data on the chain through the oracle. In fact, any application on the chain can write a Oracle for itself as an out of chain data interface. The key question is whether the user can accept the data provided by the oracle.
Blockchain is a decentralized distributed structure, dedicated to building a trusted consensus mechanism system. In this way, the central organization can’t use the users’ trust demand to build a monopoly wall, and then act recklessly in the wall.
It is not difficult to link through the Oracle machine. Simple data read and write operations can transfer the data off the chain to the chain, but the trust problem is very difficult. It needs the design of technology and consensus mechanism to make the data provided by the Oracle machine meet the user’s demand for trust.
Therefore, from the functional point of view, the Oracle is really solving the problem of data interaction, but its essence is to solve trust. Only trust solves the real use value of the Oracle, and the substantive problem of blockchain is solved.
What is a prediction machine
In the field of computer, Oracle is an abstract computer, also known as Oracle. Oracle has all the functions of Turing machine, and has an additional ability: you can get the answers to some questions directly without computing. This process is called oracle. In other words, the Oracle machine can solve problems that Turing machine can not solve through calculation, such as getting answers from the outside world.
For example, there is a DAPP for weather forecast warning. Users can query the weather forecast through the smart contract on the chain. The weather forecast data is not generated by itself on the chain, but requires the smart contract to send a request to the interface of the weather service website to obtain data. At this time, the seeker works. The smart contract can send a request to the seeker, and the seeker will call the meteorological service website interface, and return the consistent response data to the smart contract for processing.
Types of Oracle
By providing a way of communication outside the decentralized blockchain network for the smart contract, the Oracle provides additional functions for the smart contract.
Blockchain Oracle can take many forms, including but not limited to:
1. Software Oracle
This kind of Oracle may be the most powerful type of Oracle at present, because they have inherent interconnection with the Internet. This connection allows the software Oracle to provide the latest information to the smart contract.
It is generally applicable to online data information access, such as public databases, websites, etc. The following information is usually provided: temperature readings, public transport information, and current prices of various financial assets.
2. Hardware Oracle
The hardware Oracle is generally responsible for event processing in the physical world and sending data to the smart contract. For example, in the supply chain management, the objects with RFID tags are sent to a specific warehouse, the data can be sent to the smart contract, and the hardware Oracle can track the goods in the whole supply chain.
3. Input Oracle
The input Oracle simply provides the external data of the smart contract to the smart contract and starts to execute after receiving the information.
4. Output Oracle
This kind of Oracle is to transmit the data on the smart contract to external resources.
5. Consensus based Oracle
The main feature of this Oracle is to retrieve multiple information sources and get corresponding results according to their consensus. If all the prediction sources return the same value, the smart contract can execute successfully.
The realization of Oracle
There is a public oracleaddress state variable on the smart contract, which is used to represent the account address of the updateweather method that allows to call the smart contract. It is assigned in the constructor:
Next, define the weather event, which is triggered when the weatherupdate() call succeeds, with a string parameter representing the temperature attached to the event.
Finally, to implement the updateweather() method, its visibility is public, which means that this method can be called from outside:
Note the require statement. If you want to continue to execute the method, you must call the address (msg.sender) and the white list address (OracleAddress) to be consistent to allow, otherwise the transaction will be rolled back.
Future development of Oracle
With the development of blockchain, however, the data requirements are more stringent, which highlights the importance of Oracle. Especially in the blockchain application scenario, the trustworthiness of data is crucial. Data has been developing rapidly from centralization to distribution. In the future, there may be more and more applications of Oracle, which also determines the attributes and service scenarios of different data providers.
At present, the design concept of Oracle focuses on its usability and practicability. In addition to the technical and mechanism problems, it needs to have very high requirements for data privacy, anti-theft and anti attack, and may involve many comprehensive projects in many fields in the future.
Although the Oracle is the infrastructure of blockchain development, this does not mean that its development will restrict the blockchain. On the contrary, the blockchain has a great impact on the future of the oracle. Only when the off chain data and smart contract have extensive interaction, and can meet the urgent needs of users, can the future of Oracle really take off.