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 + Automation, VRF + Automation, and CCIP + Price Feeds.
Price Feeds + Automation
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 Automation was launched. Chainlink Automation is a decentralized transaction automation solution that performs DevOps tasks on behalf of smart contracts and development teams. Chainlink Automation is often used in combination with Chainlink Price Feeds across many DeFi use cases, i.e., Automation Nodes trigger smart contract processes that rely on Price Feeds during execution.
To take one such example, Siren uses Chainlink Price Feeds and Chainlink Automation to help power its DeFi options protocol. Price Feeds supply the protocol with secure price data for accurate options pricing and settlement, and Automation is used to help reliably execute options at expiry.
The Siren protocol needs to execute the settlement process when an options contract expires. In addition, when options expire, Siren needs to set the settlement price for that expiry date. The combination of Chainlink Price Feeds and Automation helps ensure that options settlement prices are accurate at all times and that options are reliably settled on time, shortly after options expiration. By combining multiple Chainlink oracle services, Siren has improved reliability and reduced the latency of critical protocol functions such as options settlement and pricing, greatly improving the user experience of the decentralized application.
Verifiable Randomness + Automation
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 Automation to outsource the entire process for a simplified user and developer experience.
Crabada, a play-to-earn game, integrated Chainlink VRF and Chainlink Automation to help power verifiably random, automated weekly draws. VRF helps randomly select winners, and Automation Nodes help start and stop each draw round, initiate the VRF call, and distribute prizes to winners. As a result, Crabada’s weekly lucky draws become fully automated, including randomness requests, reward payouts, 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, Automation, 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.
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.