Blockchain Oracle Design Patterns
Total Page:16
File Type:pdf, Size:1020Kb
Blockchain Oracle Design Patterns Amirmohammad Pasdar1;2, Zhongli Dong1;3, Young Choon Lee2 Abstract—Blockchain is a form of distributed ledger technol- Smart contracts are programs (i.e., functions and states) ogy (DLT) where data is shared among users connected over the residing at a specific address executed on the blockchain to internet. Transactions are data state changes on the blockchain digitally facilitate the transaction process. They are event- that are permanently recorded in a secure and transparent way without the need of a third party. Besides, the introduction of driven, self-executable, resistant to tamper, and they can con- smart contracts to the blockchain has added programmability sume transaction fees based on the complexity of code (e.g., to the blockchain and revolutionized the software ecosystem gas for deployment in the Ethereum blockchain), and only leading toward decentralized applications (DApps) attracting use resources available on the blockchain network [4]. Smart businesses and organizations to employ this technology. Although contracts are encoded and compiled into bytecode and upon promising, blockchains and smart contracts have no access to the external systems (i.e., off-chain) where real-world data and events deployment, they are given unique addresses and saved across resides; consequently, the usability of smart contracts in terms all connected nodes in the network. of performance and programmability would be limited to the on- Smart contracts and blockchain do not have access to the chain data. Hence, blockchain oracles are introduced to mitigate information outside of their networks (i.e., off-chain data). The the issue and are defined as trusted third-party services that send blockchain in fact is an enclosed system where interactions are and verify the external information (i.e., feedback) and submit it to smart contracts for triggering state changes in the blockchain. limited to the data available on it. Hence, it is still an open In this paper, we will study and analyze blockchain oracles with practical problem referred to as the “oracle problem” that is regard to how they provide feedback to the blockchain and smart defined as how real-world data can be transferred into/from the contracts. We classify the blockchain oracle techniques into two blockchain. If the blockchain is assumed as a component of a major groups such as voting-based strategies and reputation- larger software system [5], smart contracts need the external based ones. The former mainly relies on participants’ stakes for outcome finalization while the latter considers reputation in information relevant to contractual agreements or practical conjunction with authenticity proof mechanisms for data cor- applications, e.g., data availability verification for decentral- rectness and integrity. We then provide a structured description ized applications or adjudication mechanisms. Oracles (also of patterns in detail for each classification and discuss research known as data feeds) shown in Figure 1 act as trusted third- directions in the end. party services that send and verify the external information Index Terms—Blockchain, Decentralized oracle, Blockchain oracle, Data feed, Smart contracts. and submit it to smart contracts to trigger state changes in the blockchain. Oracles may not only relay information to the smart contracts, but also send it to external resources. They are I. INTRODUCTION simply contracts on the blockchain for serving data requests A blockchain is a form of distributed ledger technology by other contracts [6]. Without oracles, smart contracts would where transactions are duplicated and saved onto a large have limited connectability; hence, they are vital for the number of nodes. Transactions are defined as a set of data blockchain ecosystem due to broadening the scope of smart packages for storing monetary value, parameters, and function contracts operation. call results, and their integrity is ensured by cryptographic There have been several surveys on blockchain oracles [7– techniques. They are collected in the form of blocks where 12] each of which studied particular aspect(s) of oracles. there are immutable records, and each block is linked to Muhlberger et al., [7] examine oracles from two dimensions arXiv:2106.09349v1 [cs.CR] 17 Jun 2021 the succeeding block through the hash. Blocks are appended which are data flow direction and the data initiator. Heiss et to the ledger by a means of consensus algorithms such as al., [7] present a key requirement set for trustworthy data Proof of Work (PoW), Proof of Stake (PoS), or Practical on-chain, and how related challenges should be addressed. Byzantine Fault Tolerance (PBFT) [1]. Blockchain technology Beniiche [9] describes widely used blockchain oracles and is a good fit for decentralized finance (DeFi) or dealing with human oracles, and Al-Breiki et al., [10] study the trust used data integrity, e.g., supplying products [2] or food security [3]. in the leading blockchain oracles. Xu et al., [11] discuss oracle roles and provide the benefits and drawbacks, and 1 Amirmohammad Pasdar ([email protected]) and Zhongli Dong (an- Mammadzada et al., [12] provide general characteristics of [email protected]) are with Aglive Lab, 8 Hadenfeld Ave, Macquarie Park a blockchain framework to be considered when designing NSW 2113, Australia. 2 Amirmohammad Pasdar ([email protected]) and blockchain-based applications. Young Choon Lee ([email protected]) are with Department of Comput- This study reviews and analyzes blockchain oracles from ing, Macquarie University, Sydney NSW 2109, Australia. a technical perspective that previous studies have overlooked. 3 Zhongli Dong ([email protected]) is with Center for Dis- tributed and High Performance Computing, School of Computer Science, The We analyze the blockchain oracles in terms of providing final University of Sydney, NSW 2006, Australia. feedback (i.e., outcome) to the smart contracts, and we mainly Blockchain Oracles Request data Fetch data Send data Response General View Voting-based Reputation- Oracle on Oracles Oracles based Oracles External information Blockchain & Smart Contracts Oracles as Software- data feed Stake-based based Proof Figure 1. The oracle role as trusted third-party services for sending and services verifying the external information. Blockchain oracles can be single or a pool Multi- Oracles & Hardware- of oracles interacting with the external world. signature security based Proof based Review of Schelling Proofless seek an answer for the following research question (RQ); prior surveys point based RQ: How are blockchain oracles designed to provide the outcome to smart contracts? Token-based RQ fundamentally contributes to providing deep insights into the design, development requirements, and usage of Conventional blockchain oracles. Hence, to properly answer the RQ1, we conduct this research through the Multivocal Literature Review Figure 2. The structure of research study. (MLR) technique defined as a form of Systematic Literature Review (SLM) in which “grey” literature and “white papers” are included [13]. The initial search keywords are selected oracle feedback which is followed by Section IV in which based on a combination of blockchain oracles, data feed, authenticity proof mechanisms are also studied. Section V and/or smart contracts, design and/or pattern for covering the presents future research directions, and we conclude the paper vast majority of related studies. During the paper collection, in Section VI. snowballing technique [14] is employed to collect relevant studies for the literature review. Several digital libraries are II. GENERAL VIEW ON ORACLES &PRIOR RESEARCH used to extract a fine set of papers on the proposed topic This section presents a general classification of oracles as such as IEEE Xplore1, ScienceDirect2, ACM Digital Library3, data feed services, issues, and discussions on prior survey DBLP:Computer Science Bibliography4, and Google Scholar5. research on blockchain oracles. Finally, with the ever-increasing usage of blockchain, the need for real-world data for extending the blockchain usability A. Oracles as Data Feed Services while mitigating the potential risk of data manipulation is Oracles (or data feed services) respond to queries which can exponentially increasing [15]. Hence, this study intends to fill be in the form of “What is the current ETH6/USD exchange the gap by presenting techniques, challenges, advantages and rate?”, and oracles may consult with different sources (or a disadvantages of existing blockchain oracle design patterns single source) to fetch the required information and return it through a comprehensive review of cutting-edge studies. In to the smart contracts. Oracles can also be computation oracles this regard, we categorize the collected research studies on such as Truebit [16] or Provable [17] that perform user-defined either the oracle design or oracle usage into two major groups computation-intensive tasks off-chain, providing computing with respect to the monetary incentives employed in the power to the blockchains, and enabling decentralized token blockchain oracle design. Incentive mechanisms are in place economy. In addition, a general view of blockchain oracles to encourage users to participate in the network governance facilitates its classification which can be fallen into four and improve the blockchain security and functionality. The major groups: (1) source; the origin of data, (2) information first group is oracles