Double Spend Attack
A double spend attack occurs when an attacker successfully sends the same cryptocurrency to two different parties and they in return give something of value back to the attacker. To achieve this, you have to convince the network that both transactions are valid.
The way a node in the network determines if a transaction is valid, is by looking back at the blockchain and making sure you have ownership of the coins you're trying to spend. If you do, the transaction is accepted and mined into a block (which means you're now handing over ownership to the coins to the merchant).
Here comes the hard part. Now the attacker has to fork the blockchain, so each merchant has a different view of the blockchains history. That means the attacker has to spend their coins on one side, then mine blocks on the other side of the split and omit that transaction so they can spend it again.
Once the attacker stops the attack, the blockchain reaches consensus again, and there is only one valid chain. The merchant on the forked chain is out of luck because their transaction is now in an invalid block. They no longer have ownership of the coins and they also don't have their good/service. This is why it's a good practice for merchants to wait for 6 confirmations (the transactions to be buried 6 blocks deep), so they can be confident the transaction was made on the heaviest chain.
Why it's Infeasible in Bitcoin
To perform this attack you need to be technically savy and have a significant amount of hashing power in the network to create the forked view of the blockchain. This has never happened in Bitcoin because it is sufficiently decentralized and the vast amount of hashing power it has behind it.
There are a few important things to note:
- An attacker can only spend coins they already own.
- If you have the amount of hashing power to fork the blockchain, you're economically incentivized to contribute to the network because you earn a block reward and transaction fees for each legitimate block you mine.
- It also harms the integrity of the network. If a double spend attack is successful then confidence is lost in the currency and the value drops. You've already had to have invest a lot of capital into the hardware to perform the attack and now the currency isn't worth anything and now your hardware is useless.
Double spend attacks generally happen to altcoins that share the same hashing algorithm as Bitcoin, so they can benefit from the attack and still use their mining equipment.