@ethereumjs/evm / EVMOpts
Defined in: types.ts:220
Options for instantiating a EVM.
optionalallowUnlimitedContractSize:boolean
Defined in: types.ts:297
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]
optionalallowUnlimitedInitCodeSize:boolean
Defined in: types.ts:303
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.
optionalblockchain:EVMMockBlockchainInterface
Defined in: types.ts:416
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.
optionalblockLevelAccessList:BlockLevelAccessList
Defined in: types.ts:429
Optional pre-built block access list when EIP-7928 is active. If omitted, EVM creates one automatically when the EIP is activated.
Experimental (Amsterdam): may change on patch releases.
optionalbls:EVMBLSInterface
Defined in: types.ts:373
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) })
optionalbn254:EVMBN254Interface
Defined in: types.ts:396
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) })
optionalcliqueSigner: (header) =>Address
Defined in: types.ts:436
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
bigint
Address
optionalcommon:Common
Defined in: types.ts:289
Use a Common instance for EVM instantiation.
Sorted by EIP number:
Annotations:
(Prague)) indicate default activation on that fork(Amsterdam, experimental) and (experimental) mark unstable specs; behaviour can change on patch releases@ethereumjs/vm README (#amsterdam-hardfork-experimental)
optionalcustomOpcodes:CustomOpcode[]
Defined in: types.ts:343
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
optionalcustomPrecompiles:CustomPrecompile[]
Defined in: types.ts:351
optionalparams:ParamsDict
Defined in: types.ts:321
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
optionalprofiler:EVMProfilerOpts
Defined in: types.ts:421
optionalstateManager:StateManagerInterface
Defined in: types.ts:407