All packages
uniswap-database-changes-tx-digest-avalanche

uniswap-database-changes-tx-digest-avalanche

ciyengar3
v0.0.6/16 downloads

Package ref

uniswap-database-changes-tx-digest-avalanche@v0.0.6

Run package

Params
ordering_key=tx_digest_block:avalanche
Start block
latest 200 blocks

README

uniswap-tx-digest

One tx_digest_block row per block with every transaction and what wallet balances and transaction labeling need: ERC-20 transfers, wrapped-native deposits and withdrawals, native balance changes, calls made by wallets, NFT transfers, approvals, every log's emitter and topic0, 4337 user operations, 7702 delegations and the ETH each call moved. It computes no balances and no labels; consumers do. Schema: ../proto/evm/uniswap/tx_digest/tx-digest.proto.

Modules

  • map_tx_digest(params, block): the typed Block, whole.
    • wrapped=<addr>: the chain's wrapped-native contract (Deposit / Withdrawal)
    • skip=<addr,...>: addresses left out of native changes (OP-stack fee vaults), at both levels
    • logs=all|untyped|none: every log signature (default), only logs not decoded into another array, or none
    • fee=gas_changes|gas_price: how each transaction's fee is found (see Fee). Set per chain by fee in chains.json; unset leaves fee unset.
  • db_out(params, clock, map_tx_digest): one DatabaseChanges row per block for the sink.
    • ordering_key=<str>: the Pub/Sub ordering key. Generated manifests use tx_digest_block:<network>.

Wallet calls

A call is recorded when its caller is acting as a user wallet in that transaction: tx_from, an EOA running EIP-7702 code (some call entered it with Firehose address_delegates_to set), or the sender of a UserOperationEvent from a known EntryPoint (v0.6, v0.7, v0.8). Decided from the block alone; no delegation state is kept. Base-detail blocks have no call traces, so only the transaction's own top-level call is recorded there.

Native changes

Extended blocks only. One entry per address per transaction, first old value and last new value. Only committed changes count: a successful transaction skips calls with state_reverted, a failed one keeps only the root call's gas buy, gas refund and fee reward.

The block's fee recipient (coinbase) is paid by every transaction, so it is left out of each transaction's native_changes and gets one block_native_changes entry with its net change over the block, next to the changes no transaction owns (beacon withdrawals). A fee vault listed in skip stays out of both. Base-detail blocks carry no balance changes, so they have neither.

Approvals

ERC-20 Approval and ApprovalForAll from any token. Permit2's own allowances too, as kind permit2: Approval, Permit (set by signature) and Lockdown (amount 0), only from Permit2's canonical address or zkSync Era's. All come from receipt logs, so base blocks have them too.

expiration is set for Permit2 Approval and Permit: the unix time the allowance stops working, so an allowance past it is effectively revoked. Permit2 treats 0 as "expires in this block". It's 0 for every other kind.

Native transfers

The ETH each committed call moved, from any caller, in call order: a wallet's own send, a router paying out a swap, a reactor filling an order. Each entry is from, to, amount, call type, depth and the call's begin ordinal. Delegatecall, staticcall and callcode move no ETH between accounts, and a self-call nets to zero, so they're skipped, as are reverted calls.

It's for activity (who sent ETH to whom), not balances. It leaves out gas, builder tips and selfdestruct payouts, so build ETH balances from native_changes, which records every balance change with its reason.

Base-detail blocks (X Layer, and possibly other chains without full blocks) have no call traces, so only the transaction's own value is recorded there: a wallet's own sends, not ETH a contract paid it.

Fee

fee is the native wei the transaction's sender was charged, per the chain's rules: the OP-stack L1 data fee and the blob fee included. fee_source says how it was found:

  • gas_changes: minus the sum of the sender's raw GAS_BUY and GAS_REFUND balance changes on the root call. Summed before changes are folded per address, since folding drops the block's coinbase (a builder's own transactions) and addresses that net to zero (gas a contract refunded).
  • gas_price: gas_used × gas_price, for chains configured that way. Monad's balance-change reasons are all unknown, and its gas_used is the gas limit it charges, so this is right there.
  • unpriced: gas_used × gas_price is 0 and there's no gas buy (OP deposits, Arbitrum internal transactions, zero-price BNB transactions). fee is 0.
  • fallback: a gas_changes chain where a priced transaction has no sender GAS_BUY. fee is gas_used × gas_price, which may be wrong: Arbitrum retryables (types 104 and 105) land here, and one type-105 tx stores 6× its receipt. Consumers should alert on it.

The mode is set per chain (fee in chains.json): Monad gas_price, every other chain gas_changes. BASE blocks have no balance changes, so fee and fee_source stay unset there (Avalanche, zkSync, MegaETH, X Layer, Celo, Tempo); consumers read receipts instead. fee is never negative.

effective_gas_price is unchanged: Firehose's gas_price, which misses the L1 fee and is not the paid price on some chains.

Message size

The sink writes each tx_digest_block row to GCS and publishes only its URI, so rows are never split for Pub/Sub's 10 MB message or ~1 MB/s per-key limits. Measured 2026-10-21 on 10 minutes of recent blocks per chain (22 chains), as Pub/Sub-encoded bytes: the largest row was 2.3 MB (Polygon), and all chains together averaged about 1.5 MB/s, BSC the most at 0.48 MB/s.

Build and run

./scripts/build.sh <network> <version>   # ../local/uniswap-labs-database-changes-tx-digest-<network>.spkg
make run NETWORK=bsc START_BLOCK=64000000
make test

Chains, endpoints and per-chain params live in chains.json.

Modules

Execution graph

2 modules
mapMain

db_out

One tx_digest_block row per block.

from #99520000

Output

sf.substreams.sink.database.v1.DatabaseChanges

Inputs

paramssf.substreams.v1.Clockmap_tx_digest
map

map_tx_digest

Every transaction in the block with its transfers, wraps, native changes, wallet calls, NFT transfers, approvals, logs, 4337 user operations and 7702 delegations.

from #99520000

Output

evm.uniswap.tx_digest.Block