Bitcoin wallet unconfirmed balance

Due to active malleable transaction relayers, it is dangerous to spend unconfirmed change outputs

If a user sends a transaction for an amount the reference client generates an output containing the leftover amount from the original inputs, called a 'change' output. The client is programmed to allow spending of this change even when unconfirmed since it was generated by the client itself.

In the presence of a malleable transactions this is not safe though. if a second transaction is done by the user that spends this unconfirmed change and the first transaction is mutated and included in a block then the second transaction is a double spend. It will never be confirmed.

The bitcoin reference client seems to get confused by this. It seems to allow additional spending of the unconfirmed change addresses and forms a chain of double spent transactions. The bitcoin balance as reported by 'getbalance' also becomes unreliable as it computes the balance incorrectly. Eventually the wallet stops working.

I struck this issue today with my wallet and worked around it by modifying bitcoind to not allow using unconfirmed change outputs. This does mean your 'sendable balance' will be different from your normal balance. I worked around this by changing the behavior of "getbalance *" to show the sendable balance. This is the somewhat hacky patch I used to do this.

With that patch it will not spend any output with less than two confirms. And you can get the spendable balance of 2 confirms with "getbalance * 2".

Bitcoin wallet unconfirmed

Bitcoin wallet insurance

Bitcoin wallet not showing balance

Litecoin wallet unconfirmed