EVMole Decompiler

How the EVMole decompiler works

EVMole is a smart contract decompiler that turns EVM runtime bytecode into Solidity-like code, including for unverified contracts with no source, ABI, or compiler metadata. Every function it outputs is checked against the original bytecode with differential fuzzing first. If a function cannot be reconstructed cleanly, or if any tested input behaves differently, EVMole refuses the function instead of guessing.

Exact or nothing

Most bytecode decompilers fill gaps with guesses. The output looks uniform from top to bottom, so you cannot tell which lines reflect the contract and which ones were invented. EVMole does not guess: each function is either rebuilt to match the bytecode's external behavior or refused.

No AI model takes part in decompiling. The decompiler is a deterministic program: each version always turns the same bytecode into the same code.

External behavior means everything observable from outside the contract. For the same call in the same state, the decompiled function must make the same storage writes, execute the same external calls (same target, value, and calldata), emit the same events, and return or revert with the same data, all in the same order.

A refused function appears as a single comment naming the stage that rejected it:

// 0x7d2e90c2(address,uint256): refused (structural_scope)

In the workbench, the function list marks it "not decompiled". Functions are processed independently, so one refusal never blocks the rest of the contract.

From EVM bytecode to Solidity-like code

The decompiler takes runtime bytecode: the code stored at a contract address and returned by eth_getCode, not the creation bytecode used during deployment. Because it reads only bytecode, unverified contracts go through the same pipeline as verified ones, whether they were compiled from Solidity, Vyper, or another EVM language.

Decompilation runs in six stages:

  1. Find functions and arguments. The open-source EVMole library (which the decompiler is built on) extracts function selectors, infers argument types, and detects proxies and EIP-7702 delegations. When you open a proxy address, the site decompiles both the proxy and its current implementation.
  2. Rebuild control flow. For each selector, the decompiler traces execution from the contract entry point and inlines internal functions. It builds statements in execution order across branches and loops, preserving storage operations, calls, events, returns, and reverts. Code reached when no selector matches becomes fallback().
  3. Fold compiler patterns. Where the analysis can prove a rewrite holds on every path, compiler boilerplate such as ABI decoding, overflow checks, and memory setup is folded into higher-level forms (require, checked arithmetic, abi.encode). When that cannot be proven, the raw operations stay visible (mstore, mload). The output gets longer, but it stays faithful to the bytecode.
  4. Recover storage layout. Storage slots, types, bit-packing, mapping keys, and structs are inferred from how functions read and write storage. Recovered state variables are declared at the top of the contract alongside the events, errors, and constants used in the code.
  5. Resolve names. Bytecode carries four-byte selectors and event topics, not human-readable names. We look them up in a signature table built from Sourcify-verified contracts and rank candidates by usage frequency and how well their parameter types fit what the function reads. Storage variables are named from their getters or ERC-7201 namespaces where possible. Anything unresolved keeps a neutral identifier (0x7d2e90c2, storage_3, var_1).
  6. Check against the bytecode. Every function that completes the pipeline is executed alongside the original bytecode. Any behavioral difference causes the function to be refused.

If any stage cannot be completed safely, the function is refused. Most refusals happen when a function exceeds the decompiler's size or complexity limits.

Differential fuzzing on every decompile

The differential check runs on every contract submitted to evmole.com, not just our offline test suite.

  • Inputs and states: A fuzzer generates calls starting from fixed boundary values (zeros, small integers, max values, empty and long strings and arrays), then switches to coverage-guided search to reach uncovered paths. Each input runs across multiple environments: empty and populated storage, succeeding and reverting external calls, different callers and block numbers, with and without ETH. When a call reverts on a guard, the fuzzer tries to find a state that passes it.
  • Two executions: The original runtime bytecode runs in an EVM. The decompiled function runs in an interpreter executing the final representation from which the Solidity-like text is printed. Both get the same call and initial state.
  • Ordered trace comparison: We compare the final outcome (stop, return, or revert, plus returned data) and one ordered trace of side effects: storage writes, external calls (target, value, and calldata), events, and contract creations. Comparing a single ordered trace rather than separate lists per effect catches subtle bugs, such as a storage write moving past an external call or an event reading a slot after it was overwritten.
  • Refusal on mismatch: If any tested input disagrees, the function is refused and marked "not decompiled". We treat any mismatch as a bug in the decompiler and keep it out of the output.

During development, we run the same differential check after every intermediate stage, cross-check against a second independent EVM implementation, and, for most functions, parse the printed text back into an executable form and test it again.

Tested on real smart contracts

We develop and benchmark the decompiler against a large corpus of deployed contracts with source verified on Sourcify, sampled across compiler versions, optimizer settings, bytecode sizes, and function counts. Verified source is never fed to the decompiler. It is used only afterward to check recovered ABIs and storage layouts.

The corpus is split into two halves:

  • Development set: used to diagnose failures, refine passes, and build regression tests.
  • Held-out set: measured on every release candidate, but never opened to fix a specific contract. It shows how the decompiler behaves on bytecode it was not tuned for.

A change ships only when it passes both halves: no previously matching function starts to disagree (checked on every function whose output changed), nothing crashes or newly times out, and overall decompilation and argument-type recovery rates do not regress. Behavioral accuracy is never traded for a higher decompilation rate.

Alongside the corpus, more than 900 targeted tests cover individual analysis stages and specific contracts, and a separate fuzzer feeds generated and deliberately malformed bytecode into the decompiler. Hostile input must produce a clean refusal, not a crash.

What the checks do not guarantee

  • Differential fuzzing is not a formal proof. Fuzzing finds behavioral differences in practice, but it cannot cover every possible input, storage state, and execution environment. When a function passes the check, no mismatch was found on the tested cases. That does not prove equivalence for all inputs, and it does not guarantee identical gas consumption.
  • Names and types are inferred, not checked. Two different signatures can collide on the same four-byte selector, and a parameter that is logically an address may show up as uint256 if the bytecode never masks or uses it as an address. Neither changes what the bytecode executes, and neither is part of the behavioral check.
  • One contract at a time. EVMole does not recursively decompile external call targets. For proxy contracts, the implementation is resolved when you open the contract; if the proxy upgrades later, opening the same link shows the new implementation.
  • Not the original source, and not a security audit. Compilation strips comments, local variable names, and much of the original source structure. Decompiled code helps you inspect what deployed bytecode does, for unverified contracts too, but judging whether that behavior is safe remains your responsibility. See the Terms.

Comparison cases on real contracts

The home page lists six functions from well-known verified Ethereum contracts:

Each example puts another decompiler's output next to EVMole's, along with an input that separates them and what the deployed contract actually does on that input. Because all six contracts are live on-chain and have verified source, you can check each case yourself. Each link opens the function in the workbench with the current EVMole output. Three of them are written up in full, each with two more errors on the same contract: USDC, Safe 1.3.0, and the Uniswap V2 pair.

Thanks to Sourcify

Sourcify verifies smart contract source code and publishes every verified contract as open data. That dataset gives us the signatures we name functions, events, and errors from, the names of constants and storage namespaces, and the contracts we test on. Thank you to the Sourcify team.

Found a difference?

If a function shown on evmole.com behaves differently from the deployed bytecode, that is a bug in the EVMole decompiler. Send the contract link and function selector (and a reproducing input or transaction hash if you have one) to info@evmole.com.