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_v2reports.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.

sql
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

Column NameData TypeDescription
tx_hashstringEvery transaction on the blockchain has a transaction hash (tx_hash) that acts as a unique identifier for that transaction.
successfulintegerIndicates whether a transaction failed or succeeded.
tx_senderstringStores the wallet address that initiated the transaction (i.e the wallet paying the gas fee).
tx_recipientstringStores the recipient of the transaction - recipients can be other wallets or smart contracts. For example, if you want to Swap tokens on Uniswap, the Uniswap router would typically be the recipient of the transaction.
tx_createsstringStores the contract created in a transaction. The tx_creates column does not include contracts created through Create2 calls.
tx_valueintegerStores the amount of native token getting used in the transaction. For example, if a wallet sends 1 ETH, the value field would show 1 ETH. However, if a wallet sends 1 WETH the value field would be empty as WETH isn't the native token on Ethereum.
tx_gas_offeredintegerThe maximum amount of gas a transaction can use - denominated in .
tx_gas_spentintegerThe total amount of gas units used in the transaction.
tx_gas_priceintegerThe cost of one gas unit - denominated in . To find the transaction fee - in ETH - you need to multiply tx_gas_spent and tx_gas_price. For example, 62606 * 0.000000012096221206 = 0.00075729602 ETH transaction fee.
signed_atdatetimeTimestamp showing the date the transaction was successful.

The columns in the all_chains table above map to the following fields in the block explorer below:

Log Event Data Columns

Column NameData TypeDescription
log_emitterstringStores the smart contract emitting the log event. For example, in a Swap event the log_emitter is the liquidity pool that's facilitating the swap.
topic0stringStores the topic event hash. All events have a unique topic event hash.
topic1 - topic2 - topic3stringThese fields display the stakeholders in the event. For example, in a transfer event the topic1 is the sender of the token and topic2 is the recipient. A transfer event is always made up of at least two addresses - sender and recipient.
data0 - data1 - data2 - data3stringStores a lot of critical information like addresses and token amounts. The information held in these fields can vary, so it takes a bit of investigation to decode.
data_reststringThe data_rest field holds all the data outside data0-data3. It's a column that's very rarely utilised and most analysis you perform won't require this column.

The columns in the all_chains table above map to the following fields in the block explorer below:

Block Data Columns

Column NameData TypeDescription
block_heightintegerBlock height refers to the current number block in a blockchain. The genesis block, the very first block in any blockchain, has a block height equal to zero.
block_gas_usedintegerThe total amount of gas units used by the block.
block_gas_limitintegerThe maximum amount of gas a block can use - denominated in .
block_hashstringEvery block on the blockchain has a block hash that acts as a unique identifier for that transaction.
block_parent_hashstringAll the blocks are chained together by adding the previous block's hash to the next block's header - the parent hash. This chaining makes the data in the previous blocks immutable.

The columns in the all_chains table above map to the following fields in the block explorer below: