0

Bitcoin clients must find balances for some public keys quickly. Especially, miners must find balances for all incoming transactions.

I see the problem: public key with associated address can appear many times in 300 GB blocks data which can't be stored whole in memory. Full Bitcoin client uses binary data files and LevelDB index(?).

How can it do it quickly? Especially, miners spend most of the time hashing, not verifying transactions (?)

1 Answer 1

4

Balances

Bitcoin doesn't care about balances. Miners also don't.

Your wallet may keep track of your balance but it doesn't need to know about anyone else's. No one else cares about your balance. It is irrelevant.

Bitcoin only keeps track of unspent transaction outputs (UTXOs) - If you like metaphors and understand their limits, you can think of UTXOs as "coins" whose "current ownership" is indirectly kept track of in an almost anonymous way. When you give someone a coin in payment, they don't care how many other coins you have in your pocket, they only care whether the coin you gave them is genuine (really yours).

Fast verification

Bitcoin is designed so that creating new pages in the replicated journal of transactions is expensive and slow (i.e. constructing blocks that can be added to the blockchain). However, transactions can be verified quickly.

In the database world you speed up retrieval by adding appropriate indexes. You can have separate tables for live vs dead data, you can hold important data in memory, etc etc. That is how software finds UTXO's fast.

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.