What Is a Blockchain Oracle? What Is the Oracle Problem?

Chainlink
30 Aug 202005:47

Summary

TLDRThis video script delves into the concept of oracles in blockchain technology, explaining their necessity due to the deterministic nature of blockchains which cannot access external data directly. It introduces the 'oracle problem' arising from reliance on centralized data sources, which contradicts the decentrality principle of blockchain. The script highlights Chainlink as a solution, offering a decentralized network of oracles to securely bridge smart contracts with real-world data, thus maintaining the integrity and potential of blockchain applications.

Takeaways

  • ๐Ÿ”’ Smart contracts require determinism to ensure all nodes on the blockchain can validate transactions and reach consensus on the state of the blockchain.
  • ๐ŸŒ The 'oracle problem' arises when smart contracts need to access external data, which can disrupt the determinism and decentralization of blockchains.
  • ๐Ÿ”ฎ An oracle is a middleware that connects deterministic blockchains with real-world data, allowing smart contracts to access information from outside the blockchain.
  • ๐Ÿ“ˆ Oracles input data onto the blockchain through external transactions to maintain the integrity and determinism of the blockchain's state.
  • ๐Ÿ’ก The use of centralized oracles can undermine the decentrality of smart contracts, creating a single point of failure or control.
  • ๐Ÿ”„ The oracle problem is the combination of the inability of blockchains to access external data and the risks associated with centralized oracles.
  • ๐Ÿ›ก๏ธ Chainlink is a decentralized oracle solution that mitigates the risks of centralization and enhances the reliability of smart contracts.
  • ๐Ÿ”„ Chainlink operates by using a network of nodes and data providers to ensure the availability and accuracy of the data fed to smart contracts.
  • ๐Ÿ‘ฅ Chainlink's decentralized approach allows the network to be resilient against issues like node failures, hacks, or data source deprecation.
  • ๐Ÿ› ๏ธ The script encourages further exploration of Chainlink's functionalities through documentation and community engagement.
  • โš ๏ธ A disclaimer is given that while single centralized oracles might be used in examples for demonstration, they should be avoided in production for the sake of decentrality and security.

Q & A

  • What is the primary function of an oracle in the context of blockchain and smart contracts?

    -An oracle serves as a bridge between deterministic blockchains and real-world off-chain external data, allowing smart contracts to access and utilize this data without compromising the blockchain's determinism.

  • Why is it problematic for a blockchain to incorporate non-deterministic elements like API calls directly into transactions?

    -Incorporating non-deterministic elements such as API calls can lead to inconsistencies across the nodes validating the transactions, as the data retrieved from the API could change between calls, preventing consensus on the state of the blockchain.

  • What is the 'oracle problem' and why is it significant in the context of smart contracts?

    -The 'oracle problem' refers to the challenge of using centralized oracles that can compromise the decentrality and security of smart contracts. It combines the issues of blockchains being unable to access external data and the risks associated with relying on a single, centralized data source.

  • How does Chainlink address the issues presented by the oracle problem?

    -Chainlink provides a framework for creating a decentralized network of nodes and data providers, ensuring that smart contracts have access to reliable and secure external data without relying on a single, centralized source.

  • What is the role of consensus in blockchain technology?

    -Consensus is the mechanism by which all nodes in a blockchain agree upon a data value, ensuring the integrity and consistency of the blockchain's state. It is a key ingredient that makes blockchain technology work effectively.

  • Why is determinism important for blockchain transactions?

    -Determinism is crucial for ensuring that all nodes can independently and consistently validate transactions and reach a consensus on the state of the blockchain. It allows for the replay of transactions from the genesis block to the current state and achieve the same result.

  • What are some potential risks associated with using a centralized oracle?

    -Using a centralized oracle introduces risks such as the potential for the oracle to be hacked, manipulated, or to provide inaccurate data, which can have significant consequences for the execution of smart contracts and the integrity of the blockchain.

  • How does Chainlink ensure the security and reliability of data provided to smart contracts?

    -Chainlink leverages a decentralized network of nodes and data providers, which helps to mitigate risks associated with centralized oracles. If one node or data source is compromised, the network can continue to operate securely and reliably.

  • What is the significance of Chainlink being open source?

    -Being open source means that Chainlink's code is publicly accessible, allowing anyone to review, contribute to, and build upon it. This fosters transparency, community engagement, and continuous improvement of the platform.

  • What is the advice given in the script regarding the use of centralized oracles in production systems?

    -The script strongly advises against using a single centralized oracle in production systems due to the risks it poses to the decentrality and security of smart contracts. Instead, it recommends using decentralized oracle networks like Chainlink.

  • How does the script encourage further exploration and contribution to the Chainlink community?

    -The script encourages viewers to explore Chainlink's documentation, follow tutorials, and engage with the community by making pull requests (PRs) and joining the community to contribute to the open-source project.

