How using Chainlink Keepers saved Civilization $250,000/year and 3 months’ development time while providing enhanced uptime and enabling on-chain monitoring for CivTrade
NEWS: Learn more at the upcoming London (UK) Chainlink Masterclass on January 21st 2022 @ 5pm — free registration!
Join us in showcasing the cryptocurrency revolution, one newsletter at a time. Subscribe now to get daily news and market updates right to your inbox, along with our millions of other subscribers (that’s right, millions love us!) — what are you waiting for?
Introducing CivTrade
The (huge) advantages of CivTrade versus any traditional DeFi swaps. More examples in the Appendix.
The problem to be solved
As a community-driven project, it’s sometimes difficult to guarantee high standards of service and technology delivery, as our team is not paid a traditional salary and our income relies on donations which are naturally uncertain. But it’s key to users that CivTrade is reliably live 24/7!
How Civilization saves more than $250,000/year with the help of Chainlink Keepers
Comparing in-house DevOps automation with Chainlink Keepers
- 2+ People. 1 developer to build and upgrade the system, plus 1 system administrator to monitor and maintain it — with substantial upfront budget lock-up: pay people on a monthly basis, but to run a professional operation guarantee enough run-rate is available from day 1, so you can pay for at least 1 year. Assuming $100,000/year per head for reasonably senior devs, plus contingency and social security, we estimated a $250,000 budget for the in-house solution.
- 2+ Datacenters. 2 redundant locations for high availability, plus a third for disaster recovery, plus additional development and staging environments, would make the total server cost scale-up 5x. If production was run on a higher performing, higher cost stack, and disaster recovery/dev/staging on cheaper servers (which is not ideal), the cloud-computing bill to keep the in-house system up 99.9%/24/7 would still run up to $3,000+ per calendar month.
- Downtime. Having just 2 people would mean support would be 9–5 on working days only. Forget about 99.99% availability, even with 5 datacenters, issues may and will happen at times when support teams are not around (sleeping and/or on holidays)! So we estimated up to 1% system downtime in-house, versus achieving 99.99% by leveraging Chainlink Keepers’ ability to spread the administration overhead over multiple projects and therefore guarantee (much) better service. And we can also sleep soundly at night: one less thing to worry about.
- Investment. As a community-funded start-up, we prefer to pay as we scale, rather than having to fundraise money upfront. Since Chainlink Keepers don’t require ponying up any $$ upfront, we love them even more.
- Time. We conservatively estimated it would take at least 3 months to set up a stable in-house solution. Building systems, even when you have the money to do it, takes time and distracts attention from other priorities. Since it only took us a couple of days to read the Chainlink docs and set up the code required to go live, the choice gave us a huge speed boost!
So, for us, running the numbers showed that the choice was a no-brainer, and therefore we immediately got down to integrating Chainlink Keepers. Here is how we did it.
The Chainlink Keepers solution
Civilization chose Chainlink Keepers as our decentralized transaction automation service to help close trades when CivTrade-specific conditions are met. This provides CivTraders with confidence that all their limit order positions are continuously monitored and optimally executed without any manual interactions from users or the Civilization team.
The Chainlink Network is the most widely adopted and time-tested oracle network in the DeFi industry. It has a flawless track record of providing high-quality services to blockchain applications.- DexMan, Lead Dev
Decentralized exchanges allow anyone to trade. Civilization’s integration of Chainlink Keepers helps us open the door to people who want to experience the market without the need for the help of third parties.
Making the tech work
- Verify in real-time if our execution conditions have been met: “is any CivTrade ready to close?”
- Trigger the execution of our smart-contract: “immediately close all the CivTrades that have just been filled by the market”.
Our simple dedicated Keeper smart contract automates what otherwise could have been done manually, had a team of analysts been available 24/7 to monitor each trade (which clearly would be impossible, or very impractical to say the least). For every new block mined by each of our CivTrade-supported blockchains, currently Ethereum + Polygon (besides our test chains Kovan and Mumbai), Chainlink Keepers check our trigger conditions, and when they are met, close the relevant trades.
checkUpkeep()
The CivTrade Keeper contract function: checkUpkeep
triggered()
performUpkeep()
The CivTrade Keeper contract function: performUpkeep
Registration
Our first Chainlink Keepers mainnet Upkeep
We had to repeat the registration process for Polygon, and ta-da, CivTrade went cross-chain!
For security and scalability reasons, we implemented the following checks:
- Keeper contract is pausable by our multi-sign admin.
- checkUpkeep waits for an interval of at least 5 blocks (about 1 minute) after the last performUpkeep was triggered, to avoid clogging or repeat closes.
- 1,000 CivTrades can be monitored by each Upkeep, to prevent out-of-gas errors; we can register any number of new Upkeep as we scale.
World-class support
While CivTrade continues to expand to all the blockchain networks supported by Uniswap v3, we look forward to Chainlink Keepers’ continued support of new networks, so that all traders can benefit from CivTrade’s reliable and decentralized trading toolkit.
Happy CivTrading!!
About Civilization
About Chainlink
Chainlink is the industry standard for building, accessing, and selling oracle services needed to power hybrid smart contracts on any blockchain. Chainlink oracle networks provide smart contracts with a way to reliably connect to any external API and leverage secure off-chain computations for enabling feature-rich applications. Chainlink currently secures tens of billions of dollars across DeFi, insurance, gaming, and other major industries, and offers global enterprises and leading data providers a universal gateway to all blockchains.
Appendix — examples of CivTrade business case
As the size of a CivTrade grows, its benefits multiply!