Skip to main content

Blockchain Reorg Tree

Blocks in the blockchain form a tree (or directed acyclic graph DAG in general):

Blockchain graph

Blocks that linked together from the highest tip we call the trunk :

Blockchain trunk

Blocks that not having the highest tip linked to are called branches :

Blockchain branches

Archive database contains only trunk blocks, branches (forked Block 101 and Block 102) are not included in archive database.

note

Branched block 102 however is included in real time database.

Select Blocks​

The select_blocks attribute controls which blocks a realtime or combined query reads. It is ignored for dataset: archive, which holds trunk blocks only.

valueSolanaother chains (EVM, Tron, ...)
tree (default)every block the real-time database holds, abandoned forks includedthe same
trunkleaves out the blocks of abandoned forksno filtering: the same blocks as tree
branchesonly the blocks of abandoned forksnot supported: use tree

The default is tree. A query without the argument also returns the rows of abandoned forks. On Solana these are a small share of rows. If a transaction must not be counted twice, or must have landed on the chain, pass select_blocks: trunk.

How trunk works on Solana. The real-time database stores a block as soon as a validator has processed it, before the cluster decides on it. When a fork is abandoned, its blocks drop out of trunk results once the kept chain is 5 blocks past them. That usually takes under a second, at most a few seconds. A query run in that window can still return the block.

Aggregated queries. Some Solana queries are answered from pre-aggregated tables, for example volume metrics of DEXTradeByTokens. These tables keep the trades of abandoned forks even under trunk. To leave them out completely, add aggregates: no. The query then reads the row-level tables, covers only the real-time window (see the Data Coverage & Retention matrix), and can be slower.

branches on Solana returns only the blocks of abandoned forks, for analyzing reorganizations. On combined it reads nothing from the archive, because the archive holds no abandoned blocks.

tip

On chains other than Solana, trunk does not filter anything and disables the aggregated tables, so it only makes queries slower. Leave the argument out there.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.