<p>As far i know, In bitcoin there is no where storing the account balance in db straight forward. If the person wants to know his account balance from his client app the server will calculate all his transaction of credit and debit return the sum value.</p>

<p>If this above is true when person A has previous transactions like 20,000 and Person A wants to transfer some money he has to Person B.</p>

<p>When this process starts the bitcoin mining server has to calculate all his transaction from beginning to check whether the person A has enough balance or not and this has to be done in other mining server also to verify.</p>

<p>In this case as long as the person has 1 lac transaction, to calculate the balance the computation process will be heavy right ? more computation process uses more cpu cycles and power which affect the maintain cost of the computer and transaction fee may go high.</p>

<p>Please explain how its happening ?</p>

CC BY-SA 3.0
2017-11-09T18:21:25.280Z
Possible duplicate of https://bitcoin.stackexchange.com/questions/62011/blockchain-and-transaction-validation
Ava Chow
CC BY-SA 3.0
2017-11-09T19:07:40.023Z
https://medium.com/@ConsenSys/thoughts-on-utxo-by-vitalik-buterin-2bb782c67e53
From this i can understand well it uses UTXO but what if the UTXO has million transaction with value of 0.000001 BTC. At the time that the person wants to send 1.1 BTC  the system has loop through 1 million records to match 1.1 BTC and finally its going to return false because the  user has balance is 1 BTC. looping 1 million record seems heavy computation for me and the computation process also used some money (electricity)...
balaphp
CC BY-SA 3.0
2017-11-09T19:12:32.570Z
that is not how the UTXO set works. Bitcoin does not use balances, it uses UTXOs. UTXOs are explicitly referenced when they are spent, so it is trivial to just look up each individual UTXO. A UTXO represents exactly one thing, not "million transaction" or multiple transactions.
Ava Chow
CC BY-SA 3.0
2017-11-09T19:21:33.550Z
no UTXO is a collection of unspent or received transaction right ? 
There can be chances of having N number (millions) of transaction in UTXO set..
am i right ?
https://bitcoin.stackexchange.com/questions/4301/what-is-an-unspent-output/4304#4304
balaphp
CC BY-SA 3.0
2017-11-09T20:43:38.290Z
No, a single UTXO is a single item: a transaction output. It is not a collection of transactions or outputs. The UTXO set is the collection of UTXOs. There are millions of UTXOs in the UTXO set, but it does not require significant computation to retrieve them (retrieval is O(1)). Calculating the sum of the inputs is only O(n) and is not very computationally expensive. The computationally expensive parts are in signature validation and other checks that need to be done, not balance calculation.
Ava Chow
CC BY-SA 3.0
2017-11-10T03:45:22.667Z
Understand bit.. when the transaction happen the amount will be taken from UTXO set. the process will use UTXOs is LIFO or FIFO ?
balaphp
CC BY-SA 3.0
2017-11-10T04:18:43.107Z
Neither. UTXOs are specified and the sender can choose UTXOs in whatever order they want.
Ava Chow
CC BY-SA 3.0
2017-11-10T05:11:40.153Z
Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/68515/discussion-between-balaphp-and-andrew-chow).
balaphp
<balance>
Bitcoin account balance computation power
balaphp
# Bitcoin account balance computation power

(Asked by: username_0 on 2017-11-09)

As far i know, In bitcoin there is no where storing the account balance in db straight forward. If the person wants to know his account balance from his client app the server will calculate all his transaction of credit and debit return the sum value.

If this above is true when person A has previous transactions like 20,000 and Person A wants to transfer some money he has to Person B.

When this process starts the bitcoin mining server has to calculate all his transaction from beginning to check whether the person A has enough balance or not and this has to be done in other mining server also to verify.

In this case as long as the person has 1 lac transaction, to calculate the balance the computation process will be heavy right ? more computation process uses more cpu cycles and power which affect the maintain cost of the computer and transaction fee may go high.

Please explain how its happening ?

**Tags:** balance

> **Comments:**
> **username_1**: Possible duplicate of https://bitcoin.stackexchange.com/questions/62011/blockchain-and-transaction-validation  
> **username_0**: https://medium.com/@ConsenSys/thoughts-on-utxo-by-vitalik-buterin-2bb782c67e53 From this i can understand well it uses UTXO but what if the UTXO has million transaction with value of 0.000001 BTC. At the time that the person wants to send 1.1 BTC  the system has loop through 1 million records to match 1.1 BTC and finally its going to return false because the  user has balance is 1 BTC. looping 1 million record seems heavy computation for me and the computation process also used some money (electricity)...  
> **username_1**: that is not how the UTXO set works. Bitcoin does not use balances, it uses UTXOs. UTXOs are explicitly referenced when they are spent, so it is trivial to just look up each individual UTXO. A UTXO represents exactly one thing, not "million transaction" or multiple transactions.  
> **username_0**: no UTXO is a collection of unspent or received transaction right ?  There can be chances of having N number (millions) of transaction in UTXO set.. am i right ? https://bitcoin.stackexchange.com/questions/4301/what-is-an-unspent-output/4304#4304  
> **username_1**: No, a single UTXO is a single item: a transaction output. It is not a collection of transactions or outputs. The UTXO set is the collection of UTXOs. There are millions of UTXOs in the UTXO set, but it does not require significant computation to retrieve them (retrieval is O(1)). Calculating the sum of the inputs is only O(n) and is not very computationally expensive. The computationally expensive parts are in signature validation and other checks that need to be done, not balance calculation.  
> **username_0**: Understand bit.. when the transaction happen the amount will be taken from UTXO set. the process will use UTXOs is LIFO or FIFO ?  
> **username_1**: Neither. UTXOs are specified and the sender can choose UTXOs in whatever order they want.  
> **username_0**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/68515/discussion-between-username_0-and-andrew-username_1).  

---

## 0 answers

