Retrieves the state that corresponds to the block number and returns a list of accounts (including storage and code).
NOTE: This function correctly returns the state for a few latest, currently 4, block numbers. Retrieving older block state is restricted depending on the value set for the command-line option --state.block-interval (default: 128). This means that the function performs the state retrieval against only the block numbers that are multiples of state.block-interval. For example, when state.block-interval is 128, this function returns the state for the block numbers "0x0", "0x80", "0x100", "0x180", and so on. If the block number is not a multiple of state.block-interval, it returns 'missing trie node' error.
Client
Method Invocation
Console
debug.dumpBlock(number)
RPC
{"method": "debug_dumpBlock", "params": [number]}
Parameters
Name
Type
Description
block number or hash
QUANTITY | TAG | HASH
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.
NOTE: In versions earlier than Klaytn v1.7.0, only hex string type is available.
Return Value
Type
Description
JSON string
The block information.
Example
Console
>debug.dumpBlock("0x80"){ accounts: {0000000000000000000000000000000000000035: { balance:"12800000000000000000", code: "6080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631a39d8ef81146100805780636353586b146100a757806370a08231146100ca578063fd6b7ef8146100f8575b3360009081526001602052604081208054349081019091558154019055005b34801561008c57600080fd5b5061009561010d565b60408051918252519081900360200190f35b6100c873ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100d657600080fd5b5061009573ffffffffffffffffffffffffffffffffffffffff60043516610147565b34801561010457600080fd5b506100c8610159565b60005481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604081208054349081019091558154019055565b60016020526000908152604090205481565b336000908152600160205260408120805490829055908111156101af57604051339082156108fc029083906000818181858888f193505050501561019c576101af565b3360009081526001602052604090208190555b505600a165627a7a723058201307c3756f4e627009187dcdbc0b3e286c13b98ba9279a25bfcc18dd8bcd73e40029",
codeHash:"62b00472fac99d94ccc52f5addac43d54c129cd2c6d2357c9557abea67efdec5", nonce:0, root:"56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", storage: {} },/...(skipped).../ codeHash:"3f34b5d7038ae652086ba4847ede2668b26a50107c5258d1412f764b942e2661", nonce:1, root:"56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", storage: {} } }, root:"70383c826d1161ec2f12d799023317d8da7775dd47b8502d2d7ef646d094d3a5"}>debug.dumpBlock("0x81")Error: missing trie node a573119868e0898fe5526732a079dd713c005fcbcce38dec5cae75af0378e4d3 (path ) at web3.js:3239:20 at web3.js:6447:15 at web3.js:5181:36 at <anonymous>:1:1
HTTP RPC
debug_dumpStateTrie
Retrieves all state/storage tries of the given state root.
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.
NOTE: In versions earlier than Klaytn v1.7.0, only integer type is available.
Return Value
Type
Description
string
The RLP-encoded block.
Example
Console
HTTP RPC
debug_getModifiedAccountsByHash
Returns all accounts that have changed between the two blocks specified by their block hashes. Changes made in endBlockHash are included, but changes made in startBlockHash are not. If endBlockHash is not given, it returns the accounts modified in the startBlockHash. A change is defined as a difference in nonce, balance, code hash, or storage hash.
The list of addresses modified between the given range.
Example
Console
HTTP RPC
debug_getModifiedAccountsByNumber
Returns all accounts that have changed between the two blocks specified by their block numbers. Changes made in endBlockNum are included, but changes made in startBlockNum are not. If endBlockNum is not given, it returns the accounts modified in the startBlockNum. A change is defined as a difference in nonce, balance, code hash, or storage hash.
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.
NOTE: In versions earlier than Klaytn v1.7.0, only integer type is available.
Return Value
Type
Description
string
Dump of a block struct.
Example
Console
HTTP RPC
debug_setHead
Sets the current head of the local chain by block number.
NOTE: This is a destructive action and may severely damage your chain. Use with extreme caution.
Client
Method Invocation
Console
debug.setHead(number)
RPC
{"method": "debug_setHead", "params": [number]}
Parameters
Name
Type
Description
number
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter.
Return Value
None
Example
Console
HTTP RPC
debug_seedHash
Retrieves the seed hash of a block.
Client
Method Invocation
Console
debug.seedHash(number)
RPC
{"method": "debug_seedHash", "params": [number]}
Parameters
Name
Type
Description
number
uint64
The block number.
Return Value
Name
Type
Description
seedHash
string
The block seed hash.
Example
Console
HTTP RPC
debug_startWarmUp
The startWarmUp iterates the latest state trie to warm-up the trie cache. The iteration will be automatically stopped if 90% of the trie cache is full. The method returns an error if it fails in starting a warm-up, or null if it successfully has started it.
Client
Method invocation
Console
debug.startWarmUp()
RPC
{"method": "debug_startWarmUp"}
Parameters
None
Return Value
Type
Description
Error
null if a warm-up is started, or an error if not.
Example
Console
HTTP RPC
debug_startContractWarmUp
The startContractWarmUp iterates the latest storage trie of the given contract address to warm-up the trie cache. The iteration will be automatically stopped if 90% of the trie cache is full. The method returns an error if it fails in starting a warm-up or the given address is not a contract address, or null if it successfully has started it.
The stopWarmUp stops the currently running warm-up. This method takes no parameters, and returns null or an error depending on a warm-up was stopped or not.
Client
Method invocation
Console
debug.stopWarmUp()
RPC
{"method": "stopWarmUp"}
Parameters
None
Return Value
Type
Description
Error
null if a warm-up is stopped, or an error if not.
Example
Console
HTTP RPC
debug_startCollectingTrieStats
The startCollectingTrieStats iterates the latest state or storage trie to collect trie statistics. It collects storage trie statistics of the contract in the given address. If an empty address(="0x00...00") is given, it collects statistics of the whole state trie. Statistics will be logged every minute before end, containing overall and depth-by-depth information. The method returns an error if it fails in starting a task, or null if it successfully has started it.
INFO[03/10,12:03:12 +09] [5] Started collecting trie statistics blockNum=1491072 root=0x64af12b6374b92f6db457fa1b98fe9522d9f36ba352e3c4e01cdb75f001e8264 len(children)=16
...
INFO[03/10,12:03:12 +09] [5] Finished collecting trie statistics elapsed=95.152412ms numNodes=133036 numLeafNodes=95948 maxDepth=9
INFO[03/10,12:03:12 +09] [5] number of leaf nodes in a depth depth=5 numNodes=22098
INFO[03/10,12:03:12 +09] [5] number of leaf nodes in a depth depth=6 numNodes=65309
INFO[03/10,12:03:12 +09] [5] number of leaf nodes in a depth depth=7 numNodes=8083
INFO[03/10,12:03:12 +09] [5] number of leaf nodes in a depth depth=8 numNodes=456
INFO[03/10,12:03:12 +09] [5] number of leaf nodes in a depth depth=9 numNodes=2