0

In the network nodes below as shown in picture: Nodes

Let's say A is trying to double spend by sending bitcoins to B,C (A->B) and (A->C) and let's say A tried to relay (A->B) transaction to honest Node - 8 and at this point let's assume that current time is 6'o clock(might be any time zone). So at 6:00 A relayed its transaction (A->B) to honest Node-8. let's say at 6:02 (exactly after 2 mins) A tries to double spend that bitcoin and sends that bitcoin (A->C) to honest Node - 5 and at 6:04 let's say honest Node-5 validates all transaction to be valid since A's Input UTXOs are not broadcasted to network until now.

At the same time let Node-8 also validates all transaction in its block to be valid, since A's Input UTXOs still exist. let's say at 6:05 Node-5 and Node-8 are trying to solve hash puzzle to mine a their block and at 6:08 lets say Node-5 solved the puzzle and broadcasted it's block to network. While Node-8 is trying to solve the puzzle with the transactions it has**(A->B)**. Let's say at 6:14 Node-8 solved the puzzle and tried to broadcast its block which contains (A->B which is double spending). Then the peer-nodes will reject the block that Node-8 has broadcasted because it has an invalid transaction(Double spent transaction).

- Here the fault is not Node-8, Node-8 is honest doing its work by following protocol. Even though peer-nodes in this case has rejected honest Node-8's Block and Node-8 has lost a lot of computation power, which is very unfair?

- How Bitcoin protocol solves/help this issue for Node-8?

Correct me if I am wrong...

3 Answers 3

2

If two blocks has the same ancestor, we say we have a fork. If a node sees a fork, it assumes the first block it saw as the best one, but keeps the other. As the time goes on, eventually someone will solve the PoW for the next block, and this block will likely extend one of the two chains (i.e. this block will be right after one of the fork's one). The chain with more work'll always win, so whichever chain gets extended becomes the active one.
If Node-8's block gets extended, then the network'll adopt it as the current best chain, even if they see Node-5's block first. Since Node-8's block got through, A will be sent to B, and the other transaction will be invalidated.
That's why some people wait some confirmations until get a payment as final because there's no risk of reorg (reorg means change the current tip, replacing some blocks we considered part of the best chain, and replacing by others).

2

I'm going to offer a frame challenge. Your scenario makes no sense to me, because you seem to have a wrong perception of how the blockchain works and is propagated on the network.

First problem: at 6:02 Node-5 has already heard about transaction A->B. Transactions are only propagated at best effort but transactions that are candidates for the next block should get to most nodes within 30 seconds. No biggie: we can fix that by making the attacker send at 6:00 in parallel A->B to Node-8 and A->C to Node-5. So Node-5 and Node-8 do have different views on the unconfirmed transactions now and each considers their payment valid. If they see the other transaction, they will reject it because it's in conflict with the one they have already.

Now at 6:08 Node-8 finds a new block which includes A->C. Block propagation has the highest priority and the propagation of blocks is guaranteed. Some nodes might not hear about an unconfirmed transaction, but every node hears about a new block within seconds. If the block is valid and the new best chain-tip, everyone extends their blockchain with that new block. At this point Node-8 realizes that A->C has spent the funds and the transaction A->B is now invalid. Node-8 drops A->B from their mempool. Every miner, including Node-8, switches to trying to find a new block that follows the block that was published by Node-5. The doublespend has been resolved, because only one of the transactions has survived.

Nodes validate transactions before they add them to their mempool. At that point they can only assess whether a transaction would be eligible to be included in a block, and they only keep the first (or best) conflicting transaction they see. Once a block is published the content of the block always supersedes the content of their mempool. Blocks are the shared ground truth of the network and the blockchain has only one block at every height. When the chaintip progresses, everyone starts working on the new height.

If Node-5 and Node-8 had found their blocks at the same time (within a couple seconds of each other), they would have each broadcast theirs to their peers. Every node would stick to whatever block they had seen first until another block were found. Then everyone would converge on the new best chaintip and the other block would become an extinct chaintip, not part of the best chain.

2
  • Thanks a lot for your support, it helped me a lot and The time reference that is taken in question is just for representing the sequence of events but not to represent the exact time range that it would take. Thanks a lot again for info :) Jul 12, 2022 at 17:26
  • I've extended my answer to cover the case that the competing blocks were found at the same time.
    – Murch
    Jul 12, 2022 at 17:48
0

... Node-8 has lost a lot of computation power, which is very unfair?

The Bitcoin network protocols do not protect or reimburse a miner for work they honestly carry out mining a valid transaction passed to them by a secretly malicious person attempting a double spend.

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.