<p>Assuming you don't trust anyone, you need to read the entire blockchain history once to generate your own set of unspent transactions (UTXOs). You won't need then to read again the full history every time you want to see your balance. Unspent Transactions are enough to do so.</p>

<p>Your balance is the sum of the values of the unspent transactions your wallet has. Unspent means here that you didn't "spend" the previously received amounts on outgoing transactions.</p>

<p>Example:</p>

<ul>
<li>Alice sends you 1 BTC. you now have an unspent transaction of 1 BTC. Your balance is the sum of unspent transactions, i.e. 1 BTC</li>
<li>Then Bob decides to send you 2 BTC. You have now two unspent transactions associated to your wallet, for a total balance of 3 BTC.</li>
<li>Let's assume now you want to send 1 BTC to Charlie. After checking that you have at least 1 unspent BTC (which is the case), your transaction would be processed and the amount that you spend would be removed from your "unspent" transaction. In that case, the transaction received from Alice would be now marked as spent and would be removed from your list of unspent transactions.</li>
<li>Your balance is still the sum of unspent transactions, i.e. 2 BTC (from Bob)</li>
</ul>

CC BY-SA 3.0
2018-02-23T04:18:49.800Z
In order to figure out what the unspent outputs are, you still need to read the entire blockchain history.
Ava Chow
CC BY-SA 3.0
2018-02-22T13:05:48.570Z
2018-02-23T10:50:08.703Z
2018-02-23T10:50:08.703Z
Aymen
<p>If it is your 'wallet' and you have the private keys then you can import them into a wallet application. The wallet, with some work, is able to decipher which addresses are yours, scan the transactions on the blockchain and, update the balances.</p>

CC BY-SA 3.0
2018-02-22T12:43:12.083Z
I mean to ask how would one write software to do this? I'm trying to understand the format of the blockchain
Zain Rizvi
CC BY-SA 3.0
2018-02-22T10:17:03.390Z
2018-02-22T10:17:03.390Z
Willtech
<blockquote>
  <p>Therefore it seems like if you want to get the value of any given wallet you would have to read every transaction in the ledger from the very beginning.</p>
</blockquote>

<p>Yes, basically.  If you were sent 1 BTC in 2010 and never spent it, and 1 BTC in 2018 (also unspent), you have 2 BTC, but without going through the entire history of the ledger, you wouldn't be able to see both in your wallet without scanning the entire history.</p>

<p>It would be nice to be able to bootstrap a node with <em>just</em> the UTXO (unspent coins) at some point, but then to do this you'd have to trust the person generating the bootstrap, and you could not trace the true history of any of the coins (such as what IOTA do when they take a snapshot).</p>

CC BY-SA 3.0
2018-02-23T11:50:05.070Z
2018-02-23T11:50:05.070Z
Daniel Morritt
<p>It seems like the blockchain transactions only stores the number of coins moving from one wallet to the other, but does not have the total amounts for each wallet.</p>

<p>Therefore it seems like if you want to get the value of any given wallet you would have to read every transaction in the ledger from the very beginning.</p>

<p>Is this correct or am I missing something?</p>

<p>Fyi, my goal is to understand the format of the blockchain better</p>

<transactions><blockchain><wallet><balance>
How can one read the value of a wallet from the blockchain?
Zain Rizvi
# How can one read the value of a wallet from the blockchain?

(Asked by: username_0 on 2018-02-22)

It seems like the blockchain transactions only stores the number of coins moving from one wallet to the other, but does not have the total amounts for each wallet.

Therefore it seems like if you want to get the value of any given wallet you would have to read every transaction in the ledger from the very beginning.

Is this correct or am I missing something?

Fyi, my goal is to understand the format of the blockchain better

**Tags:** transactions, blockchain, wallet, balance


---

## 3 answers

### Answer by username_1 on 2018-02-22. Score: 3 | Accepted answer

Assuming you don't trust anyone, you need to read the entire blockchain history once to generate your own set of unspent transactions (UTXOs). You won't need then to read again the full history every time you want to see your balance. Unspent Transactions are enough to do so.

Your balance is the sum of the values of the unspent transactions your wallet has. Unspent means here that you didn't "spend" the previously received amounts on outgoing transactions.

Example:

* Alice sends you 1 BTC. you now have an unspent transaction of 1 BTC. Your balance is the sum of unspent transactions, i.e. 1 BTC
* Then Bob decides to send you 2 BTC. You have now two unspent transactions associated to your wallet, for a total balance of 3 BTC.
* Let's assume now you want to send 1 BTC to Charlie. After checking that you have at least 1 unspent BTC (which is the case), your transaction would be processed and the amount that you spend would be removed from your "unspent" transaction. In that case, the transaction received from Alice would be now marked as spent and would be removed from your list of unspent transactions.
* Your balance is still the sum of unspent transactions, i.e. 2 BTC (from Bob)

> **Comments:**
> **username_2**: In order to figure out what the unspent outputs are, you still need to read the entire blockchain history.  

---

### Answer by username_3 on 2018-02-22. Score: 2

If it is your 'wallet' and you have the private keys then you can import them into a wallet application. The wallet, with some work, is able to decipher which addresses are yours, scan the transactions on the blockchain and, update the balances.

> **Comments:**
> **username_0**: I mean to ask how would one write software to do this? I'm trying to understand the format of the blockchain  

---

### Answer by username_4 on 2018-02-23. Score: 1

> Therefore it seems like if you want to get the value of any given wallet you would have to read every transaction in the ledger from the very beginning.

Yes, basically. If you were sent 1 BTC in 2010 and never spent it, and 1 BTC in 2018 (also unspent), you have 2 BTC, but without going through the entire history of the ledger, you wouldn't be able to see both in your wallet without scanning the entire history.

It would be nice to be able to bootstrap a node with *just* the UTXO (unspent coins) at some point, but then to do this you'd have to trust the person generating the bootstrap, and you could not trace the true history of any of the coins (such as what IOTA do when they take a snapshot).


---

