The idea behind smart contract (PART 4)

Joefitech
3 min readDec 16, 2022

We can’t discuss smart contract without discussing Oracle’s, we need to know what role does oracle play in smart contract.

So let’s Begin

What is Oracle?

(Analogies & practical example)

In software engineering one of the main rules is good data in, good data out i.e if you put good data into a contract (code) and the contract is written correctly, a good result comes out. But when the data is bad, the app will not be useful, and like we've said in our previous post, anything written on the blockchain can't be changed (it's immutable).

This means despite their names 'smart contract' - with a careful look into it, you'll discover that they aren't smart. They are just pieces of code that live in the blockchain & execute a certain condition and logic that the smart contract developer has built.
So without good data, it will be hard for the smart contract to decide on what should happen if a transaction should occur.

Let's take an example:
Let's say a group of persons had a bet on 'horse racing' and they executed the agreement on paying out the winner via smart contract (blockchain), which is a good step to a trustless operation, but the challenge will be without having some way of getting horse racing information on the winners of each race into the smart contract, the smart contract won't be able to make a decision of its own in determining who the winner is & if that information provided is wrong i.e the wrong person got paid out, there is no way to reverse that transaction & redo it on the blockchain, this means we have a big challenge here.

This is where ORACLE comes in, ORACLE'S is just a fancy name for external services that feed information into a smart contract. They feed data into the blockchain for a certain purpose and they come in different applications and different use cases.

Let's dive into it further:
Let's say smart content needs to decide on something that is happening in the 'real world'- like weather updates, the result of a sports game, or information from a certain IoT(Internet of things) all these has to be fed into the blockchain & somehow has to be validated.

So with 'oracles', we need two things;
a. To get a certain amount of data outside of the blockchain and fed that into the smart contract in a simple way.
b. We also need to sort off certain actions in a trusted data source.

We need the ability to be able to reconcile multiple data sources and feed that as one into the smart contract, with this we can get high confidence in the level of information we are getting,
What these oracles are doing is pulling information from multiple different sources.

Let’s go back to the horse race example to make things clearer;
Let’s say there are 4 or 5 different suprapubic APIs that is to supply results of horse races with different applications out there.

What an oracle does is take 4 or 5 of these sources from the APIs, collect them and compare these results from each of those sources, average all the results together and try to figure out what the correct answer is before it supplies the data into the smart contract

So in a simple sense, you can think of an oracle as a trusted source that supplies data into the smart contract.

However, there is a downside to this kind of oracle, it’s centralized which breaks one of the bedrock of blockchain (decentralization)
We’ll discuss how this is solved in our next post

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Joefitech
Joefitech

Written by Joefitech

Crypto and Defi research analyst || Defi/Blockchain Writer

No responses yet

Write a response