Double spending is one of the major drawback or problem that every payment network faced in a digital cash scheme. Principally,
Double spending is an error under which the same single digital token is spent twice or more.
Since bitcoin or any other cryptocurrency is nothing but a digital file, people can easily manipulate and send a single unit of currency to two different sources with the same bitcoin. How to overcome such hazard?
In the early 2009, Satoshi Nakamoto, the unknown inventor of Bitcoin, implemented a solution to this problem. He tried to build a digital cash system without a central entity, more of a peer-to-peer network under which a scheme called proof-of-work was introduced. Proof-of-work is basically to avoid the necessity for a trusted third party to timestamp transactions. These timestamps are recorded in its public ledger known as the Blockchain, which further aids in avoiding double-spending the currency.
Bitcoin is a decentralized, open source digital currency. Each Bitcoin comprises of private key, used for decryption. Private key must remain secret. When the transactions are taken out of the unconfirmed transactions pool and put into the blockchain they are checked for their validity. To avoid double spending, almost 6 confirmations (and many more if required) are carried out before considering a transaction complete. So in the end we will have a clear winner and only one transaction will be confirmed. Until this race is resolved both transactions are in risk of getting cancelled. This verification is nothing but a type of proof-of-work protocol, which makes the task of creating new blocks difficult and verification easier. Anyone can view the blockchain in bitcoin network thus making it hard to distort transaction information.