analyze_evm_bytecodeHow to REA EVM Bytecode: 4-Byte Selectors, Storage Mutability & Argument Inference
Deconstruct unverified Ethereum Virtual Machine (EVM) bytecode: identify 4-byte function dispatch selectors, infer function argument types, audit state mutability (view, pure, payable), and map storage slot modifications without needing ABI files.
In this official REA guide for EVM Smart Contract Bytecode, AI coding agents (Claude Code, Cursor, Windsurf) execute 'rea analyze 0x608060405234801561001057600080fd5b506004... --provider evm --json' to safely extract file layout, symbols, and code logic without launching unverified binaries.
The Problem & Target Artifact
Smart contract security audit: You are auditing a newly deployed contract on Ethereum or Arbitrum that has not published its Solidity source code to Etherscan. You must identify all public functions and check for hidden owner-only drain functions.
Natural Language Agent Instructions
Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):
Deconstruct this EVM bytecode. Extract all 4-byte function selectors, infer their argument types, and identify any functions that modify storage without requiring payment.Run REA Analysis Command
Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:
rea analyze 0x608060405234801561001057600080fd5b506004... --provider evm --jsonWhat REA Extracts & Returns
Extracted Dispatch Selectors & Inferred Signatures
The verified findings and synthesized clean-room structures generated from this investigation:
{
"contract_type": "ERC20_Candidate",
"selectors": [
{
"selector": "0xa9059cbb",
"inferred_signature": "transfer(address,uint256)",
"mutability": "nonpayable",
"writes_storage": true
},
{
"selector": "0x70a08231",
"inferred_signature": "balanceOf(address)",
"mutability": "view",
"writes_storage": false
}
]
}Pure WebAssembly Symbolic Deconstruction
REA embeds EVMole compiled to WebAssembly. It symbolically walks the EVM jump table, parses `PUSH4` comparison patterns against `CALLDATALOAD`, and traces stack values backward from `JUMP` and `REVERT` opcodes. This identifies all valid dispatch selectors without relying on external databases or network APIs.