Solving The Oracle Problem
Tags: learning, blockchain, web3, oracle
Published: 2022-06-25 02:01:48

## Introduction 

In the world of blockchains and smart contracts, where transactions are now automated into contracts deployed on blockchains. Thereby the solution to the problem of trust issues in the economic ecosystem,
but as the rule of evolution states "The solution to a problem is only the birth of another problem".

On completing this article you'll understand what the **Oracle** problem is, how it flaws the blockchain, and new technologies that help solve these problems. 
Specifically, you'll be learning about Chainlink Oracles on Polygon.

Prerequisites
You should have test net funds in your metamask to run virtual tests, on the testnet eg. Kovan est net
You should also be familiar with working on Remix IDE Integrated Development Environment, An easy tool for compiling and deploying smart contracts.


## Smart Contracts
Before diving right into the blockchain flaw, **Oracle problem** and how Chanlilnk provides a solution, Here's a brief reminder of what smart contracts are, and their benefit to the economic ecosystem.

**Smart Contracts** are a set of computational instructions executing transaction protocols that are deployed on a decentralized blockchain like (Ethereum).
they are immutable or incredibly hard to change once deployed due to consensus and 
they are automatically executed.

### Benefit of Smart Contracts
One of the major benefits of a smart contract is **Decentralization**.
Decentralization: Introducing decentralization to the system, they dispose of the system of centralization. Meaning platforms transition from Traditional agreements where a single individual or organization holds the authorization to charge and modify the system at any time, into a Cryptographic agreement that gives the authorization to change the system to the consumers of the system.

By this system of decentralization, platforms like Centralized Financial organizations (CeFi) become Decentralized Financial organizations (DeFi), by a system of DAOs Decentralized Autonomous Organizations, where the consumers of the system make an autonomous decision for the organization.

As promising as Decentralization sounds, it is "creating an immutable contract that you deploy into a blockchain like Ethereum, which automates transactions and carries out decentralized autonomous changes". It might not be all perfect after all.

## The Oracle Problem
When you deploy a contract to a blockchain, how exactly does your contract interact with you real world?
Or how does your contract know the real-world price conversion rate between different tokens and other hard currencies?
After all, if your contract is deployed with fixed data, whereas real-world data are on the constant update, that doesn't make your contract smart right? much less trust efficient? **The Oracle Problem**
This is the Oracle Problem.
The blockchain is a deterministic platform, which means it cannot with real-world data.
and because of their ability to maintain consensus on-chain, it makes it even less efficient to use random API calls to connect off-chain data to your blockchain because inaccurate data will break the consensus.
So how do you solve the Oracle Problem, **Blockchain Oracle**?


### Blockchain Oracles

**The Solution**: Blockchain Oracles are devices that interact with the off-chain world to provide external data or computation to smart contracts. But this blockchain oracle also has to be decentralized, in order to maintain the idea of **decentralization**.

### Blockchain Oracle Networks
The oracle networks are decentralized systems that deliver valid off-chain data to the blockchain while maintaining consensus throughout the blockchain, they deliver quality data after a series of validation with original proofs and data privacy, which guarantees the crypto-graphic economy.

Smart contracts that use oracle networks to obtain off-chain components are called Hybrid Smart Contacts, because they run their transactions on chian in the smart contracts, and maintain consensus, they also require off-chain data to determine off-chain transaction details like prices, weather data, etc.

## Chainlink 
Chainlink blockchain oracle, that delivers off-chain data into the blockchain after a series of testing inside the chainlink node, this way the off-chain data reaches a high level of consensus during contract evaluation, even before they are consumed on the blockchain.

Chainlink Features
Chainlink provides a number of features that solves the oracle problem, Some of these are:

### Chainlink Keepers

**Chainlink Keepers**: These are decentralized event-driven execution, smart contracts are written 
codes that carry out automated transactions on the blockchain, but these codes are only triggered based on certain conditions specified on the code. The chainlink Keeper feature triggers the events on the smart contract. 

Based on the code you've written, the chainlink keepers trigger the events in your smart contract like when or how to run a transaction. They simply listen for conditions on the contract to trigger events.

### Chainlink API Calls

**Chainlink API Calls**: As the name implies, these features provide unlimited customization for decentralized applications. It runs the same system of evaluation through chainlink nodes, supplied from a large number of resources, and provides unlimited customization of applications with the API calls they provide to the blockchain.
 

### Chainlink Verifiable Randomness Functions
**Chainlink Verifiable Randomness Functions `VRF`**: These are features in chainlink that secures verified and unified randomization of data for the use of decentralized applications like Decentralized Autonomous Organisations, DAOs, by providing secure, and cryptographic provable random data, they ensure a fair system of the selection process. 
Decentralized Lottery applications, NFT Gaming applications, and DAOs can Effectively make use of random numbers to provide a fair chance of determination on their platforms.

The VRF feature is extremely easy to use. Without having to code from scratch,  you can simply get access to the contract files with source code for randomizing numbers.

### Chainlink Data Feeds

**Chainlink data feeds**: They hold massive data feeds that power decentralized platforms like in the  Defi ecosystem, they mine data from a global collection of data providers, running these data through a network of chainlink nodes. The evaluated data are stored on a reference contract which is used as an interface in other smart contracts, together they make up a hybrid smart contract.
These data feeds a constantly updated into their referenced contracts, and still maintain a high level of consensus.


## Conslusion

Now that you fully understand what the oracle problem is and how to solve this problem, you can decide to explore deeper into the china link features and create a hybrid contract with these functionalities. You can also explore other Blockchain Oracle Networks go get started with hybrid smart contracts to solve other bigger problems, 
You can now work on DeFi, DAOs, Decentrelized Lottery games, and other projects without having to worry about issues like data feeds, data randomness, and other Oracle Problems

Congratulations on taking another big step in learning about the cutting-edge revolutionary web3 space.