Files

59 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

# Forge Verification Proxy
**Purpose:** Bridges Forge's Etherscan-style `verify-contract` to Blockscout (Chain 138).
**Problem:** Forge sends JSON body only; Blockscout's Etherscan API expects `module` and `action` in the query string. Direct calls fail with "Params 'module' and 'action' are required parameters".
**Solution:** This proxy accepts Forge's POST, adds `?module=contract&action=verifysourcecode`, forwards to Blockscout, and falls back to Blockscout v2 API if needed.
---
## Usage
**Preferred: orchestrated script (starts proxy if needed):**
```bash
source smom-dbis-138/.env 2>/dev/null
./scripts/verify/run-contract-verification-with-proxy.sh
```
**Manual (proxy + verify):**
```bash
# 1. Start the proxy (from project root)
BLOCKSCOUT_URL=http://192.168.11.140:4000 node forge-verification-proxy/server.js
# 2. Verify via proxy (script defaults to http://127.0.0.1:3080/)
./scripts/verify-contracts-blockscout.sh
# Or from another host:
BLOCKSCOUT_URL=http://192.168.11.140:4000 node forge-verification-proxy/server.js
# Then: FORGE_VERIFIER_URL="http://192.168.11.140:3080/" ./scripts/verify-contracts-blockscout.sh
```
**Direct Forge:**
```bash
forge verify-contract <ADDR> <PATH> \
--chain-id 138 \
--verifier blockscout \
--verifier-url "http://<proxy-host>:3080/" \
--rpc-url "http://192.168.11.211:8545"
```
---
## Environment
| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | 3080 | Proxy listen port |
| `BLOCKSCOUT_URL` | http://192.168.11.140:4000 | Blockscout API base URL (IP:port) |
---
## Related
- [scripts/verify/run-contract-verification-with-proxy.sh](../scripts/verify/run-contract-verification-with-proxy.sh) — Orchestrated script (starts proxy if needed)
- [scripts/verify-contracts-blockscout.sh](../scripts/verify-contracts-blockscout.sh) — Verification script (called by orchestrated script)
- [docs/03-deployment/BLOCKSCOUT_FORGE_VERIFICATION_EVALUATION.md](../docs/03-deployment/BLOCKSCOUT_FORGE_VERIFICATION_EVALUATION.md) — Evaluation and design
- [docs/03-deployment/BLOCKSCOUT_FIX_RUNBOOK.md](../docs/03-deployment/BLOCKSCOUT_FIX_RUNBOOK.md) — Blockscout troubleshooting