A race is under way in DeFi innovation. Established players and upstart newcomers alike are in the running.
Gelato has been tinkering with use cases since 2019 and launched its production-ready V1 last July. Meanwhile, Keep3r network has been executing its own solution since late October 2020. And just last month Chainlink announced an Open Beta for Chainlink Keepers in the field of smart contract automation. The prize is automation, and from user-friendly trading strategies to infrastructure-level liquidation protection the beginnings of its massive potential are only now being realized.
Automation can be defined as the use of bots to automatically carry out software processes. Sometimes, these bots are referred to as “executors” or “keepers” and are part of the middleware infrastructure of the blockchain stack. Middleware infrastructure are the pillars holding up the blockchain ecosystem so dapps can focus on building their core product for end users to interact without a hitch. One of the most well-known examples of middleware are oracles, which are nodes that relay information from the outside world and publish it on-chain so smart contracts can utilize it for different purposes. The total oracle market cap is $9.9 billion alone which should give a sense of how massive the market for automation potentially is in size.
Gelato White Paper
When it comes to smart contracts, many people assume that they are already built with automation. This could not be farther from the truth and outside of liquidations and arbitrage, automation is noticeably absent from DeFi. According to the whitepaper of Gelato:
The reason for this lack of automation lies in the Ethereum Virtual Machine (EVM) itself: programs only run for a few milliseconds at a time; persistent loops or “cron” jobs that constantly repeat themselves, typical in traditional operating systems, limit a miner from ever completing the state transition and thus mining a block. As a result, these programs, called smart contracts, are limited to only storing state and logic. Without an outside impulse, they are functionally inactive. In order to execute their logic and to change their state, they require an external party to send a transaction to them in the first place.
Automation at a smart contract level has been tried and discussed in the Ethereum community since at least 2015 with the first attempt being the Ethereum Alarm Clock. Created by developer Piper Merriam, it described itself as “a service that allows scheduling transactions to be executed at a later time on the ethereum blockchain.” Incentivized through a decentralized network of bots referred to as TimeNodes, these execution agents were off-chain and performed simple automation tasks such as sending transactions at specific times.
The potential of automation was documented in 2018 when Ethereum Alarm Clock Partner ChronoLogic interviewed several leaders in the Ethereum community about the topic and shared their insights. Vitalik Buterin went so far as to boast that automation “seems like something that would be very valuable.” MyCrypto founder Taylor Monahan stated she envisioned automation facilitating multi-step transactions including execution of signals from the real world (a tweet, for example). Furthermore, Fabian Vogelsteller, the author of the ERC-20 token standard, viewed automation as a way to spur trading activity on decentralized exchanges (he would later be proven right).
Yet, the Ethereum Alarm Clock does not appear to be in active development anymore with the last update of any kind over a year ago on Github. Yet, the legacy of the Ethereum Alarm Clock should not be understated — it was the first genuine attempt at automating transactions on Ethereum.
The biggest problem was that the clock was too early for its time. During 2016-2018, the years when it was most active, DeFi essentially didn’t exist, which severely limited the amount of use cases the Ethereum Alarm Clock had at its disposal. In addition, the protocol’s mandate was solely directed at simple processes and not complex tasks that required deep integrations with smart contracts.
One of the first widespread uses of automation at a smart contract level was the launch of DAI, a decentralized overcollateralized stablecoin. The Maker system works by generating DAI, one must overcollateralize their assets by at least 150%. So if you wanted to generate $1000 worth of DAI, then you would need at least $1500 worth of tokens locked in a vault. If the assets dropped below 150% collateralization, then the owner is in danger of losing the assets to liquidation and paying a penalty.
Instead of taking care of the liquidations themselves, Maker has developed a system of external “Maker Keepers” to handle it. Anyone could set up a Maker keeper and start participating in liquidations. Through an incentive-driven auction system, keepers bid for the right to liquidate vaults via gas auctions and whoever wins would be able to liquidate them for profit. By allowing anyone to participate in liquidation auctions, Maker steps aside and automates one of the most important aspects of their ecosystem which today underpins billions of dollars in TVL in DeFi. If Maker were to handle liquidations themselves, then they would assume the responsibility of being the central point of failure for the entire protocol.
Yet even though Maker has its external liquidation system in place, in March of 2020 it suffered a systemic failure, which resulted in 5.67 million DAI in protocol losses. This was due to a late update to Maker’s Oracle Security Module because of high gas prices, which gave a window of opportunity for a small number of keepers to place nearly zero DAI bids to liquidate vaults. The infamous Black Thursday fiasco goes to show automation is still in its infancy of development. Progress is needed to perfect it. If Maker, one of the largest and most established institutions in DeFi, is vulnerable to such wide-spread failures, then how will other projects that are much smaller be ready to handle such shocks to their system?
As the need for automation became apparent, two of the biggest pain points have been how to incentivize bots in an economically sustainable fashion as well as adjust to volatile and unpredictable gas prices. Maker’s gas auctions were created to address both of those obstacles but is ultimately what a bot ecosystem looks like that is designed in an uncoordinated fashion.
For example, let’s say there are 10 bots bidding for the right to liquidate 1 vault. That means while 1 bot is able to recoup their costs after bidding the highest, the other 9 bots still have to pay gas for revert costs even though they lost. Repeat this process over a long enough time scale and it becomes uneconomically feasible for most bot operators to continue participating in liquidations.
Gas auctions are a winner-take-all system that is both a competitive and capital-intensive endeavor. Only a small set of bot operators will be able to survive, which results in the majority of bots being unable to participate. In addition, because of the lack of coordination, gas auctions are extremely resource-intensive with precious block space being filled with failed transactions. This results in miners capturing most of the value from liquidations because they determine the winner of the gas auctions instead of the bot operators who want to carry out the liquidations.
Outside of off-chain order book relayers, Maker’s liquidation system and an economy of arbitrage bots sniping orders on DEXs, there was no other widespread automation at a smart contract system level. That was not until Gelato came along in 2019 and was the first real attempt to organize bot operators in a coordinated manner through a smart contract protocol as opposed to an uncoordinated manner using gas auctions.
What Gelato did for the first time was to provide general automation services and match dapp developers with bot operators in a mutually beneficial way, dramatically reducing malcoordination and the leakage of value to miners. Differing from Maker’s Keeper model which centered on gas auctions, bots are coordinated into slots and perform transactions only when it is their “turn.” Compared to gas auctions, this round-robin fashion of allocating transactional tasks to bots makes it dramatically more efficient for automation to be applied to a wider variety of use cases since it eliminates reverts from bots racing each other by pooling bot resources in an organized manner. In addition, Gelato set out on a quest for coordinating bots in a network, to make it economically more feasible for operators of all sizes to participate long-term. As a result, the system is more robust and decentralized.
Gelato was started by Hilmar Orth and Luis Schliesske out of Gnosis’ Full Node co-working space in Berlin in April 2019. Gelato can be thought of as the natural successor to Ethereum Alarm Clock but instead of concentrating on simple transactions is focused on deep smart contract automation integrations from the get-go.
Tinkering and Iteration
After a $1.2 million seed round led by Galaxy Digital and IOSG Ventures and years of tinkering and iteration, Gelato is now live with several use cases that are being used across DeFi. In particular, Instadapp (which currently ranks #3 in TVL across DeFi) has utilized Gelato in multiple ways. Their first work together centered around Instadapp’s ‘debt bridge’ that automatically refinances unhealthy Maker vault positions to Aave and Compound. The next ‘bridge’ that Gelato and Instadapp would work on together would be migrating Aave positions from the Ethereum mainnet to Polygon. Most recently, in tandem with the launch of the INST token, Instadapp has used Gelato’s G-UNI pools for their liquidity mining program. G-UNI allows users to LP in Uniswap v3 and automates several functions from reinvesting fees to auto-rebalancing positions.
Last month, Gelato was awarded a $50k grant from Aave to build Automated Health Factor Maintenance and protect users against liquidation. Furthermore, Gelato has been deploying their limit order feature across multiple chains. At first, limit orders debuted on Sorbet Finance which tapped into the deep liquidity of Uniswap on Ethereum and QuickSwap on Polygon and allowed thousands of users to buy the dip. Limit orders would be natively integrated on Fantom’s leading AMM, SpookySwap in early June. In their future plans, Gelato intends to launch the $GEL token and with it, the Gelato DAO.
If there is one thing Gelato proves, it’s that automation cannot be pigeonholed into one use-case. Automation covers a plethora of uses across DeFi ranging from automated trading strategies to debt refinancing to liquidity provider management. According to Gelato’s whitepaper, future use cases for automation include automated DAO fund management, and using real-world events such as a tweet to trigger on-chain transactions. It could also power NFT rewards-minting based on on-chain conditions such as accessing a dapp a certain number of times.
Yet, Gelato is just one approach to automation and meanwhile others have attempted their own implementations as well. Andre Cronje, an early fan, released his own Keep3r Network and in their docs it is described as “a decentralized keeper network for projects that need external develops and for external teams to find keeper jobs.” Like Gelato, Keep3r was intended to be an infrastructure-level focused project that doesn’t directly benefit end-users but rather dapp developers and ecosystem health as a whole.
How the system works is that keepers could be set up and maintained by anyone and they bid to perform jobs via that are posted in the Keep3r registry. Twitter Projects that have depended on KP3R include Yearn ecosystem participants such as Yearn itself, Sushi, Pickle, etc. At the moment, only 4-5 Keepers work on jobs offered in the network on a weekly basis ince the network’s launch, 30,327 jobs have been completed and 38,027.93 KP3R have been rewarded, according to keep3r.live. Over 4,750 KP3R have been bonded, which is necessary to perform jobs and is currently valued at over $450,000.
Recently, a number of proposals have been introduced in Keep3r’s governance forum. These include Keep3r V2: optimizing the protocol ability to grow and STABLE: improved Keep3r based tokenonomics system. Both were authored by Luciano of DeFi Wonderland, which describes itself as “ an activist fund meets a Solidity army.” In the Keep3r V2 proposal, a number of improvements were discussed, including improvements in gas efficiency, replacing gas auctions with round robin execution, contract structure separation, faster bond/unbonding for jobs, deprecating oracles, work to be paid in bonds, backend improvements, and more.
Meanwhile, the STABLE proposal aims to create a new stablecoin (STABLE) pegged with the mint/burn mechanism of KP3R and modify JobCredits to mint/burn STABLE instead of KP3R. The purpose of the STABLE proposal is to increase stability among keepers who currently have to deal with the volatility and lack of liquidity of the KP3R token. These proposals are still being discussed and further action has yet to be seen.
The latest contender to step into the automation ring is Chainlink and has done so in a massive way, dedicating significant resources to the endeavor. On June 7th, Chainlink launched an Open Beta of Chainlink Keepers which is their system automating smart contract functions as well as performing regular contract maintenance which the Chainlink team considers to be an obstacle hindering smart contract development.
Chainlink Keepers broad mandate is similar to those at both Gelato and Keep3r. For starters, Chainlink Keepers uses a round-robin system of executing transactions which has been the standard in Gelato for a while and is currently proposed in Keep3r governance. In addition, some of the use cases that Chainlink Keepers are tackling are similar to ones that are already live on Gelato, including limit orders, automated trading strategies, monitoring token balances, and others.
Yet Chainlink Keepers has already inked a number of partnerships with projects including Base Protocol, a token whose price is pegged to the total market cap of all cryptocurrencies at a ratio of 1:1 trillion, to automate regular maintenance of their rebase function, as well as integrated into the OpenZepplin Defender, allowing projects to register and manage jobs directly within the Defender platform. Most recently, they have partnered with BarnBridge to operate their SMART Exposure and automate the rebalancing function of the product.
Smart Contract Automation
Chainlink has worked alongside Gelato and Keep3r in different capacities in the past. In July 2020, Gelato conceived of and was the first to utilize Chainlink’s Fast Gas/Gwei price oracle, which enabled the Gelato Network smart contracts to police fair gas pricing on behalf of developers and users. That prevented Gelato automation bots from overcharging on gas. The Gelato and Chainlink teams have been close since 2020, with Gelato’s founder Luis hosting a workshop about using Gelato for smart contract automation at Chainlink’s 2020 hackathon. In December 2020, Andre published a post on how he intended to have Keep3r scale using Chainlink. In the article, he envisioned Chainlink node operators would eventually run keeper jobs while eligible existing keepers would become Chainlink node operators.So what does all of this mean?
Automation has the power to supercharge DeFi protocols yet is still a relatively unexplored area. There have been several attempts at automation over the years ranging from simply scheduling transactions to hosting gas auctions for the right to execute a transaction. But it seems like the coordination round-robin model has won out as the most efficient automation solution for now.
Currently, the DeFi market cap sits at over $75 billion with nearly $100 billion in TVL in various lending protocols, AMMs, etc., all of which have functions that could be automated. It is more than likely that they will be potential users of automation solutions such as Gelato, Chainlink, and Keep3r. In the future, anything that can be automated, will be automated, it’s just a matter of which protocols will do it.