Answer the question
In order to leave comments, you need to log in
How does the Bitcoin network know how much money I have in my account right now?
Hello, how does the Bitcoin network know how much money I have in my account right now? After all, the balance is not stored anywhere, but only information with records of crediting and debiting from the account (my wallet). When I send money from my wallet to another one, does Bitcoin go through all the blocks looking for all my deposits?
Answer the question
In order to leave comments, you need to log in
iterates over
this much faster than finding the hash, so there would be something to iterate over
Not necessarily every time. Depending on the implementation of the mining node, account balances can be cached in memory. But in general, yes, this can only be found out by passing through the chain of blocks - more precisely, a small part of them, connected by the history of transactions.
You have the wrong idea about how the bitcoin network works, the bitcoin network uses the UTXO model - unspent transaction outputs. The balance of an address is the sum of all unspent outputs (coins) that are locked by a script that can be unlocked using the private key from that address. When a transaction occurs in the bitcoin network, the transaction spends a specific coin or coins (unspent outputs) and each node keeps a pool of all unspent outputs and performs verification. For example, here are the statistics for all current unspent bitcoin blockchain outputs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question