Many smart contracts require communication with the outside world in order to receive the information necessary for their execution. However, in the structure of blockchains, such a connection is not provided. Therefore, you can turn to the oracles for information.
The Oracle itself is not a source of information. But it has the capacity to query it in the outside world and transfer it to the blockchain system. In the same way, if necessary, it can relay information received from the blockchain.
Types of oracles
Oracles can be classified based on a number of criteria:
- origin of data — software or hardware;
- direction of information — incoming or outgoing;
- trust — centralization or decentralization.
They receive data from Internet resources (from weather to transport timetables) and put them on the blockchain.
Provide interaction of smart contracts with the real, physical world. Information comes from various sensors, barcodes and other sources. For example, in order to execute a smart contract, information about the location of the car in the parking lot is needed: as soon as the car leaves it, the oracle digitizes the data captured from the camera and writes it to the blockchain, where tokens will be debited from the owner’s account.
A person can also be a source of information. The oracles translate it into a form understandable for the blockchain and transfer it to smart contracts. In order to exclude fraud, the oracle man uses the principles of cryptography to verify the identity. Thus, the likelihood of deliberate data modification is extremely small.
Incoming and outgoing oracles
Incoming oracles receive information from the external digital world and transfer it to a smart contract. For example, “make a purchase at a certain exchange rate”. As soon as the course matches, the information enters the blockchain and initiates the execution of the smart contract.
Outgoing oracles do the work in the opposite direction: they broadcast information from the blockchain. For example, when money is credited from one participant in a smart contract to another, the smart lock is unlocked.
Centralized and decentralized oracles
Centralized oracles are controlled by one person – physical or legal. There is a high risk factor in working with them, since the information entering the smart contract depends entirely on the controlling entity that can influence the implementation of the smart contract.
To improve reliability and security, a smart contract can also request information from several oracles, which will already be decentralized. Such relationships are also called consensus or the oracle of consensus.
By using decentralized oracles, trust is distributed among many participants.
Contract oriented oracles
They can be used in a specific smart contract. If several smart contracts are required for the interaction of partners, then several oracles will be needed to execute them.
Oracles of this type are time consuming to develop, expensive and difficult to use. However, being developed for each specific smart contract, they are endowed with more functionality and become more flexible to the requirements.
The problem of using oracles
The use of oracles is based on trust. However, since the oracle is not an embedded part of the blockchain, one cannot exclude the possibility of external influence on it as a source of information and, accordingly, on smart contracts that use it. This conflict remains unresolved so far.
The solution may be Oraclize, which is already provably fair service. Oraclize provides blockchains with the ability to interact with the outside world by making requests to any Internet resource. The service uses cryptographic evidence to confirm that the data is indeed the one that was received from a specific source at a specified time.
The use of oracles solves the problem of how smart contracts work with external information. This contributes to the popularization of blockchains and allows to increase the speed of transactions in smart contracts.