Outlines

00:00

๐Ÿ”— Understanding Oracles and the Blockchain

This paragraph introduces the concept of oracles in the context of smart contracts and blockchain technology. It explains the necessity of oracles to bridge the gap between deterministic blockchains and external, real-world data. The paragraph discusses the 'oracle problem,' which arises from the potential for centralized oracles to compromise the decentrality of smart contracts. The video script also touches on the importance of determinism in blockchain for achieving consensus among nodes. It sets the stage for exploring Chainlink as a solution to these issues, emphasizing the need for a decentralized approach to oracles.

05:00

๐Ÿ›  The Role of Chainlink in Decentralized Oracles

The second paragraph delves into the specifics of Chainlink as a decentralized oracle solution. It serves as a framework for selecting a network of nodes and data providers, ensuring that smart contracts can securely access external data without compromising on decentrality. The paragraph cautions against using single centralized oracles in production systems, highlighting the risks associated with such an approach. It also invites viewers to explore Chainlink's functionalities further through documentation and tutorials, emphasizing the open-source nature of the project and encouraging community involvement.

Mindmap

Keywords

๐Ÿ’กSmart Contracts

Smart contracts are self-executing contracts with the terms of the agreement directly written into code. They are a core component of blockchain technology, enabling trustless transactions without intermediaries. In the video, smart contracts are highlighted as needing external data, like the price of Ethereum, to function in more complex and useful ways, such as in decentralized finance (DeFi) applications.

๐Ÿ’กChainlink Oracle

A Chainlink Oracle is a service that provides external data to smart contracts securely and reliably. It's a critical component for smart contracts to interact with off-chain data. The video explains how Chainlink Oracles solve the 'oracle problem' by offering a decentralized network of nodes and data providers, ensuring that smart contracts can access real-world data without compromising decentrality.

๐Ÿ’กDeterminism

Determinism in the context of blockchain refers to the property that every transaction must be predictable and reproducible by every node in the network. This ensures that all nodes can agree on the state of the blockchain. The video emphasizes the importance of determinism for consensus mechanisms to work and how external API calls could disrupt this by introducing unpredictability.

๐Ÿ’กConsensus

Consensus in blockchain technology is the process by which all nodes in the network agree on the validity of transactions and the current state of the ledger. The video mentions that mechanisms like Proof of Work and Proof of Stake are used to achieve consensus, which is fundamental to the operation of blockchain.

๐Ÿ’กAPI Calls

API (Application Programming Interface) calls are requests made to a server to retrieve or send data. In the video, it is discussed how direct API calls within a blockchain can cause issues with determinism, as the data returned by the API could change, leading to a lack of consensus among nodes.

๐Ÿ’กBlockchain Middleware

Blockchain middleware refers to the technology that connects blockchain systems with external data sources or services. In the video, oracles are described as middleware because they bridge the gap between deterministic blockchains and real-world, off-chain data.

๐Ÿ’กOracle Problem

The 'oracle problem' is a challenge in blockchain where smart contracts cannot directly access external data, and using centralized oracles can compromise the decentrality of the smart contract. The video explains how Chainlink addresses this problem by providing a decentralized network of oracles to feed data to smart contracts.

๐Ÿ’กDecentralization

Decentralization is a fundamental principle of blockchain technology, where no single entity has control or consensus over the network. The video discusses the importance of maintaining decentralization in smart contracts and how centralized oracles could undermine this principle.

๐Ÿ’กData Provenance

Data provenance refers to the origin and history of a piece of data. In the context of the video, it is important for smart contracts to have reliable and traceable data sources to ensure the integrity and security of the contract's execution.

๐Ÿ’กDeFi (Decentralized Finance)

DeFi refers to financial services that are built on blockchain technology and operate without traditional financial intermediaries. The video mentions DeFi as an example of where smart contracts that access real-time data, such as cryptocurrency prices, can be used to create innovative financial applications.

๐Ÿ’กFarmer Insurance Contracts

