One of the primary concerns of any cryptocurrency developer is the issue of double-spending. This refers to the incidence of an individual spending a balance of that cryptocurrency more than once, effectively creating a disparity between the spending record and the amount of that cryptocurrency available, as well as the way that it is distributed. The issue of double-spending is a problem that cash does not have; if you pay for a sandwich with a $10 bill, turning that bill over to the maker of the sandwich, you cannot turn around and spend that same $10 elsewhere. A transaction using a digital currency like bitcoin, however, occurs entirely digitally. This means that it is possible to copy the transaction details and rebroadcast it such that the same BTC could be spent multiple times by a single owner. Below, we'll examine how cryptocurrency developers have insured that double spending cannot happen.

Understanding the Blockchain

The blockchain which undergirds a digital currency like bitcoin is not able to prevent double-spending on its own. Rather, all of the different transactions involving the relevant cryptocurrency are posted to the blockchain, where they are separately verified and protected by a confirmation process. In the case of bitcoin and many other cryptocurrencies, transactions that have been confirmed in this way become irreversible; they are posted publicly and maintained in perpetuity.

Bitcoin was the first major digital currency to solve the issue of double spending. It did so by implementing this confirmation mechanism and maintaining a common, universal ledger system. In this way, the bitcoin blockchain retains records of time-stamped transactions going back to the founding of the cryptocurrency in 2009.

In Bitcoin terms, a "block" is a file of permanently recorded data. All recent transactions are written into blocks, much like a stock transaction ledger on an exchange. Information from blocks is added to the ledger every few minutes; all nodes on the network maintain a copy of the blockchain ledger. Users are able to navigate the blockchain for bitcoin and review transactions in terms of quantity only. Details about the identities of the buyer and seller in any transaction are protected by high-level encryption, which also protects the ledger from tampering by outside sources. When the blockchain ledger is updated, so too are all bitcoin wallets.

Dealing With Double Spending

Imagine that you have 1 BTC and you attempt to spend it twice in two separate transactions. You could attempt to do this by sending the same BTC to two separate bitcoin wallet addresses. Both of these transactions will then go into the pool of unconfirmed transactions. The first transaction would be approved via the confirmation mechanism and then verified into the subsequent block. However, the second transaction would be recognized as invalid by the confirmation process and would not be verified. If both transactions are pulled from the pool for confirmation simultaneously, the transaction with the highest number of confirmations will be included in the blockchain, while the other one will be discarded.

While this effectively deals with the issue of double spending, it is not without its issues. For example, the intended recipient of the second (failed) transaction would not have part in the transaction itself failing, and yet that person would not receive the bitcoin he or she had anticipated. Many merchants wait for at least 6 confirmations of a transaction (meaning that 6 subsequent blocks of transactions were added to the blockchain after the transaction in question). At this point, the merchant can safely assume that the transaction is valid.

There remain other vulnerabilities in this system which could allow double-spend attacks to take place. For example, if an attacker is somehow able to control at least 51% of the has power of the network, he or she can commit double spending. If an attacker were somehow able to get control of this much computational power, he or she could reverse transactions and create a separate, private blockchain. However, the rapid growth of bitcoin has virtually insured that this type of attack is impossible. (For more, see Beware of These Five Bitcoin Scams)