What is ChainLink?How does it work and why do we need it?

Chainlink is a general-purpose framework for building decentralized oracle networks that give your smart contract access to secure and reliable data inputs and outputs.

Each decentralized oracle network consists of a collection of independent node operators, a method for aggregating data, and pre-made “Chainlinks” (also called external adaptor) that act as middleware to give you access to any API you want to leverage for data and/or external services.

To put it simple;

ChainLink is a decentralized oracle network that provides real-world data to smart contracts on the blockchain.

ChainLink is the digital asset token used to pay for services on the network.

Highly decentralized and secure infrastructure

Independent and geographically distributed teams of security-reviewed node operators run decentralized infrastructure.

High-quality data sources that avoid manipulation

Market data sourced from premium APIs provides full market coverage with rigorous validation before triggering your smart contracts.

Prove your smart contracts' end-to-end security to users

Easily verifiable and immutable on-chain data provides unique reliability guarantees of provable end-to-end security.

A well maintained shared data resource

An open source community builds and funds the on-chain reference data resources for the long-term viability of your smart contracts.

To understand the benefits of ChainLink and how it functions, you need to understand some fundamental, interconnected concepts. Let’s start with smart contracts.

Smart contracts

Smart contracts are pre-specified agreements on the blockchain that evaluate information and automatically execute when certain conditions are met.

Because smart contracts exist on a blockchain, they are immutable (can’t be changed) and verifiable (everyone can see them), guaranteeing a high level of trust among parties that they accurately reflect the stated parameters of the agreement and will execute if, and only if, those parameters are met.

For smart contracts to craft agreements beyond those that pertain to data found on the blockchain, they require off-chain data in an on-chain format. The difficulty in connecting outside information sources to blockchain smart contracts in a language that they both understand is one of the main limitations in how widely smart contracts can be used.

The Value of a Smart Contract

Smart contracts offer several advantages over current digital agreements.

Security – Running the contract on decentralized infrastructure ensures there is no central point of failure to attack, no centralized intermediary to bribe, and no mechanism for either party or a central admin to tamper with the outcome.

Reliability – Having the contract logic redundantly processed and verified by multiple independent nodes gives users strong manipulation resistance and network uptime guarantees that the contract will always execute on time according to its terms.

Equitable - Using a peer-to-peer based decentralized network to host and enforce the terms of the agreement reduces the amount of value being siphoned off by centralized for-profit intermediaries.

Efficiency – Automating the backend processes of the agreement—escrow, maintenance, execution, and settlement—means neither party has to wait for manual data to be entered, the counterparty to fulfill their obligations, or a middleman to process the transaction.

Oracles

This is where oracles come into play. An oracle is software known as ‘middleware’ that acts as an intermediary, translating data from the real world to smart contracts on the blockchain and back again.

Before you get any more confused with the oracle problem, let’s define it. You see, smart contracts are coding instructions that self-execute under specified conditions on blockchain networks. The sources from where these smart contracts derive their data from are called “oracles.” The auto-enforcing ability, immutable nature, cost effectiveness & self-execution of these smart contracts make them a perfect agent for automating transactions with transparency and almost a zero chance of failure.

Ironically though, smart contracts are only as smart as the oracles that feed into them. On their own, they are just ‘dumb’ instructions of code – remember the old acronym GIGO (Garbage In Garbage Out). If you feed malicious code or bad data, the smart contract processes the information as is, producing an incorrect & unpredictable outcome, thus creating the ‘oracle problem’.

This is where Chainlink steps in – A decentralized blockchain (figure above) that acts as a bridge between the oracles (data sources, APIs, etc.) and the smart contracts they feed (on blockchains like Ethereum). The individual nodes on Chainlink act as smart contracts on their own – their job is to perform independent & decentralized computations to verify the correctness & accuracy of the data being fed into the smart contracts. Additionally, the middleware also ensures the privacy of the data between the smart contracts & blockchains. Chainlink offers various useful features like:

Connectivity – Integrating smart contracts on various networks to existing applications & external data (Bloomberg etc.)

Payments – Sending payments from your smart contracts to existing bank accounts & popularly used payment networks (PayPal etc.)

Interoperability – Creating secure cross-chain connectivity between your smart contract & any other public (Ethereum) or private network (Hyperledger).

Recap

Smart contracts are immutable and verifiable contracts that automatically execute in an IF/THEN framework when conditions are met.

The data that defines these conditions has traditionally come from the blockchain.

Recently, oracles have been introduced into the crypto ecosystem to bring off-chain data to on-chain smart contracts.

But, centralized oracles diminish the benefits of on-blockchain smart contracts because they may be untrustworthy or faulty.