- StateManager
- DefaultStateManager
- getAccount~callback
- getContractCode~callback
- getContractStorage~callback
- getStateRoot~callback
- dumpStorage~callback
- hasGenesisState~callback
- accountIsEmpty~callback
Interface for getting and setting data from an underlying state trie
Gets the ethereumjs-account
associated with address. Returns an empty account if the account does not exist.
addressBuffer Address of theaccountto getcbgetAccount~callback
Saves an ethereumjs-account
into state under the provided address
addressBuffer Address under which to storeaccountaccountAccount Theethereumjs-accountto storecbFunction Callback function
Adds value to the state trie as code, and sets codeHash on the account
corresponding to address to reference this.
addressBuffer Address of theaccountto add thecodeforvalueBuffer The value of thecodecbFunction Callback function
Gets the code corresponding to the provided address
addressBuffer Address to get thecodeforcbgetContractCode~callback
Gets the storage value associated with the provided address and key
addressBuffer Address of the account to get the storage forkeyBuffer Key in the account's storage to get the value forcbgetContractCode~callback
Adds value to the state trie for the account
corresponding to address at the provided key
addressBuffer Address to set a storage value forkeyBuffer Key to set the value atvalueBuffer Value to set atkeyfor account corresponding toaddresscbFunction Callback function
Clears all storage entries for the account corresponding to address
Checkpoints the current state of the StateManager instance.
State changes that follow can then be committed by calling
commit or reverted by calling rollback.
cbFunction Callback function
Commits the current change-set to the instance since the last call to checkpoint.
cbFunction Callback function
Reverts the current change-set to the instance since the last call to checkpoint.
cbFunction Callback function
Gets the state-root of the Merkle-Patricia trie representation of the state of this StateManager. Will error if there are uncommitted checkpoints on the instance.
Sets the state of the instance to that represented
by the provided stateRoot. Will error if there are uncommitted
checkpoints on the instance or if the state root does not exist in
the state trie.
Generates a canonical genesis state on the instance based on the configured chain parameters. Will error if there are uncommitted checkpoints on the instance.
cbFunction Callback function
Checks if the account corresponding to address is empty as defined in
EIP-161 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)
addressBuffer Address to checkcbaccountIsEmpty~callback
Removes accounts form the state trie that have been touched, as defined in EIP-161 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md).
cbFunction Callback function
Default implementation of the StateManager interface
optsObject (optional, default{})opts.commonCommon?Commonparameters of the chainopts.trieTrie? amerkle-patricia-treeinstance
Copies the current instance of the DefaultStateManager
at the last fully committed point, i.e. as if all current
checkpoints were reverted
Dumps the the storage values for an account specified by address
addressBuffer The address of theaccountto return storage forcbdumpStorage~callback
Checks whether the current instance has the canonical genesis state for the configured chain parameters.
Initializes the provided genesis state into the state trie
Callback for getAccount method
Type: Function
errorError an error that may have happened ornullaccountAccount Anethereumjs-accountinstance corresponding to the providedaddress
Callback for getContractCode method
Type: Function
errorError an error that may have happened ornullcodeBuffer The code corresponding to the provided address. Returns an emptyBufferif the account has no associated code.
Callback for getContractStorage method
Type: Function
errorError an error that may have happened ornullstorageValueBuffer The storage value for the account corresponding to the provided address at the provided key. If this does not exists an emptyBufferis returned
Callback for getStateRoot method
Type: Function
errorError an error that may have happened ornull. Will be an error if the un-committed checkpoints on the instance.stateRootBuffer The state-root of theStateManager
Callback for dumpStorage method
Type: Function
errorError an error that may have happened ornullaccountStateObject The state of the account as anObjectmap. Keys are are the storage keys, values are the storage values as strings. Both are represented as hex strings without the0xprefix.
Callback for hasGenesisState method
Type: Function
errorError an error that may have happened ornullhasGenesisStateBoolean Whether the storage trie contains the canonical genesis state for the configured chain parameters.
Callback for accountIsEmpty method
Type: Function