core-chain.balances Table: ez_balances_erc20 Type: Base Table
What
This table tracks ERC20 token balance changes at the transaction level by capturing pre- and post-transaction states from contract storage slots. It uses state tracer data to show exactly how each address’s token balance changed during transaction execution for verified ERC20 tokens, including decimal adjustments and USD valuations, where available, for comprehensive token balance analysis. This data set includes both successful and failed transactions, as state may change regardless.Key Use Cases
- Tracking ERC20 token balance changes at transaction granularity
- Analyzing token balance impacts of DeFi interactions and trades
- Monitoring large token balance changes and whale activity
- Calculating precise token balance evolution over time
- Identifying addresses with significant token holdings
- Debugging smart contract effects on token balances
- Analyzing token distribution and concentration metrics
Important Relationships
- Join with fact_transactions: Use
tx_hashfor transaction context - Join with fact_blocks: Use
block_numberfor block metadata - Join with dim_labels: Use
addressfor entity identification - Join with dim_contracts: Use
contract_addressfor token contract details - Join with ez_token_transfers: Compare balance changes to transfer events
- Join with ez_prices_hourly: USD valuations already included but can be refreshed
- Join with ez_balances_native: Compare with native token balance changes
Commonly-used Fields
address: The account whose token balance changedcontract_address: The ERC20 token contract addresssymbol: Token symbol (USDC, WETH, etc.)pre_balance: Token balance before the transactionpost_balance: Token balance after the transactionnet_balance: The change in token balance (post - pre)pre_balance_usd/post_balance_usd: USD values at time of transactiondecimals: Number of decimal places for the tokentx_hash: Transaction that caused the balance change
Sample queries
Daily ERC20 Token Balance ChangesColumns
| Column Name | Data Type | Description |
|---|---|---|
| BLOCK_NUMBER | NUMBER | Sequential counter representing the position of a block in the blockchain since genesis (block 0). |
- Immutable once finalized
- Primary ordering mechanism for blockchain data
- Increments by 1 for each new block
- Used as a proxy for time in many analyses
- Set by block producer
- Can have minor variations (±15 seconds)
- Always increasing (newer blocks = later timestamps)
- Position 0: First transaction in block
- MEV bots often target early positions
- Bundle transactions appear consecutively
- Useful for analyzing transaction ordering | | TX_HASH | TEXT | Unique 66-character identifier for the transaction.
- Primary key for transaction lookups
- Join key for traces, logs, and token transfers
- Immutable once confirmed
0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060 | | TX_SUCCEEDED |
BOOLEAN | Boolean indicator of whether the transaction that caused this balance change was
successful.
Example: true | | CONTRACT_ADDRESS | TEXT | The ERC20 token contract address whose balance changed
in this transaction.
Example: ‘0xa0b86a33e6eb88b4d81b15e4e60c8a5b776e3b7a’ | | DECIMALS | NUMBER | Number of decimal
places for the token, used for proper decimal adjustment.
Example: 6 | | SYMBOL | TEXT | The token symbol for the ERC20 token.
Example: ‘USDC’ | | SLOT_NUMBER | NUMBER | The storage slot number used to track balances for this
ERC20 token contract.
Example: 0 | | ADDRESS | TEXT | The account address whose token balance changed in this transaction.
Example: ‘0x1234567890123456789012345678901234567890’ | | STORAGE_KEY | TEXT | | | PRE_BALANCE_HEX |
TEXT | Hexadecimal representation of the pre-transaction balance as stored in the contract’s storage
slot.
Example: ‘0x3b9aca00’ | | PRE_BALANCE_RAW | TEXT | Token balance before transaction in smallest
unit, no decimal adjustment.
Example: 1000500000 | | PRE_BALANCE_PRECISE | TEXT | Token balance before transaction, decimal
adjusted, returned as a string to preserve precision.
Example: ‘1000.500000’ | | PRE_BALANCE | FLOAT | Token balance before the transaction execution,
decimal adjusted to standard units.
Example: 1000.50 | | PRE_BALANCE_USD | FLOAT | USD value of the pre-transaction token balance at the
time of the transaction.
Example: 1000.50 | | POST_BALANCE_HEX | TEXT | Hexadecimal representation of the post-transaction
balance as stored in the contract’s storage slot.
Example: ‘0x2cb417800’ | | POST_BALANCE_RAW | TEXT | Token balance after transaction in smallest
unit, no decimal adjustment.
Example: 750250000 | | POST_BALANCE_PRECISE | TEXT | Token balance after transaction, decimal
adjusted, returned as a string to preserve precision.
Example: ‘750.250000’ | | POST_BALANCE | FLOAT | Token balance after the transaction execution,
decimal adjusted to standard units.
Example: 750.25 | | POST_BALANCE_USD | FLOAT | USD value of the post-transaction token balance at
the time of the transaction.
Example: 750.25 | | NET_BALANCE_RAW | NUMBER | The change in token balance in smallest unit.
Example: -250250000 | | NET_BALANCE | FLOAT | The change in token balance (post_balance -
pre_balance).
Example: -250.25 | | EZ_BALANCES_ERC20_ID | TEXT | Primary key - unique identifier for each row
ensuring data integrity.
Format: Usually VARCHAR containing composite key generated using MD5 hash of the relevant
columns. Example: MD5(block_number, tx_hash, trace_index)
Usage:
- Deduplication in incremental loads
- Join operations for data quality checks
- Troubleshooting specific records
- Data freshness monitoring
- Incremental processing markers
- Debugging data pipeline issues
- SLA tracking