Detecting Corrupted Blockchain Data Before It Corrupts Your Queries
Theodore Butler
February 5, 2026 · 4 min read
Edge & Node, the team that built The Graph protocol, developed Amp to address a fundamental problem in blockchain data pipelines: verifying data integrity at the extraction layer.
When you query blockchain data, you are trusting that your data source reflects the canonical chain state. Providers at the start of the data pipeline may introduce errors through bugs, misconfiguration, or malicious intent. A missing transaction, a corrupted log, or even an incorrect ordering of events may go unnoticed until it causes incorrect behaviors downstream.
Amp is a blockchain data engine that transforms complex blockchain data into structured datasets that can be queried via SQL. As an intermediary between blockchain data providers and applications, Amp is built with data integrity as a core concern, verifying extracted data using the cryptographic primitives core to blockchain systems.
A Brief Cryptography Glossary
A hash is a unique fingerprint of the input to an irreversible function. It always returns the same output for a given input, but any change to that input produces a different output. A commitment, in this context, is also a hash. A signature associates a "message" with the holder of a private key. RLP encoding is the serialization format used by the EVM. A Merkle Patricia Trie is a data structure designed to produce efficient proofs that certain elements of the onchain state are present, providing a root hash that commits to the entire sequence of entries in a block.
Verifying EVM RPC Raw Datasets
For EVM RPC raw datasets, Amp extracts RPC data into three tables: blocks, logs, and transactions.
The blocks table contains the fields of each block header. Verifying it is the most straightforward: RLP-encode the fields and pass them through the Keccak-256 hash function. If the output matches the block hash, the set of values for the block header fields is well-formed.
The transactions table contains transaction data for each block. To verify it, each transaction is reconstructed in its RLP-encoded format (which varies by transaction type), then used to reconstruct the Merkle Patricia Trie to get the root commitment. The sequence of transactions is well-formed if the Merkle root matches the transactions root field of the block header.
The logs table contains structured event logs emitted by transactions. Similar to transactions, the logs are re-encoded and combined with transaction data to reconstruct the Merkle Patricia Trie for transaction receipts. The sequence is well-formed if the Merkle root matches the receipts root field of the block header.
Since each re-computed hash is verified against the corresponding hash in the block header, it proves that all transactions and logs are present, correctly ordered, and unmodified.
Segments and Query Execution
Amp stores extracted data in Parquet files called segments, where each segment covers a contiguous range of blocks. Verifying individual blocks is necessary but insufficient; Amp also ensures that segments selected for query execution form a coherent chain.
Every EVM block contains the parent block hash so blocks can form a chain. Segments are similarly linked using the same hash and parent hash of the source data. This is stronger than checking block numbers alone, because chain reorganizations can produce two blocks with the same number but different contents. For query execution, Amp selects segments by requiring them to be a view over a well-formed chain, maintaining a consistent view even in the presence of reorgs, parallel extraction, or segment compaction.
What Is Built, and What Comes Next
Amp verification can quickly verify the integrity of data per block, in parallel, and guarantees that queried data comes from blocks that form a valid chain based on block hashes. What cannot be proven yet is that those block headers come from the canonical chain agreed upon by network consensus.
Closing this gap requires access to consensus-layer data: on post-merge Ethereum, verifying that block hashes appear in the Beacon chain, which would require integrating with a light client. A related concern is cross-chain verification, such as confirming that an L2 transaction has been finalized on L1.
Beyond the benefits to Amp datasets, Edge & Node is also working on integrating with Graph Node. Using Amp datasets as an input, as an alternative to direct RPC ingestion, would both improve the speed at which subgraphs sync to chain head and prevent a primary cause of data inconsistency in subgraph query results.
Conclusion
Amp's verified extraction provides a strong guarantee that extracted datasets are internally consistent with the cryptographic commitments contained in the block headers. Combined with Amp's segment adjacency checks, users can be confident that every query executes over a consistent view of the underlying blockchain data.
This shifts the trust boundary. Instead of trusting your data provider to accurately represent onchain state, you verify it using the cryptographic tools provided by the blockchains. The standalone CLI enables external validation, so downstream consumers or auditors can verify your datasets without infrastructure access.