All Chains Table
The all_chains
table stores all the block, transaction and log event data across the 200+ supported blockchains in one unified data table. The chain_name
column identifies which chain the data belongs to; meaning you can pivot your analysis across multiple chains without any changes to your underlying SQL.
The all_chains
table is used to build out Increment's aggregated tables such as reports.nft_sales_v2, reports.lending, and reports.dex.
The table best serves as a means to examine multiple networks across a variety of metrics.
Example Query
Count Ethereum, Arbitrum, Polygon, and Optimism transactions over the last 30 days.
SELECT uniq(tx_hash) , date_trunc('day', signed_at) as date , chain_name FROM blockchains.all_chains WHERE chain_name IN ('eth_mainnet', 'arbitrum_mainnet', 'matic_mainnet', 'optimism_mainnet') AND signed_at > now() - interval '30 day' GROUP BY date, chain_name
Decode Raw Data
All columns in the all_chains
table that can contain a hexadecimal string are stored in byte code.
The hex()
function is used to transform byte code (e.g 4�f�P��Fq
) into it's hexadecimal representation (e.g 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
) whenever you want to display addresses or join onto another table.
The unhex()
function is used to transform hexadecimal strings (e.g 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
) into byte code (e.g 4�f�P��Fq
) whenever you want to parse an address to the database through a WHERE
statement.
If you wish to learn more about these functions, you can view the full guide at Functions to Transform Base Data.
Table Columns
Transaction Data Columns
The columns in the all_chains
table above map to the following fields in the block explorer below:
Log Event Data Columns
The columns in the all_chains
table above map to the following fields in the block explorer below:
Block Data Columns
The columns in the all_chains
table above map to the following fields in the block explorer below: