evm_get_contract_abi
Fetches a verified smart contract's ABI from a chain's block explorer to enable function calls and transaction decoding, or returns manual retrieval steps when API access is unavailable.
Instructions
Get contract ABI from block explorer API or provide guidance on manual retrieval (placeholder implementation).
Attempts to fetch contract ABI automatically from block explorer. For verified contracts, returns full ABI including all functions, events, and data structures. Currently provides guidance for manual retrieval.
CRITICAL RULES:
Only works for verified contracts on block explorer
Unverified contracts don't expose ABI publicly
Some explorers require API keys for programmatic access
Manual retrieval often more reliable than API
ABI is critical for all contract interactions
This is PLACEHOLDER - may return retrieval guidance instead of ABI
PARAMETERS:
chain: EVM chain where contract is deployed (required)
Each chain has different block explorer
API access varies by explorer
contractAddress: Smart contract address (required)
Format: 0x followed by 40 hex characters
Contract must be verified on block explorer
Examples: DEX routers, token contracts, NFT collections
EXAMPLES: ✅ Get ABI for verified USDC on Polygon: {chain: "polygon", contractAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}
✅ Get ABI for Uniswap Router on Ethereum: {chain: "ethereum", contractAddress: "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"}
✅ Get ABI for verified custom contract (BSC): {chain: "bsc", contractAddress: "0xCustomContract..."}
❌ Invalid - unverified contract: {contractAddress: "0xUnverified..."} // ABI not available
❌ Invalid - wrong chain: {chain: "polygon", contractAddress: "0xEthereumOnly..."} // Contract not on Polygon
SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559
CRITICAL GAS CONSIDERATIONS:
Ethereum: High gas costs, use gas oracle for timing
Polygon/BSC: Very low gas, safe for frequent transactions
Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum
Avalanche: Dynamic fees, can spike during congestion
Always check gas price before executing transactions
TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.
OUTPUT STRUCTURE: • success: Boolean indicating retrieval success • chain: Chain queried • contractAddress: Contract address • abi: Contract ABI (JSON array) if available • verified: Boolean indicating if contract is verified • retrievalMethod: How ABI was obtained (api/manual) • blockExplorerUrl: URL to view contract on explorer • manualInstructions: Steps for manual ABI retrieval • executionTime: Time taken in milliseconds
COMMON MISTAKES:
Trying to get ABI for unverified contracts
Using wrong block explorer for chain
Not having API key for explorer (if required)
Confusing contract address with implementation address (proxies)
USE CASES:
Get ABI before calling contract functions
Explore contract interface and capabilities
Verify contract functionality matches documentation
Decode transaction data
Build UI for contract interaction
BLOCK EXPLORERS BY CHAIN:
Ethereum Sepolia: sepolia.etherscan.io
Polygon Amoy: amoy.polygonscan.com
Avalanche Fuji: testnet.snowtrace.io
BSC Testnet: testnet.bscscan.com
Arbitrum Sepolia: sepolia.arbiscan.io
Base Sepolia: sepolia.basescan.org
World Chain: worldchain.explorer.io
MANUAL ABI RETRIEVAL STEPS:
Go to block explorer for your chain
Enter contract address in search bar
Navigate to "Contract" tab
Look for "Contract ABI" section (verified contracts only)
Copy ABI JSON array
Use in evm_call_contract or evm_send_contract_transaction
VERIFICATION STATUS: Verified contracts show:
✅ Green checkmark on explorer
Source code tab available
Contract ABI visible
Compiler settings shown
Contract name displayed
Unverified contracts show:
❌ No verification badge
Only bytecode visible
No ABI available
Must get ABI from project docs
PROXY CONTRACTS: For proxy patterns (common in upgradeable contracts):
Get ABI from implementation contract, not proxy
Proxy address for transactions
Implementation ABI for function calls
Explorer often detects and shows both
ALTERNATIVE ABI SOURCES:
Project GitHub repository
Project documentation
npm packages (@uniswap/v2-core)
Etherscan "Read/Write Contract" tab
Contract deployment transaction logs
COMMON CONTRACT ABIS: Standard interfaces often available in libraries:
ERC20: @openzeppelin/contracts
ERC721: @openzeppelin/contracts
ERC1155: @openzeppelin/contracts
Uniswap V2: @uniswap/v2-core
Uniswap V3: @uniswap/v3-core
API KEY REQUIREMENTS: Some explorers require API keys:
Etherscan: Free tier available
PolygonScan: Free tier available
BSCScan: Free tier available
Others: Check explorer docs
PLACEHOLDER NOTE: This tool currently provides guidance for manual retrieval. Full API integration coming in future updates. For now, use manual retrieval from block explorer.
Running on Linux.
LINUX-SPECIFIC NOTES:
Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)
Python 3 is typically 'python3' command
GNU tools are standard
Use 'xdg-open' command to open files/applications
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chain": "<chain>",
"contractAddress": "<contractAddress>"
},
"name": "evm_get_contract_abi"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | EVM chain to query | |
| contractAddress | Yes | Smart contract address (0x...) |