Bitcoin Forum
April 24, 2024, 04:47:31 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question about how miners treat unconfirmed double spend transactions  (Read 1118 times)
barbarousrelic (OP)
Hero Member
*****
Offline Offline

Activity: 675
Merit: 502


View Profile
August 27, 2014, 12:55:39 PM
 #1

Bitcoin address X contains 1.06 bitcoin.

Let's say a miner sees two unconfirmed transactions broadcasted - the first one says to send 1 bitcoin from address X to address Y. The second transaction says to send 1 bitcoin from address X to address Z. Both transactions cannot be completed. This is a double spend.

My understanding is that Bitcoin miners can write their own miner software to choose which transaction to process in any way they wish. They could include in the next block whichever transaction has the higher fee, they could go with whichever transaction they received first, they could go with whichever one has more of the letter 'Q' in the destination address because they like the letter Q.

But in practice, how would this normally be handled by most miners' software?

Do not waste your time debating whether Bitcoin can work. It does work.

"Early adopters will profit" is not a sufficient condition to classify something as a pyramid or Ponzi scheme. If it was, Apple and Microsoft stock are Ponzi schemes.

There is no such thing as "market manipulation." There is only buying and selling.
1713934051
Hero Member
*
Offline Offline

Posts: 1713934051

View Profile Personal Message (Offline)

Ignore
1713934051
Reply with quote  #2

1713934051
Report to moderator
1713934051
Hero Member
*
Offline Offline

Posts: 1713934051

View Profile Personal Message (Offline)

Ignore
1713934051
Reply with quote  #2

1713934051
Report to moderator
1713934051
Hero Member
*
Offline Offline

Posts: 1713934051

View Profile Personal Message (Offline)

Ignore
1713934051
Reply with quote  #2

1713934051
Report to moderator
The block chain is the main innovation of Bitcoin. It is the first distributed timestamping system.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
August 27, 2014, 02:21:14 PM
 #2

Bitcoin address X contains 1.06 bitcoin.

Let's say a miner sees two unconfirmed transactions broadcasted - the first one says to send 1 bitcoin from address X to address Y. The second transaction says to send 1 bitcoin from address X to address Z. Both transactions cannot be completed. This is a double spend.

My understanding is that Bitcoin miners can write their own miner software to choose which transaction to process in any way they wish. They could include in the next block whichever transaction has the higher fee, they could go with whichever transaction they received first, they could go with whichever one has more of the letter 'Q' in the destination address because they like the letter Q.

But in practice, how would this normally be handled by most miners' software?

In practice, most miners will only see one of the two transactions.  The nodes of the network will accept and relay the first transaction that they see.  They will refuse to relay the second one, so it won't propagate across the network.

If, on the other hand, you specifically connect directly to the larger mining pools, and send your transactions directly to them, then most mining pools will accept which ever transaction they receive first.  They will ignore the one they receive second.
barbarousrelic (OP)
Hero Member
*****
Offline Offline

Activity: 675
Merit: 502


View Profile
August 27, 2014, 02:31:52 PM
 #3

Bitcoin address X contains 1.06 bitcoin.

Let's say a miner sees two unconfirmed transactions broadcasted - the first one says to send 1 bitcoin from address X to address Y. The second transaction says to send 1 bitcoin from address X to address Z. Both transactions cannot be completed. This is a double spend.

My understanding is that Bitcoin miners can write their own miner software to choose which transaction to process in any way they wish. They could include in the next block whichever transaction has the higher fee, they could go with whichever transaction they received first, they could go with whichever one has more of the letter 'Q' in the destination address because they like the letter Q.

But in practice, how would this normally be handled by most miners' software?

In practice, most miners will only see one of the two transactions.  The nodes of the network will accept and relay the first transaction that they see.  They will refuse to relay the second one, so it won't propagate across the network.

If, on the other hand, you specifically connect directly to the larger mining pools, and send your transactions directly to them, then most mining pools will accept which ever transaction they receive first.  They will ignore the one they receive second.

Thank you for your answer.

One more question though. How reliable is it in practice that miners will receive transactions in the same order they occur?

Let's say one person has a habit of going out and making small Bitcoin purchases ten times a day, and receiving his goods with zero confirmations. And let's say every time he broadcasts his purchase transaction, he immediately broadcasts a second double spend transaction. Roughly how often will the second double spend transaction be confirmed in a block?

