The blockchain is very large and takes a lot of time to download to a client. Apparently, the only thing we need from the blockchain is the balance of each "user" (- public key). So, instead of keeping the entire blockchain, we could keep a smaller ledger that only contains the balances. Why isn't this done? What are the advantages of keeping the entire sequence of transactions?
3 Answers
Keeping the entire transaction history allows us to independently verify that everyone's balances (note that Bitcoin does not actually use accounts or balances) are correct. Without having the full transaction history, we cannot verify whether someone actually had the money; the only way to do so is to follow the trail of transactions all the way back to the creation of a coin and check that all of those transactions are valid.
Transactions are validated by verifying ownership with digital signatures (ECDSA), not by tracing every coin back to one or more coinbase outputs. All we do is make sure the sum of the outputs of a transaction is equal to or less than the sum of the inputs. Any difference is the fee.
There are no direct correlations between the inputs and outputs of transaction, so it's not possible to trace coins through the history of transactions unless a transaction has one input and one output, or someone has a parallel database that correlates your personal information with your blockchain data.
Transactions are confirmed not to be double-spent when a miner ensures that all the transactions in their blocks have unique inputs. As long as transactions and blocks are validated and confirmed according to the rules, it's not possible for coins to be double-spent, therefore, it's not necessary to keep the entire history of transactions. You can prune all history up to three transactions behind the UTXO and be complete safe.
Bitcoin wallet consists of collection of UTXO i.e, Unspent Transaction present in wallet. We are not only concerned about balance and public key we are maintaining the transaction to track in-flow and out-flow. Blockchain always keep transaction history because for any new transaction we need to provide the transaction id (UTXO) from our wallet so we must save the transaction information
-
This is what I do not understand... why do you need the entire history and not only the balance? Commented Jun 1, 2018 at 5:45
-
Because in bitcoin the chain start from Coinbase transaction i.e, the first transaction of chain and it gives us BTC which can be spent by us. If we maintain balance then there might chance of spending that money twice or more than once (double spent attack) as we have not maintain anywhere as user and balance records. While tracking transaction it gives us freedom to backtrack to first transaction so there will not be theft or we can say very few chance of losing money as compare to maintaining the balance. Commented Jun 1, 2018 at 6:02