TevmNode api
TevmNode
VM
The internal Vm can be accessed using getVm. getVm will wait for await tevm.ready()
to be true and then return the vm instance.
Notable methods include:
vm.runBlock({block})
to execute an entire block of txvm.runTx({tx})
to execute a single tx on the vm
The VM is also how you get access to it’s sub components including the blockchain, the state manager, and the evm.
See generated Vm docs for it’s usage.
The VM can be used as a standalone package using @tevm/vm
package. See generated docs for more
StateManager
The Tevm StateManager controls account state, contract bytecode, and contract storage. It supports forking via lazily fetching state from the fork if not already cached.
Notable methods include
stateManager.getAccount
to get an Account from statestateManager.putAccount
to add or update an AccountstateManager.putContractStorage
to add contract storagestateManager.setStateRoot(block.header.stateRoot)
to update the state to the state of a given block- many more
See generated StateManager docs for it’s usage.
The StateManager can be used as a standalone package using @tevm/state
package. See generated docs for more
Blockchain
The blockchain controls the state of blocks. It supports forking via lazily fetching blocks from the fork if not already cached.
Notable methods include
blockchain.getBlock
to get a blockblockchain.getCanonicalHeadBlock
to get the latest blockblockchain.putBlock
to add or update a block- many more
See generated StateManager docs for it’s usage.
The Blockchain can be used as a standalone package using @tevm/blockchain
package. See generated docs for more
Blockchain package uses @tevm/block to fetch blocks from rpc and create blocks
Evm
The EVM is the raw EVM interpreter of the TevmNode. It is an extremely light wrapper around ethereumjs
EVM has one notable method on it, runCall
which runs a call on the EVM. runCall
is just raw execution and does not do things like deduct the base fee. See vm.runTx
if you wish to deduct base fees and do other checks.
See generated EVM docs for it’s usage.
The EVM can be used as a standalone package using @tevm/evm
package. See generated docs for more