<blockquote>
  <p><strong>Alice has 500$</strong></p>
</blockquote>

<p>It is better to suggest <em>"Alice has 500 mBTC"</em> because amounts in the blockchain are not dollar-denominated.</p>

<blockquote>
  <p><strong>Miners who got the chance to validate the transaction has to check whether alice have sufficient balance or not.</strong></p>
</blockquote>

<p>No they dont.</p>

<p>Miners don't care about balances.</p>

<p>Miners only care whether Alice has provided proof¹ that she holds the private keys required by the scripts in the transaction inputs.</p>

<p>Other nodes validating blocks also don't care about balances.</p>

<p>In accounting terms, the blockchain is a transaction journal, not a ledger. It does not keep track of balances held by people. By processing the journal you can calculate a current amount for each Bitcoin address. Note that not all transactions use Bitcoin addresses. These addresses are merely an artifact of certain commonly used scripts. Scripts don't have to contain data that is conceptually an address.</p>

<blockquote>
  <p><strong>where are these alice and bob balances are stored?</strong></p>
</blockquote>

<p>Not in the blockchain.</p>

<blockquote>
  <p><strong>how balance is retrieved?</strong></p>
</blockquote>

<p>It isn't, not by miners and no one other than Alice ever retrieves Alice's total balance.</p>

<blockquote>
  <p><strong>Does entire block chain is searched to find their balance and validate and update?</strong></p>
</blockquote>

<p>No.</p>

<blockquote>
  <p><strong>or block where these balances are stored is kept track any where else?</strong></p>
</blockquote>

<p>No.</p>

<p>Alice's wallet might keep a separate record in memory and committed to local disk in some proprietary form. That would probably be sensible for performance reasons but is not required..</p>

<hr>

<h2>Footnotes</h2>

<ol>
<li>Proof</li>
</ol>

<p>When Alice uses her wallet to pay 500 mBTC to Bob, her wallet checks its list of unspent transaction outputs (UTXOs) for the bitcoin-addresses that Alice has contol of in her wallet. It uses as many of these as are needed to add up to 500 mBTC plus the selected transaction fee. It constructs a transaction which lists these selected UTXOs as inputs and lists outputs including a 500 mBTC output to one of Bob's bitcoin-addresses and an output to one of Alice's bitcoin-addresses for the unused "change". The transaction includes cryptographic "signatures" made using Alice's private key(s) which proves she controls those UTXOs used as inputs and which can be checked (validated) by other people's wallets by using Alice's published public keys. These signatures by ALice's wallet satisfy the Bitcoin-scripts that are part of the UTXOs which Alice's wallet is using to make the payment. </p>

<p>Note that there is no need to calculate a sufficient balance. When Alice pays Bob $17 using a $10 note† and two $5 notes, Bob doesn't need to know haw many other dollar notes Alice has in her purse. He just needs to check the notes she gave him look real. Alice needs to make sure she gets $3 in change.</p>

<p>† US: bill; Rest-of-English-speaking-world: banknote.</p>

