2

i'm trying to see all tx hashes and the balance for an address i don't own:

$ bitcoin-cli importaddress 1M43pksKTGpBd8J8XzjStjgnX5vie1kpYA
$ # wait 5 minutes while bitcoind presumably scans all txs
$ # for this address
$ bitcoin-cli getbalance 1M43pksKTGpBd8J8XzjStjgnX5vie1kpYA
0.00000000

bitcoind claims this address has no balance while blockchain.info currently shows a final balance of 0.00993754 BTC

why is this not working?

however the listunspent command appears to list the unspent transactions correctly:

$ bitcoin-cli listunspent 1M43pksKTGpBd8J8XzjStjgnX5vie1kpYA
[
    {
        "txid" : "0fdcdeff329b91fb9888720c958d550c39716f92abec4e5b6ff7c53a22bb31c2",
        "vout" : 0,
        "address" : "1M43pksKTGpBd8J8XzjStjgnX5vie1kpYA",
        "account" : "",
        "scriptPubKey" : "76a914dbf61ed2ce1def33a34d89ab7b05ccc25d9cf02288ac",
        "amount" : 0.00010000,
        "confirmations" : 3608,
        "spendable" : false
    },
    {
        "txid" : "db1beb183808e8b41064405d43bd6c684874b5f328bfb565c4e16cc2baaa0d18",
        "vout" : 1,
        "address" : "1M43pksKTGpBd8J8XzjStjgnX5vie1kpYA",
        "account" : "",
        "scriptPubKey" : "76a914dbf61ed2ce1def33a34d89ab7b05ccc25d9cf02288ac",
        "amount" : 0.00983754,
        "confirmations" : 4459,
        "spendable" : false
    }
]

adding up the funds here: 0.00983754 + 0.00010000 = 0.00993754 matches the blockchain.info figure. maybe getbalance only shows spendable funds?

1

Try getbalance "*" 0 true.

help of getbalance says: getbalance ( "account" minconf includeWatchonly )

  • i was hoping for balances denominated by address instead of a single number for all addresses. still, cheers for the answer :) – mulllhausen Jun 20 '15 at 9:27
  • If you like to aggregate by address, you can use bitcoin-cli getreceivedbyaddress "<adr>" 0 – Jonas Schnelli Jun 20 '15 at 10:14
  • good to know thanks. but this isn't quite the same as a balance - its the total received but does not subtract spent coins – mulllhausen Jun 20 '15 at 12:52
  • That is intentional. Addresses are intended to be one-use destinations for payments, and getreceivedbyaddress can tell you whether the expected amount has been paid to it. Apart from that, all coins in the wallet are treated as belonging to the wallet and not to individual addresses, which is simpler to reason about that about individual addresses, especially when change outputs move coins are for privacy reasons. – Pieter Wuille Jun 20 '15 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.