How the Compound Team Optimizes Infura Usage to Power Their DeFi Protocol

How the Compound Team Optimizes Infura Usage to Power Their DeFi Protocol

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.

How the Compound Team Optimizes Infura Usage to Power Their DeFi Protocol

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.

SkyWeaver Gaming Tournament Powered by Infura
SkyWeaver Gaming Tournament Powered by Infura
Skyweaver Gaming Tournament Powered by Infura

SkyWeaver Gaming Tournament Powered by Infura

On February 20th, hundreds of attendees, speakers, enthusiasts, and entrepreneurs gathered in NYC for NFT.NYC, the leading Non‑Fungible Token (NFT) event, to discuss the latest trends and opportunities in the emerging NFT ecosystem. During the event, Infura partnered with Horizon Games to bring a SkyWeaver Gaming Tournament to life.

Built on Ethereum using Infura’s API, SkyWeaver pioneers a new dimension of Play2Earn gaming by providing a platform for digital trading card gaming. Players can play casually or compete on the worldwide leaderboard to win cards that become their property. Once won, the cards can then be used in battles, collected to construct a legendary deck, or traded and sold in the marketplace.

During the SkyWeaver Tournament, 16 players battled for a share of the 1,000 DAI prize pool (provided by Maker) and up to 100 Silver SkyWeaver cards. Tournament sign ups and DAI payouts were facilitated using a tournament platform that allows anyone to organize tournaments from start to finish with easy participant onboarding and smart contract-powered payments. The platform currently showcases Ethereum-powered payments and prize pool management that is fast and inexpensive.

Taking home the 500 DAI first place prize was 🥇MaxHS, a veteran SkyWeaver player and former Hearthstone pro. He edged out 🥈TerrenceM, another well known NYC local digital card game player, who walked away with 300 DAI. 🥉Cybourgeoisie and 🥉Feihu tied for 3rd and both took home 100 DAI.

SkyWeaver Gaming Tournament Powered by Infura
SkyWeaver Finals match. From left to right: TerrenceM, MaxHS

Significant engineering demands are required to battle-test these new systems as adoption scales. Infura’s ability to reliably manage scale ultimately led Horizon to choose Infura as their Infrastructure partner for SkyWeaver

“The Infura team had proven their ability to handle this scale. We want to express our gratitude to the Infura team and are proud to partner with Infura as our Ethereum node provider as SkyWeaver moves into production ops.”

– Peter Kieltyka, CEO and Chief Architect of Horizon Games

. . .

NFT.NYC left us with a lot to be excited for. Inspired by all the excitement shared by our tournament attendees, I sat down with Chris Gonsalves, Gaming Partnerships Lead at ConsenSys and Michael Wuehler, Co-Founder of Infura, to get their thoughts on what 2020 holds for crypto games and what they believe to be the most promising NFT use cases.

Why are NFTs gaining popularity in games?

A non-fungible token (NFT) is a unique and non-interchangeable digital asset which can be used to represent all manner of virtual and real-world goods. NFTs are gaining popularity because they enhance in-game economies by creating verifiable digital scarcity and allow players to own (and sell) the assets they collect. Game items represented by NFTs allow for independent tracking of ownership history, provenance, and other metadata. In trading card games like SkyWeaver, this creates a trustable ownership model that follows the same principles as Magic: The Gathering with its physical assets. You can’t fake owning a physical asset (for the most part, sans counterfeiting) but faking digital ownership is incredibly easy without some kind of immutable tracking mechanism.

In addition to enhanced ownership, blockchain-based games are unlocking more ways for players to earn and monetize their assets. New concepts emerging such as Play2Earn will enable skilled players to earn supplemental income from their time spent playing and create new incentive loops to deepen player engagement.

In what spheres can NFTs be used besides games?

Gaming is a great use case for NFTs, but there are other emerging uses starting to take shape. NFTs are a type of token that can be used to represent both digital and physical assets that are verifiably unique. Digital certifications that represent that someone has accomplished a certain action such as voting, attending an event, or completing a specific task is another use case that goes beyond video games. NFTs can be used to track everything from a rare piece of art to the sushi that ends up on your plate at a restaurant. Traceability with the foods we eat and products we use is becoming a big area of interest. A rare cut of Wagyu beef could be tracked using an NFT to record ownership, producer, age, and each hop it made along the supply chain before hitting your plate.

These concepts can even expand to collectables such as a rare jersey or limited edition FunkoPops. A Lebron James jersey off the shelf is certainly not valued the same as one previously worn by the superstar himself. Auctioning off authentic pieces of sports memorabilia backed by blockchain assets allows for rarity verification, chain of ownership, and trackable metadata that will bring more trust and extensible features to the market of collectibles.

What do you think 2020 holds for NFT crypto gaming?

More game industry veterans are founding and joining studios which are developing games with built in blockchain features. With more talent, this will mean the quality of the games will continue to get better and more capital will flow to studios that have teams with decades of game experience. With the launch of games like SkyWeaver, all new players will experience owning their first digital asset. These players may not know at first they’re trading an NFT or spending a stable token, but over time as they start earning these in-game currencies and seeing the benefits of more open economies, they will be incentivized to dig deeper and explore more games and applications built using blockchain technologies.

Want your game considered for future Tournaments? If it’s built on Ethereum using Infura’s API, you’re eligible! Submit a link to your game in this thread for consideration.

Interested in competing in future Tournaments? Register your interest here with a ‘+1’ and your email to stay up-to-date.

SkyWeaver Gaming Tournament Powered by Infura
Michael Sanders, Chief Storyteller & Co-Founder, Horizon Games