CC BY-SA 4.0
2019-02-20T15:13:17.070Z
Thank you! One thing is not yet clear to me.. Suppose alice want to transfer 600 mBTC which is greater than his wallet balance to bob, still this transaction is added to the blockchain??(This might happen if miners don't check alice balance).. Then how this problem is overcomed??
Shirisha Kollapuram
CC BY-SA 4.0
2019-02-20T15:25:16.603Z
In what cases blockchain need to be searched and if it is required how searching is done? Can you please explain with some example.. Thank you   @RedGrittyBrick
Shirisha Kollapuram
CC BY-SA 4.0
2019-02-20T15:40:16.243Z
@ShirishaKollapuram: In this Q&A website, follow-up questions are asked as a new-question (with link to prior question if useful for context) using the "[Ask Question](https://bitcoin.stackexchange.com/questions/ask)" link at top right of page. But first search for existing answers. Comments are for requesting clarification of a question or suggesting improvements to an answer. Comments are temporary and may be deleted by moderators cleaning the system. Questions and Answers are intended to form a repository of searchable information useful to other people in future.
RedGrittyBrick
CC BY-SA 4.0
2019-02-20T15:53:23.863Z
@ShirishaKollapuram: see new footnote in answer above.
RedGrittyBrick
CC BY-SA 4.0
2019-02-20T11:57:19.967Z
2019-02-20T20:39:03.773Z
2019-02-20T20:39:03.773Z
RedGrittyBrick
<p>Alice has 500$ and bob has 1000$. Now alice wants to transfer 100$ to bob. Miners who got the chance to validate the transaction has to check whether alice have sufficient balance or not.
where are these alice and bob balances are stored? If they are stored in the block chain, how balance is retrieved? Does entire block chain is searched to find their balance and validate and update? or block where these balances are stored is kept track any where else?</p>

<p>Response really helps,
Thank you.</p>

<blockchain>
How data is searched in blockchain?
Shirisha Kollapuram
# How data is searched in blockchain?

(Asked by: username_0 on 2019-02-20)

Alice has 500$ and bob has 1000$. Now alice wants to transfer 100$ to bob. Miners who got the chance to validate the transaction has to check whether alice have sufficient balance or not.
where are these alice and bob balances are stored? If they are stored in the block chain, how balance is retrieved? Does entire block chain is searched to find their balance and validate and update? or block where these balances are stored is kept track any where else?

Response really helps,
Thank you.

**Tags:** blockchain


---

## 1 answers

### Answer by username_1 on 2019-02-20. Score: 3

> **Alice has 500$**

It is better to suggest *"Alice has 500 mBTC"* because amounts in the blockchain are not dollar-denominated.

> **Miners who got the chance to validate the transaction has to check whether alice have sufficient balance or not.**

No they dont.

Miners don't care about balances.

Miners only care whether Alice has provided proof¹ that she holds the private keys required by the scripts in the transaction inputs.

Other nodes validating blocks also don't care about balances.

In accounting terms, the blockchain is a transaction journal, not a ledger. It does not keep track of balances held by people. By processing the journal you can calculate a current amount for each Bitcoin address. Note that not all transactions use Bitcoin addresses. These addresses are merely an artifact of certain commonly used scripts. Scripts don't have to contain data that is conceptually an address.

> **where are these alice and bob balances are stored?**

Not in the blockchain.

> **how balance is retrieved?**

It isn't, not by miners and no one other than Alice ever retrieves Alice's total balance.

> **Does entire block chain is searched to find their balance and validate and update?**

No.

> **or block where these balances are stored is kept track any where else?**

No.

Alice's wallet might keep a separate record in memory and committed to local disk in some proprietary form. That would probably be sensible for performance reasons but is not required..

---

## Footnotes

1. Proof

When Alice uses her wallet to pay 500 mBTC to Bob, her wallet checks its list of unspent transaction outputs (UTXOs) for the bitcoin-addresses that Alice has contol of in her wallet. It uses as many of these as are needed to add up to 500 mBTC plus the selected transaction fee. It constructs a transaction which lists these selected UTXOs as inputs and lists outputs including a 500 mBTC output to one of Bob's bitcoin-addresses and an output to one of Alice's bitcoin-addresses for the unused "change". The transaction includes cryptographic "signatures" made using Alice's private key(s) which proves she controls those UTXOs used as inputs and which can be checked (validated) by other people's wallets by using Alice's published public keys. These signatures by ALice's wallet satisfy the Bitcoin-scripts that are part of the UTXOs which Alice's wallet is using to make the payment.

Note that there is no need to calculate a sufficient balance. When Alice pays Bob $17 using a $10 note† and two $5 notes, Bob doesn't need to know haw many other dollar notes Alice has in her purse. He just needs to check the notes she gave him look real. Alice needs to make sure she gets $3 in change.

† US: bill; Rest-of-English-speaking-world: banknote.

> **Comments:**
> **username_0**: Thank you! One thing is not yet clear to me.. Suppose alice want to transfer 600 mBTC which is greater than his wallet balance to bob, still this transaction is added to the blockchain??(This might happen if miners don't check alice balance).. Then how this problem is overcomed??  
> **username_0**: In what cases blockchain need to be searched and if it is required how searching is done? Can you please explain with some example.. Thank you   @username_1  
> **username_1**: @username_0: In this Q&A website, follow-up questions are asked as a new-question (with link to prior question if useful for context) using the "[Ask Question](https://bitcoin.stackexchange.com/questions/ask)" link at top right of page. But first search for existing answers. Comments are for requesting clarification of a question or suggesting improvements to an answer. Comments are temporary and may be deleted by moderators cleaning the system. Questions and Answers are intended to form a repository of searchable information useful to other people in future.  
> **username_1**: @username_0: see new footnote in answer above.  

---