Farmer insurance contracts, as mentioned in the video, are a type of smart contract that could be used in agriculture to provide insurance based on weather data. This illustrates how external data can be integrated with smart contracts to create real-world applications.

Highlights

Introduction to the concept of using an API to get the price of Ethereum for smart contracts.

Explanation of the necessity of Chainlink Oracles for incorporating external data into smart contracts.

The importance of determinism in blockchain transactions for achieving consensus among nodes.

The problem of non-determinism when nodes validate transactions based on variable data like Ethereum's price.

The challenge of API calls leading to different results among nodes, preventing consensus in the blockchain.

The definition and role of consensus mechanisms like Proof of Work and Proof of Stake in blockchain.

The need for smart contracts to connect with external APIs for functionalities like DeFi and decentralized insurance.

The introduction of Oracles as middleware that connects deterministic blockchains with off-chain data.

Description of how Oracles enter data on the blockchain through external transactions to ensure verification.

The 'Oracle Problem' arising from the use of centralized oracles compromising the decentrality of smart contracts.

The risks associated with centralized oracles, including potential hacking and control over smart contract execution.

Introduction of Chainlink as a solution to the Oracle Problem, providing a decentralized network of nodes and data providers.

Chainlink's role in maintaining the reliability and security of smart contracts by decentralizing data sources.

A cautionary note against using single centralized oracles in production systems for smart contracts.

Encouragement to explore Chainlink's open-source code and join the community for further learning and contribution.

A preview of upcoming content focusing on practical implementation of APIs and smart contract functionalities.

Transcripts

play00:00

at the end of our last video we called

play00:01

an api to get the price of ethereum into

play00:03

our smart contract

play00:04

in order to get this external data into

play00:07

our smart contracts

play00:08

we have to use the chain link oracle in

play00:09

this video we're going to go over

play00:11

what an oracle is why you need them and

play00:14

the oracle problem

play00:15

now these are crucial pieces to

play00:16

understand because they unlock

play00:18

the full potential of smart contracts so

play00:21

let's dive right in

play00:28

when a transaction occurs in the

play00:30

blockchain it needs to be validated by

play00:31

every other node in the blockchain

play00:33

so that they can all agree we can see

play00:35

when we send five dollars from bob to

play00:37

alice

play00:37

we can simply subtract five from bob's

play00:40

wallet and

play00:41

add five to alice's wall this is easily

play00:43

reproducible by every other node on the

play00:45

network but what if that wasn't the case

play00:47

let's imagine a blockchain that allows

play00:48

for non-determinism

play00:49

and allows for nodes to validate each

play00:51

other based off some variable let's say

play00:53

we want to send a variable amount from

play00:54

bob dallas we want to send the price of

play00:56

ethereum

play00:56

at that time so we have our node call an

play00:59

api

play01:00

to get the price of ethereum send it

play01:02

over to alice

play01:03

now when every other node goes to

play01:04

validate the transaction they too have

play01:06

to call this api

play01:08

but what happens now if we call this api

play01:10

even an instant later

play01:11

the api could be changed updated hacked

play01:13

or just appreciated

play01:15

and now all the other nodes are going to

play01:17

get a different result and not be able

play01:18

to validate

play01:19

and be in the same state as the first

play01:21

node this means that none of the nodes

play01:24

would be able to actually agree upon

play01:25

what

play01:26

the state of the blockchain is it's for

play01:28

this reason that the ethereum blockchain

play01:30

and

play01:30

blockchains in general are designed to

play01:32

be entirely deterministic

play01:33

this means that if we replayed every

play01:35

transaction from the genesis block 0

play01:38

to where we are currently we should end

play01:40

up in the exact same state

play01:42

if we add api calls to these

play01:44

transactions

play01:45

we're going to end up in wildly

play01:46

different states and no node is going to

play01:48

be able to have consensus with

play01:50

what the actual state of the blockchain

play01:52

is in blockchain the mechanism for

play01:53

agreeing upon a data value is called

play01:55

consensus

play01:56

and determinism is really important so

play01:58

that nodes can come to this consensus

play02:00

you might have heard of some like proof

play02:01

of work with nakamoto consensus or proof

play02:03

of stake or

play02:04

or any others out there as well

play02:05

consensus is one of the key ingredients

play02:07

that makes blockchain work in the first

play02:09

place

play02:09

now at the same time we need blockchain

play02:12

and we need smart contracts to be able

