z_getbalanceforviewingkey - Zcash 5.5.0 RPC

z_getbalanceforviewingkey "fvk" ( minconf asOfHeight )

Returns the balance viewable by a full viewing key known to the node's wallet
for each value pool. Sprout viewing keys may be used only if the wallet controls
the corresponding spending key.
Arguments:
1. "fvk"        (string) The selected full viewing key.
2. minconf      (numeric, optional, default=1) Only include transactions confirmed at least this many times.
3. asOfHeight       (numeric, optional, default=-1) Execute the query as if it
                    were run when the blockchain was at the height specified by
                    this argument. The default is to use the entire blockchain
                    that the node is aware of. -1 can be used as in other RPC
                    calls to indicate the current height (including the
                    mempool), but this does not support negative values in
                    general. A “future” height will fall back to the current
                    height. Any explicit value will cause the mempool to be
                    ignored, meaning no unconfirmed tx will be considered.
                    `minconf` must be at least 1 when `asOfHeight` is provided.

Result:
{
  "pools": {
    "transparent": {
        "valueZat": amount   (numeric) The amount viewable by this FVK held in the transparent value pool
    "},
    "sprout": {
        "valueZat": amount   (numeric) The amount viewable by this FVK held in the Sprout value pool
    "},
    "sapling": {
        "valueZat": amount   (numeric) The amount viewable by this FVK held in the Sapling value pool
    "},
    "orchard": {
        "valueZat": amount   (numeric) The amount viewable by this FVK held in the Orchard value pool
    "}
  "},
  "minimum_confirmations": n (numeric) The given minconf argument
}
Result amounts are in units of zatoshis.
Pools for which the balance is zero are not shown.

Examples:

The per-pool amount viewable by key "myfvk" with at least 1 block confirmed
> zcash-cli z_getbalanceforviewingkey "myfvk"

The per-pool amount viewable by key "myfvk" with at least 5 blocks confirmed
> zcash-cli z_getbalanceforviewingkey "myfvk" 5

As a JSON RPC call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "z_getbalanceforviewingkey", "params": ["myfvk", 5] }' -H 'content-type: text/plain;' http://127.0.0.1:8232/


Maintained by @_garethtdavies; modified by: mdr0id;license of the docs is MIT (see zcash repo), license of the scripts and webpage is also MIT (github repo)

Note it uses a mainnet zcash node