Double-spending is the risk that a cryptocurrency can be used twice or more. Transaction information within a blockchain can be altered if specific conditions are met. The conditions allow modified blocks to enter the blockchain; if this happens, the person that initiated the alteration can reclaim spent coins.
- Double-spending occurs when someone alters a blockchain network and inserts a special one that allows them to reacquire a cryptocurrency.
- Double-spending can happen, but it is more likely that a cryptocurrency is stolen from a wallet that wasn’t adequately protected and secured.
- Many variations of attacks could be used for double-spending—51% is one of the most commonly cited attacks, while the unconfirmed transaction attack is most commonly seen.
To understand double-spending, it helps to review how the blockchain works first. When a block is created, it receives a hash—or encrypted number—that includes a timestamp, information from the previous block, and transaction data. This information is encrypted using a security protocol like the SHA-256 algorithm used by Bitcoin.
Once that block’s information is verified by miners in proof-of-wor it is closed, and a new one is created with the timestamp, transaction information, and previous block’s hash. A Bitcoin is awarded to the miner whose machine verified the hash.
For someone to double spend, a secret block has to be mined that outpaces the creation of the real blockchain. They would then need to introduce that chain to the network before it caught up—if this happened, then the network would recognize it as the latest set of blocks and add it to the chain. The person that did this could then give themselves back any cryptocurrency they had spent and use it again.