I wonder if the policy of not relaying duplicate transactions ever backfires, and one node receives the second one first, and that node relays it to numerous other nodes, and now the doublespend transaction blocks out the legitimate one.

Do not waste your time debating whether Bitcoin can work. It does work.

"Early adopters will profit" is not a sufficient condition to classify something as a pyramid or Ponzi scheme. If it was, Apple and Microsoft stock are Ponzi schemes.

There is no such thing as "market manipulation." There is only buying and selling.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
August 27, 2014, 02:44:19 PM
 #4

Bitcoin address X contains 1.06 bitcoin.

Let's say a miner sees two unconfirmed transactions broadcasted - the first one says to send 1 bitcoin from address X to address Y. The second transaction says to send 1 bitcoin from address X to address Z. Both transactions cannot be completed. This is a double spend.

My understanding is that Bitcoin miners can write their own miner software to choose which transaction to process in any way they wish. They could include in the next block whichever transaction has the higher fee, they could go with whichever transaction they received first, they could go with whichever one has more of the letter 'Q' in the destination address because they like the letter Q.

But in practice, how would this normally be handled by most miners' software?

In practice, most miners will only see one of the two transactions.  The nodes of the network will accept and relay the first transaction that they see.  They will refuse to relay the second one, so it won't propagate across the network.

If, on the other hand, you specifically connect directly to the larger mining pools, and send your transactions directly to them, then most mining pools will accept which ever transaction they receive first.  They will ignore the one they receive second.

Thank you for your answer.

One more question though. How reliable is it in practice that miners will receive transactions in the same order they occur?

Let's say one person has a habit of going out and making small Bitcoin purchases ten times a day, and receiving his goods with zero confirmations. And let's say every time he broadcasts his purchase transaction, he immediately broadcasts a second double spend transaction. Roughly how often will the second double spend transaction be confirmed in a block?

I wonder if the policy of not relaying duplicate transactions ever backfires, and one node receives the second one first, and that node relays it to numerous other nodes, and now the doublespend transaction blocks out the legitimate one.

This would be considered fraud, and should be treated the same as any other form of fraud.  In other words, the person would likely be caught eventually and prosecuted.  Given the small chance of success, it is probably an acceptable risk for most retailers.  Given the small chance of such a small reward, it is probably not an acceptable risk for most attackers.  It would be more profitable and easier to just put the small purchase items in their pocket and walk out without paying.

Transactions relay across the entire network in just a second or two, so the malicious user would need to send both transactions nearly simultaneously in order for the double spend transaction to have a chance to propagate.  This means that if the doublespend transaction is the one that propagates, instead of the transaction that pays the merchant, then the merchant won't see a payment arriving in their wallet in the first place.  Therefore the merchant won't consider the bill paid.

To overcome this problem, the attacker needs to isolate the merchant's nodes so that they can't see transactions from the rest of the network.  Then the attacker needs to broadcast 1 transaction directly to the merchant's nodes while simultaneously broadcasting a doublespend transaction to the rest of the network.  Identifying and isolating the merchant's nodes isn't likely to be an easy task, and isn't something an attacker is likely to be able to do for "small Bitcoin purchases ten times a day".

As a defense against such an attack, a merchant could maintain a connection directly to a few of the largest mining pools.  If their connection to the mining pools is disrupted, the system could be designed to refuse to accept any transactions until the connection to the mining pools is restored.  As long as they see the transaction relayed from mining pools with enough hashpower, the merchant could feel confident that the transaction is likely to confirm.
barbarousrelic (OP)
Hero Member
*****
Offline Offline

Activity: 675
Merit: 502


View Profile
August 27, 2014, 02:52:02 PM
 #5

Great answers, thank you very much.

Do not waste your time debating whether Bitcoin can work. It does work.

"Early adopters will profit" is not a sufficient condition to classify something as a pyramid or Ponzi scheme. If it was, Apple and Microsoft stock are Ponzi schemes.

There is no such thing as "market manipulation." There is only buying and selling.
Scoremaster
Member
**
Offline Offline

Activity: 91
Merit: 10

Hi I am back from a long period of away time :)


