All packages

substreams_base_main

noslav
v0.1.4/4 downloads/Repository

Package ref

substreams-base-main@v0.1.4

Run package

CLI

Run map_block_meta from the command line.

substreams run substreams-base-main@v0.1.4 map_block_meta -e base-mainnet --start-block -1
Authenticate by running substreams auth or directly on thegraph.market (see docs).

README

base_mainnet substreams modules

This package was initialized via substreams init and is being updated with custom modules to support the Base Mainnet blockchain streaming service using substreams.

Nodes available for streaming:

https://docs.substreams.dev/reference-material/chains-and-endpoints

Usage

substreams build
substreams auth
substreams gui       			  # Get streaming!

Optionally, the substreams package can be published to the Substreams Registry

substreams registry login         # Login to substreams.dev
substreams registry publish       # Publish your Substreams to substreams.dev

Data

graph TD;
  map_block_meta[map: map_block_meta];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_block_meta;
  map_block_metadata[map: map_block_metadata];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_block_metadata;
  map_block_full[map: map_block_full];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_block_full;
  map_transactions_all[map: map_transactions_all];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_transactions_all;
  map_transactions_filter[map: map_transactions_filter];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_transactions_filter;
  map_transaction_traces[map: map_transaction_traces];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_transaction_traces;

Running Modules

map_block_meta

Basic block metadata without extended fields. Use this for lightweight pipelines that don't need withdrawal counts.

> substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_block_meta --start-block 31229579 --stop-block +1

----------- BLOCK #31,229,579 (8384034397f8c979d3c385f87e3d2568a8409a21fb162eb42250d3d3bb54f20c) ---------------
{
  "@module": "map_block_meta",
  "@block": 31229579,
  "@type": "base.mainnet.block_meta.v1.Meta",
  "@data": {
    "blockHash": "8384034397f8c979d3c385f87e3d2568a8409a21fb162eb42250d3d3bb54f20c",
    "blockNumber": "31229579",
    "blockTimestamp": "2025-06-06T22:21:45Z",
    "transactionsLen": "37",
    "parentHash": "2db56e9532ad11f6671fcd0c48e35a5e3983078264cfbb78478d27cc7be8e9ca"
  }
}

map_block_metadata

Extended block metadata including withdrawals_len — the count of EIP-4895 validator withdrawal balance changes in the block. On L1 Ethereum (post-Shanghai) this reflects actual withdrawal events; on L2s like Base it will be 0.

> substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_block_metadata --start-block 31229579 --stop-block +1

----------- BLOCK #31,229,579 (8384034397f8c979d3c385f87e3d2568a8409a21fb162eb42250d3d3bb54f20c) ---------------
{
  "@module": "map_block_metadata",
  "@block": 31229579,
  "@type": "base.mainnet.block_metadata.v1.Metadata",
  "@data": {
    "blockHash": "8384034397f8c979d3c385f87e3d2568a8409a21fb162eb42250d3d3bb54f20c",
    "blockNumber": "31229579",
    "blockTimestamp": "2025-06-06T22:21:45Z",
    "transactionsLen": "37",
    "parentHash": "2db56e9532ad11f6671fcd0c48e35a5e3983078264cfbb78478d27cc7be8e9ca",
    "withdrawalsLen": "16"
  }
}

map_transactions_all

This module extracts all transactions from a block.

> substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_transactions_all --start-block 31229579 --stop-block +1

