ChainLinkGod Podcast - Chainlink Oracle Services With Crypto___Oracle and ChainLinkGod
Primer: Chainlink is not just about price feeds. There are many other services that Chainlink provides as well. In this episode of the ChainLinkGod Podcast, ChainLinkGod and Crypto Oracle dives deep into each and every Chainlink service, unpacking how they work.
Aim
Covers the various Chainlink services available today and in the future:
Price feeds
Proof of Reserve
Application Programming Interfaces (APIs)
Verifiable Random Function (VRF)
Keepers
Blockchain Abstraction Layer for Enterprises
Why Do Smart Contracts Need Oracles?
Blockchains are isolated networks that perform a basic set of functions
They have limited ability to verify or impact external systems. This is known as the Oracle Problem
An oracle is a separate piece of infrastructure that provides services dealing with data in the external world and syncs it with the blockchain
Oracles allow users to do a lot of things they can never do on the blockchain itself while still keeping the blockchain really secure
Chainlink
Chainlink is 3 things:
It's a protocol. A generalized blockchain agnostic framework for building any kind of oracle network that supports any blockchain or layer 2
It's a network. Can have any number of independent Oracle networks running in parallel at the same time
A bunch of pre-built solutions that give developers plug and play Oracle solutions
Value propositions:
Allows developers to build any type of Oracle solution in a permissionless manner using that protocol framework
Allows horizontal scalability
Bootstraps Oracle services. Projects do not need to build their Oracle solutions from scratch
Price Feeds
Primary use case for Oracle networks is to provide financial market data to the DeFi ecosystem
The growth of new price feeds led to the blossoming of different financial protocols
"All the users are getting the highest quality Oracle network because of the security budget is so large, but they're only paying like a fraction of the total costs. So that essentially provides users the highest quality Oracles at the lowest cost, which is kind of why we've seen Chainlink price feeds take off as much as they've had." - ChainLinkGod
Features
Has economies of scale. Cost for a price feed is shared among all users
A growing plethora of Chainlink price feeds (cryptocurrencies, stablecoins, fiat currencies, commodities, traditional financial products, and specific equities)
Structure Of Price Feeds
On-chain reference contract that stores the current price of a specific asset
The price in the reference contract is continually updated by these Chainlink Oracle networks
Users ping the contract to immediately get the data within a single transaction
Chainlink price feeds are updated based on a deviation threshold (e.g. if price moves up/down by X%, the price feed is updated). In volatile markets, this provides fresh and accurate data
Update speed is dependent on the blockchain
Updates on a slower blockchain will use a larger deviation threshold for economical reasons
For faster blockchains/layer 2s, they will have a lower deviation threshold to accommodate rapid price changes. Specifically important to leveraged trading protocols where a lack of a prompt update could instantly liquidate users
Data Source
Chainlink price feeds are pulled from professional data aggregation firms. These are firms that provide data to leading enterprises and trading desks
Each data source that Chainlink pulls from is data that is already aggregated from multiple sources
"So what data providers essentially do is they generate a volume weighted average price across all of these different exchanges, taking into account outliers and taking into account market crashes and wash trading to generate a single global price for an asset that can actually be relied upon." - ChainLinkGod
Basing price feeds on a given exchange could be fallacious due to changes in liquidity in that particular exchange
Chainlink accounts for the above problem by having market coverage across exchanges
These data aggregator firms are financially incentivized to provide high quality, high up-time data as they are paid subscriptions/paid APIs
Each Chainlink Oracle node is not fetching data from one data aggregator, but from multiple data aggregators, and then taking the median value between them
This makes the Chainlink network tamper resistant
Decentralization occurs at both:
Data aggregator layer
Oracle node layer
"When you're looking at what is the value that Chainlink is giving you, it's essentially a median of a median of a volume-weighted average price tracking all exchanges." - ChainLinkGod
No single point of failure
Users That Need Multiple Oracle Solutions
Chainlink allows users to use multiple oracle solutions
Chainlink's circuit breaker design:
Primary feeds come from Chainlink and are continuously provided to the application
Use an on-chain data feed as a secondary circuit breaker
The circuit breaker would raise a flag if there's a large deviation between the secondary Oracle and the Chainlink feeds
When the application sees the flag, they could do something like pausing the application
Proof Of Reserve
Context: Fiat-backed stablecoins, cross-chain tokens, and asset-backed tokens are backed by actual money in a bank account, the original token on its main blockchain, and the real world asset, respectively
For asset-backed tokens, the problem we have is that we are unable to verify the specific amount of reserves backing that asset
Proof of Reserve uses an Oracle network to verify the collateralization on the backend system of the other blockchain/system
"So it's [Proof of Reserve] kind of like an audit of the collateralization in real time and on-chain. It's kind of like an automated audit, instead of doing a manual review. And you can actually share this across multiple different projects." - Crypto Oracle
Collateralization is the ratio of reserve assets, which are backing them, compared to the amount of tokenized assets that are on the blockchain
As we move to a multi-chain world, Proof of Reserves will become increasingly important. Blockchains will have to pass data between each other, specifically if the reserves are on a different chain
Features
Proof of Reserve introduces transparency into the system
Proof of Reserve is a subset of Proof of Audit. For example, USDT has been audited (proof of audit), but that information is off-chain and cannot be used by smart contracts. Hence, there is no "Proof of Reserve"
"So when you have proof of reserves, and you're putting all these cryptographically signed data points, you're creating an immutable on-chain audit trail." - ChainLinkGod
Technical Structure
From a structural perspective, Proof of Reserve is structured quite identically to price feeds. Instead of financial market data, it's fetching data from auditors who have access to these backend systems to post the reserves
Two reference feeds:
Proof of Reserve
Proof of Supply
Proof of Supply comes into play when the tokenized asset exists on multiple blockchain networks
To check if the collateralization is met, the data from the supply feed is compared against the data from the reserve feed
Use Cases
Some stablecoins are backed by the US dollar in a bank account
In this context, proof of reserve functions as a circuit breaker
It does not prevent a stablecoin from losing its collateralization. What it does is to mitigate the damages caused by fractional reserve
For example, it prevents the custodian from minting tokens, depositing said tokens on a protocol, and borrowing other tokens and running off with them since the excess tokens they minted are backed by nothing
Circuit breakers can pause functions (deposits, withdrawals, borrowing against tokens) if Proof of Reserve and Proof of Supply feeds show a major deviation
Proof of Reserve can also be used in an insurance context. Holders of fiat-backed stablecoins can buy an insurance product from another user if they want to protect themselves from the scenario where their stablecoin is not sufficiently collateralized
One of the recent Chainlink hackathon winners created a two-sided marketplace for insurers and insurees to provide a market for lenders of TUSD on the Aave market. If the TUSD token is no longer fully backed according to Proof of Reserves, the insurer would pay out to lenders
As more stocks and commodities get tokenized, proof of reserves feeds would be used to ensure that each tokenized version of an existing financial product is indeed backed by the original version in the traditional financial system
Existing Proof Of Reserve Feeds
Wrapped Bitcoin (WBTC), the largest form of tokenized Bitcoin on Ethereum
With Proof of Reserve, it is possible to verify that Bitgo, the custodian, is actually holding enough Bitcoin
If WBTC is no longer properly backed, the smart contract can pause and provide these safety functions
PAXG is a gold-backed token and what the Proof of Reserve feed does is to ensure that gold exists in the Paxos' vault
APIs
Chainlink enables smart contracts to connect to external data sources called application programming interfaces (APIs)
API is a standardized way for how computers talk to each other
Chainlink Oracles can connect to any APIs out of the box
External adapters are additional modules that can be plugged into a Chainlink node that handles the communication with the API
Each Chainlink Node Operator will run an external adapter for each data source they have
An external adapter can be created by anyone in any programming language
External adapters can be deployed by anyone
Common use case for APIs is for niche datasets that are required at a specific moment in time (e.g. results of a sports event, weather conditions in a country)
External adapters can also be connected to enterprise systems with permissioned access
Currently, external adapters are used for fetching specific datasets. In the future, it could be used for computation
Verifiable Random Function (VRF)
Chainlink VRF provides smart contracts the ability to access randomness
True randomness is impossible to get and impossible to verify
Most applications (both on the blockchain and off the blockchain) use pseudo-randomness that is programmatically generated and unpredictable to humans
Still need a way to verify that the randomness is random
Blockchain networks do not generate randomness
Often, a naive approach to randomness generation is used (cryptographic hash of a new block)
This introduces an attack vector as miners can discard a block with a hash that's not favourable to them and retry until they get a favourable hash
Already seen this attack vector happening in the real world. Projects like Meebits and many others have used the block hash for randomness generation and realized that it could be manipulated by users
Other Oracle providers offer on-chain randomness generation by fetching data from random.org
Manipulated randomness looks identical to actual randomness. If a node delivers randomness that appears random, but actually was pre-determined to be something that would help themselves, users would have no way to verify it
"If a node delivers randomness that appears random, but actually was pre-determined to be something that would help themselves, you would have no way to actually prove that, you have no way of actually verifying." - ChainLinkGod
Mechanism Of Chainlink VRF
Core value proposition of Chainlink VRF is that it generates randomness on-chain in a manner that can be proven that it is not tampered with
Every time randomness is generated from a Chainlink Oracle node, it generates randomness as well as a cryptographic proof proving that it was actually random
A seed value, like block data and any other value provided by the user, is mixed with the Oracle Node's private keys and put through the Chainlink VRF function
The resultant cryptographic proof is basically proving that the inputs produce these outputs
With a cryptographic signature, the private key is hidden but the corresponding public key is available
Hence, when the original seed value, the cryptographic proof, the randomness, and the public key is combined, people can verify that this seed value led to this piece of randomness and was signed by the correct private key
A smart contract using Chainlink VRF would reject a false cryptographic proof
Use Cases
Selecting winners of a lottery
Used for in-game dynamics such as matchmaking, map generation, etc.
"The more value the randomness secures, the more important something like VRF is." - Crypto Oracle
Used in generative art
Determining who gets to participate in a high-demand ICO
Ticketing for events
Random sample of a population for an academic study
Selecting jurors
Keepers
Smart contracts are "asleep." They need to be woken up to execute their functions
Keepers are used to "poke" these smart contracts and wake them up
Keepers do not deliver data. They are transaction automation services that ping a contract to call up a predefined function
"The Oracle is simply bringing the data on chain, whereas the keeper is telling the contract to act." - Crypto Oracle
Chainlink Oracle networks can take on both Oracle and Keeper jobs. They are complementary and can be used together, but they achieve different goals
Keepers can never be malicious. Their role is just to ping and awaken the contract
However, they can be unreliable in the sense of failing to act when it is needed to
Not much information on Chainlink keepers yet. The documentation that exists indicates that Chainlink will be decentralizing Keeper networks
Instead of one Keeper responsible for monitoring when something should happen, you have a decentralized network of nodes monitoring when a transaction should occur
ChainLinkGod foresees that existing Chainlink nodes would eventually become Keepers. They would provide the same reliability guarantees and are incentivized to continue being reliable as they have revenue and reputation on the line
Examples:
Smart contracts for loan liquidation
Smart contracts for token rebases
Pinging Mechanisms
Time-based (e.g. at a certain time each day)
Monitoring off-chain events (e.g. triggering based on price changes)
Blockchain Abstraction Layer For Enterprises
Chainlink is blockchain agnostic and API agnostic
Can read data from any blockchain, write data to any blockchain, and interact with the blockchain from any off-chain system. This is known as the blockchain abstraction layer
Enterprises that want to become blockchain-enabled require a lot of development resources. In addition, they need to integrate with many blockchains as well
"When you're using Chainlink as this abstraction layer, you can create a unified application where it's using Chainlink as like the substrate to connect all these different blockchains. You could have Ethereum as settlement, Solana for custody of assets. For high speed computations, you can use Polygon or these other layer 2 networks to get any infinite amount of different combinations of blockchains." - ChainLinkGod
Chainlink provides a single integration gateway, for any enterprise of any size. With this 1 integration, they get access to any and all blockchain networks that exist both today and into the future as more blockchains get integrated with Chainlink
Enterprises do not need to change their backend systems at all
Enterprises are very slow-moving. They want to see other enterprises taking the risk and moving to the blockchain first before they themselves do so
Once the first enterprise makes the jump, there will be a domino effect where other enterprises have to follow suit or get left behind in the dust
These enterprises will end up integrating with Chainlink in order to access the different blockchains
Chainlink also enables enterprises to switch from one blockchain to another very nimbly, if need be
Responding To Criticisms Of Chainlink
We Need More Decentralization Than What Chainlink Offers
Sometimes, ChainLinkGod and Crypto Oracle would observe the narrative from people that they want even more decentralization
Chainlink is already decentralized on 3 different layers (data source containing aggregated data, data aggregators, node operators)
Introducing unproven Oracle solutions that are fetching low-quality data from free open APIs would dilute the data quality and the user would get less security assurances
The lowest quality Oracle can be manipulated and mixing them together with Chainlink would result in dragging the overall quality of the data lower
What If Chainlink Fails?
Chainlink has a backup client running at a low frequency in the background
If the current client (OCR feeds) fails, it would failover to this backup client (Flux Monitor)
This system has been running for quite awhile already
All information presented above is for educational purposes only and should not be taken as investment advice. Summaries are prepared by The Reading Ape. While reasonable efforts are made to provide accurate content, any errors in interpreting and summarizing the source material are ours alone. We disclaim any liability associated with the use of our content.