Firmware & Web3Zero Extra Tools NeededMCP Tool: analyze_evm_bytecode

How 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.

AI Overview Direct AnswerHow to REA: EVM Smart Contract Bytecode Quickstart Summary

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.

Investigation ScenarioReal-World Objective

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.

Target Artifact: Hexadecimal EVM runtime bytecode string or deployed contract address.
AI PromptClaude Code / Cursor / Windsurf

Natural Language Agent Instructions

Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):

Prompt Template:Select All to Copy
Deconstruct this EVM bytecode. Extract all 4-byte function selectors, infer their argument types, and identify any functions that modify storage without requiring payment.
ExecutionTerminal & MCP Tool Call

Run REA Analysis Command

Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:

CLI Command Execution
rea analyze 0x608060405234801561001057600080fd5b506004... --provider evm --json

What REA Extracts & Returns

Function dispatch table: 4-byte Keccak-256 method selectors (e.g. 0xa9059cbb for transfer)
Argument count and type inference (uint256, address, bytes32, bool)
State mutability classification: view, pure, payable, or nonpayable
Storage slot read/write operations (SLOAD and SSTORE instruction analysis)

Extracted Dispatch Selectors & Inferred Signatures

The verified findings and synthesized clean-room structures generated from this investigation:

Extracted Dispatch Selectors & Inferred Signatures
{
  "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
    }
  ]
}
Internal MechanicsProduction Engineering

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.

Security Guardrails & Analysis Boundary Rules

Zero native dependencies: Runs identically on macOS, Linux, and Windows.
Detects proxy patterns (DELEGATECALL) that forward execution to implementation contracts.
Flags fallback and receive functions designed to trap incoming Ether.