2

While reading Satoshi Nakamoto's paper on how bitcoin works, I got stuck on #2. In a chain of transactions, how can someone who has received the coin check the whole chain with just a signed hash of the previous one?

Either

  • The person sending the coin would have to include the whole ownership chain, which would start increasing more and more in size
  • There would have to be a public hash-to-transaction mapping somewhere.
  • There would have to be a list of valid coins somewhere, making checking only the most recent transaction necessary

I don't see Satoshi Nakamoto talking about any of these.

1

There would have to be a public hash-to-transaction mapping somewhere.

Yes. There is a database of utxo - unspent transaction outputs. To be correct - it is an index of blockchain file.

  • 1
    In the Bitcoin Core implementation since 0.8, the UTXO set is not anymore implemented as an index into the blockchain files. Instead, it contains a full and independent copy of all unspent outputs. This is for efficiency and to allow future versions to prune the blockchain data. – Pieter Wuille Sep 2 '14 at 4:48
1

For a user running a full node, this is basically what happens. On initial installation, they download (from other peers on the network) a copy of the complete block chain, containing every transaction ever executed. So when a new transaction arrives, they have the data to trace all the transactions that led to it.

To make this more efficient, the client maintains a database of valid unspent transaction outputs (utxo), indexed by transaction hash (or txid). When a new transaction T arrives, the client checks that the inputs of T all correspond to distinct utxo's in the database. If they do, and all the signatures are in order, and everything else about the transaction makes sense, then the transaction is accepted. The utxo's corresponding to the inputs of T are removed from the database (since they are now spent), and new utxo entries are created corresponding to the outputs of T.

For "thin" nodes, which do not keep all this data, they have to request it from other network nodes which do. This complicates matters somewhat and requires a certain amount of trust in the nodes providing the information.

1

The person sending the coin would have to include the whole ownership chain, which would start increasing more and more in size

This alone wouldn't be sufficient, because it doesn't tell you whether the chain of ownership was double spent, or whether those transactions were confirmed in valid blocks, or even if the original coins were mined properly and exist in the longest chain. To know all that, you need to see the whole blockchain, or to trust someone else who has seen the whole blockchain.

The paper explains that the basis of the blockchain is that everyone is aware of every transaction that ever happened, and the order in which they happened. So by having access to the blockchain, you can validate a new payment to make sure it is genuine and not double spent.

Bitcoin nodes are optimised so that they can just validate a chain once and then store a set of its unspent transactions, so it means they don't have to re-check each transaction all the way back to the genesis block. This is just an optimisation though, so that's probably why it was left out of the paper.

You can also use an SPV wallet (see the section in the paper titled "Simplified Payment Verification") which eliminates the need to see the full chain, at the cost of outsourcing trust to the miners.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.