Fundamentally, a double spend consists of a bad actor sending a copy of one transaction to make the copy appear legitimate while retaining the original, or erasing the first transaction altogether. This is possible and dangerous for Bitcoin or any digital currency because digital information is more easily duplicated. There are a few different situations where criminals attempt to double-spend Bitcoin.
An attacker will simultaneously send the same bitcoin to two (or more) different addresses. This type of attack attempts to exploit the Bitcoin network’s slow 10-minute block time, in which transactions are sent to the network and queued to be confirmed and verified by miners to be added to the blockchain. In sneaking an extra transaction onto the blockchain, thieves can give the illusion that the original bitcoin amount hasn’t been spent already, or manipulate the existing blockchain and laboriously re-mine blocks with fake transaction histories to support the desired future double spend.
The attacker sends multiple packets (units of data) to the network to reverse the transactions, to give the illusion they never happened. With this way, the attacker attempts a Bitcoin double spend by reversing a transaction after receiving the counterparty’s assets or services, thus keeping both the received goods and the sent bitcoin.
When a group of miners controls over 50% of the network’s hash rate, they launch a 51% attack against a cryptocurrency blockchain. Having control of 51% of the network’s nodes provides the governing parties with the ability to change the blockchain.Payments between a few or all users might be stopped if the attackers were able to stop fresh transactions from receiving confirmations. The ability to undo decisions taken when they were in charge would likewise be available to them. One of the problems that consensus systems like proof-of-work were designed to avoid is that by reversing transactions, users might double spend coins.On a coin with a high participation rate, a 51% assault is an extremely demanding and difficult undertaking. The majority of the time, the group of attackers would have to be able to command the required 51% and have a backup blockchain ready to be injected when the opportunity arises.The main network would then have to be out-hashed. One of the biggest obstacles against a 51% attack is the expense of doing so. For instance, the Bitmain S19 XP Hydro is the most sophisticated Application Specific Integrated Circuit (ASIC) miner. It boasts 255 TH/s (tera hashes per second) of hash rate and costs more than $19,800.FoundryUSA, with 54.42 EH/s (exahashes per second), accounts for 23.75% of the entire Bitcoin network hash rate, followed by AntPool at 41.49 EH/s, 18.12%, and Binance Pool at 34.48 EH/s, 15.06%.[2]
The Finney attack is named after Hal Finney, who happened to be the first recipient of a Bitcoin transaction, and the first person to comment on the release of the Bitcoin source code. It is a double spending attack with the following features:
- It only works if the merchant accepts unconfirmed transactions.
- It still works, however, if the merchant waits a few seconds to verify that everyone in the network agrees he was paid.
- It requires the attacker to be mining and controlling the content of his blocks; however, he can in theory do this with any hashrate, in particular significantly less than 50% of the network hashrate.
It proceeds as follows:
- The attacker mines blocks normally. In the block he/she is trying to find, he includes a transaction which sends some of his/her coins back to himself/herself, without broadcasting this transaction.
- When he/she finds a block, he/she does not broadcast it; instead, he/she sends the same coins to a merchant for some goods or service.
- After the merchant accepts the payment and irreversibly provides the service, the attacker broadcasts his/her block. The transaction that sends the coins to himself/herself which is included in this block, will override the unconfirmed payment to the merchant.
If the time from finding the block until the attacker sends payment and the merchant accepts it is 't', and the average time to find a block is 'T', there is a probability of t/T that another block will be found on the network in this time. In this case the attack will fail, and the attacker will lose the block reward of B.This means that the average cost of attempting the attack is about (t/T) * B. As a rule of thumb, the merchant should wait at least t=V*T/B (V is the value of the transaction) to make sure that trying to carry out this attack against him isn't profitable. This may not be sufficient though, as a nimble attacker can use the same block for multiple attacks, potentially gaining the total of their value.The lower the attacker's hashrate, the less opportunities he/she has to carry out the attack. If the attack is for obtaining some illiquid good, it is difficult to make the need for this good coincide with finding a block. If the attack is for obtaining something liquid (e.g. exchanging bitcoins for other money), an opportunity is ever-present but the merchant is likely to require a few confirmations. This makes the attack difficult to use in practice.[4]
The Race Attack is a particular kind of a Double-Spending attempt which is a malicious activity when two transactions are created at the same time using the same funds to spend them twice. It requires the recipient to accept payment for unconfirmed transactions. The attacker sends the victim an unconfirmed transaction. Meanwhile, they broadcast to the network a conflicting transaction. Since the victim observed their own transaction first, they believe they will be paid. However, since the rest of the network saw the double-spend first, it’s likely that the victim will not get the money.Such an attack is significantly easier to carry out when the attacker has a direct connection to the victim's node and deposits the conflicting transaction directly to the miners.[6]