fetch-source

Installation
SKILL.md

Fetch Source

Fetches verified smart contract source code from Sourcify and Etherscan for any EVM-compatible chain.

Usage

./scripts/fetch_sources.sh -c <chain_id> [-o <output_dir>] <address>

Optional environment variable: ETHERSCAN_API_KEY (enables Etherscan fallback if not found on Sourcify)

What it does

  1. Tries Sourcify first (no API key needed)
  2. Falls back to Etherscan v2 API if not found on Sourcify
  3. Saves all source files under sources_<address>/ (or custom -o dir)

Handles all Etherscan source formats: standard JSON input (with or without extra braces), and single flat files. Detects Vyper vs Solidity by compiler version.

Installs
1
First Seen
Mar 12, 2026