Bitcoin Forum
May 02, 2024, 05:43:58 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Double spend - When will one of the two be confirmed?  (Read 1134 times)
yeeeeye (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
November 09, 2013, 07:08:46 PM
 #1

Hi! Smiley

This morning I transferred some bitcoins to bitcoin.de with Bitcoin Qt. As the client wasn't asking me to include any fees, I thought it wasn't needed. Until this time, it had always asked me to include some to get my transfer processed. Since then that transfer is waiting to be confirmed, being postponed all the time. I finally decided to overwrite it with a double spend with high fees, as I thought that miners would just process the one with high fees faster and therefore drop the first one which had none. I did it as described here: https://bitcointalk.org/index.php?topic=231309.0

Well finally both transactions are now marked as a double spend and none of them is being confirmed, they are just being delayed. I had a look at pywallet (https://bitcointalk.org/index.php?topic=34028.0) as I read I could remove one of the transactions again from the wallet so that the double spend would be cleared, but it keeps saying that the twisted package is not installed.

Will those transfers ever be completed? blockchain.info puts it kinda hard: "Estimated Confirmation Time: Possibly Never" :/

Any help appreciated. Thanks! Smiley
1714628638
Hero Member
*
Offline Offline

Posts: 1714628638

View Profile Personal Message (Offline)

Ignore
1714628638
Reply with quote  #2

1714628638
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
November 09, 2013, 07:23:46 PM
 #2

unknown.

You have to remember there is no "bitcoin network" as if it is the single syncronized unified system.  There is tens of thousands of independent Bitcoin nodes each following their own rules/logic.

So when you create a tx it goes gets relayed your node to your peers who relay it to their peers and it eventually ends up at one or more miners who will eventually include it in a block (and with no fee there is no reason for them to include it before any paying tx).  When you create a double spend any node which knows about the first tx will drop/erase the second tx.  Thus it is very possible that no miners is even aware of the second tx exists because every node you sent it to dropped it as a fraudulent duplication of the first tx.  On the other hand if not every node learned of the first tx (maybe they were offline at the time) they now will relay the second tx and if they are relayed the first will consider that the double spend and drop/erase it.

To make it even more unknown when nodes run out of space in the memory pool (list of unconfirmed txs) they delete the oldest ones.  Of course if your client comes online it will rebroadcast it and in this case "it" is the second (not first which you already deleted) tx.

So all of the above are possible
a) the first tx eventually confirms (eventually could be 1 to an insanely large number of hours)
b) the second tx eventually confirms (eventually could be 1 to an insanely large number of hours)
c) you delete the second tx from your client and eventually all nodes forget about both tx and you can start again.

As for the client not "asking" for fees.  Fees are only required if the tx is low priority, that is the only time the client will make you include a fee.  However fees are OPTIONAL on all txs.  If you include no fee and there are thousands of tx waiting which have a fee obviously a miner will pick those paying txs first.  If more and more paying tx come in while you wait you can fall further and further down the list.

Given the min fee is so low I recommend setting your client to pay a fee on all tx even those that don't require it.  You don't have to but it avoids messes like this.
nahtnam
Legendary
*
Offline Offline

Activity: 1092
Merit: 1000


nahtnam.com


View Profile WWW
November 09, 2013, 09:39:46 PM
 #3

I have a question myself. What is this? https://blockchain.info/create-double-spend

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4613



View Profile
November 09, 2013, 10:09:22 PM
 #4

I have a question myself. What is this? https://blockchain.info/create-double-spend

Looks like a great way to send two transactions using the same input.  Seems like fun.
nahtnam
Legendary
*
Offline Offline

Activity: 1092
Merit: 1000


nahtnam.com


View Profile WWW
November 09, 2013, 10:09:56 PM
 #5

I have a question myself. What is this? https://blockchain.info/create-double-spend

Looks like a great way to send two transactions using the same input.  Seems like fun.

But is it actually a double-spend?

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4613



View Profile
November 09, 2013, 10:26:35 PM
 #6

I have a question myself. What is this? https://blockchain.info/create-double-spend

Looks like a great way to send two transactions using the same input.  Seems like fun.

But is it actually a double-spend?

Well, not a true "double spend"  where both transactions eventually exist in the blockchain.  That isn't possible with the bitcoin protocol.  But it is actually what is generally considered a "double spend" where two transactions using the same input are broadcast on the network to two different addresses.  Both transactions will exist with various clients, nodes, wallets, etc each choosing which of the two transactions they are willing to accept and relay based on which one they see first.  Eventually one of the transactions will be confirmed and make it into the blockchain, the other one will then cease to exist.
tondaS
Full Member
***
Offline Offline

