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

uniswap-database-changes-tx-digest-avalanche

ciyengar3
v0.0.3/20 downloads

Package ref

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

Run package

CLI

Run db_out from the command line.

substreams run uniswap-database-changes-tx-digest-avalanche@v0.0.3 db_out -e avalanche --start-block -1
Authenticate by running substreams auth or directly on thegraph.market (see docs).

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); the coinbase is always skipped
    • logs=all|untyped|none: every log signature (default), only logs not decoded into another array, or none
  • 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.

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.

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