Execution engine which can be used to run a blockchain, individual blocks, individual transactions, or snippets of EVM bytecode.
This class is an AsyncEventEmitter, which means that event handlers are run to completion before continuing. If an error is thrown in an event handler, it will bubble up to the VM and thrown from the method call that triggered the event.
any
↳ VM
Defined in index.ts:74
Instantiates a new VM Object.
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
Default value opts |
VMOpts | {} | Default values for the options are:* `chain`: 'mainnet'* `hardfork`: 'petersburg' [supported: 'byzantium', 'constantinople', 'petersburg', 'istanbul' (DRAFT) (will throw on unsupported)]* `activatePrecompiles`: false* `allowUnlimitedContractSize`: false [ONLY set to `true` during debugging] |
Returns: VM
● _common: Common
Defined in index.ts:70
● _opcodes: OpcodeList
Defined in index.ts:74
● allowUnlimitedContractSize: boolean
Defined in index.ts:73
● blockchain: Blockchain
Defined in index.ts:72
● opts: VMOpts
Defined in index.ts:69
● stateManager: StateManager
Defined in index.ts:71
▸ _emit(topic: string
, data: any
): Promise
<any
>
Defined in index.ts:192
Parameters:
Name | Type |
---|---|
topic | string |
data | any |
Returns: Promise
<any
>
▸ copy(): VM
Defined in index.ts:184
Returns a copy of the VM instance.
Returns: VM
▸ runBlock(opts: RunBlockOpts): Promise
<RunBlockResult>
Defined in index.ts:148
Processes the block
running all of the transactions it contains and updating the miner's account
This method modifies the state. If generate
is true
, the state modifications will be reverted if an exception is raised. If it's false
, it won't revert if the block's header is invalid. If an error is thrown from an event handler, the state may or may not be reverted.
Parameters:
Name | Type | Description |
---|---|---|
opts | RunBlockOpts | Default values for options:* `generate`: false |
Returns: Promise
<RunBlockResult>
▸ runBlockchain(blockchain: any
): Promise
<void
>
Defined in index.ts:134
Processes blocks and adds them to the blockchain.
This method modifies the state.
Parameters:
Name | Type | Description |
---|---|---|
blockchain | any |
A blockchain object to process |
Returns: Promise
<void
>
▸ runCall(opts: RunCallOpts): Promise
<EVMResult>
Defined in index.ts:168
runs a call (or create) operation.
This method modifies the state.
Parameters:
Name | Type |
---|---|
opts | RunCallOpts |
Returns: Promise
<EVMResult>
▸ runCode(opts: RunCodeOpts): Promise
<ExecResult>
Defined in index.ts:177
Runs EVM code.
This method modifies the state.
Parameters:
Name | Type |
---|---|
opts | RunCodeOpts |
Returns: Promise
<ExecResult>
▸ runTx(opts: RunTxOpts): Promise
<RunTxResult>
Defined in index.ts:159
Process a transaction. Run the vm. Transfers eth. Checks balances.
This method modifies the state. If an error is thrown, the modifications are reverted, except when the error is thrown from an event handler. In the latter case the state may or may not be reverted.
Parameters:
Name | Type |
---|---|
opts | RunTxOpts |
Returns: Promise
<RunTxResult>