Skip to content

bx fetch balance

Eric Voskuil edited this page Feb 16, 2015 · 42 revisions

Get the balance in satoshi of a Bitcoin address.

$ bx fetch-balance --help
Usage: bx fetch-balance [-h] [--config VALUE] [--format VALUE]           
[BITCOIN_ADDRESS]                                                        

Info: Get the balance in satoshi of a Bitcoin address. Requires a        
Libbitcoin/Obelisk server connection.                                    

Options (named):

-c [--config]        The path to the configuration settings file.        
-f [--format]        The output format. Options are 'info', 'json', and  
                     'xml', defaults to 'info'.                          
-h [--help]          Get a description and instructions for this command.

Arguments (positional):

BITCOIN_ADDRESS      The Bitcoin address. If not specified the address is
                     read from STDIN.

This command supports configuration settings.

Example 1

first address on the blockchain

$ bx fetch-balance 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
balance
{
    address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
    confirmed 1538241483
    received 6538241483
    unspent 6538241483
}

The above properties represent the number of satoshis associated with the address in the following manner.

  • Confirmed - the number with any confirmation, excluding those spent.
  • Received - the number confirmed or unconfirmed, including those spent.
  • Unspent - the number received that remain unspent.

These numeric values will change over time as more people send money to Satoshi, and/or the money at this address is spent. This first transaction is unique in that it contains 50 bitcoin that can never be confirmed.

Example 2

--format json

$ bx fetch-balance -f json 134HfD2fdeBTohfx8YANxEpsYXsv5UoWyz
{
    "balance": {
        "address": "134HfD2fdeBTohfx8YANxEpsYXsv5UoWyz",
        "confirmed": "0"
        "received": "100000",
        "unspent": "0",
    }
}

Example 3

--format xml

$ bx fetch-balance -f xml 13Ft7SkreJY9D823NPm4t6D1cBqLYTJtAe
<?xml version="1.0" encoding="utf-8"?>
<balance><address>13Ft7SkreJY9D823NPm4t6D1cBqLYTJtAe</address><confirmed>90000</confirmed><received>90000</received><unspent>90000</unspent></balance>

BX Menu

Clone this wiki locally