----------- BLOCK #31,229,579 (8384034397f8c979d3c385f87e3d2568a8409a21fb162eb42250d3d3bb54f20c) age=59m28.801967s ---------------
{
  "@module": "map_transactions_all",
  "@block": 31229579,
  "@type": "base.mainnet.transaction.v1.Transactions",
  "@data": {
    "transactions": [
      {
        "from": "deaddeaddeaddeaddeaddeaddeaddeaddead0001",
        "to": "4200000000000000000000000000000000000015",
        "hash": "88dc9a999755edd21eddab0b5e70c145cd7de2b3782ac50d70771e4558a937f7"
      },
      {
        "from": "ecb55e5ccfc128a1eca67e48dbe2f299e4366d0e",
        "to": "e1e00b084b71b23741be7f5e01dae04c5383834a",
        "hash": "b455b814651f048e0966a7adeed84e0d68745b657452f2e0948e031330bd96a4"
      }....

map_transactions_filter

This module allows you to filter transactions by specifying either to or from value in the parameters.

> substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_transactions_filter --params='{"to":"0x4200000000000000000000000000000000000015"}' --start-block 31229579 --stop-block +1

map_transaction_traces

This module extracts all transaction traces from a block in their original format.

> substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_transaction_traces --start-block 31229579 --stop-block +1
----------- BLOCK #31,229,579 (8384034397f8c979d3c385f87e3d2568a8409a21fb162eb42250d3d3bb54f20c) age=51m36.729194s ---------------
{
  "@module": "map_transaction_traces",
  "@block": 31229579,
  "@type": "base.mainnet.transaction_traces.v1.TransactionTraces",
  "@data": {
    "traces": [
      {
        "to": "0x4200000000000000000000000000000000000015",
        "nonce": "31229581",
        "gasLimit": "1000000",
        "input": "0x098999be000008dd00101c120000000000000001000000006843694700000000015996a2000000000000000000000000000000000000000000000000000000032aceca4800000000000000000000000000000000000000000000000000000000000000010aaab98d5166ac87729ccadd8d709f1a5f06a234dc80376234669eda2bf436f80000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9000000000000000000000000",
        "gasUsed": "46168",
        "hash": "0x88dc9a999755edd21eddab0b5e70c145cd7de2b3782ac50d70771e4558a937f7",
        "from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
        "beginOrdinal": "12",
        "endOrdinal": "30",
        "status": "TRANSACTION_STATUS_SUCCEEDED",
        "receipt": {
          "cumulativeGasUsed": "46168",
          "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
        },
        "calls": [
          {
            "index": 1,
            "callType": "CALL_TYPE_CALL",
            "caller": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
            "address": "0x4200000000000000000000000000000000000015",
            "gasLimit": "977384",
            "gasConsumed": "23552",
            "input": "0x098999be000008dd00101c120000000000000001000000006843694700000000015996a2000000000000000000000000000000000000000000000000000000032aceca4800000000000000000000000000000000000000000000000000000000000000010aaab98d5166ac87729ccadd8d709f1a5f06a234dc80376234669eda2bf436f80000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9000000000000000000000000",
            "executedCode": true,
            "executedCode": true,
            "nonceChanges": [
              {
                "address": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
                "oldValue": "31229581",
                "newValue": "31229582",
                "ordinal": "14"
              }
            ],
            "gasChanges": [...

This module extracts small bits of block data, and does simple computations over the number of transactions in each block.

map_block_full

This module extracts the entire block, as received by the Substreams module.

> substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_block_full --start-block 31229579 --stop-block +1

...

----------- BLOCK #99 (c3fa67326430e97a263f8dc0e423d7c6a9f6a244390286b1ba32b80f208b271e) age=17280h9m54.073506s ---------------
{
  "@module": "map_block_full",
  "@block": 99,
  "@type": "sf.ethereum.type.v2.Block",
  "@data": {
    "ver": 4,
    "hash": "0xc3fa67326430e97a263f8dc0e423d7c6a9f6a244390286b1ba32b80f208b271e",
    "number": "99",
    "size": "870",
    "header": {
      "parentHash": "0xa0d20e58a8ec1e43a4eb58c3b2e24d602ff093c4b5bec2815e8abb809dcbf83c",
      "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
      "coinbase": "0x4200000000000000000000000000000000000011",
      "stateRoot": "0xe63d6228a77da20a1f19a604decbd5ce8f1739e24fba9aec52f32ac3ad839c8f",
      "transactionsRoot": "0x387c7f8b287f25fbb3f4e955fcdb98020da4c4aa1002bfa82a4d1feb1f083dfc",
      "receiptRoot": "0x3f71ebd8822765e8146170b0f930f55f753dbb867f55e4e605894016cd32f1e2",
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "difficulty": {
        "bytes": "0x00"
      },
      "number": "99",
      "gasLimit": "30000000",
      "gasUsed": "46913",
      "timestamp": "2023-06-15T00:39:05Z",
      "mixHash": "0xa2eef66a2a5cf6a3ee6c2da4e6b2cc64ecb77bc057572ef14df0bce5b95b206b",
      "hash": "0xc3fa67326430e97a263f8dc0e423d7c6a9f6a244390286b1ba32b80f208b271e",
      "baseFeePerGas": {
        "bytes": "0x083b038f"
      }
    },
    "transactionTraces": [
      {
        "to": "0x4200000000000000000000000000000000000015",
        "nonce": "98",
        "gasLimit": "1000000",
        "input": "0x015d8eb900000000000000000000000000000000000000000000000000000000010ac03800000000000000000000000000000000000000000000000000000000648a5da3000000000000000000000000000000000000000000000000000000036c55c1de12abd36b698fc225a0a7b895cb61dc803111b48d2cbcc97a45fbeeb9c35e014700000000000000000000000000000000000000000000000000000000000000030000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c900000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000a6fe0",
        "gasUsed": "46913",
        "type": 126,
        "hash": "0xda7e89e01361bec751e202c385a71b63d33093041d40f4a419a35c79ea28f39f",
        "from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
        "beginOrdinal": "1",
        "endOrdinal": "19",
        "status": "SUCCEEDED",
        "receipt": {
          "cumulativeGasUsed": "46913",
          "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
        },
        "calls": [
          {
            "index": 1,
            "callType": "CALL",
            "caller": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
            "address": "0x4200000000000000000000000000000000000015",
            "gasLimit": "977072",
            "gasConsumed": "23985",
            "input": "0x015d8eb900000000000000000000000000000000000000000000000000000000010ac03800000000000000000000000000000000000000000000000000000000648a5da3000000000000000000000000000000000000000000000000000000036c55c1de12abd36b698fc225a0a7b895cb61dc803111b48d2cbcc97a45fbeeb9c35e014700000000000000000000000000000000000000000000000000000000000000030000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c900000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000a6fe0",
            "executedCode": true,
            "nonceChanges": [
              {
                "address": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
                "oldValue": "98",
                "newValue": "99",
                "ordinal": "3"
              }
            ],
            "gasChanges": [
              {
                "oldValue": "1000000",
                "newValue": "977072",
                "reason": "REASON_INTRINSIC_GAS",
                "ordinal": "2"
              },
              {
                "newValue": "977072",
                "reason": 24,
                "ordinal": "5"
              },
              {
                "oldValue": "974770",
                "newValue": "974722",
                "reason": "REASON_CALL_DATA_COPY",
                "ordinal": "6"
              },
              {
                "oldValue": "974606",
                "newValue": "972106",
                "reason": "REASON_STATE_COLD_ACCESS",
                "ordinal": "7"
              },
              {
                "oldValue": "974706",
                "newValue": "15189",
                "reason": "REASON_DELEGATE_CALL",
                "ordinal": "8"
              },
              {
                "oldValue": "15189",
                "newValue": "953122",
                "reason": "REASON_REFUND_AFTER_EXECUTION",
                "ordinal": "14"
              },
              {
                "oldValue": "953114",
                "newValue": "953111",
                "reason": "REASON_RETURN_DATA_COPY",
                "ordinal": "15"
              },
              {
                "oldValue": "953087",
                "reason": 25,
                "ordinal": "16"
              },
              {
                "oldValue": "953087",
                "reason": 23,
                "ordinal": "18"
              }
            ],
            "beginOrdinal": "4",
            "endOrdinal": "17"
          },
          {
            "index": 2,
            "parentIndex": 1,
            "depth": 1,
            "callType": "DELEGATE",
            "caller": "0x4200000000000000000000000000000000000015",
            "address": "0xc0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d30015",
            "gasLimit": "956917",
            "gasConsumed": "18984",
            "input": "0x015d8eb900000000000000000000000000000000000000000000000000000000010ac03800000000000000000000000000000000000000000000000000000000648a5da3000000000000000000000000000000000000000000000000000000036c55c1de12abd36b698fc225a0a7b895cb61dc803111b48d2cbcc97a45fbeeb9c35e014700000000000000000000000000000000000000000000000000000000000000030000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c900000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000a6fe0",
            "executedCode": true,
            "storageChanges": [
              {
                "address": "0x4200000000000000000000000000000000000015",
                "key": "0x0000000000000000000000000000000000000000000000000000000000000003",
                "oldValue": "0x0000000000000000000000000000000000000000000000000000000000000002",
                "newValue": "0x0000000000000000000000000000000000000000000000000000000000000003",
                "ordinal": "11"
              }
            ],
            "gasChanges": [
              {
                "newValue": "956917",
                "reason": 24,
                "ordinal": "10"
              },
              {
                "oldValue": "937933",
                "reason": 25,
                "ordinal": "12"
              }
            ],
            "beginOrdinal": "9",
            "endOrdinal": "13"
          }
        ]
      }
    ]
  }
}

Saving Output to Files

To save the output of a substreams module to a file, you can redirect the output to a log file:

> substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_transaction_traces --start-block 90 --stop-block +10 > traces.log

For Mac/Linux users, you can also use the script command to capture all terminal output:

> script -q /dev/null substreams run -e base-mainnet.streamingfast.io:443 substreams.yaml map_transaction_traces --start-block 90 --stop-block +10 | tee traces.log

Modules

Execution graph

6 modules
map

map_transactions_filter

`map_filter_transaction` allows you to find a transaction by specifying either `to` or `from` value in the parameters. You might need to scope your search to the blocks you know you are going to find that transaction. Check with your preferred block explorer first.