View Profile
August 27, 2014, 03:02:03 PM
 #6

miners will not allow double spends to happen. in the most rare circumstance and it will probably happen a few times, if everything arrives at the exact same smallest unit of time measurement used in the btc protocol, it could happen.

✦ ────────  SPOKKZ  ──────── ✦
A COMMUNITY-POWERED FILM & TV BLOCKCHAIN ECOSYSTEM
✦ ────────  Twitter ⬝  Telegram ⬝   Facebook ⬝  Linkedin ⬝  Medium   ──────── ✦ Join Pre-Sale
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
August 27, 2014, 03:07:33 PM
 #7

miners will not allow double spends to happen.

Correct.  A "true" double spend, where both transactions are confirmed in the blockchain is impossible.

in the most rare circumstance and it will probably happen a few times, if everything arrives at the exact same smallest unit of time measurement used in the btc protocol, it could happen.

Huh

What are you talking about?  It is not possible for both transactions to be confirmed.  It doesn't matter how close together they arrive.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
August 27, 2014, 03:22:04 PM
 #8

Danny is correct - there is actually *no such thing as a double-spend* (check the entire blockchain history and you'll not find one).

There are only "double-spend attempts" which then the miners have to decide on *which* of the options to accept (but only one).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
wasserman99
Sr. Member
****
Offline Offline

Activity: 476
Merit: 250



View Profile
August 28, 2014, 01:42:39 AM
 #9

Danny is correct - there is actually *no such thing as a double-spend* (check the entire blockchain history and you'll not find one).

There are only "double-spend attempts" which then the miners have to decide on *which* of the options to accept (but only one).

I think this depends on your definition of "double spend"

If you would define a double spend as the exact same input being spent more then once then you are correct as the network would reject any found block that contains anything like this.

If you would define a double spend as a TX in which the same input(s) are part of a transaction that would prevent a separate, previously propagated TX that someone though was going to be confirmed, then this is very much possible. For example, if send a TX with inputs (a), (b), and (c) to a retailer and then later are able to get a separate TX to confirm that contains input (c) (the TX would likely be to an address that you control) then this would be a double spend under this definition. 

bitcoinbeliever
Newbie
*
Offline Offline

Activity: 54
Merit: 0


View Profile
August 28, 2014, 02:43:09 AM
 #10

If you would define a double spend as a TX in which the same input(s) are part of a transaction that would prevent a separate, previously propagated TX that someone though was going to be confirmed, then this is very much possible.

0-conf respend attempts happen every day.  As was mentioned, the network actually tries to keep as nodes from seeing both.  This site tracks the ones it sees though: http://respends.thinlink.com
Nrcewker
Copper Member
Hero Member
*****
Offline Offline

Activity: 2156
Merit: 536


Building my own Dreams!


View Profile
August 28, 2014, 04:39:53 AM
 #11

double spend may be, but mustn't double fee.

.BEST..CHANGE.███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
August 28, 2014, 04:44:45 AM
Last edit: August 28, 2014, 05:29:55 AM by CIYAM
 #12

I think this depends on your definition of "double spend"

Very true - but by saying that "double spend attempts" are "double spends" unfortunately leads those with less technical understanding of Bitcoin to think that "double spends" are a "problem with Bitcoin" (and thus to completely miss the fact that Bitcoin solves the Byzantine Generals problem which is the whole reason that we even use it).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



View Profile
August 28, 2014, 05:18:02 AM
 #13

I think this depends on your definition of "double spend"
Very true - but by saying that "double spend attempts" are "double spends" unfortunately leads those with less technical understanding of Bitcoin to think that "double spends" are a "problem with Bitcoin" (and thus to completely miss the fact that Bitcoin solves the Byzantine Generals problem which is the whole reason they we even use it).

And more importantly, it ignores the context of the statement:

Correct.  A "true" double spend, where both transactions are confirmed in the blockchain is impossible.

Furthermore, it ignores the fact that the post being responded to seems to imply that if two transactions arrive at a miner close enough together, they could somehow magically both be confirmed:

in the most rare circumstance and it will probably happen a few times, if everything arrives at the exact same smallest unit of time measurement used in the btc protocol, it could happen.

Read the thread, follow the context, and you'll see that the specific definition of "double spend" that was being discussed had already been established.
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!