I am putting together OP Security Proxy, which is a fast JSON-RPC middleware layer I wrote in Rust. You can check out the code at GitHub - Ishant5436/op-sec-proxy · GitHub . It essentially sits between a standard wallet or client and the public Optimism RPC nodes.
The core mechanic is that whenever a transaction goes out via eth_sendRawTransaction, the proxy catches it. It then uses the revm engine to fork the network state locally and run a quick simulation. If it detects that the transaction is going to revert, halt, or burn the whole gas limit without touching the state, the proxy just drops it before it ever hits the public mempool.
I built this because when you use Ethereum-equivalent chains, you still end up paying the L2 execution fee up to the point of failure if a transaction reverts on-chain. We see this all the time with MEV bots, slippage issues, or unexpected state changes. This proxy serves as a public good that stops regular users from paying for failed executions, saving them money and keeping junk traffic off the sequencer.
I ran some tests against the mainnet.optimism.io endpoint to see the performance impact. For standard read requests like eth_call, there is basically no overhead. Because I am using tokio and hyper for connection pooling, the jitter was actually slightly better than hitting the upstream directly. The upstream took around 516ms, while the proxy handled it in about 444ms.
When doing the actual transaction simulation, it takes about 2.9 seconds. That overhead comes from having to fetch nonces, balances, and raw bytecodes over the network on the fly so we can reconstruct the state from scratch.
For the stack, it is mostly Rust. I rely on tokio for the async side of things and hyper to handle the HTTP server. I also pull in alloy to handle the Ethereum primitives and RPC parsing, while revm runs the local EVM simulations. I also wrote a bunch of strict TDD tests to make sure it doesn’t panic if an upstream node times out.
Looking ahead, I am hoping to implement LRU caching for the state trie nodes so we can drop the simulation latency well below 100 milliseconds. I also plan to bake in some local heuristics to catch sandwich attacks before they happen, and eventually make sure the whole thing runs smoothly across Base and other Superchain networks.