Once an arbitrage strategy is running on a self-hosted EVM node, the key to further reducing end-to-end latency is to move candidate quoting and route search into local memory, while synchronizing the underlying pool state with extremely low latency.
Local quoting requires the arbitrage program to maintain complete pool state in memory and calculate swap outputs strictly according to each protocol's rules. Once that state is ready, the search engine can evaluate candidate routes and optimize input amounts concurrently in memory, eliminating the network and context-switching overhead of asking the node to execute quotes through RPC.
The main bottleneck, however, is how quickly state reaches the local model. Traditional approaches based on RPC queries and event subscriptions often require additional state lookups and field reconstruction when data is incomplete, directly delaying the start of a search. Customizing Geth addresses this problem by capturing effective state changes to target contracts in real time along the EVM block-execution hot path and continuously streaming them into local pool models. Local state can then advance alongside EVM execution, avoiding additional queries and waiting after a block has been persisted.
This article compares three approaches to quoting and pool-state maintenance—RPC calls to quoting contracts, local models updated through events and queries, and direct synchronization of Geth state deltas—and uses a backrun scenario to trace the complete pipeline from state updates and local search to bundle submission.
Approach 1: Execute contract quotes through a local node
The most direct implementation calls a protocol's quoting contract through the local node to obtain the expected output for a given route and input amount. For example, an eth_call to Uniswap V3's quoting contract reuses on-chain swap logic to produce the quote; see the QuoterV2 implementation.
The arbitrage program generates a candidate route and input amount
→ Calls the local node
→ The node reads state and executes the quoting contract
→ Returns the output amount
→ The arbitrage program calculates the candidate profit
This approach is easy to integrate and works well for early validation, evaluating a small number of candidate routes, or checking the accuracy of an offline quoting model.
Even when the node and arbitrage program run on the same physical machine, each quote still incurs interprocess communication, state reads, and full EVM interpretation overhead. As the number of candidate routes and input probes grows, these costs scale linearly. Multicall batching and highly concurrent requests can improve scheduling throughput, but they cannot eliminate the underlying repeated computation.
The arbitrage program can control request concurrency, but it cannot control scheduling priorities inside the node. Quote calls can compete with new-block validation, state-trie reads and writes, and other simulation tasks, causing substantial variation in the tail latency of an entire search round.
The central bottleneck is therefore that the state reads and swap calculations needed for quoting are tightly coupled inside the node, forcing the search process to wait for the node's response. Further optimization means keeping the necessary state in local memory and calculating quotes directly inside the program using the protocol's mathematical rules.
Approach 2: Build local pool models updated through events and queries
A local pool model maintains the state required for quoting in the arbitrage program's memory and reproduces swap calculations according to the protocol's rules. A constant-product pool, for example, requires both token reserves and the fee rate. A concentrated-liquidity pool such as Uniswap V3 requires the current price, active liquidity, and the complete tick distribution. Given an input amount and swap direction, the local model can calculate the output amount and the resulting pool state immediately.
With complete underlying state, the arbitrage program can evaluate large numbers of route and amount combinations in memory without blocking. See the Uniswap V3 SDK's Pool model; fully in-memory quoting also requires its underlying tick-data provider to operate entirely locally. Each model must accurately implement its protocol's calculation rules and external dependencies, including related contracts outside the pool and block-environment variables.
Accurate local calculations require the in-memory model to match the on-chain state of the block being evaluated exactly. Once quoting moves into local memory, synchronizing pool state reliably and with low latency becomes the next central challenge.
A common maintenance approach combines an initial snapshot, incremental event-stream updates, and queries for missing state. First, the node is queried in batches at a fixed block height to initialize an in-memory cache. The program then subscribes to on-chain events over WebSocket and applies changes in order. For example, Uniswap V3's Swap events update price, tick, and active liquidity, while Mint and Burn events update liquidity across tick ranges. When events do not contain all the information needed for calculations, or a disconnection causes blocks to be missed, the program queries the node for additional state or backfills logs.

