- 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.
address
Buffer Address of theaccount
to getcb
getAccount~callback
Saves an ethereumjs-account
into state under the provided address
address
Buffer Address under which to storeaccount
account
Account Theethereumjs-account
to storecb
Function Callback function
Adds value
to the state trie as code, and sets codeHash
on the account
corresponding to address
to reference this.
address
Buffer Address of theaccount
to add thecode
forvalue
Buffer The value of thecode
cb
Function Callback function
Gets the code corresponding to the provided address
address
Buffer Address to get thecode
forcb
getContractCode~callback
Gets the storage value associated with the provided address
and key
address
Buffer Address of the account to get the storage forkey
Buffer Key in the account's storage to get the value forcb
getContractCode~callback
Adds value to the state trie for the account
corresponding to address
at the provided key
address
Buffer Address to set a storage value forkey
Buffer Key to set the value atvalue
Buffer Value to set atkey
for account corresponding toaddress
cb
Function 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.
cb
Function Callback function
Commits the current change-set to the instance since the last call to checkpoint.
cb
Function Callback function
Reverts the current change-set to the instance since the last call to checkpoint.
cb
Function 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.
cb
Function 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)
address
Buffer Address to checkcb
accountIsEmpty~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).
cb
Function Callback function
Default implementation of the StateManager
interface
opts
Object (optional, default{}
)opts.common
Common?Common
parameters of the chainopts.trie
Trie? amerkle-patricia-tree
instance
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
address
Buffer The address of theaccount
to return storage forcb
dumpStorage~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
error
Error an error that may have happened ornull
account
Account Anethereumjs-account
instance corresponding to the providedaddress
Callback for getContractCode
method
Type: Function
error
Error an error that may have happened ornull
code
Buffer The code corresponding to the provided address. Returns an emptyBuffer
if the account has no associated code.
Callback for getContractStorage
method
Type: Function
error
Error an error that may have happened ornull
storageValue
Buffer The storage value for the account corresponding to the provided address at the provided key. If this does not exists an emptyBuffer
is returned
Callback for getStateRoot
method
Type: Function
error
Error an error that may have happened ornull
. Will be an error if the un-committed checkpoints on the instance.stateRoot
Buffer The state-root of theStateManager
Callback for dumpStorage
method
Type: Function
error
Error an error that may have happened ornull
accountState
Object The state of the account as anObject
map. Keys are are the storage keys, values are the storage values as strings. Both are represented as hex strings without the0x
prefix.
Callback for hasGenesisState
method
Type: Function
error
Error an error that may have happened ornull
hasGenesisState
Boolean Whether the storage trie contains the canonical genesis state for the configured chain parameters.
Callback for accountIsEmpty
method
Type: Function