play02:14

to connect to the outside world and

play02:15

connect to the apis

play02:17

so that we can do more interesting

play02:18

things we need to get the price of

play02:20

ethereum and other cryptocurrencies so

play02:21

we can do anything in defy

play02:23

we need to get weather data so we can

play02:24

have decentralized farmer insurance

play02:26

contracts

play02:27

we need this data to use blockchain for

play02:29

the pinnacle of its purpose

play02:31

so how do we bridge the world with this

play02:32

constraint enter oracles

play02:34

an oracle or is any device or entity

play02:36

that connects deterministic blockchains

play02:39

with real-world off-chain external data

play02:41

the way they work is these oracles

play02:43

actually enter data on the blockchain

play02:45

through an external transaction this way

play02:48

we can guarantee that the blockchain has

play02:50

all the information needs to verify

play02:52

itself so instead of calling an api

play02:55

an off chain oracle will actually get

play02:57

the api

play02:58

and then report it on chain in a

play03:00

transaction that way there's no api

play03:02

calling in the ethereum

play03:04

or blockchain virtual machine itself

play03:06

this is why oracles are known as

play03:07

blockchain

play03:08

middleware as they bridge the blockchain

play03:10

world to the real world

play03:12

seems simple enough though but there's a

play03:14

big problem with this

play03:15

it's commonly referred to as the oracle

play03:17

problem let's take a quick step back and

play03:19

remember why we're building on

play03:20

blockchain in the first place

play03:22

a huge region for smart contracts is

play03:24

decentrality however

play03:26

data has to come from somewhere if we

play03:28

import data

play03:29

onto a decentralized blockchain through

play03:31

a centralized or single api

play03:34

note or source we are now essentially

play03:36

removing

play03:37

one of the main benefits that blockchain

play03:39

has in the first place a centralized

play03:41

oracle or data source

play03:42

means that that single oracle or data

play03:44

source now has control

play03:46

over the entire execution of your smart

play03:49

contract and your smart contract is now

play03:50

no better than a regular contract

play03:52

even if the centralized oracle has the

play03:54

best intentions we've seen cases where

play03:56

oracle's are

play03:57

hacked and catastrophe has ensued the

play03:59

oracle problem can be defined as these

play04:01

two pieces combined

play04:02

number one blockchains themselves can't

play04:05

access external data

play04:07

and number two using centralized oracles

play04:09

essentially nullifies the decentrality

play04:11

of the smart contract

play04:13

now enter chain link chain link solves

play04:15

both of these issues and is the standard

play04:17

for decentralized oracles

play04:19

chain link is a framework for choosing

play04:20

your decentralized network of nodes

play04:22

and data providers to enable your smart

play04:25

contract to reach their fullest

play04:26

potential

play04:26

chenning also has a number of other

play04:28

functionalities that you can find out

play04:30

more by going through the docs or

play04:31

following along with these tutorials

play04:33

with chain link we are leveraging the

play04:34

same reliable decentralized

play04:36

infrastructural

play04:37

concept that makes blockchain work if

play04:39

any nodes or api sources are

play04:42

deleted hacked or depreciated the

play04:44

decentrality of the network

play04:46

will allow it to carry on and your smart

play04:48

contracts will be safe

play04:50

secure and reliable links in the

play04:52

description will describe

play04:53

even more detail about the oracle

play04:55

problem and how chainlink solves it

play04:57

all chain link code is open source so

play04:59

feel free to dig around

play05:00

make a pr and join the community now i

play05:02

know we've gone over a lot of conceptual

play05:04

pieces here but

play05:05

they're really important to understand

play05:06

in order to do any of the coding aspects

play05:08

and a quick disclaimer in most examples

play05:11

we're going to be calling from a single

play05:13

centralized oracle

play05:14

just to show you the functionality but

play05:16

please when you move to a production

play05:18

system

play05:18

do not use a single centralized oracle

play05:21

ever

play05:22

now that we know how and why chain link

play05:24

is such a powerful tool

play05:25

let's dive even deeper into figuring out

play05:27

exactly how to work with these apis

play05:29

and make our smart contracts do really

play05:31

interesting things i'll see you in the

play05:33

next video

play05:46

you

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Smart ContractsChainlink OraclesBlockchain TechDecentralizationAPI IntegrationEthereum PriceOracle ProblemDeterminism IssueData SecurityBlockchain MiddlewareDeFi Applications