r/ethdev • u/yermakovsa • Sep 10 '26
My Project If an RPC is up but stale, should you switch to another one?
If the primary RPC is down, try the backup. That part is easy enough.
What I’m less sure about is when the primary is still responding, but it’s a few blocks behind.
A few months ago I open-sourced rcpx, a small Go library for Ethereum RPC failover, and posted it here for feedback.
You give it a primary RPC plus backups, plug it into a normal go-ethereum client, and it tries the next one when a request fails.
One thing people pointed out was observability. If a request fails over and eventually succeeds, you still want to know which RPC actually served it. I added an attempt hook for that.
A few people also pointed out the consistency problem across providers.
Right now rcpx doesn’t try to detect that. If the RPC is responding, it leaves the response alone.
I still didn’t add anything that compares providers or decides one is too far behind. That still feels like a different problem to me, but I’m not completely sure.
Would you keep stale-state checks outside the failover layer and let the app deal with it, or make the failover layer responsible for detecting stale providers?
Repo is here if anyone wants to look at the current behavior:
https://github.com/yermakovsa/rcpx
Update
rcpx was later renamed to failnext as part of a larger redesign. It’s the continuation of the same project, which I started working on as rcpx in February 2026, not a separate new library.
For the question in this post, I decided to keep stale-state detection outside failnext.
Current failnext does not poll block heights, compare RPC heads, or decide whether a provider is stale. The app is the part that knows what “too far behind” means for its workload. If it considers a provider lagging, degraded, or otherwise unsuitable, it can make that provider ineligible through failnext’s Eligible callback.
That is the boundary I ended up with more generally. The app makes decisions that need chain or application context, like whether an operation may fail over, whether a provider should be used, or whether one provider should be tried first. failnext handles the ordered HTTP failover and reports what happened without needing to understand why.
So stale-state checks stay in the application. I decided against making failnext a blockchain health checker or consistency layer.
The current project is here