eRPC Logoerpc

How eRPC slashed Moonwell RPC calls by 67%

Moonwell is an open and decentralized lending and borrowing protocol built on Base, Optimism, Moonbeam, and Moonriver. We utilized eRPC to reduce RPC requests by two‑thirds, thereby enhancing operational efficiency and significantly lowering costs.

Company Logo
eRPC Logo

Challenges

Moonwell relies heavily on real‑time data to provide users with accurate information about their assets and the broader market. Our application performs numerous multicalls and background polling every few seconds to update data across dozens of smart contracts and user wallets. This involves fetching the balanceOf all collateral and underlying tokens for various markets, resulting in a staggering number of RPC requests. The high volume of these requests not only posed technical challenges but also led to significant RPC costs, impacting our operational efficiency.

Beyond the raw call volume, we saw frequent duplication of identical reads during bursts of user activity and re-renders. Having multiple regions amplified that duplication whenever front‑ends routed across POPs. The lack of an opinionated cache in front of our providers meant we were paying repeatedly for the same payloads and hitting provider‑specific rate limits faster than necessary.

Setup

To address these challenges, we adopted eRPC with the following infrastructure setup:

In‑Memory Cache Implementation

We utilized eRPC in‑memory cache, setting a maximum of 10 million items. This shift significantly improved data retrieval speeds and eliminated most duplicate upstream reads. For hot keys like eth_chainId and chain metadata calls, hit rates were effectively instant.

Distributed Deployment for Low Latency

Our deployment strategy ensured low‑latency access globally. We utilized Railway to deploy eRPC instances across four strategic regions:

  • United States: West and East Coast
  • Europe: Amsterdam
  • Asia: Singapore

Each region hosts a single eRPC instance, ensuring users are served from the nearest geographical location. A Cloudflare load balancer with dynamic traffic steering routes users to the closest eRPC instance based on real‑time latency measured from health checks, ensuring optimal performance.

Infrastructure diagram 1
Infrastructure diagram 2

Results

Implementing eRPC has yielded impressive results for Moonwell. Below are the headline outcomes and a snapshot of the reduction in RPC activity after rollout.

  • 67% Reduction in RPC Requests: Prior to eRPC integration, our application made approximately 1.2B upstream RPC requests per month. With eRPC, we expect to reduce this number to under 400M.
  • Cost Efficiency: While data egress is ~5 TB/month, the request reduction more than compensates, driving meaningful net savings.
  • Enhanced Data Handling: eRPC multiplexes requests for identical payloads into a single upstream request, reducing redundant fetches and improving responsiveness. Multicall‑heavy paths still benefit via batching and deduplication.
RPC reduction chart