Quickstart
Substreams is a streaming-first blockchain indexing engine. Pick a network, plug your PINAX_KEY into the CLI or graph-node TOML provider, and stream transformed blocks as the chain produces them, or backfill history in parallel.
1# Set your API Key2export SUBSTREAMS_API_KEY=YOUR_API_KEY34# Run Substreams5substreams run -e eth.substreams.pinax.network:443 blocks@v1.0.0 map_blocks -s -10
Parallel workers
In production mode, Substreams splits a historical block range across parallel workers. The number of workers a stream gets depends on your plan:
- Free: 5 workers per stream, fixed (the header below is ignored), and at most 10 across all of your team's concurrent streams.
- Pro: 15 workers per stream by default, up to 50 per stream when you ask for more with the header below. The 50 is a pool shared by all of your team's concurrent streams, not 50 per stream.
- Enterprise: set per contract.
To request more workers, send the X-Substreams-Parallel-Workers header. A value above your plan's maximum is lowered to the maximum.
1substreams run -e <network>.substreams.pinax.network:443 ... \2 --production-mode \3 -H "X-Substreams-Parallel-Workers: 50"
To check what you got, read max_parallel_workers in the session's SessionInit message; the CLI logs it when run with DLOG=info.
More workers do not speed up every module equally. A simple map module processed about 9× as many blocks in the same time with 50 workers as with 5; modules with stores gain less.
Reliability and reorgs
Every BlockScopedData message carries a cursor and a final_block_height. Save the cursor in the same transaction as the data you wrote for that block, and pass it back as start_cursor (CLI: --cursor) to resume exactly after it, with nothing skipped or repeated.
final_blocks_only: false(default)- Blocks arrive as soon as they are produced. On a reorganization you receive a
BlockUndoSignal: delete everything abovelast_valid_blockand savelast_valid_cursor, again in one transaction. final_blocks_only: true- Only final blocks are sent and no undo signal ever arrives, at the cost of waiting for the chain's finality (see Per-chain notes).
1# Resume from the cursor saved with the last block you processed2substreams run -e <network>.substreams.pinax.network:443 <package> <module> \3 --production-mode \4 --cursor "$(cat cursor.txt)"
Data at or below final_block_height will never be undone. The official sinks (SQL, files, webhooks and others) store the cursor and handle undo signals for you, so most pipelines do not implement this by hand.
Per-chain notes
Every endpoint serves the chain from the earliest block below to the head. EVM data is either extended (from an instrumented node: call traces, balance and storage changes) or base (rebuilt from JSON-RPC: transactions, receipts and logs only); see Base vs Extended blocks. “Final when” says when a new block near the head becomes final and can no longer be undone. Older history is already final, including the base-tier history of chains that later moved to extended blocks.
| Network | Data | Earliest block | Final when | Block schema |
|---|---|---|---|---|
eth | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
solana | Native block | 0 | Sent at confirmed, final at finalized | firehose-solana |
bsc | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
base | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
polygon | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
optimism | Extended from 105,235,064 (base before) | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
arbone | Extended from 22,207,818 (base before) | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
avalanche | Base | 0 | 200 blocks behind head | firehose-ethereum |
unichain | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
arc | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
bitcoin | Native block | 0 | 6 blocks behind head | firehose-bitcoin |
celo | Base | 0 | 200 blocks behind head | firehose-ethereum |
eos | Native block | 2 | Chain's last irreversible block | firehose-antelope |
hyperevm | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
ink | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
linea | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
litecoin | Native block | 0 | 6 blocks behind head | firehose-bitcoin |
megaeth | Base | 0 | 200 blocks behind head | firehose-ethereum |
robinhood | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
soneium | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
tempo | Base | 0 | 200 blocks behind head | firehose-ethereum |
wax | Native block | 2 | Chain's last irreversible block | firehose-antelope |
xlayer | Base | 0 | 200 blocks behind head | firehose-ethereum |
zksyncera | Base | 0 | 200 blocks behind head | firehose-ethereum |
zora | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
amoy | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
arbsepolia | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
basesepolia | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
chapel | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
eth-cl | Native block | 0 | Finalized checkpoint | firehose-beacon |
gnosis-cl | Native block | 0 | Finalized checkpoint | firehose-beacon |
hoodi | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
hoodi-cl | Native block | 0 | Finalized checkpoint | firehose-beacon |
jungle4 | Native block | 2 | Chain's last irreversible block | firehose-antelope |
lineasepolia | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
minato | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
opsepolia | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
sepolia | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
sepolia-cl | Native block | 0 | Finalized checkpoint | firehose-beacon |
soldev | Native block | 391,843,999 | Sent at confirmed, final at finalized | firehose-solana |
unisepolia | Extended | 0 | Node's finalized block (≤ 200 behind head) | firehose-ethereum |
waxtest | Native block | 2 | Chain's last irreversible block | firehose-antelope |
Use the finality the stream sends with each block (Firehose metadata.lib_num, Substreams final_block_height) rather than hard-coding a depth: it is the stream's own statement of finality and follows the rules above. Solana slot numbers skip slots that produced no block, so gaps in slot numbers are normal there.
Gaps and integrity
Blocks are delivered in order, and blocks are hash-linked to their parents. To check continuity, compare each new block's parent hash with the hash of the block before it; they match unless an undo arrived in between. A mismatch means the client missed a message, not that the chain skipped one; reconnect from the last cursor you saved.
A Substreams response does not carry the parent hash: clock gives only the block's own number, hash and timestamp. To check continuity, include the parent hash in your module's output. final_block_height is the last irreversible block when the response was sent.
Latency
With final_blocks_only: false, live blocks are pushed as soon as the chain produces them; there is no polling interval on your side. With final_blocks_only: true, each block arrives only once it is final, so add the chain's finality delay (see Per-chain notes). End-to-end delay (chain tip to your client) also depends on the chain's block time, your network path and, for Substreams, your modules. Measure it from each block's timestamp in your own deployment. There is no latency SLA: the Free plan is best effort, and service levels for Enterprise are set in the contract.
Billing
- Processed blocks: each block your modules actually execute, including parallel back-processing of history. Blocks whose module outputs are served from cache are not counted.
- Egress: the size of the messages sent to your client, measured as uncompressed protobuf before gRPC compression.
- Free: when the included usage for the calendar month is used up, new requests are rejected and open streams are closed (checked about once a minute) until the next month starts, or until you upgrade.
- Pro: usage beyond the included amount is added to your next invoice. Team owners can set a spending cap under Team settings → Usage limits; once it is reached, requests are rejected the same way.
The usage page shows a warning once you pass half of your limit. Usage totals can lag by a few minutes. Rates and included usage per plan are on the pricing page.
Errors and limits
| gRPC status | Message | Meaning and fix |
|---|---|---|
UNAUTHENTICATED | invalid api key | The key is mistyped or deleted. Check it on the API keys page. Do not retry. |
UNAUTHENTICATED | no authorization token found | No key was sent. Firehose reads it from the X-Api-Key metadata; Substreams from SUBSTREAMS_API_KEY or X-Api-Key. Do not retry. |
PERMISSION_DENIED | api key not found | The key was deleted while the stream was open, so the stream was closed. Reconnect with a current key from your last cursor. |
PERMISSION_DENIED | (varies) | The key is valid but not allowed to use this stream. Check which project and plan the key belongs to; retrying with the same key will not help. |
RESOURCE_EXHAUSTED | you have reached the limit of N credits as part of your "<plan>" subscription plan… | Usage for the month reached the Free allowance or your team's spending cap (ErrorInfo reason CUSTOMER_CREDIT_EXHAUSTED). Upgrade or raise the cap; do not retry until then. |
RESOURCE_EXHAUSTED | Concurrent stream limit exceeded (active sessions: N/N) | Your team has too many streams open (Free: 10). Close one, then retry. |
UNAVAILABLE | service under heavy load, please try connecting again | Temporary. Reconnect with backoff from your last cursor. |
UNAVAILABLE · INTERNAL · connection reset | (varies) | Network or server interruption. Reconnect with backoff from your last cursor. |
Retry pattern: retry only interruptions (UNAVAILABLE, INTERNAL, dropped connections), with exponential backoff, for example from 1 second doubling to a 30-second cap. Always reconnect with the last cursor you saved, so no block is skipped or processed twice. Authentication and credit errors do not clear on retry.
Limits: there is no request-rate limit on Substreams streams; usage is bounded by your plan's credits, by concurrent streams per team and by parallel workers (above).