evm_call_contract
Call read-only smart contract view/pure functions to query on-chain state without gas fees or transactions. Use it to fetch token balances, DEX reserves, NFT owners, and other contract data.
Instructions
Call a smart contract view/pure function for read-only access (no gas cost, no state changes).
Executes contract function locally without broadcasting transaction. Used to query contract state, read data, or simulate operations. No blockchain state modifications - perfect for getting information.
CRITICAL RULES:
Only works with view/pure functions (read-only)
NO gas cost (local execution)
Does NOT modify blockchain state
Requires contract ABI to understand function interface
Parameters must match function signature exactly
Returns data immediately (no transaction confirmation needed)
PARAMETERS:
chain: EVM chain where contract is deployed (required)
Contract must exist on specified chain
Different chains may have different contract instances
contractAddress: Smart contract address (required)
Format: 0x followed by 40 hex characters
Must be deployed contract
Examples: DEX routers, NFT contracts, lending pools
abi: Contract Application Binary Interface (required)
JSON array defining contract interface
Get from block explorer (verified contracts)
Defines function names, parameters, return types
Example: [{"name":"balanceOf","inputs":[...],"outputs":[...]}]
functionName: Name of function to call (required)
Must be view or pure function
Exact name as defined in contract
Case-sensitive (balanceOf ≠ BalanceOf)
Examples: "balanceOf", "totalSupply", "getReserves"
params: Function parameters array (optional)
Must match function signature order
Correct types: addresses as strings, numbers as strings
Empty array [] if function takes no parameters
Examples: ["0x742d35..."], ["100", "200"], []
EXAMPLES: ✅ Check token balance (ERC20 balanceOf): {chain: "polygon", contractAddress: "0x2791Bca...", abi: [...ERC20_ABI], functionName: "balanceOf", params: ["0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"]}
✅ Get DEX pool reserves: {chain: "arbitrum", contractAddress: "0xPairAddress...", abi: [...], functionName: "getReserves", params: []}
✅ Check NFT owner: {chain: "ethereum", contractAddress: "0xNFT...", abi: [...ERC721_ABI], functionName: "ownerOf", params: ["1"]}
❌ Invalid - trying to call write function: {functionName: "transfer"} // transfer modifies state, use evm_send_contract_transaction
❌ Invalid - wrong parameter count: {functionName: "balanceOf", params: []} // balanceOf requires address parameter
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 call success • chain: Chain queried • contractAddress: Contract called • functionName: Function executed • result: Return value(s) from function (decoded) • resultRaw: Raw hex-encoded return data • executionTime: Time taken in milliseconds
COMMON MISTAKES:
Using with write functions (will fail - use evm_send_contract_transaction)
Wrong parameter types (address as number, etc.)
Missing required parameters
Wrong ABI (function signature doesn't match)
Incorrect parameter order
Not handling complex return types (tuples, arrays)
USE CASES:
Query token balances without transactions
Get DEX prices and reserves
Check NFT ownership and metadata URIs
Read lending protocol rates
Verify contract state before writing
Simulate operations locally
VIEW/PURE FUNCTIONS:
view: Reads blockchain state (storage, balance, etc.)
pure: No state access (pure computation)
Both execute locally (no gas, no transaction)
Common examples:
balanceOf(address) - token balance
totalSupply() - total tokens
getReserves() - DEX reserves
ownerOf(uint256) - NFT owner
GETTING CONTRACT ABI:
Etherscan/PolygonScan - verified contracts show ABI
Block explorer "Contract" tab
Project GitHub repository
npm packages for common contracts (@uniswap/v2-core)
ABI EXAMPLES: ERC20 balanceOf ABI: [{ "name": "balanceOf", "type": "function", "stateMutability": "view", "inputs": [{"name": "account", "type": "address"}], "outputs": [{"name": "balance", "type": "uint256"}] }]
RETURN VALUE TYPES:
Single value: Returned directly
Multiple values: Returned as array
Struct/tuple: Returned as object
Array: Returned as array
BigNumber strings for large numbers
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>",
"abi": "<abi>",
"functionName": "<functionName>"
},
"name": "evm_call_contract"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| abi | Yes | Contract ABI (JSON array) | |
| chain | Yes | EVM chain to query | |
| params | No | Function parameters (optional) | |
| functionName | Yes | Function name to call | |
| contractAddress | Yes | Smart contract address (0x...) |