Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Ethereum's Oracles: Unleashing Trustless Wisdom from Beyond the Blockchain

Posted on Jul 13 In this chapter, we'll explore Oracles in Ethereum. Oracles are systems that link Ethereum smart contracts with external data sources. The term "oracle" comes from Greek mythology, where it referred to a person who communicated with gods and could see the future. In the blockchain world, an oracle serves as a connection between Ethereum and the real world by providing answers to questions beyond Ethereum.Oracles are essential in enabling smart contracts to use real-world information, like stock prices or weather updates. This external data helps smart contracts execute actions based on certain conditions. What makes oracles fascinating is their trustless nature. They work on decentralized principles, meaning they don't rely on a single authority and don't require blind trust.By exploring Ethereum's oracles, we aim to simplify and clarify their role in the blockchain ecosystem. Join us as we unravel the workings of these trustless systems that connect smart contracts to the outside world.In Ethereum, there is a system called the Ethereum Virtual Machine (EVM) that runs programs and updates the Ethereum network. It follows specific rules agreed upon by the network to make sure everyone agrees on what should happen. However, there are two important limitations that come with these rules.Firstly, the EVM cannot use a random function to generate randomness for smart contracts. If it did, different computers on the network would end up with different results, causing disagreements. This would prevent the network from reaching a shared decision on what should happen. It could quickly lead to even bigger problems, like incorrect transfers of money.Secondly, external data, like real-time information or random numbers, can only be added to the Ethereum network through transactions. However, this data cannot be trusted because it comes from sources that cannot be verified.To solve these issues, Ethereum uses oracles. Oracles act as a bridge between the Ethereum network and external sources of data. They provide reliable information to smart contracts, so they can make informed decisions. In the next part of this chapter, we will explore oracles in more detail and how they help overcome these limitations.Oracles serve as a way to securely bring real-world information onto the Ethereum platform for smart contracts to use. They act as a bridge between off-chain data and the blockchain. By using oracles, smart contracts can enforce agreements based on real-world events and data, expanding their capabilities.However, relying on oracles introduces certain risks to Ethereum's security. For instance, if a smart Contract controls a large inheritance amount and depends on an oracle to trigger its distribution upon someone's death, there is a high incentive for hackers to manipulate the oracle and steal the assets before the intended time.It's important to note that some oracles provide data from trusted private sources, such as universities or government departments. This data, like academic certificates or government IDs, is subjective and can only be trusted based on the authority of the source. While such data sources are not fully trustless, they are still considered oracles as they provide a bridge for smart contracts to access the data they need.Here are some examples of the types of data that oracles can provide:These are just a few examples of how oracles can provide valuable information to smart contracts, enabling them to interact with the real world.In the following sections, we will examine some of the ways oracles can be implemented, including basic oracle patterns, computation oracles, decentralized oracles.All oracles have some important functions. These include:Once the data is stored in a smart contract, it can be accessed by other smart contracts, Ethereum nodes, or network-enabled clients. They can retrieve the data by calling a specific function in the oracle's smart contract or directly accessing the oracle's storage.There are three main ways to set up an oracle:For a request-response oracle, the steps can be summarized as follows:Oracles can take various forms, including human, software, or hardware. They can be used to request and return data directly by an externally owned account (EOA) or through Internet of Things (IoT) devices.The request-response pattern is commonly used in client-server architectures, allowing applications to have two-way communication. However, it may not always be suitable. For instance, if a smart bond needs an interest rate from an oracle, using a request-response pattern would require daily requests to ensure the rate is up to date. Considering that interest rates change infrequently, a publish-subscribe pattern may be more appropriate. This pattern categorizes published messages and allows subscribers to express interest in specific categories, reducing network bandwidth usage and storage costs.In a broadcast or multicast pattern, an oracle posts messages to a channel, and subscribing contracts listen to the channel based on their subscription preferences. For example, an oracle could publish messages to a cryptocurrency exchange rate channel. A subscribing contract might request the full content of the channel for a moving average calculation, while another contract might only need the latest rate for a spot price calculation. A broadcast pattern is suitable when the oracle doesn't need to know the identity of the subscribing contract.If we assume that the data source queried by a decentralized application (DApp) is authoritative and trustworthy, there is still a concern about the trustworthiness of the oracle and the request-response mechanism operated by different entities. Data tampering during transit is a possibility, so it is crucial to have off-chain methods to ensure the integrity of the returned data. Two common approaches for data authentication are authenticity proofs and trusted execution environments (TEEs).Authenticity proofs are cryptographic guarantees that the data has not been tampered with. They shift the trust from the data carrier to the attestor, who provides the attestation. Smart contracts can verify the authenticity proof on-chain to ensure the integrity of the data before using it. Oraclize is an example of an oracle service that utilizes various authenticity proofs. One available proof is TLSNotary, which provides evidence that HTTPS web traffic occurred between the client and a server. TLSNotary relies on TLSNotary signatures and splits the TLS master key between the server (oracle), an auditee (Oraclize), and an auditor (AWS virtual machine instance). This approach offers higher assurance against data tampering but relies on the assumption that Amazon will not tamper with the VM instance.Town Crier is an oracle system based on the TEE approach, which uses hardware-based secure enclaves to ensure data integrity. Town Crier employs Intel's Software Guard eXtensions (SGX), which guarantees integrity and confidentiality of applications running within an enclave. SGX allows attestation, providing a digitally signed proof that an application is securely running within an enclave. Decentralized applications can verify this proof to ensure that a Town Crier instance is running securely within an SGX enclave, ensuring the authenticity of the emitted data. The confidentiality property enables Town Crier to handle private data by encrypting data queries using the instance's public key. Operating the oracle's query/response mechanism within an enclave like SGX ensures that it runs securely on trusted third-party hardware, ensuring the requested data is returned untampered (assuming trust in Intel/SGX).In simple terms, authenticity proofs are cryptographic guarantees that data hasn't been tampered with, and trusted execution environments use secure enclaves to ensure data integrity. These approaches provide additional assurance when verifying the authenticity and integrity of data returned by oracles.Oracles can do more than just fetch data. They can also perform complex computations that would be too expensive or impossible to do on the Ethereum blockchain. There are different approaches to achieve this.One option is to use Oraclize, a centralized but auditable service. With Oraclize, decentralized applications can request a computation to be performed in a sandboxed AWS virtual machine. The computation is carried out within a Docker container, and the result is returned to the application. While this solution offers auditability, it is not truly decentralized.Microsoft's ESC Framework introduces the concept of "cryptlets" as a way to provide verifiable oracle truths. Cryptlets run in an encrypted capsule and handle tasks like signing and validating messages. They support complex transactions across multiple blockchains and external systems, enabling developers to create private and portable solutions for smart contracts.For a more decentralized approach, TrueBit offers a solution for off-chain computation. It involves solvers and verifiers who perform computations and verify them. In case of a challenge, an iterative verification process takes place on-chain. Ethereum miners act as judges to make a final ruling. TrueBit creates a computation market where decentralized applications can pay for verifiable computation outside of the network. This allows trustless smart contracts to perform various computational tasks securely.TrueBit has applications in fields like machine learning and proof of work verification. For example, the Doge-Ethereum bridge uses TrueBit to verify Dogecoin's proof of work within a smart contract on Ethereum's Rinkeby testnet. This enables secure verification of Dogecoin transactions on the Ethereum blockchain.In summary, oracles can perform computations, and different approaches like Oraclize, cryptlets, and TrueBit offer ways to achieve this. These methods provide options for decentralized applications to perform complex computations securely and efficiently.To address the limitations of centralized oracles, decentralized approaches have been proposed. ChainLink, for example, suggests a decentralized oracle network composed of three smart contracts and an off-chain registry of data providers. The reputation contract tracks data providers' performance, while the order-matching contract selects bids from oracles based on reputation scores. The aggregation contract collects responses from multiple oracles, calculates the final result, and updates the reputation contract.However, the challenge lies in determining how to aggregate the responses. ChainLink proposes a weighted response approach, where validity scores are assigned to oracle responses. Detecting invalid scores is difficult, as it relies on identifying outliers. Customized aggregation contracts are also allowed to address specific needs.Another approach is the SchellingCoin protocol, where participants report values and the median value is considered correct. Reporters must provide a deposit, which is redistributed to values closer to the median. This encourages the reporting of values that align with others, aiming for a common value or Schelling point.Jason Teutsch proposed a decentralized off-chain data availability oracle that utilizes a dedicated proof-of-work blockchain. Miners download, store, and propagate registered data to ensure local availability. While this system requires significant resources, storage can be reused by releasing data after a certain period.In summary, decentralized oracle approaches like ChainLink, SchellingCoin, and Teutsch's proposal aim to ensure data availability and create networks of individual data providers. These methods address the limitations of centralized oracles and promote decentralized decision-making in the Ethereum network.Oracles play a vital role in smart contracts by providing external information. However, they also bring risks. If you trust an oracle without caution, it can compromise the security of your smart contract by providing false data. It's important to carefully consider the trustworthiness of an oracle before using it.Decentralized oracles can address some of these concerns by providing trustless external data to Ethereum smart contracts. By making careful choices, you can start exploring the connection between Ethereum and the real world that oracles offer.Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Vidyasagar Machupalli - Jun 10 Omar.unwrap(); - Jun 1 Ashkan Ebtekari - Jul 1 Shivesh Tiwari - Jun 1 Once suspended, sahil_4555 will not be able to comment or publish posts until their suspension is removed. Once unsuspended, sahil_4555 will be able to comment and publish posts again. Once unpublished, all posts by sahil_4555 will become hidden and only accessible to themselves. If sahil_4555 is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to Sahil Sojitra. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag sahil_4555: sahil_4555 consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging sahil_4555 will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

Ethereum's Oracles: Unleashing Trustless Wisdom from Beyond the Blockchain

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×