Language

Choose a language

/build/rpc / btc

getbalances

getbalances Returns an object with all balances in BTC. Result: { (json object) "mine" : { (json object) balances from outputs that the wallet can sign "trusted" : n, (numeric) trusted balance (outputs created by the wallet or confirmed outputs) "untrusted_pending" : n, (numeric) untrusted pending balance (outputs created by others that are in the mempool) "immature" : n, (numeric) balance from immature coinbase outputs "bonded" : n, (numeric) balance bonded in issuer credential UTXOs "used" : n (numeric, optional) (only present if avoid_reuse is set) balance from coins sent to addresses that were previously spent from (potentially privacy violating) }, "watchonly" : { (json object, optional) balances from watch-only outputs (only present if the wallet tracks watch-only scripts) "trusted" : n, (numeric) trusted watch-only balance "untrusted_pending" : n, (numeric) untrusted pending watch-only balance "immature" : n, (numeric) immature watch-only coinbase balance "bonded" : n (numeric) watch-only balance bonded in issuer credential UTXOs }, "lastprocessedblock" : { (json object) hash and height of the block this information was generated on "hash" : "hex", (string) hash of the block this information was generated on "height" : n (numeric) height of the block this information was generated on } } Examples: > bitcoin-cli getbalances > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "getbalances", "params": []}' -H 'content-type: application/json' http://127.0.0.1:8332/

Signature

getbalances() → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"getbalances","params":[]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

No parameters.

Result

Type:  any

{ (json object) "mine" : { (json object) balances from outputs that the wallet can sign "trusted" : n, (numeric) trusted balance (outputs created by the wallet or confirmed outputs) "untrusted_pending" : n, (numeric) untrusted pending balance (outputs created by others that are in the mempool) "immature" : n, (numeric) balance from immature coinbase outputs "bonded" : n, (numeric) balance bonded in issuer credential UTXOs "used" : n (numeric, optional) (only present if avoid_reuse is set) balance from coins sent to addresses that were previously spent from (potentially privacy violating) }, "watchonly" : { (json object, optional) balances from watch-only outputs (only present if the wallet tracks watch-only scripts) "trusted" : n, (numeric) trusted watch-only balance "untrusted_pending" : n, (numeric) untrusted pending watch-only balance "immature" : n, (numeric) immature watch-only coinbase balance "bonded" : n (numeric) watch-only balance bonded in issuer credential UTXOs }, "lastprocessedblock" : { (json object) hash and height of the block this information was generated on "hash" : "hex", (string) hash of the block this information was generated on "height" : n (numeric) height of the block this information was generated on } }

Source: services/core-node/bcore/src/wallet/rpc/coins.cpp:426

C++ symbol: getbalances