|
September 24, 2017, 04:01:57 PM |
|
First of all, the blockchain is more than 20 GB, it is around 150 GB now.
Secondly, how software finds data in the blockchain is all up to their implementation. There is no singular standard way to look up blockchain data. Most software use a similar approach though, and what I will be describing is how Bitcoin Core does it.
Bitcoin Core maintains a database separate from the blockchain which contains all of the unspent transaction outputs. This database is updated when blocks are found; outputs that are spent are removed from the database and new outputs that are created are added to it. When a transaction is received, the outputs that it spends from are looked up in that database so that the transaction can be verified. There are no balances, just unspent transaction outputs and a node will look up the outputs that a transaction spends from.
For sending Bitcoin, your wallet maintains its own database of your transactions. It maintains a database separate from the blockchain which contains the transactions and outputs that pertain to you. When you want to spend, that database is read and the outputs that you are spending are chosen from that database.
|