8

I've occasionally seen people online claiming they were victims of a double-spend because they handed over something of value in exchange for a bitcoin payment with no confirmations.

Although I understand this is theoretically possible, how would someone try this practically? All available bitcoin clients would not allow you to make a transaction that spends an output that has already been spent, and the client would know about the first transaction very soon after it was broadcast.

Are there specialized double-spend-friendly bitcoin clients out there?

EDIT: Please note: I am not asking for theory of any kind (especially not theory on how the blockchain / proof-of-work / waiting for confirmations solves the dobule-spend problem). I am asking purely practically ... how does someone pull off a double-spend attempt?

2

Edit

You could practically open two separate bitcoin clients (such as MultiBit and Bitcoin-QT). Prepare a transaction that is using the same input. As for output one would use the payee's address, while the other client would use your address (you're double spending right?).

At this point you'd just have to send the transactions at the same time and hope your payee has gotten the correct transaction instead of the double spend. I doubt there's a client that automates this procedure.

You could also make this happen with a higher success rate if you send the valid transaction directly to the payee's client, while you send the double-spend to the node of a pool. This would increase the chances that your double spend will actually make it inside a block before the other.

Of course to do this would require you to get your hands wet with lower level bitcoin clients such as sx or directly bitcoind. Actually I'm afraid you'd have to program this functionality yourself studying the protocol and making sure you know how to broadcast to specific nodes instead of the entire network.

  • The question specifically asks how someone practically could get a bitcoin client to broadast a double-spend transaction under the assumption that the merchant will accept a zero-confirmation transaction. I'm not asking how the blockchain / proof-of-work system solves this problem with confirmations. – RentFree Jan 22 '14 at 18:06
  • Ah well you didn't specify the zero-confirmation part in your question. Why not try with two different bitcoin clients and see what happens? – Luca Matteis Jan 22 '14 at 19:11
  • "... they handed over something of value in exchange for a bitcoin payment with no confirmations." – RentFree Jan 22 '14 at 19:13
  • Sorry I then missed your point of the question. My bad. But again why not try to send a payment at the same time using two separate bitcoin clients? Some clients will eventually converge with one, others with another. Depends on propagation speed and latency of the network. – Luca Matteis Jan 22 '14 at 19:15
  • I edited with some more info. Hope it's appropriate to your question this time. – Luca Matteis Jan 22 '14 at 19:22
1

I think the best way to explain this is to use the analogy of the old banker's cheque.

In the olden days when I was a lad we had a cheque book which allowed us to sign an instruction to pay someone a particular amount.

Now if I was cheeky, I could write one cheque to Bob for ten pounds and another to Alice for ten pounds. The trouble was I only had ten pounds in my account and no overdraft facility. So when Alice cashed the cheque first, she got the money and Bob's cheque was bounced "insufficient funds". Cashing the cheque meant that she had succeeded in being the first person to put her claim to the bank, who then checked my account balance and agreed to pay.

Making a double spend attempt is exactly the same on the bitcoin network. You are contriving to sign two transactions to two different people when you know that your bitcoin funds are not sufficient to cover both payments. This is a simple string of text, not a physical cheque, but the principle is identical.

In this case the network is much faster than the old banking system, and on the bitcoin network, I think a transaction is visible to the whole bitcoin-world-network in under three seconds, so I would have to somehow force one transaction to be delayed in order to move my funds with another transaction. In any event the network will only accept one transaction.

If you wanted to create a transaction head on over to this link and have a look. It allows you to create a raw transaction and then broadcast it. I suspect you are going to have a go anyway, but it would be nice if you could try out your stuff on Testnet.

  • Actually, here, it's not simply a matter of your funds not being sufficient to cover both payments. When you spend bitcoins, you're spending specific bitcoins, not just a number off of your balance. A double-spend is signing two transactions that spend the same output. – Micha Jan 22 '14 at 18:51
  • @Micha nope, the protocol doesn't identify specific bitcoins, it really is just a number that you have. If you have two bitcoins in your account and you send out two transactions for the 'same' bitcoin then both will be accepted and you will have zero bitcoins. – placeybordeaux Jan 22 '14 at 22:42
  • @Peter ...no, you're wrong. When you create a Bitcoin transaction, you spend (destroy) one or more transaction outputs, referenced with the txid and output index, as the input, and you create one or more new transaction outputs with a value equal to or less than the sum of the inputs. If you look at any raw transaction, you can see that it spends one or more specific outputs from earlier transactions. On the protocol level, there are no such things as addresses or accounts or balances -- each transaction output is its own unit. – Micha Jan 24 '14 at 8:38
  • I don't think this is a question about unspent transaction outputs and how they become the inputs to the next transaction. I simplified to explain the issue to the OP. – T9b Jan 24 '14 at 12:10
0

Double-spending is simply the act of signing two transactions that spend the same bitcoin output twice. There are a few ways one could accomplish this.

All you would need is some tool that allows you to craft transactions manually, such as http://brainwallet.org/#tx, Bitcoin Core's raw transaction RPC commands, or even just a test editor and knowledge of the transaction format. You would create a transaction that spends certain outputs to some address, typically controlled by yourself, and create a different transaction spending one or more of the same output(s) to whoever you're paying. It can also be possible without manual transaction creation, if you can make your wallet forget the transaction, in which case it can create a double-spend that it simply doesn't know it's doing.

0

With Bitcoin Core, or most any local wallet, you can generate a double-spend without complex raw transaction tricks, simply by making two copies of your wallet, then doing one spend from each, using at least one of the same inputs.

You will need to make sure the second wallet is not connected to the network when you transmit the spend from the first, and transmit both before the next block.

The network will mostly ignore the double-spend (but see Bitcoin XT).

WARNING: Using more than one copy of a wallet is very dangerous. See Can I use my wallet on different computers?

  • Can you clarify exactly what you mean by "ignore the double spend"? Do you mean, it will honor one spend and ignore the others, or do you mean it will ignore both? I'm pretty sure you mean "ignore both" but you may want to consider editing your answer to make this clear. – RentFree Mar 1 '15 at 20:13
  • A Bitcoin Core node that encounters a second-spend silently drops it, and does not relay it to other nodes. It does not forget about the first spend it saw. – Tom Harding Mar 3 '15 at 0:36

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.