0

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.

1 Answer 1

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.

4
  • 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?? Feb 20, 2019 at 15:13
  • 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 Feb 20, 2019 at 15:25
  • @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" 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. Feb 20, 2019 at 15:40
  • @ShirishaKollapuram: see new footnote in answer above. Feb 20, 2019 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.