- Organized 252 files across project - Root directory: 187 → 2 files (98.9% reduction) - Moved configuration guides to docs/04-configuration/ - Moved troubleshooting guides to docs/09-troubleshooting/ - Moved quick start guides to docs/01-getting-started/ - Moved reports to reports/ directory - Archived temporary files - Generated comprehensive reports and documentation - Created maintenance scripts and guides All files organized according to established standards.
6.2 KiB
6.2 KiB
Blockscout Contract Verification Guide - ChainID 138
Date: $(date)
Purpose: Guide for verifying smart contracts on ChainID 138 using Blockscout
Block Explorer: https://explorer.d-bis.org
Overview
ChainID 138 uses Blockscout (self-hosted) as its block explorer. This guide covers how to verify smart contracts deployed on ChainID 138 using Foundry's verification tools.
Prerequisites
- Foundry installed and configured
- Deployed contracts on ChainID 138
- Access to contract source code and constructor arguments
- Blockscout instance accessible at
https://explorer.d-bis.org
Blockscout Configuration
Block Explorer Information
- URL:
https://explorer.d-bis.org - API Endpoint:
https://explorer.d-bis.org/api - Type: Self-hosted Blockscout
- Chain ID: 138
- API Key: Not required (self-hosted instance)
Verification Methods
Method 1: Using Foundry Script with Verification
When deploying contracts with Foundry, add Blockscout verification flags:
forge script script/YourDeploymentScript.s.sol:YourScript \
--rpc-url https://rpc-core.d-bis.org \
--private-key $PRIVATE_KEY \
--broadcast \
--verify \
--verifier blockscout \
--verifier-url https://explorer.d-bis.org/api \
-vvvv
Method 2: Manual Verification with forge verify-contract
After deployment, verify contracts manually:
forge verify-contract \
<CONTRACT_ADDRESS> \
<CONTRACT_NAME> \
--chain-id 138 \
--rpc-url https://rpc-core.d-bis.org \
--verifier blockscout \
--verifier-url https://explorer.d-bis.org/api \
--constructor-args $(cast abi-encode "constructor(<ARGS>)" <ARG1> <ARG2> ...) \
--compiler-version <VERSION>
Method 3: Using Foundry.toml Configuration
Add Blockscout configuration to foundry.toml:
[etherscan]
chain138 = {
url = "https://explorer.d-bis.org/api",
verifier = "blockscout"
}
Then use:
forge verify-contract \
<CONTRACT_ADDRESS> \
<CONTRACT_NAME> \
--chain chain138 \
--rpc-url https://rpc-core.d-bis.org
Verification Examples
Example 1: Simple Contract (No Constructor Arguments)
forge verify-contract \
0x1234567890123456789012345678901234567890 \
SimpleContract \
--chain-id 138 \
--rpc-url https://rpc-core.d-bis.org \
--verifier blockscout \
--verifier-url https://explorer.d-bis.org/api \
--compiler-version 0.8.20
Example 2: Contract with Constructor Arguments
# First, encode constructor arguments
CONSTRUCTOR_ARGS=$(cast abi-encode "constructor(address,uint256)" \
0x1111111111111111111111111111111111111111 \
1000000000000000000)
# Then verify
forge verify-contract \
0x1234567890123456789012345678901234567890 \
ComplexContract \
--chain-id 138 \
--rpc-url https://rpc-core.d-bis.org \
--verifier blockscout \
--verifier-url https://explorer.d-bis.org/api \
--constructor-args "$CONSTRUCTOR_ARGS" \
--compiler-version 0.8.20
Example 3: Verify with Libraries
If your contract uses libraries, specify them:
forge verify-contract \
<CONTRACT_ADDRESS> \
<CONTRACT_NAME> \
--chain-id 138 \
--rpc-url https://rpc-core.d-bis.org \
--verifier blockscout \
--verifier-url https://explorer.d-bis.org/api \
--libraries <LIBRARY_NAME>:<LIBRARY_ADDRESS> \
--compiler-version <VERSION>
Troubleshooting
Issue: Verification Fails with "Contract Not Found"
Solution:
- Ensure the contract is deployed and confirmed on ChainID 138
- Verify the contract address is correct
- Check that the RPC endpoint is accessible
Issue: "Invalid Source Code"
Solution:
- Ensure compiler version matches the deployment compiler version
- Verify all source files are accessible
- Check that constructor arguments are correctly encoded
Issue: "Already Verified"
Solution:
- The contract is already verified on Blockscout
- Check the contract on the explorer:
https://explorer.d-bis.org/address/<CONTRACT_ADDRESS>
Issue: Blockscout API Timeout
Solution:
- Check if Blockscout instance is running and accessible
- Verify network connectivity to
https://explorer.d-bis.org - Try again after a few moments (Blockscout may be indexing)
Manual Verification via Blockscout UI
If automated verification fails, you can verify contracts manually through the Blockscout web interface:
- Navigate to the contract address:
https://explorer.d-bis.org/address/<CONTRACT_ADDRESS> - Click on "Verify & Publish" tab
- Select verification method:
- Via Standard JSON Input (recommended)
- Via Sourcify
- Via Multi-file
- Upload contract source code and metadata
- Provide constructor arguments (if any)
- Submit for verification
Verification Best Practices
- Verify Immediately After Deployment: Verify contracts right after deployment while deployment details are fresh
- Use Standard JSON Input: Most reliable method for complex contracts
- Document Constructor Arguments: Keep a record of constructor arguments used during deployment
- Test Verification Locally: Test your verification command before deploying to production
- Keep Source Code Organized: Maintain clean source code structure for easier verification
Related Documentation
- Block Explorer:
https://explorer.d-bis.org - RPC Endpoint:
https://rpc-core.d-bis.org - API Keys Documentation: See
docs/CROSS_CHAIN_BRIDGE_ADDRESSES.md - Contract Deployment Guide: See
docs/CONTRACT_DEPLOYMENT_GUIDE.md
Quick Reference
Blockscout API Endpoints
- API Base URL:
https://explorer.d-bis.org/api - Contract Verification:
POST /api/v2/smart-contracts/<ADDRESS>/verification - Contract Info:
GET /api/v2/smart-contracts/<ADDRESS>
Common Verification Flags
--verifier blockscout # Use Blockscout verifier
--verifier-url https://explorer.d-bis.org/api # Blockscout API URL
--chain-id 138 # Chain ID 138
--compiler-version 0.8.20 # Solidity compiler version
--constructor-args <ENCODED_ARGS> # Encoded constructor arguments
--libraries <LIB>:<ADDR> # Library addresses
Last Updated: $(date)
Status: ✅ Ready for use with ChainID 138