I know from https://github.com/near/near-cli#overview that I can call near state
to view general details of an account, like this:
NEAR_ENV=mainnet near state root.near
Account root.near
{
amount: '517981340092537993206924239',
block_hash: '6A4vsQqTjdQgKnWrHVURycSmehBMgtgg4GNemmjZUB6S',
block_height: 64959783,
code_hash: '11111111111111111111111111111111',
locked: '0',
storage_paid_at: 0,
storage_usage: 13899,
formattedAmount: '517.981340092537993206924239'
}
And I know that I can browse on the web at https://explorer.near.org/accounts/root.near
But how can I explore (either via a website or CLI) the contents of all of the on-chain data in an account's storage?
You can use the CLI's
view-state
command. An example of this could be:export NEAR_ENV=mainnet
near view-state nft.nearvember-challenge.near --finality final
This will return key value pairs that are base64 encoded. You can loop through and decode these as you wish. For example, one of the key value pairs returned from this call is:
which, if base64 decoded, has a value of
Keep in mind that the CLI will only return state that's below a certain threshold. If the account's state is too large, it won't be viewable unless you configure and run your own node.