> For the complete documentation index, see [llms.txt](https://docs.leather.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.leather.io/learn/double-spending.md).

# What is Double Spending?

Double spending is spending the same bitcoin twice. The kinds of attack and how confirmations protect against them.

Double spending means spending the same coins twice. Bitcoin prevents it: every node checks that a transaction spends only unspent outputs, and only one of two conflicting transactions can confirm. The attacks below target a recipient who accepts a payment before it is safely confirmed.

## Kinds of attack

* **Race attack:** the attacker sends a payment to the victim and, at about the same time, a conflicting transaction that pays the same coins back to themselves. If the second one confirms, the victim's payment never does.
* **Finney attack:** a miner mines a block with a transaction paying themselves, keeps it secret, pays the victim with the same coins, then publishes the block.
* **Vector76 attack:** a combination of the two, in which the attacker uses a private block to reverse a payment that had one confirmation.
* **51% attack:** an attacker with most of the mining power rewrites recent blocks and replaces confirmed transactions. On Bitcoin, the cost of this is very high.

## Protection

* Wait for confirmations before treating a payment as final. Many services wait for six for large amounts.
* Treat unconfirmed payments as pending. A sender can replace an unconfirmed payment with Replace-By-Fee.

See [What is Replace-By-Fee (RBF)?](/learn/replace-by-fee-rbf.md) and [Understand Pending Transactions](/transactions/pending-transactions.md).
