Reading the chain
A public account
wallet account get --scope all --account-id Public/<id>
--scope takes three forms:
--scope | Reads |
|---|---|
balance | the native balance only. This is the default |
all | every program’s state on the account |
<program account id> | one program’s state |
Prefer a single program’s id once an account has accumulated state: a full read can exceed the RPC response limit (jsonrpsee’s default 10 MiB, which neither the sequencer nor the wallet raises).
--raw gives the underlying bytes as hex instead of the wallet’s decoding:
wallet account get --raw --scope all --account-id Public/<id>
{
"actor_states": { "<program account id>": "486f6c61206d756e646f21" },
"nonce": 0
}
A Label: line per label precedes the JSON, so the output is not pure JSON. actor_states is keyed by program, because each program owns its state on the account and cannot touch another’s. Decode a value with whatever that program uses; for plain bytes, echo <hex> | xxd -r -p.
Without --raw the wallet decodes only the native balance: it prints Balance <n>, nonce <n> (or Balance not read when the scope is another program), then each other program’s non-empty state as hex under Record of program <id>.
A private account
Sync first, then read:
wallet account sync-private
wallet account get --scope all --account-id Private/<id>
The chain holds only a commitment and an encrypted note, so the wallet shows a private account from its own record. Two things update that record: sync-private, which scans the chain for notes the wallet can decrypt, and the inclusion of a transaction the wallet CLI itself sent, for the accounts that transaction changed (finish_transaction, lez/wallet/src/lib.rs). A transaction sent any other way, such as by a client built on the wallet library, shows only after a sync. Until then the wallet prints its last record; for an account it holds keys for but has no state for yet, --scope all prints Account is Uninitialized and --scope balance prints Balance 0, nonce 0. sync-private asks before reading any blocks when run at a terminal; --yes skips the prompt.
The server does not have the keys, so no query returns a private account’s state, for you or anyone else.
A private account’s nonce is a hash chain rather than a count, so it changes unpredictably with each update and says nothing about how often the account has been used.
Scanning from genesis
A new wallet starts synced at the chain tip, so sync-private never reads the blocks before it. That is right for keys the wallet just made, and wrong for anything older. Importing a private account, or adding a shared account of a group this wallet did not create, rewinds the sync cursor of a wallet that started at the tip, so the next sync-private reads from block 1. To rediscover every private account the wallet’s keys open, from block 1:
wallet account sync-private --rescan
It does not move the sync cursor and keeps every other record. It fails with History ends before block N when the cursor is past the end of the chain, as for a wallet set up against one network and then pointed at a younger one; start a new wallet home for that chain.
The chain itself
wallet chain-info current-block-id
wallet chain-info block --id <n>
wallet chain-info transaction --hash <32-byte hex>
current-block-id is the tip, not the last finalized block; Finality explains the difference.
When something is missing
A submitted transaction you cannot find is usually one of three things.
- It has not been included yet. Wait for a block.
- It was refused, so nothing happened and there is nothing to find. A private transaction whose public part fails at settlement is refused if the failure is a malformed input or nothing pays for it. If its proof carries a fee fallback, or a public signer declares the fee, it is included instead: the public part reverts and the fee is still paid. Whenever the public part can fail, the wallet adds one of the two or stops before proving.
- It touched a private account and you have not synced.
Programmatic access
The public reads here have RPC equivalents, and more besides, including event queries and a subscription for finalized blocks. See Reading state from a client.