With some of the clients I use regularly (Multibit, Bitcoin for Android), I've noticed that, after I send bitcoins to an address, I have 0 BTC available to spend despite having perhaps a several bitcoin balance.

Looking more closely at the transaction details on Blockchain.info or Blockexplorer.com, I observe that the client sent my entire balance back to myself in the same transaction.

For example, my balance in my wallet before the transaction is 1 BTC. I send 0.5 BTC to address C from my wallet, plus 0.0005 BTC for transaction fees. I should have 0.4995 available immediately to spend on another transaction. However, the clients show 0 BTC available, but a balance of 0.4995 BTC.

When I look at the transaction, I see two input addresses, addresses A and B. The outputs are 0.5 BTC to address C, the destination of my payment, and 0.4995 to address B.

Why then do I have 0 BTC available when I clearly should have 0.4995 BTC available?

3 Answers
3

In this scenario, neither address A nor address B had a sufficient balance to pay 0.5 BTC by itself. The two together did have enough. So, the clients are intelligent enough combine the amounts of two addresses together in order to meet the desired transaction amount.

Unfortunately, the combination has the effect of sending bitcoins to yourself as "change" in the transaction. In this scenario, all of the available balance was split between address A and address B. In combining those in order to satisfy the payment to C, some was consolidated as "change" into address B.

Think of it mathematically, as well. This shows the equilibrium, from the point of view of the accounts you control.

Unfortunately, because of the number of confirmations the clients wait before allowing one to spend incoming transactions, the balance is present but unavailable to spend for several minutes, or as much as hour or more.

Clients should handle this better by warning if transaction about to be sent will create this confusing situation.

Say your 1 BTC balance was the output of a single transaction. To pay someone .5 BTC, you have to claim the output of that transaction. Then you have to pay the .0005 BTC fee. That leaves .4995 BTC which need to be left as an unclaimed transaction output for you to spend later.

To perform another transaction, you need to claim that .4995 BTC output from that previous transaction. But that .4995 BTC hasn't been confirmed yet. So it's not spendable.

The Bitcoin system deals with transactions which have inputs and outputs. Things like "accounts" and "balances" are just ways the client makes the system easier for humans to understand. They're not part of the protocol and aren't how the system works internally.

There is no way to leave part of an output. Either a transaction claims it or it doesn't. And transactions you sent to yourself are no different from transactions others sent you. (In fact, in general, it's impossible for outsiders to tell which is the change coming back to you and which is the payment to someone else. They're both just transaction outputs.)

When someone sends you bitcoin you receive a notification within a few seconds. You cannot however spend this money immediately. The computers in the bitcoin network group transactions together and confirm them in 'blocks'. These are produced on average every ten minutes. Once a block is produced with your transaction in it the bitcoin is then available to spend. You can see this on the transactions screen once the status icon is no longer empty.

Also, when you send a payment to someone, you often end up being sent change back. This is like giving someone a 'twenty' and getting 'ten' in return in a shop. Change is sent back to you when the next block is produced and until then you cannot spend the change.

The total balance shown (the large number next to the gold coins) is the total amount of bitcoin you have in your wallet INCLUDING unconfirmed receipts and your change. The amount 'Available to spend' is the amount in your wallet that is confirmed and not involved in a current spend. At any given moment, you can only spend up to the 'Available to spend' amount.