Skip to content
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 as hex string>

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

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


--gas=<gas as a decimal integer>

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=<gas price in GWei as a decimal integer>

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.



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.



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


--input=<hex binary>

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


--value=<Wei in decimal>

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.



Provide an operation-by-operation trace of the command in JSON when set to 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.



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.



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.



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



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



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.



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



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



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.



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