Chainlink

Chainlink is one of the most fundamental infrastructure projects necessary for blockchains to be adopted in the coming decade.

As Sergey Nazarov, the co-founder of Chainlink Labs, says, blockchains have the ability to replace brand based promises into trust minimized systems backed by cryptographic guarantees. Moving to cryptographic proofs to back a plethora of agreements and methods to reach consensus is a more scalable, modern, and efficient tool that humanity and its electronic counterparts of nodes are bound to leverage. In essence: Truth > Trust a.k.a. ‘Don’t trust. Verify.’

Imagine all of the following markets (including debt which seems to be missing!) being moved completely on-chain where one drastically reduces the trust of a brand, legal contract, or even person… Chainlink is the backbone that will allow this to occur.

Chainlink’s network enabled the growth of DeFi and is now supporting the inception of other verticals such as decentralized identity, gaming, and more.

So how does Chainlink do this?

At it’s core Chainlink is a protocol on how independent parties come to consensus on sets of data and then write that single value to a database (on or off-chain). In the Whitepaper(s) this protocol is coined as ‘Decentralised Oracle Networks’ (DONs). As of Sep 2023, there are over 980 third party DONs in existence!

If you asked me what Chainlink does in one word it would be: security.

Chainlink Labs provides services (i.e. protocols) that go through incredible levels of security and battle testing so that users and developers have peace of mind regarding certain inputs into the smart contracts they are interacting with. Do not be confused… it is not security in terms of code audits.

Yet, this is not a simple question and thus the answer cannot be so straightforward either… so let me try another way. Chainlink is a collection of secure DONs but can also be described as:

  • Decentralised API feeds
  • Secure off-chain computation
  • The internet to the operating system (if you perceive blockchains as the operating system)

If we zoom out, we learn that blockchains are closed and deterministic systems. Teams and developers who want to create any significant use cases in this closed decentralised database/operating system and leverage smart contracts for efficiency and scalability need to have a secure way to pull data from external systems into the contracts.

The problem that existed before Chainlink was that if a decentralised application pulls data from a centralised API/JSON feed one creates a single point of failure. As an example, if a DeFi money market decides to pull the price of ETH only from Coingecko they risk huge losses to their users if there is a flash wick/crash of the price of the asset (ETH) on Coingecko which can cause unnecessary liquidations. Note, this is not uncommon… even if one pulls the price from a DEX the asset price is susceptible to flash loan attacks.

Let us look at two more examples for more interesting financial products that do not rely on crypto assets – insurance and prediction markets.

Insurance is one of the corner stones to create stability in our lives and hedge against risks that naturally abound. Chainlink works with Etherisc to provide insurance to smallholder farmers in developing countries. The Chainlink infrastructure allows for automatic on-chain payouts depending on extreme weather events on the farm. This could theoretically even be built to payout depending on the actual crop yields for the farmer if the data can be accessed in an automated and trust minimised manner.

Prediction markets leverage Chainlink DONs in that the markets are usually based on external events such as the outcome of a sports event. The DON can pull data from external sources and then write the final score on chain which then triggers a payout from the smart contract to the winners of the bet in the dApp.

Given that the bread and butter of Chainlink’s business is the data feed DONs lets dig a bit deeper into how they function…

Looking at this website we can use visuals to help us understand what is going on. Ultimately it comes down to:

  • Battle tested node operators across a variety of industries and geographies with experience running digital infrastructure that put a LINK stake behind their services to ensure they have an incentive to pull and submit accurate values in a timely manner. They all also have red-phones and teams on standby to ensure consistent uptime… its not a job for the faint of heart!
  • Three layers of aggregation of premium/paid APIs which are aggregated using medians. The first layer is at the premium API level which pulls values from multiple centralised and decentralised exchanges. The second level is at the node level where each node operator needs to take the median of at least three premium APIs. Finally, the third step of aggregation is between a group of node operators who take another median and write the final agreed upon value on chain
  • Importantly, DONs also use Volume Weighted Average Price’s (VWAP) and not Time Weighted Average Price’s (TWAP) in the values they collect and submit. Lastly, the classic data feeds are updated based on trigger parameters such as deviation thresholds (e.g. +/- 0.5% from the last value written on chain) and backups based on a time internal (e.g. 60 minutes). This ensures that values are updated in a timely and sensible manner while not becoming stale or putting too much burden on the node operators with gas costs.

Time for a concrete example.

Looking at the ETH/USD price feed on Ethereum we learn that:

  • there are 31 independent node operators that in aggregate make up the one DON for the ETH/USD feed
  • Node operators consist of companies such as Deutsche Telekom, Framework Ventures, and Stake Fish all of which are experienced at running infrastructure to ensure maximum uptime
  • This specific feed is secured by through 24,026,964 LINK staked as ‘insurance’ and thereby creating an incentive for true values to be committed on-chain
  • We also see that the last update was 35 minutes ago and the agreed upon price was 1631.42 USD

If the above didn’t convince you, then you may still be wondering why each of these nodes go through the hassle of aggregating values from multiple sources on a regular basis. Again it comes back to the concept of security. By collecting and taking medians from on-chain and off-chain sources (CEX & DEXs) Chainlink DON’s ensure the feed accurately represents a market price. While writing this the market was quite ‘quiet’ so the price of ETH on Uniswap was tracking closely to the Chainlink feed. However, next time the market is in turmoil have a look at Coingecko’s ETH markets section where you will probably see a large discrepancy in prices even for the same asset across various exchanges.

Finally to round this longer post out, I want to briefly outline all the services Chainlink has to offer.

  • Data Feeds: Chainlink’s extensive collection of tamper-proof data feeds (DONs) secure billions of dollars in smart contract value across the DeFi ecosystem. This is what I wrote about for the examples above.
  • Automation (previously Keepers): Chainlink Automation aims to provide options for smart contracts to outsource regular maintenance tasks (harvesting, liquidating, rebase etc) and even jobs such as telling the time.
  • Proof of Reserve (PoR): My personal favourite (since I haven’t used CCIP yet…)! PoR is a real time auditing solution which allows projects to demonstrate that they posses adequate (off-chain) reserves through cryptographic proofs. Main use cases currently are to ensure stable coins are fully collateralised. This increases transparency for users when interacting with tokens that are backed by off-chain assets and prevent systemic failures in DeFi and beyond.
  • Verifiable Randomness Function (VRF): Chainlink VRF provides cryptographically secure randomness for powering provably fair gaming applications and verifiably rare NFTs.
  • Cross Chain Interoperability Protocol (CCIP): The newest addition which allows developers to bridge data from one on-chain environment to another. Most uses cases will be leveraging on-chain to on-chain messaging however it can also be built with hybrid systems in mind. This is extremely exciting as some of the biggest hacks in the industry have been on the bridges and remember that Chainlink is focused on security.
  • Any API & Functions: This allows developers to pull data from any external API sources and have this written on chain for their smart contracts to ingest using the DON infrastructure that Chainlink pioneered.

In conclusion, as stated at the start, Chainlink is one of the most exciting infrastructure projects in the crypto space that will allow the world to see the real power of blockchains.

If you are a builder or simply just really into this then be sure to check out the documentation.

One response to “Chainlink”

  1. […] OraclesGiven the last post was on Chainlink and DONs, Helium is the ideal next project to write about as Chainlink’s and Helium’s […]