Ai Overview
Suspected sandwich attacks are hard to prove after the fact. Teams usually start with swaps, logs, and public explorers, then hit a wall when they need exact pre-trade state, internal call paths, or historical balances at a specific block. Nadcab RPC offers pay-as-you-go pricing at $0. 375 per 1M compute units, and Nadcab Cloud starts from $10 with no rate tiers.
Key Takeaways
- Archive RPC forensics is essential when you need reproducible historical state reads, not just current chain data.
- A credible sandwich-attack investigation usually combines receipts, logs, full block ordering, and point-in-time state queries.
- Full nodes often cover current application traffic, but archive access is the stronger fit for older incident reconstruction.
- The most common forensic failures come from missing history, switching providers mid-investigation, and backfill rate limits.
- MEV protection helps reduce repeat exposure after an incident, especially when paired with tighter routing and monitoring controls.
Suspected sandwich attacks are hard to prove after the fact. Teams usually start with swaps, logs, and public explorers, then hit a wall when they need exact pre-trade state, internal call paths, or historical balances at a specific block. That is where archive RPC forensics becomes practical infrastructure instead of a nice-to-have.
For developers, incident responders, and protocol security teams, the goal is not just to say that MEV probably happened. The goal is to reconstruct what happened, show the transaction order, estimate user impact, and produce evidence that another engineer can reproduce. Standard RPC access often covers the latest chain state well enough for apps, but historical investigations usually need deeper data and more consistent responses.
This guide explains when archive access matters, how to build a repeatable workflow for suspected sandwich attacks, which JSON-RPC methods to use, and how managed infrastructure like Nadcab RPC fits into that process on supported networks. On major EVM chains, Nadcab RPC also offers archive data and MEV protection, which is useful both for investigation and for reducing repeat incidents.
One API key. 70+ blockchains. Production-grade RPC.
Nadcab RPC gives you HTTPS and WebSocket endpoints across 150+ chain endpoints with smart routing and a 99.99% gateway uptime target. Pay as you go from $0.375 per 1M compute units.
What MEV forensics teams need from RPC
A forensic workflow is different from normal dApp traffic. Your app may only need current heads, pending transactions, and a few balance checks. A security investigation needs historical consistency.
In a suspected sandwich attack, analysts usually need to answer five questions:
- What was the exact order of transactions in the block?
- What happened inside the victim transaction and the surrounding attacker transactions?
- What was the pool state immediately before and after each step?
- How much value moved, and who captured it?
- Can another engineer rerun the analysis and reach the same result?
That means your RPC layer must support more than fast latest-block reads. It must return reliable historical logs, receipts, block data, and state queries pinned to exact block numbers. On some investigations, you also need traces or debug-style call reconstruction from your own infrastructure stack.
This is one reason many teams move forensic workloads away from the same endpoint they use for front-end reads. A shared gateway for app traffic is optimized for uptime and throughput. An investigation stack is optimized for reproducibility.
If you need one entry point across many networks, Nadcab RPC supports 70+ networks and 150+ endpoints with one API key over HTTPS and WebSocket. For multi-chain teams, that reduces operational drift between networks when building the same incident workflow on Ethereum, Arbitrum One, Base, Polygon, Optimism, or BNB Smart Chain.
Minimum RPC capabilities for incident review
- Historical block and transaction retrieval by hash and number
- Logs over specific block ranges and contract topics
- Transaction receipts with gas use, status, and emitted events
- State reads at exact blocks using
eth_calland storage methods - Archive access for old state, not just recent snapshots
- Stable behavior across repeated queries during the investigation window
Archive RPC vs full node for historical investigations
A full node is enough for many production applications, but it may not preserve all historical state required for older point-in-time reads. Archive infrastructure stores state history so that calls like eth_call or eth_getBalance at an old block can be answered reliably.
For sandwich-attack analysis, that difference matters. You may know a swap failed to get expected output, but you still need to inspect pool reserves and relevant contract state before the victim swap entered execution. Without archive data, you may only see the latest state, which is not useful evidence.
When a full node is enough
- Pulling recent blocks and receipts
- Indexing current logs for monitoring
- Building mempool or head-based alerting
- Running app reads that only use latest or safe block tags
When archive RPC is the better fit
- Replaying old incidents weeks or months later
- Comparing state before and after a suspicious trade
- Auditing contract storage at a specific historical block
- Producing reproducible reports for legal, compliance, or internal postmortems
| Requirement | Standard full node | Archive RPC |
|---|---|---|
| Latest block reads | Usually yes | Yes |
| Historical logs and receipts | Often yes | Yes |
| Historical contract state at old block numbers | Not always available | Designed for this |
| Repeatable forensic queries across old incidents | Can be limited | Stronger fit |
| One endpoint across many chains | Operationally heavier | Available through managed gateway |
On major EVM chains including Ethereum, BNB Smart Chain, Polygon, Arbitrum, Optimism, and Base, Nadcab RPC provides archive data and MEV protection. That makes it relevant for teams that both investigate incidents and want safer routing for future transaction flows. See the developer docs and pricing if you are planning a dedicated forensic environment.
The core workflow to detect suspected sandwich attacks
A sandwich attack normally has three parts inside or around one block window: a frontrun buy or position-changing trade, the victim trade, and a backrun sell or unwind. Your job is to prove whether those actions are causally related.
Step 1: Identify the victim transaction
Start from the transaction hash reported by the user, your backend, or a monitoring alert. Pull the receipt and block number. Then list all transactions in that block and isolate nearby transactions touching the same router, pair, or pool.
Step 2: Pull surrounding logs
Use eth_getLogs over the block range that includes the victim block and possibly one block before and after. Filter by pool address, router address, or swap event topic. This often reveals whether the same actor traded immediately before and after the victim.
Step 3: Reconstruct order and addresses
Map transaction indexes inside the block. The attacker’s first transaction typically has a lower transaction index than the victim. The backrun follows after the victim. Check sender addresses, recipient paths, and whether an intermediate contract or builder-related address appears repeatedly.
Step 4: Read historical state
At this point, archive access matters. Query token balances, reserves, or pool slot data at the block before the attacker’s first trade, then at the victim block, and after the backrun. The delta helps estimate the attacker’s extracted value and the victim’s slippage impact.
Step 5: Build a reproducible case file
Store the raw JSON-RPC responses you used, not just derived numbers. Include block numbers, transaction hashes, event topics, and exact method calls. If another engineer cannot rerun your steps, your forensic result is weaker than it looks.
For teams handling many incidents, Nadcab Cloud is useful for shared auto-scaling endpoints, while Nadcab Core is a better fit when you want your own nodes behind Nadcab’s routing engine. For enterprise review pipelines that need custom auth or compliance logging, Nadcab Craft is the product to evaluate.
Stop overpaying for RPC requests
Nadcab Cloud starts at $10 with no rate tiers: you pay $0.375 per 1M compute units and scale up or down without contracts. Every plan includes archive and WebSocket access on supported networks.
Which JSON-RPC methods matter: logs, traces, receipts, state
You do not need every method for every case. Start simple and add depth only when the evidence requires it.
Core methods for most sandwich investigations
eth_getTransactionByHashfor sender, destination, calldata, gas settingseth_getTransactionReceiptfor status, logs, gas used, effective gas priceeth_getBlockByNumberwith transactions enabled to reconstruct orderingeth_getLogsfor pool and router events around the victim windoweth_callwith a historical block tag for point-in-time readseth_getBalanceand tokenbalanceOfcalls at historical blocks
Useful examples
The endpoint pattern for Nadcab RPC is:
https://rpc.nadcab.com/<network-slug>/<your-api-key>
Fetch a victim receipt on Ethereum:
curl https://rpc.nadcab.com/ethereum/<your-api-key>
-H 'content-type: application/json'
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"eth_getTransactionReceipt",
"params":["0xYOUR_TX_HASH"]
}'
Fetch the full block with transactions to inspect ordering:
curl https://rpc.nadcab.com/ethereum/<your-api-key>
-H 'content-type: application/json'
-d '{
"jsonrpc":"2.0",
"id":2,
"method":"eth_getBlockByNumber",
"params":["0xBLOCK_NUMBER_HEX", true]
}'
Pull swap logs for a specific pool at the victim block:
curl https://rpc.nadcab.com/ethereum/<your-api-key>
-H 'content-type: application/json'
-d '{
"jsonrpc":"2.0",
"id":3,
"method":"eth_getLogs",
"params":[{
"fromBlock":"0xBLOCK_NUMBER_HEX",
"toBlock":"0xBLOCK_NUMBER_HEX",
"address":"0xPOOL_ADDRESS",
"topics":["0xSWAP_EVENT_TOPIC"]
}]
}'
Read historical state with ethers.js:
import { JsonRpcProvider, Contract } from "ethers";
const provider = new JsonRpcProvider(
"https://rpc.nadcab.com/ethereum/<your-api-key>"
);
const pairAbi = [
"function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)"
];
const pair = new Contract("0xPOOL_ADDRESS", pairAbi, provider);
const victimBlock = 22000000;
const beforeBlock = victimBlock - 1;
const reservesBefore = await pair.getReserves({ blockTag: beforeBlock });
const reservesAtVictim = await pair.getReserves({ blockTag: victimBlock });
console.log({ reservesBefore, reservesAtVictim });
If you need a broader infrastructure refresher, Nadcab’s article on Web3 infrastructure explained: nodes, RPCs, and APIs is a good companion to this workflow.
How to reconstruct transaction order and estimate impact
Order reconstruction is usually straightforward at the block level but subtle in interpretation. A sandwich is not just three trades near each other. You need evidence that the first trade worsened execution for the victim and that the final trade monetized that change.
Order reconstruction checklist
- Get the victim receipt and note
blockNumberandtransactionIndex. - Fetch the full block with transactions.
- Filter transactions touching the same router or pool contracts.
- Sort by
transactionIndex. - Decode swap paths or event logs for each candidate transaction.
- Confirm the same actor or tightly related addresses appear before and after the victim.
Impact estimation model
You do not need a perfect MEV profit calculator to produce a useful report. In many cases, a defensible estimate is enough:
- Calculate expected output under pre-attack reserves.
- Calculate actual output from victim logs and receipt data.
- The difference is the victim’s direct execution loss.
- Compare attacker inventory before and after to estimate captured value.
Historical reserve reads and event deltas are usually enough for AMM-style pools. More complex protocols may require storage-slot inspection, internal call analysis, or custom decoders.
For implementation details on stable RPC clients and retries, Nadcab’s Web3 API integration guide covers authentication, error handling, and setup patterns you can reuse in forensic scripts.
Pick the RPC setup that fits your stage
- Nadcab Cloud: shared, auto-scaling endpoints for dApps and wallets
- Nadcab Core: bring your own nodes and add our smart routing engine
- Nadcab Craft: dedicated clusters, custom auth, compliance logging and enterprise SLA
- Nadcab for Chains: RPC infrastructure for new L1 and L2 networks
Common failure points: missing history, inconsistent providers, rate limits
Most failed investigations do not fail because the analyst lacks ideas. They fail because the data source is incomplete or inconsistent.
Missing historical state
This is the most common issue. Your logs may exist, but reserve snapshots at the needed block do not. Without archive-capable access, old eth_call requests can fail or return incomplete results for the exact point-in-time question you need answered.
Inconsistent behavior across providers
If you switch endpoints halfway through an investigation, you may see differences in indexing lag, error handling, or method availability. That does not always mean one endpoint is wrong, but it does make your report harder to defend.
Rate limiting during backfills
Forensics often means wide log scans, repeated block pulls, and batch state reads. If your RPC plan is tuned only for user-facing dApp traffic, your scripts may hit request controls exactly when an incident needs rapid answers.
Operational mitigations
| Failure point | Symptom | Mitigation |
|---|---|---|
| Missing history | Old block reads fail or cannot return state | Use archive-capable endpoints for supported chains |
| Provider inconsistency | Different results across reruns | Freeze your investigation to one endpoint and save raw responses |
| Backfill throttling | Long scans stall mid-incident | Batch requests, cache results, separate app and forensic workloads |
| Unclear service health | Hard to tell if the issue is yours or the gateway | Check a live status page and instrument retries |
Nadcab RPC is useful here because it provides smart routing across providers and regions, a 99.99% gateway uptime target, and a live status page. That does not remove the need for good script design, but it helps reduce avoidable infrastructure variance during analysis.
If you are evaluating whether to self-host more of the stack, this Nadcab Labs piece on Ethereum node hardware vs managed RPC gives a practical framework for that decision.
When MEV protection helps prevent repeat incidents
Forensics is retrospective. MEV protection is preventative. After you confirm a sandwich pattern, the next question from product and security teams is usually: how do we reduce the chance of this happening again?
On major EVM chains, routing sensitive order flow through infrastructure with MEV protection can help reduce exposure for specific transaction paths. It is not a universal shield. Users can still choose unsafe routes, smart contracts may expose other attack surfaces, and protocol design still matters. But it is a meaningful control for wallets, trading interfaces, and backend relayers.
In practice, teams pair MEV protection with:
- Tighter slippage defaults
- Private or protected transaction submission paths where appropriate
- User warnings on unusually thin liquidity
- Onchain monitoring for repeated attacker addresses and pools
Nadcab RPC includes MEV protection on major EVM chains where it also offers archive data. That combination is useful because the same platform can support incident review and safer transaction routing after you identify the pattern.
How to choose RPC infrastructure for security analysis
Security analysis workloads deserve explicit infrastructure requirements. Do not assume the endpoint that powers your UI is automatically suitable for incident response.
Evaluation checklist
- Do you have archive access on the chains where incidents matter most?
- Can you use one API key and a consistent endpoint pattern across networks?
- Is there a clear status page for operational visibility?
- Can you separate shared app traffic from deeper forensic workloads?
- Do you need custom auth, dedicated clusters, or compliance logging?
- Is pricing simple enough that incident-driven spikes do not create planning problems?
For many teams, a managed gateway is the fastest path to a usable workflow. Nadcab RPC offers pay-as-you-go pricing at $0.375 per 1M compute units, and Nadcab Cloud starts from $10 with no rate tiers. If your requirements go beyond shared endpoints, Nadcab Core and Nadcab Craft cover more controlled deployment models. You can review product details on the RPC FAQ or get started via the API key signup page.
For broader architecture planning, Nadcab’s article on a multi-provider RPC strategy for high-volume Web3 apps is worth reading, especially if your security team and product team share infrastructure today.
Related guides from Nadcab Labs
Final Thoughts
Sandwich-attack investigations succeed when they are reproducible, not just plausible. To get there, teams need exact block ordering, historical logs, receipts, and point-in-time state reads that standard latest-state RPC setups often cannot provide on their own.
That is why archive RPC forensics belongs in the core security toolkit for DeFi apps, wallets, and protocol teams. Use archive access to reconstruct what changed before and after the victim transaction, preserve raw responses, and separate forensic traffic from normal app traffic. Then combine that workflow with MEV protection and safer routing where possible to reduce repeat exposure.
If you want one gateway across supported networks, archive data and MEV protection on major EVM chains, and deployment options from shared endpoints to dedicated clusters, Nadcab RPC is a practical place to build that workflow.
Ship faster on infrastructure you don’t have to babysit
Get one API key for 70+ networks, HTTPS and WebSocket endpoints, smart routing and a live status page. Building something bigger? Our blockchain team can design and run the full stack with you.
Get Your Free API Key →Talk to Our Experts
Pay as you go · No rate tiers · 99.99% gateway uptime target
Frequently Asked Questions
Q1.What is archive RPC forensics in blockchain incident response?
Archive RPC forensics is the use of archive-capable RPC infrastructure to investigate past onchain events with exact historical context. Instead of only reading the latest chain state, analysts query logs, receipts, and contract state at specific old block heights to reconstruct what happened and produce evidence that another engineer can reproduce.
Q2.Why is a standard RPC endpoint not always enough to detect a sandwich attack?
A standard endpoint may be fine for current app reads but still fall short on older point-in-time state queries. Sandwich analysis often requires reserve balances, storage values, or contract reads from exact historical blocks. Without archive access, you may see transaction metadata and logs but still miss the state evidence needed to prove impact.
Q3.Which JSON-RPC methods are most useful for sandwich attack analysis?
Start with eth_getTransactionByHash, eth_getTransactionReceipt, eth_getBlockByNumber, eth_getLogs, and eth_call with a historical block tag. Those methods let you reconstruct order, inspect emitted swap events, and compare state before and after the victim trade. Additional tracing methods may help for deeper call-path analysis, depending on your stack.
Q4.How do I estimate user impact from a suspected sandwich attack?
A practical approach is to compare expected execution under pre-attack pool state with the actual execution shown in the victim transaction logs and receipt. Historical reserve reads and event deltas can often show how much the price moved before the victim swap and how much value the attacker likely captured on the unwind.
Q5.When should a security team choose managed RPC instead of self-hosting nodes for forensics?
Managed RPC is usually the faster choice when you need archive access, multi-chain consistency, operational visibility, and quick scaling for incident workloads. Self-hosting can make sense when you need deeper control, custom tracing, or internal policy requirements, but it adds maintenance overhead that many teams do not want in the middle of active investigations.
Explore Services
Related Services
Reviewed by

Aman Vaths
Founder of Nadcab Labs
Aman Vaths is the Founder & CTO of Nadcab Labs, a global digital engineering company delivering enterprise-grade solutions across AI, Web3, Blockchain, Big Data, Cloud, Cybersecurity, and Modern Application Development. With deep technical leadership and product innovation experience, Aman has positioned Nadcab Labs as one of the most advanced engineering companies driving the next era of intelligent, secure, and scalable software systems. Under his leadership, Nadcab Labs has built 2,000+ global projects across sectors including fintech, banking, healthcare, real estate, logistics, gaming, manufacturing, and next-generation DePIN networks. Aman’s strength lies in architecting high-performance systems, end-to-end platform engineering, and designing enterprise solutions that operate at global scale.