Although this approach supports fully in-memory quoting, frequent state updates still expose significant weaknesses:
-
More hops amplify state dependencies and sequential waits. In multi-hop arbitrage, each hop's input depends strictly on the previous hop's output, so every pool along the route must have complete state. If missing ticks or related state trigger an additional node query for even one pool, the network wait blocks evaluation of the entire route. Only complete state allows consecutive multi-hop calculations in memory without waiting.
-
Additional state queries introduce node-resource contention outside the search engine's control. The local engine can manage its own concurrency, task priorities, and compute budget, but extra queries still run on the node, competing for I/O and CPU with new-block processing, other queries, and transaction simulations. When volatile markets trigger concentrated updates across multiple pools, the search process often has to wait for query responses, leaving total runtime dependent on node load.
-
Incomplete event data and repeated reads add overhead. Some protocols expose only limited business parameters in their events, omitting fields needed to calculate quotes directly. Reconstructing complete state requires reading related contracts or underlying storage slots. If concurrent events or candidate routes request the same missing field without request coalescing, such as singleflight, and cache reuse, substantial redundant reads can result.
Approach 3: Customize Geth to synchronize block-execution state into local models
The goal of customizing Geth is to extract and emit effective changes to target contracts as the node executes a block, allowing local pool models to update alongside EVM execution and eliminating the wait for log parsing and additional node queries after block processing.
There are many ways to customize Geth and other EVM clients, including direct changes to StateDB and custom RPC interfaces. The Live Tracer approach below is one engineering option that balances performance against the extent of client modifications. The overall pipeline is:

3.1 Which modules need to change?
There is no need to begin by rewriting the transaction-execution loop or changing the underlying SSTORE instruction. Geth's built-in Live Tracer mechanism provides access to existing state-tracing hooks; see the transaction-execution source and storage-capture entry points.
3.2 Step 1: Define the monitoring scope and initialize local models
Start with the target protocol's quoting math to identify the minimum required state, then map it to specific contract addresses and storage-slot layouts:
Protocol type and version
→ Pool addresses and dependency contracts
→ Fields required for quoting
→ Storage layouts and decoding rules
Constant-product pools mainly require reserves and fee rates. Concentrated-liquidity pools also require price, active liquidity, tick data, and tickBitmap. Protocols with shared vaults, such as Balancer Vault, or dynamic fees require the relevant external dependency contracts to be included in the monitoring allowlist as well.
At cold start, anchor a full snapshot to a specific block height and state root, initialize the local models, and then transition seamlessly to state deltas from subsequent blocks. While the snapshot is being fetched, buffer incoming delta batches. Once the snapshot is complete, replay and merge those batches in order to avoid gaps between the snapshot and the live stream.
Because Geth captures raw storage-slot changes, protocol adapters must map physical slots back to business fields. In particular, Solidity mapping entries are located using Keccak256 hashes: the original key, such as a tick index, cannot be recovered directly from a slot hash. Local adapters must therefore maintain a reverse key index and update it when new dynamic entries, such as newly initialized ticks, are captured. See Solidity's storage-layout documentation.
3.3 Step 2: Register the state-capture module
Add a custom tracing module, such as arb_state.go, under eth/tracers/live/, and register it as arbstate through tracers.LiveDirectory.Register().
The module implements these main lifecycle hooks:
-
OnBlockStart: capture the block number, block hash, and parent block hash, and initialize a block-level update batch. -
OnTxStart: initialize the transaction's change-tracking context and bind the currentStateDBstate-reading interface. -
OnStorageChange: filter contracts against the monitoring allowlist and record storage slots touched during transaction execution. -
OnTxEnd: read the final values of affected slots at transaction completion and merge them into the transaction's effective net deltas. -
OnBlockEnd: mark the end of state capture for the current block, finalize the batch, and perform cleanup.
Here, arbstate is a custom identifier. Refer to the official examples for directory conventions, registration, and startup configuration in the Live Tracing documentation.
3.4 Step 3: Merge effective changes and continuously emit deltas
An individual SSTORE write does not necessarily represent the final state of a transaction. The same slot may be overwritten multiple times, and a reverted internal call can undo earlier state changes.
An initial implementation can merge changes by comparing values before and after each transaction:
OnStorageChange
→ Record the target contract address and slot
→ Preserve the value before the transaction's first write
OnTxEnd
→ Synchronously read the final values of those slots
→ Compare them with the values before the first writes
→ Emit effective net changes
→ Clear temporary records for the transaction
Reading final values directly inside the node process eliminates external node-interaction overhead. The emitted data consists of structured delta packets with changes already merged and cleaned up. Downstream asynchronous consumers never need to access the execution-time StateDB while it is changing rapidly, avoiding concurrent read/write conflicts by design.
3.5 Step 4: Decode deltas and maintain current pool state
Protocol adapters receive the raw delta stream from the node and decode it according to contract storage layouts into fields that local models can consume directly:
Contract address, storage slot, final value
→ Decode using the protocol's storage layout
→ Update price, reserves, liquidity, and other fields
→ Record affected pools
Every delta batch must carry the block hash, parent block hash, and a monotonically increasing batch sequence number so the receiver can verify continuity between chain-state versions and detect missing packets. Adapters must unpack bit-packed fields according to protocol rules—for example, extracting sqrtPriceX96 and the current tick from slot0—and maintain dynamic storage structures using the local key index.
As a block executes, incoming deltas continuously merge into a local working copy. Only after the node adopts that block as the canonical head should the complete model become the baseline for production searches. Invalid batches must be discarded immediately. A chain reorganization requires state rollback or snapshot reconstruction, while a sequence gap should trigger state recovery before proceeding. Full historical snapshots for every transaction are unnecessary, but rigorous versioning and recovery remain essential. In particular, OnBlockEnd means only that block execution has completed; it does not mean the block has become the canonical head.
This pipeline allows block execution, delta-stream transport, and local pool-model updates to overlap extensively, substantially shortening the interval between a new block's arrival and local state becoming ready.
3.6 Step 5: Build, enable, and connect the search and arbitrage pipeline
After implementing the module, rebuild the node binary with make geth, add --vmtrace arbstate to the startup arguments to enable the custom tracer, and supply the monitored-contract list and delta-output channel, such as a Unix domain socket or shared memory, through configuration.
Because Live Tracer callbacks run synchronously on the node's EVM execution hot path, keep them minimal: allowlist filtering, recording raw slots, necessary reads, and nonblocking delivery only. Move expensive bit decoding and route search into a separate downstream process to minimize the impact on block production and validation. See the Live Tracing performance notes.
After deployment, periodically check local pool models against node state at the same block height. Compare the event-based and Geth-delta approaches systematically using block-execution time, state-readiness latency, and P95/P99 tail latency. Some Geth versions also adjust execution-engine scheduling depending on whether tracing is enabled, so verify the actual effect on serial or parallel block execution for the target chain before deployment.
Backrun example: How arbitrage data flows after customization
The Geth changes above primarily maintain the local pool models' baseline state at the chain head in real time. Consider a typical backrun: the node first uses native tracing to simulate a pending target transaction T—for example, debug_traceCall with prestateTracer and diffMode: true to extract differences between pre- and post-transaction state. The arbitrage engine then searches for opportunities using the pools' state immediately after T. Ordinary top-of-block arbitrage can search the latest baseline model directly, without simulating a target transaction. The complete pipeline is:
Local pool models are synchronized to baseline state B
→ Send target transaction T to the node
→ The node simulates T in isolation on B
→ Extract effective state deltas ΔT for the target contracts
→ Apply ΔT to a temporary branch of the local models
→ Quote and search locally on the post-transaction state
→ Construct the arbitrage transaction and submit it in a bundle
With the same baseline state, target transaction, and block environment, all candidate routes can reuse the state deltas from a single simulation. A new simulation is required only when one of those conditions changes.
4.1 Two-hop arbitrage across pools: USDC → WETH → USDC
Select two liquidity pools with a potential price discrepancy:
Pool A: USDC / WETH
Pool B: USDC / WETH
These pools may belong to different DEX protocols, or to the same protocol with different fee tiers and liquidity depths.
Suppose target transaction T sells a large amount of WETH for USDC in pool A, pushing its WETH price significantly below pool B's. The arbitrage system constructs this backrun route:
Target transaction T:
Sell WETH in pool A
↓
Arbitrage transaction A:
Use USDC to buy WETH in pool A
→ Sell WETH in pool B to receive USDC
The data flow has three stages:
-
Simulate the target transaction in isolation on the node. Execute T against baseline state B and extract effective state changes for pool A and its dependency contracts.
-
Build a temporary local state branch. Create a lightweight copy-on-write branch from the local pool models corresponding to B. Override only the pool A fields affected by T; unaffected pool B reuses baseline state B directly.
-
Iterate quotes at high frequency in memory. Calculate both swap outputs consecutively on the temporary branch, probing different input sizes through binary search or numerical optimization to identify the highest net profit after costs.
The following in-memory quoting example illustrates the logic only; it is not a production benchmark:
| Stage | Local calculation result |
|---|---|
| Input to pool A | 10,000 USDC |
| Output from pool A | 4.98 WETH |
| Output after feeding that WETH into pool B | 10,035 USDC |
| Candidate spread after both pools' swap fees | 35 USDC |
These local quotes already account for each pool's protocol-level swap fees. The final decision must also deduct execution costs such as gas and payments to the builder.
Every candidate calculation throughout the search must reuse the state immediately after target transaction T. Each candidate route and input amount must start independently from that state. State changes produced while evaluating one candidate must never contaminate the next.
4.2 Triangular arbitrage: USDC → WETH → DAI → USDC
Triangular arbitrage typically spans three related trading pairs:
Pool A: USDC / WETH
Pool C: WETH / DAI
Pool D: DAI / USDC
Target transaction T is again simulated in isolation on the node first. If T changes one or more pools, the system applies all affected pools' deltas to the same temporary local branch, then calculates the three-hop output consecutively in memory:
Input x USDC
→ Pool A outputs a WETH
→ Pool C outputs b DAI
→ Pool D outputs y USDC
→ Calculate y − x − other execution costs
Each swap in the local model must accurately reproduce the protocol's fee model, price-slippage curve, and underlying fixed-point and integer rounding rules.
The same target-transaction simulation deltas can also drive parallel evaluation of multiple route topologies. For example, if pool A is part of both a two-hop route and a triangular route:
The node simulates T and obtains pool A's state deltas
→ Update the temporary local branch
├── Evaluate the A → B two-hop route
└── Evaluate the A → C → D triangular route
A prebuilt pool-to-route inverted index lets the search engine identify candidate routes affected by pool A's changes within milliseconds, then independently schedule multithreaded evaluation, prune invalid routes, and optimize input amounts. More candidate routes still increase computational work linearly, but the entire loop runs in local memory: there is no need to simulate T again for each candidate or send any quote requests to the node.
4.3 Build a bundle and submit it to a builder
If the strategy can obtain the complete signed raw transaction for T and the target network has builders that support bundles, it can proceed as soon as local search identifies the best route and input size. The program signs arbitrage transaction A, packages T followed by A in strict order, and submits the bundle to a builder for a specified target block height. See the bundle RPC format.
Target transaction T
→ Arbitrage transaction A
→ Package as a bundle
→ Submit to a builder
A profitable local simulation does not guarantee successful on-chain execution. Bundles preserve the atomic execution order of the target transaction followed by the arbitrage transaction, but inclusion still depends on the builder's global ordering strategy, competing searchers' bids through priority fees or coinbase transfers, and the actual state when the block is produced.
5. Which stages do node customization and Node Stream optimize?
The full end-to-end path from network-wide state changes to on-chain arbitrage execution also includes network transport and consensus synchronization outside the node:
Network and external-data synchronization
→ Local node reception and execution
→ Pool state enters local models
→ Arbitrage search
→ Transaction submission
Customizing Geth optimizes how quickly state generated by execution inside the node reaches the local strategy models. If the node already receives new blocks or transaction broadcasts later than competitors at the P2P layer, even highly optimized internal processing and local search may be unable to recover the upstream network delay fully.
BlockRazor Node Stream accelerates the external synchronization path of self-hosted nodes. For example, its Ethereum CL/EL Client Sync service improves data synchronization for consensus-layer and execution-layer clients; see Ethereum CL/EL Client Sync. It operates at a different stage from the internal Geth state-delta customization discussed here. The two can be benchmarked independently and used together.
6. What this architecture delivers
This architecture establishes two core engineering capabilities: real-time, low-latency synchronization of local pool state, and high-throughput mathematical quoting and route search entirely in memory. Customizing Geth's Live Tracer shortens the path from EVM execution to strategy memory. Complete local pool models remove candidate evaluation's dependency on RPC communication and node execution resources, giving the search engine control over concurrency, pruning, and compute budgets.
In a backrun scenario, native node simulation captures the state changes caused by the target transaction. Lightweight local state branches reuse those deltas to optimize multiple routes, after which the strategy constructs the arbitrage transaction and submits a bundle. Together with the Geth block-state capture extension, this delta-reuse mechanism forms a complete pipeline for low-latency responses.
The result is a shorter, more predictable state-synchronization pipeline and independently scheduled local search infrastructure. Whether an entire search round can consistently finish within milliseconds still requires rigorous production benchmarking against the number of monitored pools, route-topology complexity, protocol-math efficiency, and host hardware.