Activity: 122
Merit: 100


View Profile
November 09, 2013, 10:40:58 PM
 #7

I have a question myself. What is this? https://blockchain.info/create-double-spend

Looks like a great way to send two transactions using the same input.  Seems like fun.

But is it actually a double-spend?

Well, not a true "double spend"  where both transactions eventually exist in the blockchain.  That isn't possible with the bitcoin protocol.  But it is actually what is generally considered a "double spend" where two transactions using the same input are broadcast on the network to two different addresses.  Both transactions will exist with various clients, nodes, wallets, etc each choosing which of the two transactions they are willing to accept and relay based on which one they see first.  Eventually one of the transactions will be confirmed and make it into the blockchain, the other one will then cease to exist.

So you may send one tx to someone trusting 0 confirmation to get something in return (product, service) without fee and the second tx with fee to yourselves. Succesfull doublespend in almost 50% in this scenario (it takes long to include no fee transaction), right ?
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
November 09, 2013, 10:45:50 PM
 #8

It is not quite that easy to pull off a double spend.  Most (virtually all) nodes will reject and refuse to relay or include in a block the second transaction they see.

So you broadcast a tx paying for a product then any node which sees that tx will reject the double spend back to yourself.
If you send the "double spend" (the tx back to yourself first) then there is a good chance the merchant will not see the "good spend" as all the merchants peers will drop it before it gets to the merchant.
0-confirm should be considered untrusted but it isn't as trivial as pay someone, pay yourself w/ fee and win but yes that is the general concept.
tondaS
Full Member
***
Offline Offline

Activity: 122
Merit: 100


View Profile
November 09, 2013, 11:00:59 PM
 #9

It is not quite that easy to pull off a double spend.  Most (virtually all) nodes will reject and refuse to relay or include in a block the second transaction they see.

So you broadcast a tx paying for a product then any node which sees that tx will reject the double spend back to yourself.
If you send the "double spend" (the tx back to yourself first) then there is a good chance the merchant will not see the "good spend" as all the merchants peers will drop it before it gets to the merchant.
0-confirm should be considered untrusted but it isn't as trivial as pay someone, pay yourself w/ fee and win but yes that is the general concept.


I assume blockchain.info sends first tx to 1st half connected peers (about 500) and second tx to 2nd half connected peers (about 500) at the same time. Then merchant bitcoin-qt see 0-confirm tx with 50% likelihood and reject the one going to yourselves with a fee. Obviously, half miners have your tx with a fee, but this tx is almost sure to be included to the blockchain as the 2nd half of miners with no fee transaction are not likely to include it to blockchain quickly
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4613



View Profile
November 09, 2013, 11:08:54 PM
 #10

It is not quite that easy to pull off a double spend.  Most (virtually all) nodes will reject and refuse to relay or include in a block the second transaction they see.

So you broadcast a tx paying for a product then any node which sees that tx will reject the double spend back to yourself.
If you send the "double spend" (the tx back to yourself first) then there is a good chance the merchant will not see the "good spend" as all the merchants peers will drop it before it gets to the merchant.
0-confirm should be considered untrusted but it isn't as trivial as pay someone, pay yourself w/ fee and win but yes that is the general concept.


I assume blockchain.info sends first tx to 1st half connected peers (about 500) and second tx to 2nd half connected peers (about 500) at the same time. Then merchant bitcoin-qt see 0-confirm tx with 50% likelihood and reject the one going to yourselves with a fee. Obviously, half miners have your tx with a fee, but this tx is almost sure to be included to the blockchain as the 2nd half of miners with no fee transaction are not likely to include it to blockchain quickly

If this is a concern for the merchant, they should not be accepting transactions with 0 confirmations.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
November 10, 2013, 01:03:58 AM
Last edit: November 10, 2013, 02:16:26 AM by DeathAndTaxes
 #11

It is not quite that easy to pull off a double spend.  Most (virtually all) nodes will reject and refuse to relay or include in a block the second transaction they see.

So you broadcast a tx paying for a product then any node which sees that tx will reject the double spend back to yourself.
If you send the "double spend" (the tx back to yourself first) then there is a good chance the merchant will not see the "good spend" as all the merchants peers will drop it before it gets to the merchant.
0-confirm should be considered untrusted but it isn't as trivial as pay someone, pay yourself w/ fee and win but yes that is the general concept.


