Bitcoin Forum
May 18, 2024, 12:53:01 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Spending At The Same Time?  (Read 590 times)
cvramen (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile WWW
February 14, 2014, 01:32:05 AM
 #1

  • There is a Bitcoin wallet containing 10 Bitcoin.
  • Two people on two separate computers open the Bitcoin wallet simultaneously.
  • They spend 6 Bitcoin from the wallet.
  • They hit the Send button simultaneously
  • They have set up the timing and positioning so that they are the same time/distance from the nearest Bitcoin node (I know this is silly, but this was the hypothetical presented to me)

What would happen?

My friend asked me what would happen in this situation and I think I know what the answer is, but I thought I'd confirm with the community, so I can say that I heard the answer from other people as well. Gotta be able to answer newcomer questions, if we want Bitcoin to be successful, even silly or weird ones. Tongue
spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 261


View Profile
February 14, 2014, 10:40:17 AM
 #2

One of the two transactions will arrive before the other at each node.  Each node will reject the second one to arrive.
Eventually one of the transactions (you can't predict which I guess) will arrive at a miner and be included in the blockchain.  Once that happens the other will be ignored by nodes.

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
February 14, 2014, 03:42:44 PM
 #3

One of the two transactions will arrive before the other at each node.  Each node will reject the second one to arrive.
Eventually one of the transactions (you can't predict which I guess) will arrive at a miner and be included in the blockchain.  Once that happens the other will be ignored by nodes.

Very good answer.

Here is one where the answer isn't quite as obvious.

Same exact question, except instead of sending 6 BTC, the two people both send 4 BTC?

(I'm aware of the answer to this question.  I'm just posting it to provoke some thought in people who might think they know what will happen.  The true experts will get it right, but many people who think they know the answer will be surprised when they read the actual answer)
uminatsu
Newbie
*
Offline Offline

Activity: 55
Merit: 0


View Profile
February 14, 2014, 06:57:18 PM
 #4

One of the two transactions will arrive before the other at each node.  Each node will reject the second one to arrive.
Eventually one of the transactions (you can't predict which I guess) will arrive at a miner and be included in the blockchain.  Once that happens the other will be ignored by nodes.

Very good answer.

Here is one where the answer isn't quite as obvious.

Same exact question, except instead of sending 6 BTC, the two people both send 4 BTC?

(I'm aware of the answer to this question.  I'm just posting it to provoke some thought in people who might think they know what will happen.  The true experts will get it right, but many people who think they know the answer will be surprised when they read the actual answer)

That depends on how the initial 10BTC was distributed among the unspent outputs. If the whole 10BTC is just one unspent output then only one transaction can be confirmed no matter how little they send. But suppose there's 2 unspent outputs of 5BTC each and the two people each send 4BTC from a different unspent output then both can be confirmed.
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
February 14, 2014, 07:03:46 PM
 #5

One of the two transactions will arrive before the other at each node.  Each node will reject the second one to arrive.
Eventually one of the transactions (you can't predict which I guess) will arrive at a miner and be included in the blockchain.  Once that happens the other will be ignored by nodes.

Very good answer.

Here is one where the answer isn't quite as obvious.

Same exact question, except instead of sending 6 BTC, the two people both send 4 BTC?

(I'm aware of the answer to this question.  I'm just posting it to provoke some thought in people who might think they know what will happen.  The true experts will get it right, but many people who think they know the answer will be surprised when they read the actual answer)

That depends on how the initial 10BTC was distributed among the unspent outputs. If the whole 10BTC is just one unspent output then only one transaction can be confirmed no matter how little they send. But suppose there's 2 unspent outputs of 5BTC each and the two people each send 4BTC from a different unspent output then both can be confirmed.

But if both people use the same wallet-software and create their transaction at the same time (or at least before their wallet-software becomes aware of the transaction created by the other), both copies of the software will select the same unspent output(s) to create the transaction and it will still double-spend.
uminatsu
Newbie
*
Offline Offline

Activity: 55
Merit: 0


View Profile
February 14, 2014, 07:07:42 PM
 #6

One of the two transactions will arrive before the other at each node.  Each node will reject the second one to arrive.
Eventually one of the transactions (you can't predict which I guess) will arrive at a miner and be included in the blockchain.  Once that happens the other will be ignored by nodes.

Very good answer.

Here is one where the answer isn't quite as obvious.

Same exact question, except instead of sending 6 BTC, the two people both send 4 BTC?

(I'm aware of the answer to this question.  I'm just posting it to provoke some thought in people who might think they know what will happen.  The true experts will get it right, but many people who think they know the answer will be surprised when they read the actual answer)

That depends on how the initial 10BTC was distributed among the unspent outputs. If the whole 10BTC is just one unspent output then only one transaction can be confirmed no matter how little they send. But suppose there's 2 unspent outputs of 5BTC each and the two people each send 4BTC from a different unspent output then both can be confirmed.

But if both people use the same wallet-software and create their transaction at the same time (or at least before their wallet-software becomes aware of the transaction created by the other), both copies of the software will select the same unspent output(s) to create the transaction and it will still double-spend.

That's correct. The only way both transactions can go through is if the two people coordinate ahead of time to select disjoint unspent output(s) and push Tx manually.
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!