Verify Smart Contracts
After deploying your smart contracts to SKALE, it’s important to verify them on the block explorer. Verification makes your contract source code publicly available, allowing users to interact with your contract with confidence and enabling better transparency.Prerequisites
- A deployed smart contract on SKALE
- The source code and constructor arguments used for deployment
- Foundry or Hardhat installed (depending on your deployment method)
Verification Methods
Using Foundry
Foundry provides a built-in verification command that works with Blockscout (the explorer used by SKALE).Basic Verification
Verification with Constructor Arguments
If your contract has constructor arguments:Verification with Libraries
If your contract uses libraries (like OpenZeppelin):Using Hardhat
Hardhat also supports contract verification through the@nomicfoundation/hardhat-verify plugin.
Basic Verification
Verification with Constructor Arguments
Configuration
Ensure yourhardhat.config.js includes the verify plugin configuration:
Verifying ERC-20 Tokens
Example: Verify ERC-20 Token
Verifying ERC-721 Tokens
Example: Verify ERC-721 Token
Verifying ERC-1155 Tokens
Example: Verify ERC-1155 Token
Finding Your Block Explorer URL
Each SKALE Chain has its own block explorer. To find your chain’s explorer URL:- Visit the SKALE Portal
- Select your chain
- Find the “Explorer” link or API endpoint
- Testnet:
https://<chain-name>.explorer.testnet.skalenodes.com/api - Mainnet:
https://<chain-name>.explorer.mainnet.skalenodes.com/api
Troubleshooting
Contract Already Verified
If you see “Contract is already verified”, the contract has been successfully verified previously.Verification Failed
Common issues and solutions:- Wrong Constructor Arguments: Double-check your constructor arguments
- Compiler Version Mismatch: Ensure you’re using the same Solidity version
- Optimization Settings: Match your compiler optimization settings
- Library Addresses: Verify all library addresses are correct
Manual Verification
If automated verification fails, you can manually verify:- Go to your contract’s page on the block explorer
- Click “Verify and Publish”
- Fill in the contract details manually
- Paste your source code
Best Practices
- Verify Immediately: Verify contracts right after deployment
- Save Constructor Args: Keep a record of constructor arguments
- Use Version Control: Commit your source code for reference
- Test Verification: Test verification on testnet before mainnet
