evm_decode_contract_data
Decode raw EVM transaction input data using a contract ABI to reveal the called function and parameters for debugging, auditing, or verifying contract interactions.
Instructions
Decode transaction input data to understand what function was called and with what parameters.
Takes raw hex transaction data and ABI to decode function name and parameters. Essential for understanding transactions on block explorers, auditing contract interactions, and debugging failed transactions.
CRITICAL RULES:
Requires correct ABI for contract being decoded
Data must start with function selector (first 4 bytes)
Parameters decoded based on ABI parameter types
Decoding only works if ABI matches contract
Complex types (tuples, arrays) properly structured in output
PARAMETERS:
chain: EVM chain context (required)
Used for context, doesn't affect decoding
Helps identify which chain's transaction
abi: Contract ABI (required)
Must include function being decoded
Function selector computed from signature
All parameter types must be defined
Get from block explorer or project docs
data: Transaction input data to decode (required)
Format: 0x followed by hex characters
First 4 bytes: function selector
Remaining bytes: encoded parameters
Get from transaction details on block explorer
EXAMPLES: ✅ Decode ERC20 transfer transaction: {chain: "polygon", abi: [...ERC20_ABI], data: "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f0beb0000000000000000000000000000000000000000000000000de0b6b3a7640000"}
✅ Decode DEX swap transaction: {chain: "arbitrum", abi: [...ROUTER_ABI], data: "0x38ed1739..."}
✅ Decode NFT mint transaction: {chain: "ethereum", abi: [...NFT_ABI], data: "0xa0712d68..."}
❌ Invalid - wrong ABI: {abi: [...ERC721_ABI], data: "0xERC20TransferData"} // ABI mismatch
❌ Invalid - invalid data format: {data: "not-hex-data"} // Must be 0x... hex string
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 decoding success • chain: Chain context • functionName: Name of function called • functionSignature: Full function signature • parameters: Array of decoded parameters with names and values • methodId: Function selector (first 4 bytes) • decodedData: Human-readable representation • executionTime: Time taken in milliseconds
COMMON MISTAKES:
Using wrong ABI (from different contract)
Missing function definition in ABI
Truncated or malformed data
Not handling complex parameter types
Confusing input data with output data
USE CASES:
Understand what a transaction does before executing
Audit historical transactions
Debug failed transactions
Verify transaction parameters
Build transaction explorers
FUNCTION SELECTOR: First 4 bytes of input data:
Computed from function signature
Example: transfer(address,uint256)
Keccak256 hash, first 4 bytes
Used to identify function being called
DECODING PROCESS:
Extract function selector (first 4 bytes)
Match selector to function in ABI
Extract parameter types from ABI
Decode remaining data using types
Return function name and parameters
PARAMETER TYPES: Common Solidity types decoded:
address: Ethereum addresses
uint256: Large integers (as strings)
bytes: Byte arrays
string: Text strings
bool: True/false
arrays: Multiple values
tuples: Structured data
EXAMPLE DECODED OUTPUT: { functionName: "transfer", parameters: [ {name: "recipient", type: "address", value: "0x742d35..."}, {name: "amount", type: "uint256", value: "1000000000000000000"} ] }
WHERE TO GET INPUT DATA:
Block explorer transaction details
Pending transaction before broadcast
Transaction receipt logs
Wallet transaction history
Contract event logs
DEBUGGING FAILED TRANSACTIONS:
Get failed transaction hash
View on block explorer
Copy input data
Decode with this tool
Understand what was attempted
Fix parameters and retry
COMPLEX TYPES: Arrays and tuples decoded recursively:
address[]: ["0x...", "0x...", "0x..."]
(uint256,string): {amount: "100", name: "Token"}
Nested structures: Full object hierarchy
SECURITY AUDITING: Use to verify transactions:
Check recipient addresses
Verify amounts being transferred
Confirm function being called
Detect suspicious patterns
Audit contract interactions
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>",
"abi": "<abi>",
"data": "<data>"
},
"name": "evm_decode_contract_data"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| abi | Yes | Contract ABI (JSON array) | |
| data | Yes | Transaction input data to decode (0x...) | |
| chain | Yes | EVM chain context |