2

I'm aware of the get_balance function - https://www.getmonero.org/resources/developer-guides/wallet-rpc.html#get_balance

$ curl http://127.0.0.1:18082/json_rpc -d 
'{"jsonrpc":"2.0","id":"0","method":"get_balance",
"params":{"account_index":0,"address_indices":[0,1]}}'
-H 'Content-Type: application/json'

===> {.............}

However, it doesn't show how, at what point use the private view key, nor any keys at all.

How?

Kum
  • 25
  • 5

1 Answers1

0

The monero-wallet-rpc program operates on a wallet, not just key(s). Create1 yourself a view-only wallet and open that with the monero-wallet-rpc (either using the --wallet-file=<file> option or open_wallet RPC method).

Additionally, you need to understand that to get the balance, a view-only wallet is not sufficient alone, as you need to also track the spent status of outputs to know the wallet balance. See this answer for import/export of outputs and key-images, which you'll also need to perform.

1There are multiple ways to create your view-only wallet, one example is via monero-wallet-cli --generate-from-view-key arg.

jtgrassie
  • 19,601
  • 4
  • 17
  • 54