Combining Multiple Chainlink Oracle Services to Build Advanced Smart Contracts
The Chainlink Network offers smart contract developers a wide range of oracle services that provide their applications with external data and advanced computational capabilities. Chainlink oracle services are designed to bootstrap the growth of emerging sectors of the smart contract economy. For example, Chainlink Price Feeds enable DeFi applications to dynamically manage assets based on real-time market conditions while Chainlink Verifiable Random Function (VRF) empower NFTs and blockchain games to create fair distribution models and unpredictable gameplay.
This combination of on-chain blockchain infrastructure and off-chain oracle services forms the foundation of a powerful new hybrid smart contract framework, where applications can retain the non-custodial and censorship-resistant properties of blockchains while becoming substantially more feature-rich and performant via oracles. Though many hybrid smart contracts began by using a single oracle service, this is quickly changing as applications become more sophisticated. Now, developers are combining multiple Chainlink oracle services together within a single application to unlock more utility and simplify user experience.
In this blog post, we explore the complementary nature of Chainlink oracle services through the lens of three initial combinations: Price Feeds + Keepers, VRF + Keepers, and CCIP + Price Feeds.
Price Feeds + Keepers
DeFi applications often require real-time price data when taking specific on-chain actions, such as determining a user’s maximum loan size or calculating payouts on a futures contract. With DeFi becoming the first major sector for smart contracts, Chainlink Price Feeds was launched. Chainlink Price Feeds has become the most widely used oracle solution for accurate, tamper-proof financial market data on blockchains, with 700+ Chainlink Price Feeds already running in production across many of the leading blockchain networks.
However, smart contracts are not autonomous by default; they require an external triggering transaction that instructs them when to perform certain on-chain actions. For example, an options contract will only settle once it’s informed to do so. The challenge lies in making sure the mechanism responsible for triggering the application under specific conditions is highly reliable. To remove any centralized points of failure, Chainlink Keepers was launched. Chainlink Keepers is a decentralized transaction automation solution that performs DevOps tasks on behalf of smart contracts and development teams. Chainlink Keepers are often used in combination with Chainlink Price Feeds across many DeFi use cases, i.e., Keepers trigger smart contract processes that rely on Price Feeds during execution.
To take one such example, bZx uses Chainlink Price Feeds and Chainlink Keepers to power the liquidation mechanism of its decentralized money market protocol. Chainlink Keepers are used to actively monitor the collateralization of user loans off-chain, and then call bZx’s on-chain liquidation function when specific positions are found to be under-collateralized. Once the function is called, the bZx liquidation contract verifies the off-chain computation by calling the relevant Chainlink Price Feeds to determine if the users’ positions meet the requirements for liquidation (e.g., collateralization is below a predefined threshold).
By combining multiple Chainlink oracle services, bZx was able to create a more robust and accurate liquidation mechanism. Lenders now have better solvency protection during volatile market conditions while borrowers have better protection against faulty liquidations—all in an automated, decentralized, and fully verifiable manner.
Verifiable Randomness + Keepers
Following DeFi, NFTs and blockchain gaming have become the latest smart contract-based sectors to achieve user adoption. A key element found throughout both is randomness, which is used to generate unpredictability, excitement, and fairness. Demand for randomness drove the launch of Chainlink Verifiable Random Function (VRF)—a random number generator purpose-built for smart contract applications that anyone can publicly verify is tamper-proof. Chainlink VRF has become widely used by NFT and blockchain gaming projects to select winners in giveaways, assign traits during NFT mints, and order queues in a provably fair manner, among other use cases.
Like DeFi, most NFT and gaming applications need to be told when to execute certain on-chain functions. For example, a game may require an on-chain transaction to trigger the start of a round, a second to call Chainlink VRF for a random number, and a third to end the game and make payouts. Instead of spending time and resources manually calling the smart contract, applications can combine Chainlink VRF and Keepers to automate the entire process for a simplified user and developer experience.
PoolTogether, a no-loss savings game, integrated Chainlink VRF to select the winner of each prize round and is integrating Chainlink Keepers to automatically end rounds, pick winners, and initiate new rounds. As a result, PoolTogether’s no-loss prize games become fully automated, including payouts, randomness requests, and continuous game rounds.
Cross-Chain Interoperability + Price Feeds
The smart contract ecosystem is increasingly shifting towards a multi-chain world where adoption is spread across many blockchains, each with its own features and applications. However, interoperability between blockchains is still primitive, limiting the ability for tokens and commands to be seamlessly and securely bridged across environments.
The Cross-Chain Interoperability Protocol (CCIP) is an open-source standard in development aimed at supporting secure token bridges and cross-chain messaging pathways. The addition of CCIP has the potential to fundamentally alter the multi-chain strategies of dApps. Instead of a dApp having separate isolated deployments on each blockchain, it can leverage CCIP to become a single, interconnected cross-chain application. Furthermore, CCIP can be greatly enhanced by combining with other Chainlink oracle services, such as Price Feeds, Verifiable Randomness, Keepers, Proof of Reserve, Any API, Fair Sequencing Services, and more.
For example, CCIP and Chainlink Price Feeds can be combined to power decentralized money market applications for users wanting to open cross-chain collateralized loans. Volatile collateral could be deposited into a smart contract on a source blockchain, allowing different assets, such as stablecoins, to be borrowed on a destination chain. Chainlink Price Feeds can then be used to calculate collateralization ratios during loan issuance and liquidations while CCIP bridges the collateralization data across chains. As a result, users are able to keep their collateral stored on a highly decentralized blockchain while borrowing assets on a higher-throughput blockchain or layer-2 network.
In addition to cross-chain DeFi applications, centralized finance (CeFi) platforms have a growing need for secure cross-chain interoperability in order to tap into DeFi yields. One instance is Celsius, a market-leading CeFi platform with over $26B in AUM and 1M+ users. Celsius uses Chainlink Price Feeds to set borrowing rates for loans, with plans to leverage CCIP to bridge tokens across blockchains. Through the combination of CCIP and Price Feeds, Celsius is able to decentralize key components of its platform, securely generate high yields for users, and create a simple user experience that abstracts away the complexities of blockchain technology.
Unlocking The Full Potential of Hybrid Smart Contracts
Similar to the relationship between Web 2.0 app development and APIs, Web 3.0 dApp development is advancing with a similar model where smart contracts outsource key services to oracles as well as combine oracle services together to build more complex and easy-to-use applications. This is why Chainlink is committed to launching oracle services into production as a means to accelerate development and unlock new value streams.
This article has only scratched the surface of what’s possible when using combined Chainlink oracle services. The scope of what’s possible will only accelerate as additional oracle services that bring a wide range of datasets and computations to the hybrid smart contract development framework are launched into production.
If you want to start building hybrid smart contract applications today and need some type of external data or computation, refer to our documentation, ask a technical question in Discord, or set up a call with one of our experts.