Difference between account balance and the sum unspent transaction outputs

1

I have account in bitcoin-core (for example it's "maks") and there I have 0.00010884 BTC.

getbalance "maks"
0.00010884

But when I get UTXO:

listunspent 1 999999 [...array of addresses belongs to "maks" account...]

and sum all amounts up I get 0.00009824 BTC and I don't understand WHY?? I thought account balance is sum all unspent transactions outputs. Please help me! Or maybe it's don't need me... I want to create raw transactions and for this I need unspent transactions. How I can get these transactions?

xmaks

Posted 2017-10-18T13:50:15.223

Reputation: 11

Answers

3

Accounts have nothing to do with UTXOs.

They are bean counters to help you determine who owns how much, in case you have multiple users sharing the same wallet.

An account is credited whenever a payment arrives to an address associated with that account. It is debited whenever the sendfrom or sendmany RPC is used while specifying that account. If you use any other means of sending, the "" account will be debited.

However, the UTXOs are always shared across all accounts in a wallet, and don't belong to a specific account. When you send out money, all UTXOs are always considered. Accounts can go negative even, if you use the move command (which just increments one account and decrements another).

The above is one of the reasons why the accounts system is deprecated, as it does not match people's expectations. If you want to have actually separated users, with independent UTXOs and balances, you should look at the multi-wallet feature added in 0.15.0.

Pieter Wuille

Posted 2017-10-18T13:50:15.223

Reputation: 54 032

Do you want to say that bitcoin-core is a bad idea for creating a bitcoin-purse?xmaks 2017-10-19T05:56:36.107

I have no idea how you read that in my answer. All I'm saying is that you've very much misunderstood what accounts in Bitcoin Core are designed to do. I've added a line about multi-wallet support, which may be more what you're after.Pieter Wuille 2017-10-19T06:11:08.740

Sorry! I meant creating multi-wallet. where each user can use just his UTXOsxmaks 2017-10-19T06:20:59.257

0

bitcoin-core accounting system is not perfect. as far as i know the developers do not support it anymore

I want to create raw transactions and for this I need unspent transactions.

are you sure that you want to do this hard work for 0.00010884 btc? :)

How I can get these transactions?

  • create a dump of your wallet
  • look through all addresses on some block explorer
  • write down the unspent outputs

amaclin

Posted 2017-10-18T13:50:15.223

Reputation: 5 763

bitcoin-core accounting system is not perfect - As far as I know, a new version 15 has been released recently. It's just balance for testing :) So why account balance and the sum of UTXO are not equal?xmaks 2017-10-18T14:09:13.623

1You're right that the accounting system is deprecated and will be removed, but that has nothing to do with this question. The answer is the UTXOs have never had anything to do with accounts.Pieter Wuille 2017-10-18T15:48:07.780