Skip to content

jose-compu/lutetia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lutetia EVM Decompiler 🫕

EVM bytecode decompiler — Lutetia is the fastest EVM decompiler. Turns EVM bytecode (hex only; no network/RPC) into readable pseudo-Python (Python-style def/if/while with EVM/Solidity types and require/calls).

Rust License: MIT

Decompiling EVM bytecode is a bit like staring into a fondue pot: everything’s melted together and it’s not obvious what went in.

Online Version: https://jose-blockchain.github.io/lutetia-web/


Benchmarks (vs Panoramix)

Tested on mainnet bytecodes (WETH, USDT, DAI, Uniswap V2 Factory, Uniswap V2 Router). Single run, release build.

Contract Panoramix (s) Lutetia (s) Pan lines Lut lines
weth 0.70 0.38 89 111
dai 1.14 0.97 225 282
usdt 1.39 1.09 365 484
uniswap_v2_factory 0.55 0.45 50 73
uniswap_v2_router 122.58 16.65 7910 3043
  • UniV2 Router: Lutetia is ~6.7× faster (16.6 s vs 122.6 s) and produces ~55% fewer lines (3043 vs 7910).
  • Lutetia is faster than Panoramix on 4 of 5 contracts.
  • Panoramix fails on Uniswap V2 Factory’s createPair; Lutetia decompiles it fully.

Install

Lutetia is published on crates.io. Install the CLI and run lutetia from the command line:

cargo install lutetia
lutetia --help

To install from a local clone:

cargo install --path .

Or build and run from the repo:

cargo build --release
./target/release/lutetia --help

Usage

Bytecode is never fetched from the web. Input is local only: hex argument, file, or stdin.

# From hex string (paste bytecode; 0x prefix optional)
lutetia 6001600201

# From file
lutetia -f bytecode.hex

# From stdin
cat bytecode.hex | lutetia

# Options
lutetia --help
#   -f, --file <FILE>     Read bytecode from file
#   -o, --format <FMT>    text (default), asm, json
#   -t, --timeout <SEC>   Execution timeout (default: 60)
#   --no-color            Disable coloured output

Example output

$ lutetia 00
stop

$ lutetia 602a60005500
stor[0] = 42
stop

Real contract output is pseudo-Python with def, require, and resolved calls/storage:

def balanceOf(address account): # not payable
  return balanceOf[account]

def approve(address spender, uint256 amount): # not payable
  allowance[caller][spender] = amount
  log Approval(amount, address=caller, address=spender)
  return 1

Thanks

Lutetia builds on ideas and prior art from Panoramix and Eveem (eveem.org). We thank the Panoramix and Eveem-org contributors.


License

MIT

About

Fastest EVM bytecode decompiler in the Roman Empire

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages