1

Suppose Alice wants to validate a transaction (check this transaction does exist, not make a new transaction), and suppose her has not downloaded all transaction history.

My understanding is,

1) Alice will send a request to all her peer computer nodes and ask for the root the Merkel tree and hashes required to validate the transaction.

2) Some miners among her peer nodes will locate the block that includes the transaction

3) As block only stores Merkle tree root, not internal nodes, these miners will have to construct a Merkle tree from all transactions

4) The miners send block header and hashes (Merkle tree root and hashes on the authentication path) back to Alice.

Since the step 3 requires computational resources, my questions is why some nodes want to perform these computations for Alice? It seems that these nodes will not get paid for validating an old transaction.

2 Answers 2

3

You have a few things wrong.

1) Alice will send a request to all her peer computer nodes and ask for the root the Merkel tree and hashes required to validate the transaction.

Alice probably already has the Merkle root, since it is part of the block header. The first step in validating a transaction is making sure that block that contains it is real. Even SPV clients store all the block headers of the entire chain, so they already have every Merkle root.

2) Some miners among her peer nodes will locate the block that includes the transaction

This is more or less correct, except that the nodes do not have to be miners. There are plenty of full nodes with full copies of the blockchain on the network that can be queried for these hashes.

3) As block only stores Merkle tree root, not internal nodes, these miners will have to construct a Merkle tree from all transactions

Full nodes store all transactions, and returning the hashes of the Merkle tree is not too computationally intensive. You can read more about this in the Transaction Data section of the Developer Guide.

4) The miners send block header and hashes (Merkle tree root and hashes on the authentication path) back to Alice.

Again, it is not necessarily (or even usually) miners who will send the hashes of the Merkle path that are needed. It will usually be non-mining full nodes. And as mentioned before, the block header and Merkle root do not need to be requested.

In the end, Alice is the one validating her transaction, but doing so by using additional information provided by full nodes on the network. The work that the full nodes do to supply this data is important, yet not too computationally intensive. For example, my Raspberry Pi 2 works just fine as a full node. As for who pays the full nodes for their service...well...nobody. This has been a topic of much debate.

In the end, however, people operate full nodes for several reasons. Off the top of my head:

  • so they can operate trustlessly
  • as a service to the overall health of the network (which, in turn, protects their own investments)
  • for research or business purposes

So even though supplying the required data for thin clients to do transaction verification can be viewed as charity, in reality there are incentives for participating...even if not directly financial.

1
  • I read the "Transaction Data section of the Developer Guide" and then go to the SPV section (bitcoin.org/en/…). Now I understand this. Thanks for explaining the motivations that why people want to run full nodes.
    – zhanxw
    Feb 9, 2017 at 20:23
3

Suppose Alice wants to validate a transaction

suppose her has not downloaded all transaction history.

That's not possible. In order to validate a transaction you must have the entire state of the ledger before that point. Either you validated the entire history yourself, or you copied the result of that history (the chainstate, who owns which coins and how much are they worth) from someone you ultimately trust.

1) Alice will send a request to all her peer computer nodes and ask for the root the Merkel tree and hashes required to validate the transaction.

That's not what happens when validating a transaction, but what lightweight (non-validating) clients do in order to check the transaction exists. It relies on the fact that miners will not produce a block with invalid transaction, and thus implicitly trust that when it appears in a block, it is valid.

Also, the request is not really "give me all the data necessary to prove transaction X exists". The request is "give me all transactions that match criteria A, and include the proofs that they're real. See BIP37 for more information, but know that now it is known that this method has very bad privacy implications.

2) Some miners among her peer nodes will locate the block that includes the transaction

Miners only have a function in creating blocks, not looking things up in it. After a block is created, and propagated across the network, any node can look things up in it.

3) As block only stores Merkle tree root, not internal nodes, these miners will have to construct a Merkle tree from all transactions

Miners do that at the time they create a block, but every fully-validating node does that to when they receive a block. It's not done separately for each transaction.

4) The miners send block header and hashes (Merkle tree root and hashes on the authentication path) back to Alice.

Again, not miners. Any full node that Alice is connected to and supports BIP37 will do that.

Since the step 3 requires computational resources, my questions is why some nodes want to perform these computations for Alice? It seems that these nodes will not get paid for validating an old transaction.

Step 3 requires some resources, but they vanish compared to the work of actually validating transactions (validating signatures, checking that no coins are double spent). However, all of these steps are only done by nodes that fully validate.

Most of your question does not seem to be about validation, but about BIP37 as a means for a lightweight clients to obtain assurance that what their peers tell them about new transactions it is correct. That does have a cost, but the cost is mostly in scanning through the blockchain to find transactions Alice is interested in. This costs CPU and disk accesses, but only very little memory. In recent versions of Bitcoin Core, BIP37 support was made optional for that reason.

1

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.