I assume blockchain.info sends first tx to 1st half connected peers (about 500) and second tx to 2nd half connected peers (about 500) at the same time. Then merchant bitcoin-qt see 0-confirm tx with 50% likelihood and reject the one going to yourselves with a fee. Obviously, half miners have your tx with a fee, but this tx is almost sure to be included to the blockchain as the 2nd half of miners with no fee transaction are not likely to include it to blockchain quickly

Propogation is very fast.  It is highly likely one tx or the other will rapidly out pace the other one and as it does it "cuts off" more and more of the network from the other tx.   If the merchants tx out paces the "bad tx" it will end up at a super majority of the network nodes and "isolate" the bad tx and the reverse is also true.    It is simplistic to assume that sending tx a to half your peers and tx b to the other half will ensure each one gets to 50% of miners.  It is far more likely one tx ends up in the memory pool at ~100% of miners.  Also propogation beyond the first peer is chaotic.  Some nodes as slow, some are fast, some may have few unique peers some may have hundreds or thousands.  Many of your peers have the same peers so the two tx are going to race almost instantly.

I am not saying it is impossible to pull of a (non hashpower related) double spend but it isn't as easy as 1, 2, 3, click and win.

Merchants looking to accept 0-confirms shouldn't do it casually but there are methods they can take to improve double spend detection and prevention.  The merchant should maintain multiple geo diverse listening nodes which have a high number of inbound connections.  These "listening nodes" can communicate out of band with the merchants main "processing node" and look for double spends.  While a single node has a limited view of the global network multiple nodes sharing information have a much better view.  If one of the listening nodes detects a double spend they can alert the merchant and halt the transaction.  The merchant can automatically institute a small delay between notification of payment and release of goods.  This makes if very unlikely that an attacker can both propagate the network to miner and not be seen by any of the merchants listening nodes (which are unknown to the attacker).  Imagine a merchant with 5 listening nodes and an average of 1,000 inbound connections.   There probably is some overlap but lets say the merchant sees 3,000 unique peers and lets assume the network consists of 10,000 nodes.  The "bad" tx would need to make it to miners without it being relayed to any of the 3,000 nodes the merchant is connected to, otherwise they will relay it to one of the merchants listening nodes which will detect the attack.   Pulling that off in a chaotic network would be a challenge.

The larger risk in 0-confirm txs is the attacker exploits a flaw in tx relaying by nodes, the attacker performs a Finney attack, or the attacker is assisted by "dishonest" miners who are willing to do an in memory pool replacement for a bribe.  These types of scenarios are hard to defend against so a merchant should be very aware of the risks of 0-confirm before considering accepting them.  

Nothing in this post should be taken as "0-confirm" is safe.  Most merchants should likely NOT accept 0-confirm transactions, however not all transactions are have the same risk profile. A site selling $5 css website templates is a different story than an exchange accepting $5,000 deposits.  Someone looking to steal website templates will most likely just pirate them rather than try to pull off a double spend.    For high margin, low value, low risk items the benefit of strong double spend detection may warrant the risk.  Remember the fraud rate of credit cards is not zero either, and online merchants are able to turn a profit.
lnternet
Sr. Member
****
Offline Offline

Activity: 299
Merit: 253


View Profile
November 10, 2013, 02:09:15 AM
 #12

Good posts DeathAndTaxes, thank you.

1ntemetqbXokPSSkuHH4iuAJRTQMP6uJ9
yeeeeye (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
November 10, 2013, 11:36:01 AM
 #13

Just wanted to let you know that the first transaction without fees was processed and everything's fine now. Smiley So the second one was and still is being ignored. Interesting that it didn't override the first. Thanks all! Smiley
SquallLeonhart
Legendary
*
Offline Offline

Activity: 2324
Merit: 1101


View Profile
November 10, 2013, 12:31:45 PM
 #14

I don't get it, everyone can do the double spend thing since if we can control our transaction fees?
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
November 10, 2013, 04:30:34 PM
 #15

Just wanted to let you know that the first transaction without fees was processed and everything's fine now. Smiley So the second one was and still is being ignored. Interesting that it didn't override the first. Thanks all! Smiley

Yes and pointing out the network actively tries to prevent double spends.  Any node which saw the first tx will drop the second tx and not relay it.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!