@ethereumjs/evm / EVMOpts
Defined in: types.ts:196
Options for instantiating a EVM.
optional
allowUnlimitedContractSize:boolean
Defined in: types.ts:251
Allows unlimited contract sizes while debugging. By setting this to true
, the check for
contract size limit of 24KB (see EIP-170) is bypassed.
Default: false
[ONLY set to true
during debugging]
optional
allowUnlimitedInitCodeSize:boolean
Defined in: types.ts:257
Allows unlimited contract code-size init while debugging. This (partially) disables EIP-3860. Gas cost for initcode size analysis will still be charged. Use with caution.
optional
blockchain:EVMMockBlockchainInterface
Defined in: types.ts:370
The EVM comes with a basic mock blockchain interface and implementation for non-block containing use cases.
For block-containing setups use the full blockchain implementation from the `@ethereumjs/blockchain package.
optional
bls:EVMBLSInterface
Defined in: types.ts:327
For the EIP-2537 BLS Precompiles, the native JS ethereum-cryptography
(@noble/curves
)
https://github.com/ethereum/js-ethereum-cryptography BLS12-381 curve implementation
is used (see noble.ts
file in the precompiles/bls12_381/
folder).
To use an alternative implementation this option can be used by passing
in a wrapper implementation integrating the desired library and adhering
to the EVMBLSInterface
specification.
An interface for the MCL WASM implementation https://github.com/herumi/mcl-wasm
is shipped with this library which can be used as follows (with mcl-wasm
being
explicitly added to the set of dependencies):
import * as mcl from 'mcl-wasm'
await mcl.init(mcl.BLS12_381)
const evm = await createEVM({ bls: new MCLBLS(mcl) })
optional
bn254:EVMBN254Interface
Defined in: types.ts:350
For the EIP-196/EIP-197 BN254 (alt_BN128) EC precompiles, the native JS ethereum-cryptography
(@noble/curves
) https://github.com/ethereum/js-ethereum-cryptography BN254 curve implementation
is used (see noble.ts
file in the precompiles/bn254/
folder).
To use an alternative implementation this option can be used by passing
in a wrapper implementation integrating the desired library and adhering
to the EVMBN254Interface
specification.
An interface for a WASM wrapper https://github.com/ethereumjs/rustbn.js around the
Parity fork of the Zcash bn pairing cryptography library is shipped with this library
which can be used as follows (with rustbn.js
being explicitly added to the set of
dependencies):
import { initRustBN } from 'rustbn-wasm'
const bn254 = await initRustBN()
const evm = await createEVM({ bn254: new RustBN254(bn254) })
optional
cliqueSigner: (header
) =>Address
Defined in: types.ts:382
When running the EVM with PoA consensus, the cliqueSigner
function from the @ethereumjs/block
class
must be provided along with a BlockHeader
so that the coinbase can be correctly retrieved when the
Interpreter.getBlockCoinbase
method is called.
bigint
Address
bigint
bigint
bigint
Uint8Array
bigint
Address
optional
common:Common
Defined in: types.ts:243
Use a Common instance for EVM instantiation.
experimental
)Annotations:
experimental
: behaviour can change on patch versions
optional
customOpcodes:CustomOpcode
[]
Defined in: types.ts:297
Override or add custom opcodes to the EVM instruction set
These custom opcodes are EIP-agnostic and are always statically added
To delete an opcode, add an entry of format {opcode: number}
. This will delete that opcode from the EVM.
If this opcode is then used in the EVM, the INVALID
opcode would instead be used.
To add an opcode, add an entry of the following format:
{
// The opcode number which will invoke the custom opcode logic
opcode: number
// The name of the opcode (as seen in the step
event)
opcodeName: string
// The base fee of the opcode
baseFee: number
// If the opcode charges dynamic gas, add this here. To charge the gas, use the i
methods of the BN, to update the charged gas
gasFunction?: function(runState: RunState, gas: BN, common: Common)
// The logic of the opcode which holds the logic of changing the current state
logicFunction: function(runState: RunState)
}
Note: gasFunction and logicFunction can both be async or synchronous functions
optional
customPrecompiles:CustomPrecompile
[]
Defined in: types.ts:305
optional
params:ParamsDict
Defined in: types.ts:275
EVM parameters sorted by EIP can be found in the exported paramsEVM
dictionary,
which is internally passed to the associated @ethereumjs/common
instance which
manages parameter selection based on the hardfork and EIP settings.
This option allows providing a custom set of parameters. Note that parameters get fully overwritten, so you need to extend the default parameter dict to provide the full parameter set.
It is recommended to deep-clone the params object for this to avoid side effects:
const params = JSON.parse(JSON.stringify(paramsEVM))
params['1679']['bn254AddGas'] = 100 // 150
optional
profiler:EVMProfilerOpts
Defined in: types.ts:375
optional
stateManager:StateManagerInterface
Defined in: types.ts:361