How double spending is avoided on the bitcoin blockchain
Bitcoin is revolutionary step in terms of economics of money creation. One of the reasons we rely on central banks to control and regulate money is in order to create an orderly system that avoids cheating the system. Double spending is one of the main challenges for digital money just like counterfeit is challenge for physical money. Double spending is the spending of money more than once without depletion due to duplication of digital ledger.
Just to note that double spending is not only unique to cryptocurrencies such as bitcoin but also other forms of digital fiat currency. If double spending is not avoided, it would create runaway inflation as someone can spend unlimited currency and ending up with a worthless currency. For existing fiat currency, third party trust agents are used for this verification process. However, cryptocurrencies such as bitcoin do not have a central third party to do this, so what happens? can someone spend the same amount of bitcoin over and over?
Simply, NO, it would be realistically very difficult to do so
On the Bitcoin network, proof-of-work system with decentralized miners (computer network) is used thereby eliminating need for a central trust authority. But still what if these computers are made to collude and cheat the system?
Generally, the process of verifying and confirming a transaction on the Bitcoin network involves computers competing to solve complex mathematical puzzles. A valid transaction is included in the blockchain with greatest amount of computational work. A valid transaction needs to be agreed upon by different computer nodes without them having to know or trust each other.
Byzantine generals’ problem used in warfare can be used to explain this consensus phenomenon on the bitcoin blockchain
In warfare, generals must agree on a concerted strategy in order to avoid catastrophic system failure. Catastrophic system failure is as a result of some actors being unreliable while others are reliable and therefore efforts put forward by one side are not countered by efforts on the other side. Imagine a group of generals both leading different armies in order to attack a city. Since the city is wide and expansive, the generals will be in different points and there is no way to communicate with each other during warfare. Generals therefore need to have a formula for attacking the city. If all of them agree to attack and some retreat, it will be a big blow to the operation. Also another problem is that some generals may be traitors; they may cast a vote to attack and when it’s time to attack they retreat.
The solution is to have a plan that everyone agrees with and that those who don't agree and try to sabotage cannot defeat the other loyal soldiers.
This general’s problem is hypothetical but is at the core of how to build a decentralized and trustless system. How do you make sure different parties working in different regions (even countries) reach the same level of agreement? Since there is no central server on the bitcoin blockchain, in order to verify transactions, various nodes must agree and reach consensus on any transaction based on set of agreed rules. When consensus is agreed upon, it is added to the blockchain.
The system is set up such that it is easier to abide by the rules than to try and cheat.
In addition, since all transactions are tied together, an attacker will have to more CPU power than other nodes and choose between defrauding the people or stealing back his payments.
Consensus is generally a problem that has been a major issue in any fault-tolerant distributed systems. When multiple servers agree on values then a decision is made and it is final, this is what results to verification of transactions.
on Telegram @chrismakubi