Chainlink Blog: Smart Contract Automation Use Cases Powered by Chainlink Keepers
Chainlink Keepers is a decentralized transaction automation solution that enables smart contracts to automate key functions and DevOps tasks in a highly reliable, trust-minimized, and cost-efficient manner. Individual developers, teams, and DAOs can utilize Chainlink Keepers as an off-chain computation layer to reliably automate key functions and unlock advanced utility.
Chainlink Keepers are already empowering smart contract developers on Ethereum, Polygon, and Binance Smart Chain to build feature-rich dApps that are decentralized and fully automated end-to-end.
In this blog post, we briefly examine why smart contracts need secure and decentralized automation services and then explore some of the advanced use cases supported by Chainlink Keepers.
Why Smart Contracts Need Decentralized Automation
An often overlooked characteristic of smart contracts is that they cannot trigger their own functions. Instead, they need to be triggered by an external entity through an on-chain transaction to run certain functions. While some protocols such as automated market makers (AMMs) can rely on users to initiate transactions to wake up the contract, many smart contracts need an external entity known as a “keeper” to monitor predefined conditions and trigger the contract when those conditions are met. Such conditions can include reaching a specific moment in time, the occurrence of a specific event, or the execution of a complex off-chain computation.
Before keeper services, smart contract development teams had to set up centralized servers or use DevOps teams to manually trigger transactions. However, this method not only introduces a central point of failure that subjects the protocol to potential failure and downtime but also consumes precious development resources that could be spent improving the underlying business logic of the protocol or expanding its features.
In essence, Chainlink Keepers are decentralized transaction automation bots that enable smart contracts to operate autonomously. Developers can submit custom jobs to Chainlink Keepers outlining the smart contract functions that should be called based on specific conditions, and Keepers then monitor those conditions through secure off-chain computation and trigger the functions when they are reached. The end result is that developers are able to increase the uptime guarantees of their decentralized applications, save on development costs, simplify user experience, and create feature-rich hybrid smart contracts that are fully automated end-to-end.Chainlink Keepers enable development teams to decentralize their protocols end-to-end.
Chainlink Keepers enable extensive smart contract automation use cases, ranging from basic automation and DevOps tasks such as replacing a centralized script to advanced off-chain computation to enable gas savings, security, or confidentiality. Crucially, Keepers unlock entirely new decentralized functionality that wasn’t previously possible in the blockchain ecosystem, with even more use cases enabled when Keepers are combined with other Chainlink services such as Chainlink Price Feeds and Chainlink VRF. The possibilities are endless, with the smart contract developer community now able to invent and discover exciting new use cases that take advantage of both the data delivery and off-chain computation capabilities of Chainlink to bring more value to users.
A wide-ranging collection of prominent DeFi applications are already powered by Chainlink Keepers, while many development teams are actively working on integrating Keepers into their protocols. Below is a collection of Chainlink Keepers use cases that development teams are already using on mainnet or are in the process of integrating to support reliable transaction automation. If you’re interested in leveraging the capabilities of Chainlink Keepers in your own project, find us on Discord and check out the developer documentation to begin building with Keepers today.Yield Harvesting and Compounding
Yield farming protocols reward users for provisioning liquidity or providing other value-adding services to a protocol, typically through lending or staking tokens.
Some ways to earn yield in DeFi includeLending tokens on a decentralized money market protocol like Aave. Depositing tokens into a liquidity pool on an AMM such as Curve to earn a portion of trading fees. Staking in a protocol like Liquity to earn a portion of borrowing and redemption fees. Curve liquidity providers can manually collect their earned trading fees.
Harvesting yield is a fundamental function of yield farming platforms. In order to harvest yield, an on-chain transaction is required to claim rewards from a yield-generating vault. As smart contracts cannot trigger their own functions, they need an external entity to trigger an on-chain transaction in order to run their coded logic. While users can initiate these transactions and periodically “wake up” the contract to perform harvesting operations, this requires either manual intervention or the use of centralized bots. Both of these solutions can be unreliable and subject the protocol to downtime.
Beefy Finance is a decentralized, multi-chain yield optimizer platform that enables its users to earn compound interest on their crypto holdings. Beefy offers a set-and-forget DeFi user experience, with users receiving earnings directly in their accounts without any manual intervention. Rewards are regularly harvested, swapped for the original vault asset, and deposited again for compound farming.Beefy Finance’s dashboard for tracking yield farming returns.
Beefy Finance is integrating Chainlink Keepers on Binance Smart Chain and Polygon to securely automate yield harvesting functions in more than 700 yield pools on the platform. Outsourcing harvesting to a decentralized network of keepers will not only bring a major upgrade to user experience but will also help ensure that yield is harvested as soon as it’s calculated to be profitable, or at least once per 24-hour period. This enhancement will maximize compounding efficiency, decentralize the automation of Beefy’s vault harvesting and yield compounding functions, and make the platform more competitive in the yield farming landscape.Beefy Finance is integrating Chainlink Keepers to automatically harvest and compound yield in a fully decentralized manner. “Chainlink Keepers enable us to decentralize the automation of our yield harvesting and compounding functions, resulting in greater reliability, transparency, and ease-of-use across all our yield optimization strategies.” — Beefy Finance team
Alchemix is a self-repaying lending protocol that deposits user collateral into Yearn’s yield aggregator vaults, where the interest generated is used to repay user loans over time. In essence, the Alchemix platform lets users get an advance on their future yield in the form of a fungible token. In order to enable automated operation, the yield harvesting and debt repayment functions need to be periodically triggered in the Alchemix smart contract.
Alchemix chose to integrate Chainlink Keepers to automate yield harvesting and debt repayment, which are now fully automated and execute without any manual intervention required from the Alchemix team, providing greater assurance to users that their loans will be continuously paid down.Alchemix uses Chainlink Keepers for secure smart contract automation.
Synthetix is a decentralized derivatives protocol that offers users on-chain exposure to overcollateralized synthetic assets and enables them to trade those assets with zero slippage against a liquidity pool contract. Synthetix is using Chainlink Keepers for its fee period closing service. Chainlink Keepers call this function after the fee period duration has ended to automate the distribution of Kwenta exchange fees and staking rewards.Synthetix uses Chainlink Keepers to automate the distribution of exchange fees.
Paçoca is a portfolio tracker, DEX aggregator, and yield aggregator with auto-compounding vaults called Sweet Vaults. In order to help decentralize its DeFi platform and create a trust-minimized architecture, Paçoca integrated Chainlink Keepers to reliably auto-compound yield from its vaults.“By leveraging Chainlink Keepers to perform secure off-chain computation, the Paçoca protocol can now reliably auto-compound its Sweet Vaults in a decentralized, trustless, and tamper-proof manner. Ultimately this simplifies the user experience, as users won’t need to manually make transactions to auto-compound their yield.” – Paçoca Core Team Rebasing and Rebalancing of Tokens
The beauty of decentralized financial applications is that strategists and developers can create fully-fledged asset allocation strategies that can autonomously execute a predefined plan of action codified into a deterministic smart contract. The success of these systems depends not only on the strategy itself but also on the consistent execution of the defined logic. Automating the rebasing mechanism of elastic supply tokens and rebalancing tokens according to a predefined exposure ratio are smart contract maintenance tasks that have to be periodically performed to achieve the desired functionality.
COTI created the Crypto Volatility Index (CVI), an index designed to predict the cryptocurrency market’s expected future volatility for the upcoming 30 days, along with volatility tokens pegged to the index. These tokens need a periodic adjustment of their supply, known as a rebase, to maintain their peg. Relying on centralized scripts or manual input would subject the volatility token rebasing function to potential downtime, leading to incorrect token pricing and cascading failures in other DeFi applications integrating the tokens.The Crypto Volatility Index uses Chainlink Keepers for automated rebases.
The COTI team decided to integrate Chainlink Keepers because they needed a decentralized and highly reliable entity to call their smart contracts on-chain to trigger the rebasing mechanism. Every 24 hours at midnight UTC, Chainlink Keepers trigger the rebasing smart contract. The CVI smart contract then verifies that an adjustment of the supply is needed and executes the rebase to achieve the desired peg with the index. With the help of Chainlink Keepers, the CVI smart contract can now execute rebases in a fully decentralized and trust-minimized manner, without any manual input required. And since checkUpkeep is performed off-chain, CVI optimizes for gas fees and will thereby save significant costs.
BarnBridge integrated Chainlink Keepers to automate the rebalancing function in its SMART Exposure product, which lets users maintain a specific risk exposure to an ERC-20 token pair. Investors can define a desired target allocation between two tokens that the smart contract automatically maintains through a rebalancing mechanism when the prices of the underlying tokens change. When the predefined allocation threshold is exceeded, Chainlink Keepers initiate a rebalancing transaction, providing strong guarantees for timely and consistent rebalances.
Benchmark Protocol is also using Chainlink Keepers to execute fully on-chain rebases in a decentralized manner. The Benchmark token (MARK) is an elastic supply collateral utility designed to inject liquidity during periods of high volatility in correlation with global equities markets. The integration of Chainlink Keepers allows for automated rebases to occur based on triggers at certain time intervals.
Automate Your Smart Contracts With Chainlink KeepersStarting and Stopping Games or Rounds
Entropyfi offers prediction games on various on- and off-chain assets which reward users with amplified yields. Users have the opportunity to profit from market movements with zero loss to their wager by depositing assets into Entropyfi. User assets are then deposited into yield-generating platforms to generate interest. Winners of the prediction market receive the interest earned by the pool, while all users—regardless of whether they won or not—get back their principal.EntropyFi uses Chainlink Keepers to automate its prediction games.
Entropyfi uses Chainlink Keepers to automate its smart contract workflow for starting and ending prediction markets and calculating users’ profits. Each lossless prediction game has a start date, contribution cutoff date, and settlement date. Users can only deposit funds between the start date and the contribution cutoff date. Chainlink Keepers automate calls to the Entropyfi smart contracts in order to trigger the contribution cutoff date pause and trigger the settlement process to execute.Liquidations
One characteristic of a healthy on-chain DeFi ecosystem is easy access to debt. Decentralized money markets are becoming increasingly popular as a way to take out a loan or earn yield on idle holdings. However, these protocols need a robust and reliable liquidation mechanism to prevent undercollateralized positions and ensure continued platform solvency.
Aave, a DeFi protocol that lets users borrow and lend crypto assets, is integrating Chainlink Keepers to help ensure that the protocol remains solvent through a reliable liquidation mechanism. Keepers will monitor the health of user loans off-chain by consistently computing collateralization and checking if the collateralization ratio of open loans has dropped below the predefined liquidation threshold. If a user’s borrow transaction is found to be undercollateralized, Chainlink Keepers will call the Aave protocol’s liquidation function, helping to ensure that positions remain solvent even during periods of high market volatility and network congestion.Aave is integrating Chainlink Keepers to automatically trigger liquidations for undercollateralized loans on the platform.
B.Protocol’s Backstop Automated Market Maker (B.AMM) is designed to improve the liquidation process on lending platforms by incentivizing liquidity providers—instead of bots and miners—to liquidate undercollateralized loans. If a liquidation happens, an automatic rebalance process converts the seized collateral back to the original asset by offering the asset for sale at a discount depending on a price formula.
One potential edge case in the B.AMM system is that despite a significant discount, takers may not buy the offered inventory as most of the time there is no inventory for sale. Another potential edge case is that liquidity providers might be slow to liquidate loans during extreme market conditions and periods of network congestion. To address these edge cases, B.Protocol needed a secondary liquidation mechanism to help it provide a timely and reliable liquidation process.
B.Protocol integrated Chainlink Keepers to periodically check for DEX arbitrages and undercollateralized open loans using off-chain computation. If the price on the B.AMM significantly deviates or liquidity providers fail to liquidate a loan on time, Chainlink Keepers trigger the arbitrage or the liquidation, resulting in B.AMM’s liquidations and on-chain pricing mechanism consistently representing the most up-to-date global market prices no matter the market conditions. The integration of Chainlink Keepers not only makes the B.AMM system more robust, it also contributes to a fairer, safer, and more reliable user experience.Liquidity Management
Uniswap v3 introduced the concept of concentrated liquidity, where liquidity providers (LPs) can have granular control over the price range their liquidity position is allocated to. This novel automated market maker (AMM) design induced an emerging sector of decentralized transaction automation services that rebalance Uniswap v3 liquidity positions based on predefined conditions.
Visor Finance is one example of a protocol for automated liquidity provision management that aims to optimize LP returns. Users can provision their assets to be managed by ‘Supervisors’ that execute Uniswap v3 liquidity position management strategies based on chosen conditions and thresholds. Visor is integrated with many liquidity pools on Uniswap and utilizes a variety of market-making strategies to maximize returns while minimizing impermanent loss.
In order to automatically execute these liquidity management strategies, Visor’s smart contract needs to be notified based on external conditions and thresholds. Visor integrated Chainlink Keepers to automate certain on-chain liquidity management functions such as reinvesting fees, opening and closing limit orders, and setting price ranges. By support from Chainlink Keepers, liquidity management strategies in Visor can run in an automated and reliable manner.
Adding the strong reliability guarantees of Keepers to Visor’s feature set decreases the complexity for third parties running a Supervisor and empowers strategists to focus on their fundamental task—developing advanced liquidity management strategies that maintain the highest possible asset utilization for Uniswap v3 LPs.On-Chain Interest Rate Updates
The DeFi ecosystem allows for increasingly advanced “money legos” that plug into existing protocols to provide sophisticated on-chain yield opportunities. 88mph is a non-custodial, on-chain fixed yield rate protocol that offers two products:A fixed-term fixed yield product with a custom or preset maturity that allows users to earn a fixed interest rate on the assets they supply. An instrument for yield speculation called a Yield Token (YT) that lets users speculate on the variable yield rate of third-party lending protocols, such as Aave or Compound.
In order to make the platform easier to use, the 88mph team needed a way to automate updates of their on-chain interest rates—a task that previously had to be done manually. Keepers provide a low-cost automation solution for 88mph’s cryptocurrency-based bonds by allowing for automated on-chain interest rate updates.
Chainlink Keepers trigger the Keeper Hub contract developed by the 88mph team, which allows an externally owned account to check which of their many on-chain interest rates require an update. Keepers not only eliminate manual processes in 88mph but also enhance the platform’s reliability, as the decentralized network is made up of the same time-tested node operators that help secure tens of billions of dollars in smart contract value in Chainlink Price Feeds.
In this video, McFly from the 88mph team explains how they automated their on-chain interest rate updates using Chainlink Keepers:
DEX Limit Orders
DEXs are peer-to-peer marketplaces that enable seamless transactions without intermediaries. Most DEXs are powered by AMM protocols, which are essentially self-governing trading mechanisms. AMMs pool liquidity by enabling users to deposit their tokens for a share of trading fees, and liquidity pools are automatically rebalanced by the AMM according to supply and demand. Though AMMs are highly useful tools, one limitation is that they do not feature order books, meaning users are unable to set limit orders that automatically buy or sell assets at their desired target price. Instead, traders are forced to wait for their desired price and market buying the asset once it is reached, which is extremely time-consuming and inefficient.Limit orders allow traders to specify future entry and exit points.
However, that changed with the launch of Chainlink Keepers. Users can specify their target buy or sell price and Chainlink Keepers will use off-chain computation to continuously monitor asset prices on the DEX. Once a user’s target price is reached, Chainlink Keepers will automatically execute the transaction on their behalf. With Chainlink Keepers, users no longer have to sit by the computer for hours at a time until their desired target price is reached—a significant user experience improvement for many DEXs.
In fact, bZx is already working on integrating Chainlink Keepers to enable automated limit orders, while ApeSwap and DODO also plan to use Chainlink Keepers, now that they are natively available on BSC.DODO is integrating Chainlink Keepers for automated limit order functionality. “Chainlink Keepers set the industry standard for secure smart contract automation, and we’re excited to empower traders with new tools for capitalizing on market movements, even when they are not awake.” — Lei Mingda, Founder of DODO
Start Building With Chainlink KeepersCross-Chain NFT Minting
NFTs have been surging in popularity, with total sales amounting to $10.7B in Q3 2021 alone. However, there have been some issues around NFT drops—there have been instances of bots unfairly minting the rarest NFTs and many drops have led to record-breaking gas prices. Many projects have integrated Chainlink VRF to help eliminate bot manipulation and ensure their NFTs are distributed via a provably fair process. Some projects have opted to move their projects to layer-2 solutions or blockchains with lower gas fees in response to high gas prices.
That said, many projects view Ethereum as the most desirable blockchain for launching NFT projects due to its large user base and secure architecture. One way to get around the prohibitive issue of high gas prices while still launching NFTs on Ethereum is to use Chainlink VRF and Chainlink Keepers for cross-chain NFT minting—Crazy Crows Chess Club (CCCC) did just that.
CCCC had a set of smart contracts on both Polygon and Ethereum. First, CCCC used Chainlink VRF to initiate the minting of provably rare NFTs on Polygon. Once an NFT’s initial metadata was set on Polygon, Chainlink Keepers were used to push the metadata back to an Ethereum-based NFT, which was then automatically minted with verifiably random traits. By offloading some of the complex smart contract interactions to layer-2 environments, CCCC was able to launch on Ethereum with reduced fees.“At the end of the day, we wanted to build something that would last. We didn’t want to integrate with a service that might be here today but gone the next. We feel Chainlink has that long-term viability and vision. It gave us great confidence that CCCC could continue to run without us now that we have made the integrations and our community can take advantage of the utility of our tokens.” — kingmaker, Creator and Co-Founder of the Crazy Crows Chess Club Dynamic NFTs
NFTs are blockchain-based tokens representing the ownership of something unique, whether that’s a real-world asset such as a property deed or a unique piece of digital art. Most NFTs are static, meaning their features are permanent once they are minted. However, static NFTs are evolving into dynamic NFTs with the help of real-world data inputs from Chainlink’s decentralized oracle network. NFT projects can update their NFTs with real-world data by using ready-made Chainlink Data Feeds or connecting to any internet-based API using custom-built External Adapters.
However, since smart contracts are asleep by default, NFTs will not automatically update according to real-world data inputs without someone or something triggering the smart contract. As decentralized, tamper-proof automation bots, Chainlink Keepers are the perfect tool to create automated dynamic NFTs.
One can imagine a variety of use cases for dynamic NFTs representing real-world assets. For instance, a mortgage-backed NFT could use Chainlink Data Feeds and Chainlink Keepers to automatically update its variable interest rate according to the market rate. Meanwhile, Chainlink Keepers could monitor changes in identity-based blockchain systems to automatically update digital NFTs representing an individual’s digital identity.
The Curse NFT from Accursed Share uses Chainlink Keepers to create a novel dynamic NFT of a changing 4K 3D image. Featuring a 1/1 collection of the model Krystall Schott, the Curse NFT updates according to Ethereum’s price movements. Chainlink Keepers use off-chain computation to continuously monitor the price of Ethereum, altering the NFT to reveal new positive and negative representations of Krystall’s face depending on the price of Ethereum.A caption from the Curse NFT showing model Krystall Schott. Source
Check out Accursed Share’s interview on Chainlink Live:
Automated Trading Strategies
In traditional markets, many trading firms use automated trading strategies to respond to market movements. To build and execute these strategies, institutions often heavily invest in advanced computer equipment and trading bots that remove the need for most forms of manual human intervention. Trading firms program these bots to respond in certain ways according to market movements, whether that’s trend-based strategies to automatically sell or buy assets according to price fluctuations or arbitrage methodologies that enable firms to take advantage of an asset’s spread across multiple exchanges.
However, automated trading strategies are difficult to introduce on DEX-based markets for many of the same reasons mentioned above in relation to DEX limit orders. But with the right data inputs, Chainlink Keepers enable seamless, automated trading strategies for DEXs. For instance, Chainlink Keepers can be programmed to sell a certain amount of tokens if a DeFi protocol’s Total Value Locked (TVL) drops below a certain threshold. Moreover, traders could use Chainlink Keepers’ off-chain computational abilities to follow trend-based strategies and spot arbitrage opportunities just like in traditional markets.
CoTrader is integrating Chainlink Keepers to automate its trading strategies, taking advantage of Keepers’ reliable, low-cost smart contract automation capabilities.
“Our new Chainlink Keepers-powered decentralized investment funds platform provides advanced, time-tested trading strategies, incorporating dynamic ratios such as TVL to market capitalization. The decision to use Chainlink Keepers was easy, as it’s the industry standard for decentralized, secure, and cost-efficient smart contract automation.” — Gary Bernstein, Founder of CoTrader.
Learn how to automate your Solidity smart contracts with Chainlink Keepers:
As the smart contract ecosystem expands, more teams are switching from centralized to decentralized governance models in the form of Decentralized Autonomous Organizations (DAOs). DAOs are reinventing traditional governance models with their bottom-up, community-focused decision-making processes.
In practice, DAOs are often composed of working groups or a board of directors appointed by token holders. Typically, DAOs serve specific purposes or have clearly defined goals, whether that’s helping with the ongoing governance of a protocol as is the case with Compound or attempting to purchase and share ownership of the American Constitution, the purpose of ConstitutionDAO. At the time of writing, over 1.7M unique entities are involved in 160+ DAOs, helping control over $12.5B in assets. While DAOs are making great strides in redefining traditional organizational hierarchies, one of the main issues holding them back is an inability to automate key processes.
With Chainlink Keepers, DAOs can automate their everyday processes in a decentralized manner, helping reduce decision-making friction. There are dozens of ways DAOs can use Chainlink Keepers for automation, but some examples include:Relaying off-chain votes on-chain Topping up DAO treasuries with tokens when they reach a certain balance threshold Distributing voting rewards Vesting or unvesting tokens automatically Executing votes after timelocks Automating salary payments from the DAO treasury Rebalancing DAO funds as market prices change
DAOs can use Chainlink Keepers to automate key day-to-day tasks and become truly autonomous organizations.Conclusion
While the use cases listed above provide a broad overview of the extensive automation capabilities enabled by Chainlink Keepers, it’s important to remember that new use cases are emerging every day. The secure, trust-minimized automation of recurring smart contract functions is a feat many development teams strive for, and this trend will continue to drive more demand towards transaction automation solutions that offer a way to fully decentralize dApps end-to-end and empower developers to create blockchain-based applications that stand out in comparison to legacy alternatives.
If you’re a developer and want to quickly get your application integrated with Chainlink Keepers, visit the developer documentation and join the technical discussion in Discord. If you want to schedule a call to discuss the integration more in-depth, reach out here.
To learn more, visit chain.link, subscribe to the Chainlink newsletter, and follow Chainlink on Twitter, YouTube, and Reddit.More on This Topic