Introduction to Chainlink – LINK
This article assumes that you are familiar with the terms of distributed ledger, blockchain, token, blocks or transactions.
What is Chainlink
Chainlink was launched in 2017 through its whitepaper written by Steve Ellis, Ari Juels and Sergey Nazarov. Their main idea was to provide different blockchain (like Ethereum, Tezos or Polkadot) data coming from the external world.
To understand the purpose of Chainlink you need to have an good understanding of blockchain like Ethereum and the concept of smart contract. You can go there to have an Introduction to Ethereum. Basically, a smart contract could be a transaction which is embedding some programmable logic. An example of a smart contract could be an address waiting to receive a certain amount of Ethereum tokens and then send all of it to a charity organisation address once the goal is reached.
However, the smart contracts running in a network like Ethereum have a limited scope of accessible data. Those data are basically centered around the blockchain itself (transactions, blocks, sender etc…). It’s made like this for security reasons and it’s great to avoid vulnerabilities or breaches in a smart contract. Nevertheless, sometimes for your application you really want to access some external data. Let’s say you want to create an Ethereum smart contract relying on the price of gold. The smart contract will distribute ether once the price reaches a certain amount. How do you get the price of gold ? This question is answered by the blockchain Oracle concept.
The isolation of a blockchain is the precise property that makes it extremely secure and reliable. However, the majority of potential usecases for smart contracts would need to be connected to the outside world. A blockchain oracle is a secure middleware acting as a link between blockchains and any off-chain system like data providers, web APIs, external databases etc…
The oracle is composed of 2 parts. The first part resides on-chain as a smart contract serving as an entry point for the smart contracts willing to get data. The second part resides off-chain and is used to process requests, retrieve and format data and finally sending back to the oracle contract. Let’s take back our smart contract example using gold. We assume our smart contract is running on Ethereum and is making requests to get the price of gold. Below is a schematic representing the oracle architecture. In our case, the User-Sc Contract will be the Ethereum smart contract requiring the price of gold. It will send a request to the Oracle contract (residing on the same blockchain so Ethereum). This oracle contract was programmed specifically to receive requests, calling the External API for Gold price and sending back to the original contract.
This is what an hypothetical oracle design should look like. Here we only have one data source for our gold price. What is happening if the external API we are counting on to get the price of gold doesn’t work anymore ? Or if the external data provider is getting hacked and gives erroneous gold price value ? It could lead to the original User smart contract distributing ethereum even if the price of gold is not reached. This is what Chainlink is trying to resolve.
First of all Chainlink is blockchain agnostic, meaning it’s not focusing only on one blockchain like Ethereum but can run on different ones like Polkadot, Tezos, Bitcoin Elrond etc…
The purpose of Chainlink is to provide a trustful and efficient link between the user smart contract and the external data source. In fact, Chainlink is a decentralized network of oracles. For each specific data feed (e.g gold price feed) there will be a network of nodes. Each node is going to retrieve the data from a one or multiple data source which may overlap with other node’s data sources. This solves one of the issue, if one of the external API doesn’t work anymore, it’s fine as there are other nodes relying on different data sources. Every Chainlink node is running the Core Chainlink program to be part of the Chainlink network. Then the node is running an adapter which is specific to the type of data feed we want. The retrieval of gold price will have its own adapter.
Once the Chainlink network has multiple data from different nodes it will aggregate the different values and filter out the wrong data. Then Chainlink will format the result to be suitable for the smart contract data types. This solves another issue, regarding wrong data given by an external API which will be filtered out. Below is an overview of the Chainlink architecture.
Let’s come back to our example where we want to retrieve the price of gold in our Ethereum smart contract. Usually, the price of gold in dollars is symbolized as XAU / USD. Chainlink provides a list of the available general data feed here: https://data.chain.link/. The network is not limited to those data feed and you can create your own adapter retrieving your own data if you want, about football results for example. You will have to deploy a Chainlink smart contract and a node retrieving your data. Now let’s search on the list in the Commodities section for the gold XAU /USD. Here is the page regarding the gold data feed: https://data.chain.link/xau-usd. We can see at the time of writing there are 16 oracle nodes backing up the gold value which gives a good availability. Additionally, this is where we can get the Chainlink smart contract address (for Ethereum) which is here: 0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6. So our Ethereum smart contract will send a request to get the price of gold to this specific address.
Here is the list of the different price feed Chainlink smart contract addresses for different blockchain: https://docs.chain.link/docs/reference-contracts#config.
About the LINK token
In order to motivate the people to run nodes and provide data feed, Chainlink is rewarding them with some LINK tokens. Moreover, to discourage nodes of providing wrong data or to not be consistent in the way they run the node, Chainlink will penalize them by substracting some of their LINK tokens. As the LINK token has an economical value, it ensures the security and the availability of Chainlink.
The LINK token has a maximum supply of 1,000,000,000 (1 billion) tokens. The repartition of the token is:
- 350,000,000 LINK tokens sold during the launch in 2017 to the public.
- 350,000,000 LINK tokens allocated for node operator incentives.
- 300,000,000 LINK tokens allocated to the development team behind Chainlink.
At the time of writing, the current circulating supply is 415 millions tokens (41,5 %). This amount is composed of the 350 millions token sold in 2017 and by a small portion of the amount initially allocated to the development team. The 350 millions tokens allocated for node operator incentives remain for the moment untouched. There is currently no clear fixed LINK token generation rate.
The LINK token is an ERC677 token that inherits functionalities from the famous ERC20 token standard. In simpler terms it is a token running and implemented in the Ethereum blockchain through a smart contract.
How is the LINK token used
Before a smart contract send a request to a Chainlink smart contract to get data, it needs to have some LINK token. In fact, every time a request is made, the smart contract will pay a fee in LINK (like 0.1 LINK) to the Chainlink smart contract. Then, this one will redistribute the fee to all the honest oracle nodes.
In order to run an oracle node and provide data, you also need to buy some LINK tokens before. As we mentionned before, the purpose is to incentivize the nodes to act honestly. Each node will have to make a deposit of LINK tokens. If the oracle node is providing a wrong answer or is not responding to a request it will lose some part or all of this deposit. The honest oracle nodes providing a correct answer will get their deposit back with an additional fee paid by the initial smart contract.
About the Chainlink network
In correct terms, Chainlink is not a blockchain. Chainlink doesn’t have blocks or distributed ledger storing transactions. It is a decentralized tool residing between a blockchain like Ethereum or Polkadot and the external world.
There is no consensus mechanism in the Chainlink network like Proof-of-Work or Proof-of-Stake to link the different nodes. However there is a concept of trust and reputation for each node. Each node is described in terms of performance and reliability. Some data feed require nodes to have a certain amount of proven honest transaction to be added in the network.
To sum up Chainlink is a bridge between different blockchain and internet. The deployed smart contracts will create a request to a specific Chainlink smart contract and will pay a fee using the LINK token. This specific Chainlink smart contract will then reach a decentralized oracle network responsible of providing the requested data. The oracle network is composed of different nodes and will aggregate the values coming from them.
The LINK token is an ERC20 token and is used to incentivize the correctness of the oracle network. There is a maximum supply of 1 billion LINK tokens. The tokens are used to penalize faulty nodes and reward honest nodes by paying them in fees.