All articles

How is Chainlink used in smart contracts?

How Chainlink and the LINK token maintain order in the smart contract ecosystem

24 Mar 2021by Jonnie Emsley

How is Chainlink used in smart contracts?


Smart contracts are capable of completely changing the way value and information flow in our society, creating systems that give individuals more autonomy in the way they interact with products and services.

Due to the rapid growth of the cryptocurrency and blockchain ecosystem, smart contracts are now used in payment systems, wallet services, crypto-to-wire transfers, trading platforms, exchanges, and more, powering an array of financial and non-financial applications and services. But as powerful as this technology may be, an age-old issue has been that smart contracts are only as useful as the data feeding into them — smart contracts need access to decentralized, trustworthy data sources.

Chainlink has enabled the use case of both cryptocurrencies and smart contracts to advance immensely by solving this exact issue. Instead of trusting a central authority to moderate data, Chainlink maintains an Ethereum-based, decentralized network of node operators where participants are incentivized to verify data, and feed it back to smart contracts for use.

Smart contracts that are seeking trustless data from an off-chain source — web APIs, IoT sensors, and more — can send Chainlink a query, creating a “job” for nodes. To be eligible to fulfill jobs and receive rewards, Chainlink nodes need to buy LINK tokens, and lock them up as collateral. If nodes feed bad or incorrect data to smart contracts, they will lose a portion or all of this collateral — if they act correctly, they will have their collateral returned plus a reward.

To give smart contracts control in this process, Chainlink allows nodes (oracles) to be selected based on their reputation and job history.

Chainlink's Node Market

First, a smart contract becomes involved in a transaction that needs input from an external data source, so the smart contract operator makes a query to Chainlink.

The smart contract operator can specify a number of variables which determine which oracles are eligible to complete the job, for example filtering oracles based on uptime, number of jobs completed, and percentage of accuracy.

All the oracles that meet these requirements will now fulfill the data request, retrieving the data, collectively verifying its accuracy, and then feeding it into the smart contract. Oracles that reach a consensus on the correctness of the data will be rewarded in the agreed-upon amount of LINK tokens, and then have their collateral released back to them.

While this all happens behind the scenes (most end-users probably aren't too concerned with this process), Chainlink plays a vital role in determining the outcomes of thousands of cryptocurrency transactions every day, ensuring smart contracts have unstoppable access to real-world data.

You can buy LINK on the MoonPay website or on one of our partner wallet applications.  Just select LINK from the drop-down menu and follow the steps to complete your order.