Blockchain technology cited volume | oracle: the bridge between the blockchain and the outside world
Text: Token Research Team
Introduction
There are many application scenarios for the oracle machine, which will greatly expand the application range of the blockchain in the real world. All decentralized applications that need to interact with off-chain data need to use oracles, such as decentralized derivatives trading platforms, lending platforms, stable tokens, insurance applications, casino applications, forecast markets, etc.
The main role of the oracle is to provide reliable external data for smart contracts, and its core value is to connect the blockchain to the outside world on a credible basis. In the ideal state, the workflow of the oracle is to accept requests, obtain data, and return data. The data sources that can be queried by the oracle are generally URL links on the Internet, search engines, data from other blockchains, data from the interstellar file system IPFS, and so on.
- Opening with 500 million financing, the road to DeFi in 2020
- Trump speech sends peace signal, bitcoin price falls
- Difficulties and Solutions to Blockchain Security in Accidents
There are many types of oracles, which can be classified by software and hardware, by centralization or not, and by data flow.
When designing oracles in practical applications, we need to focus on the issues of confidentiality, integrity, and availability .
Typical oracle projects include ChainLink, Oraclize, DOS Network, OracleChain, etc.
In general, the oracle projects on the market are mainly decentralized oracles, and most of them are dedicated to supporting multiple mainstream public chains. In order to guarantee the confidentiality, integrity and availability of the oracle information, different projects have adopted different schemes. For example, ChainLink's scheme combines reputation contracts, order matching contracts, and aggregation contracts. Oraclize uses proof of authenticity. DOS Network uses For verifiable random equations and threshold cryptography, OracleChain uses reputation and mortgage proofs.
Risk Warning: Privacy Leak
1 meaning of the oracle
1 meaning of the oracle
1.1 The meaning of the oracle in the traditional Internet
Oracle in English is Oracle, which originally originated from the ancient Greek religion, meaning "god, prophet, prophecy".
The father of computer science, Alan Turing, introduced the concept of oracles in a doctoral dissertation in 1939, and introduced hypercomputation. The prediction machine is more powerful than the Turing machine, and can answer some questions that cannot be solved through calculations, such as "Which team will win the championship this year in the World Cup?"
A oracle machine is a Turing machine with a "magic black box". The black box can answer two types of questions: one is the decision problem (you only need to answer "yes" or "no"), and the second is Functional problems (also known as complex problems) are more complicated than simply answering "whether", for example, which numbers can be divided by a positive integer x?
1.2 The meaning of the oracle in the traditional Internet
Ethereum brings the blockchain to the 2.0 era. By adopting Turing's complete programming language, it implements more complex functions such as logical judgments. It is not limited to transfers between addresses like BTC, which greatly enriches the commercial use of blockchain In the scene of landing, Smart Contract is the key technology among them. The so-called smart contract refers to the automatic execution of a program when a certain condition is met, which is equivalent to the "if … then …" programming statement in the computer.
The blockchain is a definitive and closed system, and each node needs to obtain a precise and consistent state, which gives the blockchain the immutability, but also means the lack of flexibility. The "certain conditions" that trigger a smart contract can be the status on the chain, such as whether the payment is completed, or external information, such as the status of the weather, whether the flight is late, which team won the game, and so on.
The blockchain network cannot independently collect information from the outside world. The oracle is the interface between the blockchain smart contract and the outside world. It can find and verify real-world data and submit the information to the smart contract for use in an encrypted manner. It allows certain smart contracts to respond to the uncertain external world and can be understood simply as a pre-processor for external data or third-party data agents. "What Can and Can't Blockchains Do? "The article defines the oracle as follows:
The mechanism for writing information outside the blockchain into the blockchain is generally called the oracle mechanism.
Take Alice and Bob as an example to illustrate the role of the oracle in smart contracts. Suppose Alice and Bob first send 1 ETH as a bet to the address in the smart contract, and agree:
1) Both parties send the bet to the smart contract address in advance, and the smart contract automatically executes the corresponding program according to the external information provided by the oracle;
2) If Alice's betting team wins, Alice will win 1 ETH from Bob, and 2 ETH in the smart contract address will be automatically sent to Alice;
3) If Bob's betting team wins, Bob will win 1 ETH from Alice, and 2 ETH in the smart contract address will be automatically sent to Bob;
4) The team that Alice and Bob bet was tied and the ETH in the smart contract address was returned the same way, neither of them won or lost.
There is no human intervention in the whole process, even if Alice and Bob are two strangers, they will not incur additional trust costs.
1.3 Application Scenarios
All blockchain applications that need to interact with off-chain data need to use the oracle. Typical application scenarios are:
1) Crypto asset derivatives trading platform
At present, typical crypto asset derivatives trading platforms include dydx, etc., allowing users to go long or short token assets. Smart contracts need to obtain asset prices from outside the chain to trigger liquidation and determine the participants' gains and losses.
2) Stable token for decentralized operation
A stable token is a type of digital token that anchors its value and price through a specific mechanism. According to the value support division, the stable token currently has three models: fiat currency anchor, asset anchor and internal anchor. Currently there are DAI and other stable tokens that operate through decentralization. These decentralized stable tokens need to use the oracle to sense their own price changes, and then make corresponding decisions to stabilize prices.
DAI is a stable token issued by the MakerDAO platform through mortgage crypto assets (currently mainly ETH). The MakerDAO platform obtains the market prices of collateral and DAI through multiple oracles, and can make warning and clearing decisions when the market price of collateral falls too much.
3) Lending platform
Blockchain-based lending platforms currently include ETHLend, SALT, etc. These platforms allow users to mortgage crypto assets to borrow fiat currencies or other crypto assets. Similar to DAI, the platform monitors the collateral's margin ratio with the help of a predictor. A warning is issued and the liquidation process is triggered. At the same time, the oracle can import the borrower's credit rating, and then determine the corresponding loan interest rate.
4) Insurance application
Blockchain-based insurance applications currently include Etherisc, HGS, etc. Users can purchase insurances such as aviation delay insurance and crop insurance on the platform. The oracle can introduce external data sources for such events, so that smart contracts can make decisions about insurance products based on the agreement.
5) Casino applications
Blockchain-based casino applications currently include FunFair, Edgeless, etc., and the use of smart contracts to ensure fair and instant secure payment of games has a significant advantage over traditional centralized casinos. Most important for non-centric casino applications is unpredictable, verifiable random number input.
The traditional random number generation method is centralized. The specific value of the random number is related to the physical state of the specific machine. The random number on the blockchain needs to meet the distributed characteristics. The random number generated at each node must have consistent randomness. Traditional methods cannot meet this requirement. The input from the chain can be achieved through the oracle. A random number of characteristics.
6) Decentralized prediction market
The decentralized prediction market currently has projects such as Augur and Gnosis. It can make predictions on events such as sports events, presidential elections, and token price changes, and wagers on different outcome predictions. After betting, you can choose to wait for the final result, or you can choose to trade "lottery tickets" in the secondary market in advance. The oracle will obtain the final true result and calculate the profit or loss based on this result.
7) Blockchain-based Internet of Things applications
The application of the Internet of Things based on the blockchain is to pass off-chain sensor information to the chain through the oracle, so that the smart contract will trigger the next action after verification.
2 workflow and types of oracles
1) Accept the request. The oracle receives the request Req = (Src, τ, q) sent by the user contract (USER-SC Contract), where Src indicates the data source specified by the query, τ indicates the time point or period, and q indicates the content of the query.
2) Get data: send query content q to Src at time τ for query;
3) Return data: Once the answer a is obtained, return a to the smart contract for use.
The data sources that can be queried by the oracle are generally:
1) Internet URL link;
2) search engine;
3) Data of other blockchains;
4) IPFS data of interstellar file system;
5) Sensor data, etc.
2.2 Classification methods of oracles
1) Classified by software and hardware
The source of the data obtained by the oracle is online (including the Internet, on the blockchain) and offline (sensor data in the physical world), corresponding to the software oracle and hardware oracle respectively.
2) Classification by centralization or not
The results of the oracle feedback are obtained through a single node, or through the "brain brainstorming" of distributed nodes, respectively corresponding to the centralized oracle and the decentralized oracle. Decentralized oracles are less efficient, and centralized oracles are less reliable.
3) Classification by data flow
External data can flow to the blockchain through the oracle to trigger the smart contract to execute the next procedure. The data generated by the smart contract can also flow to the physical world through the oracle (such as smart locks on the blockchain. When the smart contract detects the receipt of the specified blockchain address, After the transfer, the smart lock will be automatically unlocked).
3Problems to be overcome in the practical application of the oracle
When designing a real-world application, the oracle needs to focus on the following three factors: integrity (Integrity), confidentiality (Confidentiality), and availability (Availability).
Integrity means that the information is complete, accurate, and reliable, and has not been intentionally or unintentionally destroyed or tampered with.
Confidentiality means that the content that the smart contract requests from the oracle will not be leaked out. For example, in the case of decentralized insurance business, users may not want the oracle to disclose their flight information to the whole world. In the case of decentralized derivatives transactions, users are also unwilling to disclose their investment portfolios and operating strategies.
Availability means that when the data is retrieved through the oracle, the required information can be obtained in a timely manner, including censorship-resistance.
For integrity, it can generally be solved through multiple data sources, multiple oracles, reputation systems, trusted execution environments (trusted hardware), and authenticity verification. For details, see the typical project analysis below.
In view of confidentiality, the oracle nodes use public keys to encrypt query requests, and restrict the information flow of the oracles, and only decrypt when querying the information source.
For availability, decentralized oracles can be effectively addressed.
4 typical project analysis
4.1 ChainLink
ChainLink is committed to creating a highly reliable distributed oracle network. The user contract (USER-SC) issues a query request. CHAINLINK-SC assigns an adapter to the requested event. The adapter calls an external API and returns the result. CHAINLINK-SC aggregates the relevant responses and feeds back a final result to USER-SC.
CHAINLINK-SC is mainly composed of a reputation contract, an order-matching contract, and an aggregation contract. The reputation contract scores the oracle nodes using indicators such as response time, margin amount, and request completion rate. The order matching contract uses the reputation contract to automatically match request events with the oracle nodes to increase availability. Aggregate contracts collect and aggregate the responses of the oracle nodes and feed back node metrics to reputation contracts.
To ensure the integrity and availability of information, ChainLink adopts three solutions: distributed data sources (Distributing Sources), distributed oracles (Distributing Oracles), and use of trusted hardware (Use of Trusted Hardware).
ChainLink's vision is to support all smart contracts, easily realize the connection of smart contracts with data sources and APIs, and enable cross-chain and off-chain interactions and payments.
4.2 Oraclize
Oraclize is a centralized oracle with proof of authenticity. Currently it supports multiple platforms such as Ethereum, Rootstock, R3 Corda, Hyperledger Fabric, and EOS.
The smart contract obtains data by issuing a call request to Oraclize, specifying the data source and parameters, and after obtaining data according to the request, Oraclize uses the callback function to return the result.
Oraclize believes that the solution of decentralized oracles has the limitations of being inefficient, requiring all participants to pay, and taking a long time. Oraclize's idea is to prove that the data obtained from the source is authentic and unaltered. Similar to network technology, the HTTPS protocol replaces HTTP, creating an encryption and authentication channel between the client and server, and providing identity verification.
Proof of authenticity can be solved through hardware or software solutions, such as trusted execution environment TEE (hardware), auditable virtual machines (software).
4.3 DOS Network
DOS Network is a decentralized oracle service network that supports multiple mainstream public chains.
DOS Network is a Layer-2 oracle solution, consisting of two parts: on-chain and off-chain. The smart contract specifies the data source and data type required by the contract, sends a oracle request to the on-chain system contract, and then the request will be randomly assigned to an off-chain working group. Each member node in the work group will obtain data from the specified data source and parse it according to the specified type and structure. Then the nodes in the group reach the consensus in the group by threshold cryptography and produce a proof of the consensus result. The data and corresponding proofs after the consensus in the group will be sent back to the system contract as a transaction, and the contract will trigger the verification of the result certificate returned by the submission group.
DOS Network believes that selecting service nodes based on prestige is easy to cause centralization problems due to the "Matthew Effect", so it uses a random method to select the oracle working combination nodes. DOS Network generates a secure, unpredictable, and publicly verifiable random number based on verifiable random equation (VRF) and threshold cryptography (Threshold Cryptography), which avoids the problems of the prestige system and is more fair and fair to participating nodes.
4.4 OracleChain
OracleChain is a decentralized oracle platform for the EOS ecosystem based on the EOS platform. OracleChain uses a dual-effect mechanism of PoRD (Proof-of-Reputation & Deposit), which is essentially a reputation system for mortgage deposits, rewarding goodwill nodes and punishing malicious nodes.
In general, the oracle projects on the market are mainly decentralized oracles, and most of them are dedicated to supporting multiple mainstream public chains. In order to guarantee the confidentiality, integrity and availability of the oracle information, different projects have adopted different schemes. For example, ChainLink's scheme combines reputation contracts, order matching contracts, and aggregation contracts. Oraclize uses proof of authenticity. For verifiable random equations and threshold cryptography, OracleChain uses reputation and mortgage proofs.
We will continue to update Blocking; if you have any questions or suggestions, please contact us!
Was this article helpful?
93 out of 132 found this helpful
Related articles
- European Central Bank President: Hopes for the development of digital currencies, will not prevent private companies from participating
- Fintech giants hunt for blockchain: different landing postures
- Thousands of exchange platform license thresholds reach the cloud or 5 platforms enter the Hong Kong Securities Regulatory Commission's sandbox
- Frequent trust crisis in the public welfare industry Can blockchain become a "life-saving straw"?
- Zhejiang court launched "e-key intelligent delivery", the whole process of on-chain deposit certificate through blockchain technology
- First local financial off-site supervision blockchain system released
- Nic Carter: Bitcoin halving and efficient market hypothesis