Skip to content

createEvm

createEvm(__namedParameters): Promise<Evm>

Creates the Tevm Evm to execute ethereum bytecode internally. Wraps ethereumjs EVM

Parameters

__namedParameters: CreateEvmOptions

Returns

Promise<Evm>

Example

import { createEvm } from '@tevm/evm'
import { mainnet } from '@tevm/common'
import { createBlockchain } from '@tevm/blockchain'
import { createStateManager } from '@tevm/state-manager'
import { EthjsAddress } from '@tevm/utils'
const common = mainnet.clone()
const stateManager = createStateManager({ common })
const blockchain = createBlockchain({ common })
const evm = await createEvm({ common, stateManager, blockchain})
const runCallResult = await evm.runCall({
to: EthjsAddress.from(`0x${'00'.repeat(20)}`),
value: 420n,
skipBalance: true,
})
console.log(runCallResult)

@param {import(’./CreateEvmOptions.js’).CreateEvmOptions} options @returns {Promise<import(’./EvmType.js’).Evm>} A tevm Evm instance with tevm specific defaults

Defined in

packages/evm/src/createEvm.js:30