Skip to content

mamolas/contract-downloader-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

📦 Smart Contract Downloader (Simple)

Zero dependencies. Zero build tools. Just open and use.

A single HTML file that downloads verified smart contract source code from 50+ blockchain explorers using the Etherscan API V2.

⚡ Features

  • Single File: Just one index.html - no npm, no webpack, no mess
  • Zero Setup: Open in browser and it works
  • 50+ Chains: Ethereum, BSC, Polygon, Arbitrum, Optimism, Base, Avalanche, and more
  • ZIP Download: Gets all contract files bundled with metadata
  • API V2: Uses the latest Etherscan unified API
  • One API Key: Single key works across all supported chains

🚀 Quick Start

Option 1: Use Online (Easiest)

Just visit: https://mamolas.github.io/contract-downloader-simple

Option 2: Download and Run Locally

# Download the file
wget https://raw.githubusercontent.com/mamolas/contract-downloader-simple/main/index.html

# Open in browser
open index.html  # macOS
xdg-open index.html  # Linux
start index.html  # Windows

Or just download index.html and double-click it!

🔑 Get Your API Key

  1. Go to Etherscan.io and create a free account
  2. Navigate to API Keys
  3. Create a new API key
  4. Copy and paste it into the form

That's it! One key works for all 50+ supported chains.

🌐 Supported Networks

Preset Networks

  • Ethereum Mainnet (Chain ID: 1)
  • BNB Smart Chain (Chain ID: 56)
  • Polygon (Chain ID: 137)
  • Base (Chain ID: 8453)
  • Arbitrum One (Chain ID: 42161)
  • Optimism (Chain ID: 10)
  • Avalanche C-Chain (Chain ID: 43114)
  • Linea (Chain ID: 59144)
  • Blast (Chain ID: 81457)

Custom Chain

Select "Custom Chain ID" from the dropdown and enter any chain ID:

  • Scroll: 534352
  • Mantle: 5000
  • Gnosis: 100
  • Moonbeam: 1284
  • Celo: 42220
  • Sonic: 146
  • And 40+ more!

📖 Full list: Etherscan Supported Chains

📝 How It Works

  1. Enter your Etherscan API key
  2. Select the blockchain network (or enter custom chain ID)
  3. Paste the contract address
  4. Click "Download Contract"
  5. Get a ZIP file with:
    • All contract source files (.sol)
    • Complete metadata (compiler version, optimization settings, etc.)

📦 What's in the ZIP?

The downloaded ZIP contains:

  • Source Code Files: All .sol files from the contract
  • metadata.json: Complete contract information including:
    • Contract name and address
    • Compiler version
    • Optimization settings
    • Constructor arguments
    • License type
    • Proxy/implementation details (if applicable)

👀 Example Usage

Download USDC on Ethereum

  • Network: Ethereum Mainnet
  • Address: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48

Download USDC on Polygon

  • Network: Polygon
  • Address: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174

Download on Scroll (Custom Chain)

  • Network: Custom Chain ID → 534352
  • Address: Your contract address

❓ FAQ

Does this work offline?

No, it needs internet to call the Etherscan API. But the HTML file itself is completely standalone.

Do I need Node.js or npm?

Nope! Just a web browser.

Does it work with private/unverified contracts?

No, the contract must be verified on the blockchain explorer.

Is my API key safe?

Yes, everything runs in your browser. Your API key never touches any server except Etherscan's.

What about rate limits?

Free Etherscan API keys have 5 calls/second limit. This tool makes 1 call per download.

🛠️ Technical Details

  • Pure HTML/CSS/JavaScript: No frameworks, no build process
  • Only External Dependency: JSZip CDN (for creating ZIP files)
  • File Size: ~13KB total
  • Browser Support: Any modern browser (Chrome, Firefox, Safari, Edge)
  • API: Etherscan API V2 unified endpoint

🔗 Comparison with the Old Version

Feature Old (Next.js) New (Simple)
Dependencies 15+ packages 1 CDN
File Size ~50MB 13KB
Setup Time 5-10 min 0 seconds
Build Required Yes No
npm audit issues Many None
Works Offline No No*

*Both need internet for API calls

🐛 Known Limitations

  • CORS: Must use browser, not command-line curl
  • Large contracts (100+ files) may take a few seconds to ZIP
  • No batch download (one contract at a time)

📚 Resources

🤝 Contributing

Found a bug? Have a suggestion?

  1. Open an issue
  2. Or submit a PR (it's just one file!)

📜 License

MIT - Use it however you want!

⭐ Star This Repo

If you find this useful, give it a star! ⭐


Made with 💜 for developers who prefer simplicity over complexity.

About

Single-file smart contract downloader using Etherscan API V2 - no dependencies, no build tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages