Insights into the Blockchain infrastructure supporting Kyber’s protocol.
Hello Kyberians, in this blog post we will take you on a journey through a part of Kyber Network that isn’t visible to most of the outside world, but is incredibly vital to our operations. Our underlying Blockchain infrastructure is what allows end users to seamlessly swap through our token swap platform KyberSwap, and what tames the huge amounts of data required to process and understand what is going on in a decentralized system like Ethereum. In this post, we explain how our infrastructure works and introduce you to a very important partner in this endeavor.
What is blockchain infrastructure and why is it so important?
Blockchains are cryptographically-secured databases replicated across a network of computers, and use consensus rules to coordinate state changes between all participants. We won’t get into the details, but suffice to say, synchronizing and using a constantly updating database with tens of thousands of participants is particularly complex, and requires a strong infrastructural foundation.
Kyber’s infrastructure currently makes more than 7M queries per day to stay up to date with Ethereum. These queries fetch data on the latest state of the blockchain and are depended on by the rest of Kyber’s infrastructure, specifically for KyberSwap when displaying the most accurate token swap quotes to the end user, and our Kyber Reserve when updating token prices. One of the most common forms used to fetch this data is to run an Ethereum node. However, they require engineering resources to set up, maintain, upgrade, and deal with forks.
As user numbers grow and requirements on the infrastructure increases, scalability and reliability start to become challenges for nodes. Incorrect and inconsistent blockchain data start to creep in and it becomes extremely difficult for nodes to manage the flow of data. This is why reliability is critical when setting up blockchain infrastructure, and why at large scale, robust APIs from third parties might be required.
This is where Alchemy comes in.
Alchemy is Kyber Network’s blockchain infrastructure partner that delivers the 7M daily queries and provides the infrastructure that allows KyberSwap to service thousands of users per day. Alchemy’s platform involves complex pieces of functionality all working together with the goal of serving accurate and consistent data to various parts of the Kyber infrastructure stack. This architecture is built from the ground up to meet Kyber’s key requirements; reliability, scalability, and consistency.
Why does Kyber use Alchemy for its infrastructure needs?
We met the Alchemy team perchance when our CEO (Loi Luu) overheard a conversation about Alchemy at DevCon 2018 hosted in Prague. Their reliable, scalable blockchain infrastructure service seemed to be exactly what we needed. Moreover, Alchemy powers some of the biggest leaders in Ethereum, including Kyber, Augur, Dapper Labs, 0x, and more, reaching millions of users across 100+ countries.
After weeks of extensive benchmarking, we found that Alchemy was the clear winner — 107x more stable (estimated, compared to node issues in the past) and excelled at reliability, uptime, and response time. To test reliability, we measured the frequency of failure, and Kyber user issues have decreased at least 26x since moving over to Alchemy. In addition, Alchemy has proven reliable in terms of customer support, scalability, and performance. Communication with Alchemy’s team is seamless, and we’ve received close to 24 hour-support, including calls at 3 or 4 AM in the middle of the night. Before Alchemy, we were worried about nodes crashing when scaling or when deploying new functionalities, but now, we can scale our product without limiting user connections or currencies. Finally, Alchemy’s overall performance is exemplary.
Kyber runs better thanks to Alchemy
Previously, we had to fret over adding new infrastructure assets which results to seeing nodes crash, respond slowly, or observe different data from node to node due to node-specific state. Substantial engineering time went towards complicated algorithms to interpret inconsistent responses, and we even had to run our own nodes. We had to create complex fallback logic in case a provider failed and we needed to route to another, lengthening transaction times. Our engineers were tasked with optimizing infrastructure, despite being extremely busy, from addressing customer complaints to keeping nodes running, on top of key responsibilities like building Kyber’s products.
With Alchemy, we can now focus 100% on building Kyber’s products and delivering value to our users. Our engineers are able to build Kyber faster than ever before. We estimate that we’ve saved over 2160 engineering hours since switching to Alchemy 9 months ago.
We are excited to have found partners whose core mission aligns with ours! Our liquidity protocol and Alchemy’s infrastructure both aim to empower developers and users everywhere to accelerate blockchain development, build better products, and make the potential of blockchain a reality.
We hope this article on Kyber’s infrastructure has been enlightening. Over time, we plan to share more of such information to educate the community about how Kyber works behind the scenes.