You are reading Hyperledger Besu development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.
Date of last update: September 20, 2022

# EVM tool reference

Options for running:

## Run options

The first mode of the EVM tool runs an arbitrary EVM and is invoked without an extra command. Command Line Options specify the code and other contextual information.

### code

--code=<code as hex string>

--code=5B600080808060045AFA50600056


The code to be executed, in compiled hex code form.

No default value: execution fails if this is not set.

### gas

--gas=<gas as a decimal integer>

--gas=100000000


Amount of gas to make available to the EVM. The default value is 10 Billion, an incredibly large number unlikely to be seen in any production blockchain.

### price

--price=<gas price in GWei as a decimal integer>

--price=10


Price of gas in GWei. The default is zero. If set to a non-zero value, the sender account must have enough value to cover the gas fees.

### sender

--sender=<address>

--sender=0xfe3b557e8fb62b89f4916b721be55ceb828dbd73


The account the invocation is sent from. The specified account must exist in the world state, which unless specified by --genesis or --prestate is the set of accounts used for testing.

### receiver

--receiver=<address>

--receiver=0x588108d3eab34e94484d7cda5a1d31804ca96fe7


The account the invocation is sent to. The specified account does not need to exist.

### input

--input=<hex binary>

--input=9064129300000000000000000000000000000000000000000000000000000000


The data passed into the call. Corresponds to the data field of the transaction and is returned by the CALLDATA and related opcodes.

### value

--value=<Wei in decimal>

--value=1000000000000000000


The value of Ether attached to this transaction. For operations that query the value or transfer it to other accounts this is the amount that is available. The amount is not reduced to cover intrinsic cost and gas fees.

### json

--json=<boolean>

--json=true


Provide an operation-by-operation trace of the command in JSON when set to true.

### nomemory

--nomemory=<boolean>

--nomemory=true


By default, when tracing operations the memory is traced for each operation. For memory heavy scripts, setting this option may reduce the volume of JSON output.

### genesis

--genesis=<path>

--genesis=/opt/besu/genesis.json


The Besu Genesis file to use when evaluating the EVM. Most useful are the alloc items that set up accounts and their stored memory states. For a complete description of this file see Genesis file items.

--prestate is a deprecated alternative option name.

### chain

--chain=<mainnet|goerli|sepolia|dev|classic|mordor|kotti|astor>

--chain=goerli


The well-known network genesis file to use when evaluating the EVM. These values are an alternative to the --genesis option for well known networks.

### repeat

--repeat=<integer>

--repeat=1000


Number of times to repeat the contract before gathering timing information. This is useful when benchmarking EVM operations.

### revert-reason-enabled

--revert-reason-enabled=<boolean>

--revert-reason-enabled=true


If enabled, the JSON tracing includes the reason included in REVERT operations.

### key-value-storage

--key-value-storage=<memory|rocksdb>

--key-value-storage=rocksdb


Kind of key value storage to use.

Occasionally it may be useful to execute isolated EVM calls in context of an actual world state. The default is memory, which executes the call only in context of the world provided by --genesis or --network at block zero. When set to rocksdb and combined with --data-path, --block-number, and --genesis a Besu node that is not currently running can be used to provide the appropriate world state for a transaction. Useful when evaluating consensus failures.

### data-path

--data-path=<path>

--data-path=/opt/besu/data


When using rocksdb for key-value-storage, specifies the location of the database on disk.

### block-number

--block-number=<integer>

--block-number=10000000


The block number to evaluate the code against. Used to ensure that the EVM is evaluating the code against the correct fork, or to specify the specific world state when running with rocksdb for key-value-storage.

## State test options

The state-test subcommand allows the Ethereum state tests to be evaluated. Most of the options from EVM execution do not apply.

### Applicable options

#### json

--json=<boolean>

--json=true


Provide an operation by operation trace of the command in JSON when set to true. Set to true for EVM Lab Fuzzing. Whether or not json is set, a summary JSON object is printed to standard output for each state test executed.

#### nomemory

--nomemory=<boolean>

--nomemory=true


By default, when tracing operations the memory is traced for each operation. For memory heavy scripts, setting this option to true may reduce the volume of JSON output.

### Using command arguments

If you use command arguments, you can list one or more state tests. All the state tests are evaluated in the order they are specified.

docker run --rm -v \${PWD}:/opt/referencetests hyperledger/besu-evmtool:develop --json state-test /opt/referencetests/GeneralStateTests/stExample/add11.json

evm --json state-test stExample/add11.json


### Using standard input

If no reference tests are passed in using the command line, the EVM Tool loads one complete JSON object from standard input and executes that state test.

docker run --rm  -i hyperledger/besu-evmtool:develop --json state-test < stExample/add11.json

evm --json state-test < stExample/add11.json