๐ฆ Rate Limiting: Infura, Alchemy, QuickNode
Understand RPC provider limits and batching techniques
Communicate with blockchain nodes programmatically
Your Progress
0 / 5 completed๐ฆ Rate Limiting & Optimization
RPC providers rate-limit everything. Free tiers allow 10-100 requests/second. Paid tiers scale to thousands. Exceed limits and you get HTTP 429 errors. Production dApps must optimize RPC usage: batch requests, cache data, use WebSockets, and implement proper retry logic. Let's learn how to stay under limits and reduce costs by 90%.
๐ฎ Interactive: Rate Limit Calculator
Adjust your application's request rate and provider limits to see if you exceed rate limits, calculate costs, and understand optimization needs.
Your application will receive HTTP 429 errors. You need to either upgrade to a higher tier (12 req/sec) or optimize your RPC usage (caching, batching, WebSockets).
โก Optimization Strategies
Send multiple RPC calls in one HTTP request. Instead of 10 separate requests (10 credits), send 1 batched request (1 credit). Reduces usage by 90% for read-heavy apps.
const batch = [
{ method: 'eth_getBalance', params: [...] },
{ method: 'eth_call', params: [...] }
];
await provider.send(batch);Block data never changes. Cache blocks, receipts, and logs in Redis/database. First request hits RPC, subsequent requests hit cache. Saves 99% of requests for historical data.
const cached = await redis.get(blockNumber); if (cached) return cached; const block = await provider.getBlock(blockNumber); await redis.set(blockNumber, block);
For real-time data (new blocks, pending txs), use eth_subscribe via WebSocket. Node pushes updates to you. No polling needed. Saves 99% of requests vs polling every second.
const ws = new WebSocket(wssUrl);
ws.send({ method: 'eth_subscribe',
params: ['newHeads'] });
// Receive block updates automaticallyQuery multiple contracts in one eth_call. Multicall aggregates 100 calls into 1. Popular for token prices, balances. Used by Uniswap, 1inch. Saves 99% of requests.
const multicall = new Multicall(provider); const results = await multicall.aggregate([ token1.balanceOf(wallet), token2.balanceOf(wallet), // 100 more ]);
๐ Provider Comparison
| Provider | Free Tier | Growth Tier | Features |
|---|---|---|---|
| Infura | 100K/day ~1 req/sec | $50/mo 5M/day | Archive, WebSocket, IPFS |
| Alchemy | 300M/mo ~100 req/sec | $199/mo 1B/mo | Enhanced APIs, NFT API, Webhooks |
| QuickNode | None | $49/mo 50M/mo | Dedicated nodes, 20+ chains |
| Ankr | 500M/mo ~200 req/sec | Pay-as-go $10/50M | Public RPC, 50+ chains |
๐ก Key Insight
RPC costs scale with poor optimization, not traffic. A naive dApp making 1,000 requests for data that could be batched into 10 requests wastes 99% of its quota. Professional dApps use 10-100x fewer RPC calls than amateur ones through batching, caching, WebSockets, and Multicall contracts. This isn't just about costโit's about reliability. When you hit rate limits during a traffic spike, your dApp breaks. Optimization isn't optional for production apps.