Skip to content

The evm_bytes CLI

evm_bytes

Convert EVM bytecode to EEST's Python Opcodes or an assembly string.

The input can be either a hex string or a binary file containing EVM bytes.

Usage:

evm_bytes [OPTIONS] COMMAND [ARGS]...

Options:

  --help  Show this message and exit.

Subcommands

  • binary-file: Convert a binary file to Python Opcodes or assembly.
  • hex-string: Convert a hex string to Python Opcodes or assembly.

evm_bytes binary-file

Convert the BINARY_FILE containing EVM bytes to Python Opcodes or assembly.

BINARY_FILE is a binary file containing EVM bytes, use - to read from stdin.

Returns:

(str): The processed EVM opcodes in Python or assembly format.

Example: Convert the Withdrawal Request contract to assembly

uv run evm_bytes binary-file ./src/ethereum_test_forks/forks/contracts/withdrawal_request.bin --assembly

Output:

caller
push20 0xfffffffffffffffffffffffffffffffffffffffe
eq
push1 0x90
jumpi
...

Usage:

evm_bytes binary-file [OPTIONS] BINARY_FILE

Options:

  -a, --assembly  Output the code as assembly instead of Python Opcodes.
  --help          Show this message and exit.

evm_bytes hex-string

Convert the HEX_STRING representing EVM bytes to EEST Python Opcodes.

HEX_STRING is a string containing EVM bytecode.

Returns:

(str): The processed EVM opcodes in Python or assembly format.

Example 1: Convert a hex string to EEST Python Opcodes

uv run evm_bytes hex-string 604260005260206000F3

Output 1:

Op.PUSH1[0x42] + Op.PUSH1[0x0] + Op.MSTORE + Op.PUSH1[0x20] + Op.PUSH1[0x0] + Op.RETURN

Example 2: Convert a hex string to assembly

uv run evm_bytes hex-string --assembly 604260005260206000F3

Output 2:

push1 0x42
push1 0x00
mstore
push1 0x20
push1 0x00
return

Usage:

evm_bytes hex-string [OPTIONS] HEX_STRING

Options:

  -a, --assembly  Output the code as assembly instead of Python Opcodes.
  --help          Show this message and exit.