Bitcoin Forum
May 13, 2024, 01:00:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Double spending within ten minutes  (Read 973 times)
AlphaGammaDelta (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
July 30, 2015, 02:52:27 PM
 #1

This must have been asked before but I can't find an answer.

SCENARIO:  It takes ten minutes to add a new block of data to the blockchain.  Larry has one bitcoin.  He goes to the mall and within one ten minute period between blocks:

1) Larry spends most of his bitcoin at a computer store.
2) Larry runs next door to a jewelry store, where he again spends most of his bitcoin.

Obviously this can't happen.  What is the mechanism that prevents double spending within the ten minutes between blocks?

Thanks.
1715605245
Hero Member
*
Offline Offline

Posts: 1715605245

View Profile Personal Message (Offline)

Ignore
1715605245
Reply with quote  #2

1715605245
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715605245
Hero Member
*
Offline Offline

Posts: 1715605245

View Profile Personal Message (Offline)

Ignore
1715605245
Reply with quote  #2

1715605245
Report to moderator
1715605245
Hero Member
*
Offline Offline

Posts: 1715605245

View Profile Personal Message (Offline)

Ignore
1715605245
Reply with quote  #2

1715605245
Report to moderator
notlist3d
Legendary
*
Offline Offline

Activity: 1456
Merit: 1000



View Profile
July 30, 2015, 03:43:16 PM
 #2

This must have been asked before but I can't find an answer.

SCENARIO:  It takes ten minutes to add a new block of data to the blockchain.  Larry has one bitcoin.  He goes to the mall and within one ten minute period between blocks:

1) Larry spends most of his bitcoin at a computer store.
2) Larry runs next door to a jewelry store, where he again spends most of his bitcoin.

Obviously this can't happen.  What is the mechanism that prevents double spending within the ten minutes between blocks?

Thanks.

Conformations are there to prevent this.  That is why you wait to see conformations before sending items/codes/etc. 

Like Bitmain I think 3 conformations they wait on before it shows paid in their payment if I'm not mistaken.

Are you really a AlphaGammaDelta? I had to look it up was one i was unfamiliar with Smiley
guytp
Member
**
Offline Offline

Activity: 62
Merit: 12


View Profile
July 30, 2015, 03:43:25 PM
 #3

You don't spend a balance in the blockchain, instead you spend a previous input.

For example - let's say you received 1 BTC from someone and another 1 BTC from someone else.  This gives you 2 BTC.

If you want to send 1.5 BTC you end up "claiming" both 1 BTC inputs that you were given, sending 1.5 BTC to your recipient (in this case a store) and the remainder back to yourself.

The transaction get's a unique ID which is basically made up from the exact details of the input and how much you are paying to whom.

In your example you would generate two different transactions.  Since both are claiming the same inputs you would get Shop A submitting a transaction then Shop B submitting a transaction both stating these inputs are being used.  These would propogate around the network - including to miners.

When a miner discovers a block they will pick up transactions.  If the miner has only seen one of your transactions then it will include that one (which may be for Shop A or Shop B depending on the network).  If it has seen both I believe it will only accept the first one it sees.

Once that miner has accepted and "published" your transaction it gets "confirmed" to the network.  At this point you would see the transaction the miner accepted as "1 confirmation" and the other as "unconfirmed".

If at the same time two different miners both discovered a block and they both published different transactions you'd temporarily see an orphaned chain.  It's then a race as to which one gets most people to see it.  Once 51% of the network have seen one of the two confirmed transactions first - that becomes the "official" transaction and the other one is "orphaned" meaning the money cannot be spent.

In your example one of the two shop keepers would receive the BTC and the other wouldn't.

For bitcoin transactions it is down to the vendor to decide how many confirmations they require before releasing goods.  As the number of confirmations goes up the change of a reversal becomes expoentially more difficult.  Forks very rarely occur for more than a couple of blocks so 5 is generally a good example that you've got the money.  If you're selling a £1mn painting you'll probably want to wait 30-or-so blocks.

If one of your shops below is selling an expensive item it would be fair for them to say "come back in 30 minutes to pick it up".  If they're both seeling you £10 of goods then one of them has made a loss through fraud.  This is no different than a shop doing "offline auths" on low value credit cards to speed up transaction times (i.e. they don't contact bank, hope it will be OK and take the risk themselves to serve people faster like if paying by card at McDonalds).

So the situation you describe can happen but only one person gets paid eventually.

Other coins implement systems for "0 confirmations" - or are starting to.  These still don't give you 100% confidence but will certainly approach having a few blocks confirmed in a current system as it adds an additional layer on top of the above.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
July 30, 2015, 03:43:33 PM
 #4

Nodes will only accept and relay the first transaction that it sees that spends those inputs. Larry would need to spend the same inputs twice. Most nodes that see the first transaction will reject the second one since it spends the same inputs twice. It is part of the relaying rules. Miners also follow these rules. When they see a double spend, they go with the version that came first. Due to the network speed, Larry would not be able to do the common Race Attack. That would require him to be at both stores at once and send both transactions at the same time. Due to the network propagation, the first transaction sent will reach most of the network before Larry can even leave the first store.

Also, most businesses and business deals should only go through after a few confirmations. This ensures that the transaction cannot be double spent. The computer store would be very idiotic to let unconfirmed transactions to happen.

ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4186



View Profile
August 01, 2015, 03:41:22 PM
 #5

Nodes will only accept and relay the first transaction that it sees that spends those inputs. Larry would need to spend the same inputs twice. Most nodes that see the first transaction will reject the second one since it spends the same inputs twice. It is part of the relaying rules. Miners also follow these rules. When they see a double spend, they go with the version that came first. Due to the network speed, Larry would not be able to do the common Race Attack. That would require him to be at both stores at once and send both transactions at the same time. Due to the network propagation, the first transaction sent will reach most of the network before Larry can even leave the first store.

Also, most businesses and business deals should only go through after a few confirmations. This ensures that the transaction cannot be double spent. The computer store would be very idiotic to let unconfirmed transactions to happen.
The rules are for reference implementation. People can modify it themselves, whether to relay double spend transactions or not. Do note that a miner can accept the replacement transaction if they want to, the entire network would then accept that transaction.But it is not possible for two transactions spending the same output to get confirmations as majority of the network would reject that.
Zero confirmations are not always safe.

IMO, it is okay to allow small transactions to go through if you connect to peers at different geographical locations, make sure big pools are accepting the transaction, inputs are already confirmed and a good fee per kilobyte has been used.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
BestBitcoinOdds
Member
**
Offline Offline

Activity: 152
Merit: 30


View Profile
August 01, 2015, 04:33:23 PM
 #6

This must have been asked before but I can't find an answer.

SCENARIO:  It takes ten minutes to add a new block of data to the blockchain.  Larry has one bitcoin.  He goes to the mall and within one ten minute period between blocks:

1) Larry spends most of his bitcoin at a computer store.
2) Larry runs next door to a jewelry store, where he again spends most of his bitcoin.

Obviously this can't happen.  What is the mechanism that prevents double spending within the ten minutes between blocks?

Thanks.

Yes, confirmations are needed.   It is not advisable to sell product for bitcoin without waiting for confirmations.    This is why I reall think we need to change the standard block time to reduce variances.
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4186



View Profile
August 01, 2015, 04:44:28 PM
 #7

This must have been asked before but I can't find an answer.

SCENARIO:  It takes ten minutes to add a new block of data to the blockchain.  Larry has one bitcoin.  He goes to the mall and within one ten minute period between blocks:

1) Larry spends most of his bitcoin at a computer store.
2) Larry runs next door to a jewelry store, where he again spends most of his bitcoin.

Obviously this can't happen.  What is the mechanism that prevents double spending within the ten minutes between blocks?

Thanks.

Yes, confirmations are needed.   It is not advisable to sell product for bitcoin without waiting for confirmations.    This is why I reall think we need to change the standard block time to reduce variances.
Confirmations should be needed for amounts more than $100. Changing block times aren't easy and it would reduce the security of the network, increasing orphan blocks. A 5 minutes block would need 2 blocks to provide the same level of consensus as 10 minute blocks and it would require a hard fork to reduce block time. Varience can't be eliminated. Even with shorter block time, blocks can still reach 30 minutes per.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Foxpup
Legendary
*
Offline Offline

