You shipped a feature. Traffic barely moved. Then you check your dashboard and see your RPC spend has jumped by a third.
This happens because RPC billing has almost nothing to do with the number of users you have. It tracks how your dApp talks to the chain. A single background loop polling for new blocks every second, a balance you re-fetch on every render, a log query that reaches back too far and gets retried three times: none of that shows up in your analytics, but all of it shows up on your bill.
The good news is that the same patterns that waste money also make your app slower and more fragile. So this is not a trade-off between cost and reliability. Fixing the spend usually fixes the latency too.
The fix isn't switching to a cheaper provider. This is using your provider you already have fewer times, and smarter.
TL;DR:
You're billed by method weight, not by request count. Expensive methods and archive queries cost far more than a simple block-height check.
Cache anything that can't change: finalized blocks, confirmed receipts, historical logs, token metadata, ABIs.
Collapse many calls into a single call with JSON-RPC batching and Multicall.
Replace polling loops with WebSocket subscriptions and add reconnection logic to avoid missing events.
Keep eth_getLogs inside the 1,500-block range limit and filter tightly.
Tame your retries so a provider blip doesn't turn into a request storm.
Match your plan to your traffic shape once volume is predictable.
Get every optimization below running against a free GetBlock endpoint. Grab your RPC access and follow along.
Understand what you're actually paying for
You can't cut a cost you can't see. Before you touch a line of code, learn how your usage converts into money.
On GetBlock Shared Nodes, you don't pay per request. Each call spends Compute Units (CUs) from a monthly allocation, and the cost of a call is calculated like this:
Total CU = Chain Multiplier × Method Multiplier × Archive Modifier
Three things fall out of that formula, and each one is a lever:
Not all methods cost the same: The method multiplier reflects how much backend work a call takes. A cheap call like eth_blockNumber sits near the floor. Heavier calls like eth_getLogs, eth_call, and anything in the debug_* or trace_* families carry a much higher multiplier. Ten thousand cheap calls can cost less than a few hundred heavy ones.
Archive queries cost double: The archive modifier is 1 for standard (full-node) endpoints and 2 for archive endpoints. Every historical-state read you send to an archive endpoint costs twice what the same call would on a full node. If you're hitting archive for data a full node could serve, you're paying a 2x tax for nothing.
The chain matters: The chain multiplier reflects each network's resource intensity, so the same method can cost different amounts across chains.
Now you have a way to prioritize. Pull your usage breakdown, sort by total CU spent per method, and start at the top. Or you can use your GetBlock statistics to have more insight, and if you are using a dedicated node, request Advanced Analytics to have a clearer view
The rest of this guide covers safely attacking those top offenders, one at a time.
Steps in Reducing Your RPC Cost
1: Measure before you optimize
Guessing which call is expensive is how you spend a day optimizing something that was never the problem. Instrument first.
Wrap your provider so every call is counted by method name:
1
2
3
4
5
6
const callCounts = new Map();
function instrument(provider) {
const send = provider.send.bind(provider); provider.send = (method, params) => { callCounts.set(method, (callCounts.get(method) || 0) + 1); return send(method, params); }; return provider; }
// Log the top offenders on an interval
setInterval(() => { const sorted = [...callCounts.entries()].sort((a, b) => b[1] - a[1]); console.table(sorted.slice(0, 10)); }, 60_000);
Run this in staging under realistic load. Cross-reference the top methods against the CU weighting above. High count times high weight equals your bill. That intersection is your target list.
Don't optimize in production blind. Measure in staging, ship one change, watch the number move, then ship the next. One change at a time keeps you able to attribute both savings and regressions.
2: Cache everything that can't change
A huge share of RPC spend is re-fetching data that is already final and will never change. A finalized block is finalized forever. A confirmed receipt is permanent. Historical logs, token decimals, symbols, and ABIs do not move. Fetching them twice is pure waste.
1
2
3
4
5
6
7
8
const cache = new Map();
async function getReceiptCached(txHash) {
if (cache.has(txHash)) return cache.get(txHash);
const receipt = await provider.getTransactionReceipt(txHash);
// Only cache once confirmed and final
if (receipt && receipt.status !== null) cache.set(txHash, receipt);
return receipt;
}
Cache by data mutability, not by convenience. Immutable data (finalized blocks, confirmed receipts, ABIs) can cache forever. Mutable data (balances, nonces, pending state, the latest block) must have a short TTL or no cache at all. Caching a balance is exactly how you "break the app": your UI shows a stale number and the user loses trust. Separate the two clearly, and never let a mutable value into the permanent cache.
3: Collapse many calls into one
If you're reading ten contract values with ten separate eth_call requests, you're paying ten method multipliers for one logical operation. Two tools fix this.
JSON-RPC batching sends multiple requests in a single HTTP round trip. Multicall goes further: it aggregates many contract reads into a single eth_call through an on-chain aggregator (the canonical Multicall3 contract is deployed at the same address across most EVM chains).
1
2
3
4
5
6
7
8
import { Contract } from "ethers";
const multicall = new Contract(MULTICALL3_ADDRESS, MULTICALL3_ABI, provider);
const calls = tokens.map((t) => ({
target: t.address,
allowFailure: true, // one bad call won't sink the batch
callData: erc20.interface.encodeFunctionData("balanceOf", [user]),
}));
const results = await multicall.aggregate3.staticCall(calls);
Reading 50 token balances drops the number of calls from 50 to 1.
Set allowFailure: true and handle partial results. In a naive batch, a single malformed call can spoil the entire response. With per-call failure allowed, you decode successes and handle failures individually rather than losing the good data. Also watch your batch size: very large batches can hit payload limits, so chunk into reasonable groups.
4: Replace polling with subscriptions
This is usually the single biggest hidden cost. A loop that calls eth_getBlockByNumber or eth_getLogs every second runs 86,400 times a day, whether or not anything happened. Most of those calls return nothing new.
Swap the loop for a WebSocket subscription that only pushes when there's something to push:
1
2
3
4
5
6
7
8
9
import { WebSocketProvider } from "ethers";
const ws = new WebSocketProvider(GETBLOCK_WSS_URL);
ws.on("block", (blockNumber) => {
// fires once per new block, not on a timer
handleNewBlock(blockNumber);
});
ws.on({ address: CONTRACT, topics: [TRANSFER_TOPIC] }, (log) => {
handleTransfer(log);
});
You go from thousands of speculative calls per hour to one push per actual event.
WebSocket connections drop. That's normal, and it's where subscriptions "break the app" if you're careless: a silent disconnect means you stop receiving events without noticing. You need reconnection logic and gap backfill. On reconnect, query the range of blocks you missed while you were down, then resume the live stream. A subscription without backfill will eventually lose an event, and a lost event is worse than a slightly higher bill.
5: Right-size your log queries
eth_getLogs is one of the heaviest methods you'll call, and oversized queries are a top cause of both cost spikes and errors. On GetBlock's Ethereum RPC, a request wider than the range limit fails outright:
Request block range exceeds the limit(1500 blocks)
An unbounded query doesn't just fail once. It fails, your retry logic fires, and now you've paid for the same doomed request several times over. Keep every query inside the limit and chunk large scans:
1
2
3
4
5
6
7
8
9
10
11
const MAX_RANGE = 1500;
const CHUNK = 1000; // stay comfortably under the limit
async function getLogsChunked(filter, fromBlock, toBlock) {
const all = [];
for (let start = fromBlock; start <= toBlock; start += CHUNK) {
const end = Math.min(start + CHUNK - 1, toBlock);
const logs = await provider.getLogs({ ...filter, fromBlock: start, toBlock: end });
all.push(...logs);
}
return all;
}
Always filter by address and topics, never by block range alone. A tight filter returns less data, costs less, and avoids the timeouts that trigger expensive retries. The chunk size of 1,000 leaves headroom under the 1,500-block ceiling, so a slightly off boundary calculation never tips you into a failed request.
6: Tame your retries
Retries are supposed to protect you. Done naively, they multiply your bill. If your client retries instantly on every failure, a brief provider hiccup turns into a burst of duplicate requests, each one billed, each one adding load that makes the hiccup worse.
Three patterns turn retries from a cost risk into a cost control:
Exponential backoff with jitter: Wait longer between attempts, with randomness so that many clients don't retry in lockstep.
Request deduplication: If the same call is already in flight, reuse that promise instead of firing a second identical request (single-flight).
Circuit breaker: After repeated failures, stop calling for a cooldown window and instead hammer a struggling endpoint.
1
2
3
4
5
6
7
const inFlight = new Map();
function dedupe(key, fn) {
if (inFlight.has(key)) return inFlight.get(key);
const p = fn().finally(() => inFlight.delete(key));
inFlight.set(key, p);
return p;
}
7: Move heavy historical work off your hot path
Some work genuinely needs a lot of history: analytics, indexing a contract's full event log, backfilling a dashboard. Doing that by hammering standard RPC in real time is the wrong approach, and it's expensive due to the archive modifier.
For deep historical reads, use Archive Mode on a purpose-built endpoint rather than pushing archive-weight queries through your live application path. Keep your latency-sensitive app calls on a standard full-node endpoint, and route the heavy backfill work separately so one doesn't starve or inflate the other.
Separate your workloads by shape. Real-time user traffic and bulk historical scans have different cost profiles and different performance needs. Mixing them means your users feel the backfill, and your bill reflects archive pricing for calls that didn't need it.
8: Match your plan to your traffic
Every move above reduces waste. This one ensures you're on the right pricing model for the remaining traffic, because the wrong plan shape can still cost you even when your call patterns are clean.
Shared Node (CU-metered): you pay for what you use from a monthly CU allocation. Ideal for early-stage apps and spiky, unpredictable traffic where you don't want to pay for idle capacity.
Limitless Node (flat RPS): a fixed monthly fee with a guaranteed requests-per-second tier and no CU metering. Ideal once your volume is steady and high enough that per-call metering is no longer the cheaper option.
Dedicated Node (unlimited): a private RPC server with no CU or rate limits. Ideal for production apps at scale that need predictable performance and a fixed, uncapped cost line.
Conclusion
Your RPC bill reflects your calling patterns, not your popularity. Once you can see which methods cost what, reducing spend becomes a series of small, safe, measurable changes: cache what can't change, batch what you can, subscribe instead of poll, size your queries to the limit, and control your retries. None of it requires taking features away from your users, and most of it makes the app faster and sturdier in the process.
Every optimization in this guide runs on a standard GetBlock endpoint across 130+ supported chains. Create a free endpoint and start with step one.
DevRel
August 19, 2026
10 min read
DevRel at GetBlock with over five years of experience in building and writing developer documentation.
Popular Posts
December 4, 2026
8 分鐘閱讀
September 14, 2026
4 分鐘閱讀