Introduction to OKLink's Contract Verification Tools
OKLink provides comprehensive API solutions for blockchain developers, including:
- Address and token authorization details
- Domain risk assessment
- Transaction broadcasting and chain confirmation
- Proxy and standard contract verification
- Contract source code validation
👉 Explore OKLink's full API suite
Why Verify Smart Contract Source Code?
Contract verification is crucial for:
- Project transparency
- User trust building
- Security auditing
- Compliance with open-source standards
OKLink's verification module supports:
- Source code submission for contract validation
- Proxy contract verification
- Retrieval of verified contract ABI and source code
Contract Source Code Verification
How It Works
Upload your Solidity/Vyper source code to OKLink's browser. Our system:
- Compiles your code
- Matches the bytecode with blockchain-stored bytecode
- Displays verified code on the contract page
Average processing time: 30-60 seconds
API Endpoint
POST /api/v5/explorer/contract/verify-source-codeRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chainShortName | String | Yes | Blockchain identifier (e.g., "ETH") |
contractAddress | String | Yes | Target contract address |
contractName | String | Yes | Name of contract |
sourceCode | String | Yes | Flattened source code |
codeFormat | String | Yes | solidity-single-file / solidity-standard-json-input / Vyper |
compilerVersion | String | Conditional | Compiler version string |
optimization | String | Conditional | 0 (none) or 1 (enabled) |
Example Request
{
"chainShortName": "ETH",
"contractAddress": "0x9Dca580D2c8B8e19e9d77345a5b4C2820B25b386",
"contractName": "HelloWorld",
"sourceCode": "pragma solidity ^0.7.6;↵contract HelloWorl {↵ string public greet = 'Hello Worl!';↵}",
"codeFormat": "solidity-single-file",
"compilerVersion": "v0.7.6+commit.7338295f",
"optimization": "1"
}Response
{"data": ["eb5c06099d3841359d398541166343fe"]}Checking Verification Status
Use the returned GUID to check verification results.
API Endpoint
POST /api/v5/explorer/contract/check-verify-resultStatus Responses
Success: Verification passedFail: Verification failedPending: Verification in progress
Proxy Contract Verification
Verify proxy contracts and their implementation addresses.
API Endpoint
POST /api/v5/explorer/contract/verify-proxy-contractSuccessful Verification Response
Returns implementation contract address
Retrieving Verified Contract Information
Access ABI, source code, and metadata for verified contracts.
API Endpoint
GET /api/v5/explorer/contract/verify-contract-infoReturned Data Includes:
- Source code
- Compiler version
- Optimization settings
- ABI
- Proxy status (if applicable)
Third-Party Tool Integration
Hardhat Verification (Recommended)
Install plugin:
npm install @okxweb3/hardhat-explorer-verify
👉 Complete Hardhat setup guide
Sample configuration:
okxweb3explorer: { apiKey: "YOUR_API_KEY", customChains: [{ network: "ETH", chainId: 1, urls: { apiURL: "https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/ETH", browserURL: "https://www.oklink.com" } }] }
Foundry Verification
forge verify-contract \
src/MyToken.sol:MyToken \
--verifier oklink \
--verifier-url https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/eth \
--api-key YOUR_API_KEYTruffle Verification
oklinkVerify: {
apiUrl: 'https://www.oklink.com/api/v5/explorer/contract/verify-source-code-plugin/eth@truffle',
apiKey: 'YOUR_API_KEY',
explorerUrl: 'https://www.oklink.com/'
}Supported Blockchains
OKLink supports verification on 20+ chains including:
- ETH, BSC, Polygon
- Avalanche, Fantom, Optimism
- Arbitrum, Base, Scroll
- Testnets: Goerli, Sepolia, Mumbai
FAQ
Q: How long does contract verification take?
A: Typically 30-60 seconds for standard contracts.
Q: Can I verify proxy contracts?
A: Yes, OKLink supports full proxy contract verification.
Q: What if my contract uses imports?
A: Flatten your contract first using tools like Solidity Flattery.
Q: Is there a cost for API usage?
A: Basic verification endpoints currently consume 0 points.
Q: How do I get an API key?
A: Request one in your OKLink account dashboard.
Q: Can I verify Vyper contracts?
A: Yes, set codeFormat to "Vyper" in your request.