Activity: 4354
Merit: 3044


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
August 02, 2015, 07:28:54 AM
 #8

Unconfirmed transactions are relayed to everyone on the network. That's how miners get them in the first place. The jewellery store will normally see his original transaction within seconds, and will reject Larry's double spend unless he runs very fast. Bonus points for wiring the point-of-sale terminal to trigger the silent alarm and lock the doors when a double-spend attempt is detected.

While there is always a risk of double-spends against unconfirmed transactions, the chance of success is so low, and the risk of being caught is so high, that in practice it should not be a problem.

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
ajareselde
Legendary
*
Offline Offline

Activity: 1722
Merit: 1000

Satoshi is rolling in his grave. #bitcoin


View Profile
August 02, 2015, 09:32:54 AM
 #9

This must have been asked before but I can't find an answer.

SCENARIO:  It takes ten minutes to add a new block of data to the blockchain.  Larry has one bitcoin.  He goes to the mall and within one ten minute period between blocks:

1) Larry spends most of his bitcoin at a computer store.
2) Larry runs next door to a jewelry store, where he again spends most of his bitcoin.

Obviously this can't happen.  What is the mechanism that prevents double spending within the ten minutes between blocks?

Thanks.

Yes, confirmations are needed.   It is not advisable to sell product for bitcoin without waiting for confirmations.    This is why I reall think we need to change the standard block time to reduce variances.
Confirmations should be needed for amounts more than $100. Changing block times aren't easy and it would reduce the security of the network, increasing orphan blocks. A 5 minutes block would need 2 blocks to provide the same level of consensus as 10 minute blocks and it would require a hard fork to reduce block time. Varience can't be eliminated. Even with shorter block time, blocks can still reach 30 minutes per.

Regardless of block time, unconfirmed transactions could be lasting way more than 10 minutes op is talking about, since block time varies, and also in
cases like the blockchain spam attack (some call it "testing"). But in any way, confirmations should be the only reason to take the transaction seriously.

cheers
Snorek
Legendary
*
Offline Offline

Activity: 1400
Merit: 1001



View Profile
August 02, 2015, 12:02:03 PM
 #10

Double spending is not problem of the ordinary bitcoin users. It is rather like bitcoin companies are penalized for double spending.
And it is totally possible for bitcoin network to process confirmatin much faster. however, it is not feasible for bitcoin's code to be adjusted to make confirmations quicker.
ranochigo
Legendary
*
Offline Offline

Activity: 2968
Merit: 4186



View Profile
August 02, 2015, 02:28:21 PM
 #11

This must have been asked before but I can't find an answer.

SCENARIO:  It takes ten minutes to add a new block of data to the blockchain.  Larry has one bitcoin.  He goes to the mall and within one ten minute period between blocks:

1) Larry spends most of his bitcoin at a computer store.
2) Larry runs next door to a jewelry store, where he again spends most of his bitcoin.

Obviously this can't happen.  What is the mechanism that prevents double spending within the ten minutes between blocks?

Thanks.

Yes, confirmations are needed.   It is not advisable to sell product for bitcoin without waiting for confirmations.    This is why I reall think we need to change the standard block time to reduce variances.
Confirmations should be needed for amounts more than $100. Changing block times aren't easy and it would reduce the security of the network, increasing orphan blocks. A 5 minutes block would need 2 blocks to provide the same level of consensus as 10 minute blocks and it would require a hard fork to reduce block time. Varience can't be eliminated. Even with shorter block time, blocks can still reach 30 minutes per.

Regardless of block time, unconfirmed transactions could be lasting way more than 10 minutes op is talking about, since block time varies, and also in
cases like the blockchain spam attack (some call it "testing"). But in any way, confirmations should be the only reason to take the transaction seriously.

cheers
In the future, blockchain spamming costs would be much more expensive than now due to the increased block size. More transactions are able to be confirmed. The spam just shows that a simple 0.0001BTC fee can easily get your transaction confirmed within several blocks. Confirmations aren't that necessary for brick and mortar stores. After all, the risk of accepting a counterfeit note and getting charged back is much higher compared to accepting a transaction after it has fulfilled serveral requirements set by the owner.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
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!