- vm.runBlockchain
- VM
- vm.runBlock
- runBlock~callback
- runTx~callback
- vm.runTx
- runCode~callback
- vm.runCode
- Event: beforeBlock
- Event: afterBlock
- Event: beforeTx
- Event: afterTx
- Event: step
Processes blocks and adds them to the blockchain
blockchainBlockchain A blockchain that to processcbFunction the callback function
VM Class, new VM(opts) creates a new VM object
optsObjectopts.stateManagerStateManager aStateManagerinstance to use as the state store (Beta API)opts.stateTrie a merkle-patricia-tree instance for the state tree (ignored if stateManager is passed)opts.blockchainBlockchain a blockchain object for storing/retrieving blocks (ignored if stateManager is passed)opts.chain(String | Number) the chain the VM operates on [default: 'mainnet']opts.hardforkString hardfork rules to be used [default: 'byzantium', supported: 'byzantium', 'constantinople' (will throw on unsupported)]opts.activatePrecompilesBoolean create entries in the state tree for the precompiled contractsopts.allowUnlimitedContractSizeBoolean allows unlimited contract sizes while debugging. By setting this totrue, the check for contract size limit of 24KB (see EIP-170) is bypassed. (default:false; ONLY set totrueduring debugging)opts.emitFreeLogsBoolean Changes the behavior of the LOG opcode, the gas cost of the opcode becomes zero and calling it using STATICCALL won't throw. (default:false; ONLY set totrueduring debugging)
Processes the block running all of the transactions it contains and updating the miner's account
optscbrunBlock~callback callback
Callback for runBlock method
Type: Function
Callback for runTx method
Type: Function
errorError an error that may have happened ornullresultsObjectresults.amountSpentBN the amount of ether used by this transaction as abignumresults.gasUsedBN the amount of gas as abignumused by the transactionresults.gasRefundBN the amount of gas as abignumthat was refunded during the transaction (i.e.gasUsed = totalGasConsumed - gasRefund)
vmVM contains the results from running the code, if any, as described invm.runCode(params, cb)
Process a transaction. Run the vm. Transfers eth. Checks balances.
optsopts.txTransaction aTransactionto runopts.skipNonceBoolean skips the nonce checkopts.skipBalanceBoolean skips the balance checkopts.blockBlock the block to which thetxbelongs, if no block is given a default one is created
cbrunTx~callback the callback
Callback for runCode method
Type: Function
errorError an error that may have happened ornullresultsObjectresults.gasBN the amount of gas leftresults.gasUsedBN the amount of gas as abignumthe code used to runresults.gasRefundBN abignumcontaining the amount of gas to refund from deleting storage valuesresults.selfdestructObject anObjectwith keys for accounts that have selfdestructed and values for balance transfer recipient accountsresults.logsArray anArrayof logs that the contract emittedresults.exceptionNumber0if the contract encountered an exception,1otherwiseresults.exceptionErrorString aStringdescribing the exception if there was oneresults.returnBuffer aBuffercontaining the value that was returned by the contract
Runs EVM code
optsObjectopts.accountAccount theAccountthat the executing code belongs to. If omitted an empty account will be usedopts.addressBuffer the address of the account that is executing this code. The address should be aBufferof bytes. Defaults to0opts.blockBlock theBlockthetxbelongs to. If omitted a blank block will be usedopts.callerBuffer the address that ran this code. The address should be aBufferof 20bits. Defaults to0opts.codeBuffer the EVM code to run given as aBufferopts.dataBuffer the input dataopts.gasLimitBuffer the gas limit for the codeopts.originBuffer the address where the call originated from. The address should be aBufferof 20bits. Defaults to0opts.valueBuffer the value in ether that is being sent toopt.address. Defaults to0
cbrunCode~callback callback
The beforeBlock event
Type: Object
blockBlock emits the block that is about to be processed
The afterBlock event
Type: Object
resultObject emits the results of processing a block
The beforeTx event
Type: Object
txTransaction emits the Transaction that is about to be processed
The afterTx event
Type: Object
resultObject result of the transaction
The step event for trace output
Type: Object
pcNumber representing the program counteropcodeString the next opcode to be rangasLeftBN amount of gasLeftstackArray anArrayofBufferscontaining the stackaccountAccount theAccountwhich owns the code runningaddressBuffer the address of theaccountdepthNumber the current number of calls deep the contract ismemoryBuffer the memory of the VM as abuffermemoryWordCountBN current size of memory in wordsstateManagerStateManager aStateManagerinstance (Beta API)