feat: add Blockscout platform, support all 700+ Blockscout chains, shared explorer utilities.#665
Open
thevolcanomanishere wants to merge 9 commits intocrytic:masterfrom
Open
Conversation
- Add new `Blockscout` platform (`platform/blockscout.py`) that fetches verified contracts from Blockscout-based explorers using the same `chain:0xAddress` target syntax as Etherscan. Supports Flow, Ink, Metis, Plume, and Story chains out of the box. - Add `_normalize_blockscout_result` to translate Blockscout's API field conventions (e.g. `"true"`/`"false"` OptimizationUsed, split AdditionalSources) into Etherscan-compatible format so the existing compilation pipeline works unchanged. - Extract shared block-explorer helpers into `platform/explorer_utils.py` (`handle_bytecode`, `handle_single_file`, `handle_multiple_files`, `sanitize_remappings`, `convert_version`, `EXPLORER_BASE_BYTECODE`). Etherscan and Sourcify now import from this module instead of having private copies. `ETHERSCAN_BASE_BYTECODE` kept as a backwards-compat alias. - Add `Type.BLOCKSCOUT = 14` to the platform type enum. - Add Monad mainnet (`"monad"`, chain ID 143) to SUPPORTED_NETWORK_V2. - Add CI integration tests for five Blockscout chains in `scripts/ci_test_etherscan.sh` (no API key required). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…back - Rename `--etherscan-only-source-code`, `--etherscan-only-bytecode`, `--etherscan-export-directory` to `--explorer-*` equivalents so they apply cleanly to all block explorer platforms (Etherscan, Blockscout). Add `--explorer-ignore` flag (was previously undocumented/unconfigured). Rename CLI group from "Etherscan options" to "Block explorer options". - Each platform now defaults to its own export subdirectory name: `etherscan-contracts`, `blockscout-contracts`, `sourcify-contracts`. `--explorer-export-directory` overrides the default for all of them. - Add `try_compile_from_sourcify()` helper to sourcify.py. Blockscout's compile() now tries Sourcify first for each chain; if the contract is verified there (e.g. Metis chain 1088), it compiles via Sourcify for richer metadata. Falls back to Blockscout silently on 404 or unsupported chain. - Add chain IDs to SUPPORTED_NETWORK_BLOCKSCOUT for Sourcify lookup. - Update stale bzzr1 hash in test_metadata.py. - Add .env and crytic-export/ to .gitignore. - Update README to list Blockscout as a supported platform. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
elopez
reviewed
Mar 6, 2026
elopez
reviewed
Mar 9, 2026
elopez
reviewed
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Blockscoutplatform (platform/blockscout.py) — fetches verified contracts from Blockscout-based block explorers using theblockscout-<chainid>:0xAddresstarget syntax. Supports all 700+ Blockscout-indexed chains via dynamic discovery from the Blockscout chain directory API, with hardcoded overrides for chains not yet in the directory (e.g. Flow, Plume).--blockscout-urlflag for targeting self-hosted or unlisted Blockscout instances.platform/explorer_utils.py) — extracts helpers previously private toetherscan.py(handle_bytecode,handle_single_file,handle_multiple_files,sanitize_remappings,convert_version) into a common module reused by Etherscan, Sourcify, and Blockscout."true"/"false"vs"1"/"0", separateAdditionalSourcesarray) into Etherscan-compatible conventions so the existing compilation pipeline works unchanged.--etherscan-only-source-code,--etherscan-only-bytecode,--etherscan-export-directoryto--explorer-*equivalents so they apply to all block explorer platforms.Type.BLOCKSCOUT = 14added to the platform type enum.scripts/ci_test_blockscout.sh.