In the past year alone, we have seen the rapid evolution and adoption of decentralized finance (DeFi) applications that are working to create an open financial system with new financial assets and protocols. These applications allow people to do things like trade digital assets on decentralized exchanges, borrow using crypto assets as collateral, or earn interest on their crypto holdings via multiple interest rate markets. Yet ultimately, the interoperability, programmability, and composability of DeFi applications lends itself to infinite possibilities.

One application in particular that has made massive strides is the interest rate protocol Compound Finance. Compound is creating a decentralized protocol for the frictionless borrowing of Ethereum assets and a safe positive-yield approach to storing assets. At the time of writing, they have over $110M of assets earning interest across 8 markets and in 2019, they were the leader in the “finance” sub-category, according to a recent Binance Research Report.

We caught up with Geoffrey Hayes, CTO of Compound, to learn more about the protocol, how the team is batching requests to optimize their Infura usage, and why they chose Infura for their infrastructure needs.

Can you introduce Compound, for those who aren’t familiar with the company?

Hayes: “Compound provides interest rate markets on the Ethereum blockchain, allowing users to earn interest on their crypto. The goal for the organization is to integrate the Compound Protocol into many products across the globe, ensuring that all assets, when sitting idle, are moved into Compound and are utilized to earn interest.”

As a blockchain-based platform, your product operates on Web3 infrastructure. How was Compound handling infrastructure before you started using Infura?

Hayes: “We used to run a node in Kubernetes. We tried running both Geth and Parity, but both applications hogged memory, bandwidth and disk IO from our other containers in the cluster. With this set up, performing a basic task, like pulling event logs from the blockchain, required a significant chunk of our DevOps' time. Additionally, we needed to upgrade to maintain compatibility with hardforks.”

Is that what drew you to Infura?

Hayes: “Joe Lubin and Consensys really helped pioneer a large number of tools that have become the backbone of Ethereum development. To this day, no other blockchain seems to have a wealth of resources that Ethereum does, and I believe it's due to this early focus on developers. Founded by infrastructure engineers, Infura seemed at the time to have unlimited capacity for querying the blockchain. It was a no-brainer to make the switch.”

How does Compound use Infura to interact with the Ethereum blockchain?

Hayes: “First, our Compound interface uses Infura to pull all of the details of the Compound protocol and the user's account. We decided to build our interface on Web3 directly instead of our APIs to make sure that users always see what's on the blockchain. Second, to power our API, we query all event logs from the blockchain. We push those events into a stream processor and read from that stream to populate the data in our API.”

How has Infura helped you simplify operations?

Hayes: “Simply we don't need to run Ethereum nodes, which is a huge time-saver. Additionally, as our Compound interface reads directly from Infura, even if Compound servers have an issue, users can still access Compound through our interface.”

Have you found any ways to optimize your Infura usage that you’d be willing to share with the dev community?

Hayes: “The biggest optimization, that we are in the process of integrating, is to unify all of our requests on chain into one large request via a view contract. That is, instead of pulling the user's balance in each supported asset, we can create and deploy a contract that, given a user address, loops and returns all the balances for a user in a single Web3 call. Given the amount of data points required to populate a page, this can save a huge amount of round-trips to Infura.”

How important is Infura's service to the future of Compound's growth?

Hayes: “Infura has been rock-solid and saved us from having to roll our own solution. Additionally, Infura provides our users with a high-availability solution to access their account data even in the craziest of times in crypto. The Infura team is full of competent engineers, which is a refreshing view in a world where companies focus on marketing first. The APIs provided by Infura have been rock-solid for years.”

To learn more from top Web3 applications like Compound, or for more case studies, follow us on Twitter and subscribe to the Infura newsletter.