(Note · · 5 min read)
Your app breaks when the RPC provider does
Every read from a chain goes through a node, usually someone else's, usually on a free tier. It rate limits, it falls behind, it returns different answers from one request to the next, and an application written as though it were a database will reflect every one of those problems to the user.
By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka
Treat it as an unreliable third party
Timeouts, retries with backoff, and a circuit breaker so a failing provider is not hammered. The same discipline as any external service — the mistake is that chain reads look local because the library call looks like a function call.
Configure at least two providers and fail over. A single endpoint, especially a free one, is a dependency whose downtime is your downtime, and that choice should be deliberate rather than inherited from a tutorial.
Nodes lag, and disagree
One node is three blocks behind another. Failing over mid-operation can mean reading a state older than one you have already seen, so a balance appears to go backwards and a confirmed transaction appears to vanish.
Track the highest block you have observed and ignore responses older than it. For a sequence of related reads, pin them to a specific block number rather than asking for the latest each time, so the set is internally consistent.
Batch, cache and stop asking the same thing
Rate limits are usually hit by repetition rather than genuine need. A token's symbol and decimals never change — read them once. Historical blocks and settled transactions are immutable and can be cached indefinitely.
- Cache immutable data permanently: decimals, symbols, old blocks, finalised receipts.
- Cache volatile data briefly — balances, prices — with a short expiry, and show its age.
- Batch multiple reads into one request where the provider supports it.
- Collapse duplicate concurrent requests for the same value into a single call.
- Poll for ranges of blocks rather than asking per item.
On a dashboard with many live values, these four measures usually turn a rate-limit problem into a non-problem without any change to what the user sees.
Never let the browser be your only reader
Reads made directly from each visitor's browser multiply by your traffic and expose your endpoint key. Read on the server, cache centrally, and serve your own clients — which also means one cache warms for everybody rather than each visitor paying for their own.
Indexing what you need into your own database is the next step, and the right one for anything historical. Reconstructing a year of events from a chain on every page load is not a data access strategy.
Degrade visibly
When data cannot be fetched, showing a stale value with its timestamp is usually better than an error or a spinner that never resolves. For balances and prices that drive a decision, say plainly that the figure could not be refreshed.
Keep writes separate from this. A stale read is tolerable; submitting a transaction based on one is not, so re-read the state that matters immediately before a transaction is built, from a provider you have confirmed is current.
Common questions
How should I handle RPC rate limits?
Mostly by not repeating requests: cache immutable data like decimals, symbols and settled receipts permanently, cache balances and prices briefly, batch reads, and collapse duplicate concurrent requests. Rate limits are usually hit by repetition rather than need.
What happens when one node is behind another?
Failing over mid-operation can return older state, so a balance appears to go backwards and a confirmed transaction seems to vanish. Track the highest block observed, ignore older responses, and pin a sequence of related reads to one block number.
Should the browser call the RPC provider directly?
No. Per-visitor reads multiply with traffic and expose your endpoint key. Read on the server and cache centrally so one cache warms for everyone, and index historical data into your own database rather than reconstructing it per page load.
Is it safe to build a transaction from cached data?
No. A stale read is acceptable for display with its age shown, but re-read the state that matters immediately before building a transaction, from a provider confirmed to be current.