Why doesn't each node store only a portion of the blockchain?

4

1

Why doesn't each node only store a portion of the blokchain instead of the entire blockchain? Is it possible and why is it possible or impossible?

ethereum_noob

Posted 2016-10-23T19:46:48.530

Reputation: 73

1They store a part of the blockchain. When you edit your quesiton to change it to something along the lines of "only part of the block chain" or – even better – to something explicitly stating that the block chain should be distributed, please also state which advantages you expect from your idea. – UTF-8 – 2016-10-23T20:05:17.263

@UTF-8: I mean,why does not node store blockchain as the distributed database? Why doesn't each node store a portion of a blokchain? – ethereum_noob – 2016-10-23T20:24:01.517

Answers

6

Your question is vague, but I assume your real question is why every node must store the full blockchain.

The answer to that is that they don't. In fact, nodes can choose to not store any part of the blockchain at all. The blocks are only needed when validating history, to build up the state of the global ledger (the "UTXO set").

Nodes that do store the full chain advertize so on the network, so that new nodes that join can fetch history from them. However, they themselves do not need the chain at all after validating it, and since Bitcoin Core 0.11, it is in fact possible to configure your node to throw away older parts of the chain to reduce disk space.

To summarize: the only data that every fully validating network node needs is its own validated copy of the UTXO set.

Given that information, maybe your question becomes: why isn't the UTXO set stored in a distributed fashion?

The answer to that is more complicated:

  • Trust model we cannot trust other nodes to store the UTXO set for us. The reason we went through the entire blockchain to build up the UTXO set is because the blockchain is auditable while the UTXO set is not. It allows us to check whether the entirety of history is valid. If we go outsource the UTXO set, and rely on other nodes to keep part of it, they could modify it to their advantage (for example, to make us believe they have more money than they do).

  • Performance Access to the UTXO set must be very fast. Faster nodes often are configured to keep large portions of it in RAM rather than on disk. The reason for that is that it directly influences the time we need to verify new blocks that are being broadcast. Delays in verification cause blocks to propagate slower across the network, which results in more stale blocks, and indirectly an advantage for a 51% attacker.

Pieter Wuille

Posted 2016-10-23T19:46:48.530

Reputation: 64 874

3

The blockchain determines whether a transaction can be made. When a miner creates a new block, they are only allowed to include valid transactions. If they include an invalid one, their block is invalid which costs them a lot of money (currently the equivalent of currently over 8'000 USD). So each miner has a big interest to only include valid transactions. If they don't know which unspent outputs (those basically are the "coins") exist, they can't be sure which transactions to include.

Asking others about which transactions are valid, is cumbersome:

  • How do you know whom to ask?
  • Why would you trust them to not tell you a transaction is valid if it fact it's invalid? You shouldn't trust others if you don't have to.
  • It takes time. If you mine, you need to know which transactions to include. If that's slow, you can start mining with a few transactions and only hash with regard to the ones you already managed to get verified. If you find a block during that time, you lost the transaction fees you could've included if you included more transactions. Furthermore, it's bad for the users as fewer transactions are processed than would've been possible. If you include a transaction that's already in a previous block, you just lost the equivalent of over 8'000 USD.
  • It requires a good internet connection which currently isn't required.

Furthermore, nodes need to verify the blockchain. If you're given blocks, how do you know they are valid? Full nodes verify every block including all of their transactions all the way from the genesis block. Without knowing about the entire blockchain, someone could sent you trash so you mine on top of trash and everything you mine is thus trash. Ergo, you don't make any money.

Storing about 100 GB on a hard disk is so much easier than the hassle of any of the above.

UTF-8

Posted 2016-10-23T19:46:48.530

Reputation: 3 046