1

Apologies if this has been covered, but there's one area of the Bitcoin network that is not clear in my head, and it's intimately linked to the double-spend problem.

Suppose Person A is purchasing an item in a store. They "pay" Person B 1 BTC for a good and broadcast this transaction to the network, which Person B sees as unconfirmed. The transaction is included in a block (Block 1) whose Proof of Work is now being found/solved.

Suppose Person A controls 30% of the Bitcoin mining network (arbitrary high proportion), and has his miners instead mine a different block (Block 2) containing a transaction spending the same BTC to a different wallet controlled by Person A.

Suppose the Proof of Work for Block 2 is, against the odds, obtained first, and the "corrupt" miner who finds the requisite hash broadcasts it to the entire bitcoin network. This is where my understanding breaks down. What exactly happens when the remaining 70% see this transaction? Do they stop mining Block 1? At what point can Block 1 be orphaned?

  • I would change the wordings: "...to a different wallet controlled by Person A" with "...to pay Person C for yet another good". – croraf Oct 30 '17 at 15:00
  • In my understanding, the 70% of miners aren't working all on identical blocks Block1, but each on his own block, which might or might not include the first or the second transaction, depending on their transaction priority scheme, the transactions available and so on. No miner will include both contradicting transactions in his block. There's no guarantee which transaction wins, but guarantee that only one will persist. – Ralf Kleberhoff Oct 30 '17 at 15:27
  • Yes, that was an oversimplification for the example. Block 1 was just supposed to represent any block that contained the legitimate transaction but did not contain the illegitimate transaction – Marcus Johnson Oct 30 '17 at 16:31
1

Imagine the blockchain as... a chain of blocks

The situation is:

A -> B -> C
      \-> C'

But some nodes see it as A -> B -> C and mine over the block C

and some other see A -> B -> C' and mine over the block C'

If node sees something like this:

A -> B -> C -> D -> E...
      \-> C'-> D'-> E'...

it should select the chain with larger cumulative difficulty (longest) and forget anything about orphan chain

  • So the immediate two questions that come to mind are: (1) how does a node decide that it's A->B->C rather than A->B->C'? Is it just whoever was working on C rather than C'? and (2) At what point would a node "select the chain with larger cumulative difficulty"? If C' is found first, would they immediately switch and forget the block containing the legitimate transaction? – Marcus Johnson Oct 30 '17 at 16:33
  • (1) if you have C and C' - compare their difficulty and drop one. In fact you can drop any of them because usually C+D > dC' and C'+D' > C – amaclin Oct 30 '17 at 16:55
  • (2) at any point – amaclin Oct 30 '17 at 16:56
  • yes, transactions in orphan chain are forgotten and return to state unconfirmed if not included to main chain – amaclin Oct 30 '17 at 17:00
0

What exactly happens when the remaining 70% see this transaction? Do they stop mining Block 1?

Let's say they started mining Block1 when the chain was -A-B-C->. They were mining on-top of block C. When Block2 is mined on top of C the situation becomes -A-B-C-Block2->. These 70% now stop mining Block1 and they move to mine on-top of Block2. The first transaction is not added to the chain and is rejected and the second transaction is confirmed (with confirmation length of 1 block). (After some time when the next block is mined on top of Block2 if will be confirmed with length of 2 blocks.)

At what point can Block 1 be orphaned?

Block1 was never added to the chain so is not orphaned.

  • So you're saying that in my example, the double-spend attack would have been successful and there is no way to prevent this? – Marcus Johnson Oct 30 '17 at 16:35
  • Coins would not be double spent. Coins were spent only on Block2. First transaction is then rejected and person B did not send the good. Person B would send the goods only if first transaction managed to get mined but it did not in your example. – croraf Oct 30 '17 at 16:40
  • Assuming Person B released the goods at 0/unconfirmed... – Marcus Johnson Oct 30 '17 at 16:43
  • He would not do that as it would not be smart, and contrary to bitcoin concept. Don't know what practice is, but I would send the goods only when transaction is confirmed in a block (thus added to the blockchain) and has one more additional block on top of that. – croraf Oct 30 '17 at 16:44
  • So I guess he waits for 6 confirmations, at which point you're going to tell me there's a low probability that the "illegitimate" miners have been working on a secret chain long enough supersede the legitimate chain? – Marcus Johnson Oct 30 '17 at 16:48

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.