Skip to content

feat(infra): local Blockscout explorer for the run anvil (#31) - #64

Merged
adachi-440 merged 1 commit into
mainfrom
feat/local-blockscout-explorer
Aug 26, 2026
Merged

feat(infra): local Blockscout explorer for the run anvil (#31)#64
adachi-440 merged 1 commit into
mainfrom
feat/local-blockscout-explorer

Conversation

@adachi-440

Copy link
Copy Markdown
Contributor

Closes #31.

What

Stock Blockscout pointed at whichever sim anvil is running, as a thin config set in infra/blockscout/ — official images pinned by tag (blockscout:9.0.2 / frontend:v2.3.5, ground-truthed against ghcr), no Blockscout source vendored or patched. The layout follows the official docker-compose/anvil.yml trimmed to db (postgres 17) / redis / backend / frontend / nginx proxy; stats, visualizer, sig-provider, user-ops-indexer and the NFT media handler are spectator polish rather than debugging value and are dropped.

npm run explorer          # → http://localhost:3100
npm run explorer:reset    # wipe the indexer DB and reindex (after every chain reset)
npm run explorer:tag      # name agent wallets from a run's summary.json
npm run explorer:down

All knobs (RPC port, chain id, explorer port, fork FIRST_BLOCK, image tags) live in infra/blockscout/explorer.env; defaults match local-deploy mode. explorer.sh cross-checks the configured chain id against what the anvil actually reports and refuses to start on a mismatch.

The three points from the issue

  • Chain-reset lifecycleexplorer:reset drops the postgres volume and reindexes from scratch. A resetFork / snapshot-revert rewind is something no indexer can follow, so the wipe is the supported lifecycle, not a workaround. Reindexing a run-sized chain takes well under a minute.
  • Arbitrum-fork caveatETHEREUM_JSONRPC_VARIANT=anvil fetches receipts per transaction (eth_getTransactionReceipt), never eth_getBlockReceipts (known-broken on anvil Arbitrum forks in this project). Archive balance fetching is disabled for the ~1,050-block historical state depth, and FIRST_BLOCK is mandatory in fork mode (without it the indexer walks all of Arbitrum history backwards from the head).
  • Agent wallet namingexplorer:tag reads agents[].{id,address} from a run's summary.json and inserts Blockscout address tags (address_tags / address_to_tags; config-level, no Blockscout change), plus env:deployer for anvil account 0 so environment txs don't read as a participant's. Tags live in the indexer DB and are wiped by reset.

Also disabled the stock frontend's third-party ads (NEXT_PUBLIC_AD_*_PROVIDER=none) — pointless egress on a local explorer. The one remaining egress is contract verification through Blockscout's hosted eth-bytecode-db (names canonical bytecode like Uniswap V3 / Aave without a local verifier); MICROSERVICE_SC_VERIFIER_ENABLED=false turns it off for fully offline use.

Verified

End-to-end against a live anvil (chain 31337): compose up and indexing, frontend rendering checked in a real browser (homepage, tx list, address page), tag badges visible on address pages via API v2 public_tags, and the reset flow (DB wiped, reindexed to head, tags gone). The stale-mix failure mode the reset exists for was also reproduced and cleared by explorer:reset.

Not yet exercised live: fork mode (42161) against a real Arbitrum fork — the config for it is in place per the caveats above and documented in infra/blockscout/README.md.

🤖 Generated with Claude Code

Stock Blockscout pointed at the sim anvil as a thin config set in
infra/blockscout/ - official images pinned by tag, no source vendored
or patched. Follows the official docker-compose/anvil.yml layout
trimmed to db / redis / backend / frontend / nginx proxy (stats,
visualizer, sig-provider, user-ops-indexer and the NFT media handler
are spectator polish, not debugging, and are dropped).

- npm run explorer / explorer:down / explorer:reset / explorer:tag,
  driven by explorer.sh; all knobs (RPC port, chain id, explorer port,
  fork FIRST_BLOCK, image tags) live in explorer.env
- Chain-reset lifecycle: explorer:reset wipes the indexer postgres
  volume and reindexes - a resetFork / snapshot-revert rewind is
  something no indexer can follow, so the wipe is the supported path
- Arbitrum-fork caveat: ETHEREUM_JSONRPC_VARIANT=anvil fetches
  receipts per transaction, never eth_getBlockReceipts (known-broken
  on anvil Arbitrum forks here); archive balance fetching is disabled
  for the ~1,050-block historical state depth, and FIRST_BLOCK is
  mandatory in fork mode
- Agent wallet naming: explorer:tag reads agents[].{id,address} from a
  run's summary.json and inserts Blockscout address tags (plus
  env:deployer for anvil account 0) - config-level, wiped by reset
- Ads disabled (NEXT_PUBLIC_AD_*_PROVIDER=none): pointless third-party
  egress on a local explorer

Verified end-to-end against a live anvil: indexing, frontend
rendering (browser), tag badges on address pages, and the reset flow.
Fork mode (42161) is configured but not yet exercised against a real
fork.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@adachi-440
adachi-440 merged commit fb87b4d into main Aug 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sim] Local Blockscout explorer for run anvil (stock, no fork)

1 participant