Bitcoin Forum
May 27, 2024, 11:14:15 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How are double spends and other fraud transactions dealt with by the blockchain?  (Read 170 times)
gentleman2019 (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 27


View Profile
December 22, 2019, 05:13:56 PM
 #1

Lets say in my Electrum wallet I have 0.5 BTC which I send to an address, and then a few seconds later send the same 0.5 BTC from my Electrum wallet to another address. (How will this even be allowed by the wallet? does it require hacking into wallet software?)

How is this double spend resolved? Is it chronological order, i.e. will the first transaction be accepted by the blockchain and the second one be rejected as the address does not now have enough balance?
rosezionjohn
Sr. Member
****
Offline Offline

Activity: 882
Merit: 301


View Profile
December 22, 2019, 05:26:26 PM
 #2

How Blockchain prevents Double-Spending?

Let us take a scenario where a person makes a cryptocurrency transaction and tries to spend it twice.  Well, the person would not be able to do so because, once the transaction is initiated, it goes in the pool of unconfirmed transactions. In Blockchain, only the first transaction gets the confirmation and verification by the miners. But the other transaction or the second similar transaction, doesn’t get enough confirmation because the miners get to know that it is invalid.

Now you might be thinking, what if both the transaction takes place at the same time? In such cases, the transaction which gets the maximum number of confirmations from the miners is included in the Blockchain while others get discarded. The merchants are advised to wait for at least six confirmations. It means that after a particular transaction gets added to the Blockchain, six more blocks should be added on top of that particular block. Each transaction and blocks are mathematically associated with the previous one. Once the transaction gets an entry in the DLT or Blockchain, it becomes difficult to change or alter the transactions, thus making it safe.

Thus, if the merchant gets a minimum of six confirmations then he/she is assured that the transaction is not double–spent. The reason the merchant can be guaranteed is that if the sender wishes to double-spend, then he/she has to go back and reverse all the transaction in the six blocks which are computationally impossible.

The above should answer all your questions.
RapTarX
Hero Member
*****
Offline Offline

Activity: 1358
Merit: 850



View Profile
December 22, 2019, 05:43:36 PM
 #3

(How will this even be allowed by the wallet? does it require hacking into wallet software?)
As long as you have unconfirmed transaction, you can create another transaction by the same input. That doesn't necessarily mean you can send & use the 0.5 BTC twice. Answer in the 2nd quote.

Quote
How is this double spend resolved? Is it chronological order, i.e. will the first transaction be accepted by the blockchain and the second one be rejected as the address does not now have enough balance?
It's not chronological. The higher fee one will get confirmed before the low fee one. Low fee one will then rejected because it has already spent input.

Edit- Looking forward to someone expert to confirm my statement is correct or wrong.

o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18566


View Profile
December 22, 2019, 09:32:17 PM
 #4

It's not chronological. The higher fee one will get confirmed before the low fee one. Low fee one will then rejected because it has already spent input.
Not necessarily.

When a node receives the details of an unconfirmed transaction, it adds it to its memory pool. Default behavior of nodes is to reject a transaction if it conflicts with another transaction already in their memory pool, and flag it up as a potential double spend. These nodes will essentially keep whichever transaction they saw first, regardless of the fee. They also won't broadcast this conflicting transaction to other nodes, therefore impeding its dissemination through the network.

One of the two transactions will arrive first at the miner which will mine the next block. This can be down to various things, such as which transaction was broadcast first, which node or nodes it was broadcast to, and luck. Provided it has an acceptable fee, then it will be mined first, regardless of what fee the other transaction has.
IadixDev
Full Member
***
Offline Offline

Activity: 322
Merit: 151


They're tactical


View Profile WWW
December 22, 2019, 09:39:59 PM
 #5

You could have same address in two different wallets, in two different computers, in two different places, and if you make the two transactions at the same time, it can take some time for them to be propagated on the network, and two differents versions of the chain can exist at the same time, the version that has the more confirmations will be selected by nodes and the others removed after a few blocks. Its up To each miner which transaction it will include in the block, but each node can recieve the two transactions in different orders, chronology is often difficult to establish in open distributed system, so each miner can have its own policy when choosing which version it will include in the block.

nc50lc
Legendary
*
Offline Offline

Activity: 2422
Merit: 5650


Self-proclaimed Genius


View Profile
December 23, 2019, 05:44:38 AM
 #6

Lets say in my Electrum wallet I have 0.5 BTC which I send to an address, and then a few seconds later send the same 0.5 BTC from my Electrum wallet to another address. (How will this even be allowed by the wallet? does it require hacking into wallet software?)
Your wallet and the server (connected node) won't allow it.
If you try to send another 0.5 BTC, your wallet will find another UTXOs to spend, not the already used ones.

There are certain conditions before double-spend can be achieved; like marked as "replaceable" or connection to a miner's node that configured to accept double-spend TXs.
but by using default settings and normal transaction creation procedures, it's not possible to double spend.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
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!