The birth and operation of bitcoin and blockchain involves two classic problems: the Double-Spending Problem and the Byzantine General Problem.
Solving Double-Spending and Overcoming the Payment Trust Problem
In the early days of human society, shells and precious metals became general equivalents by virtue of their scarcity, and these physical currencies had value and could complete the transfer of value instantly.
The physical banknotes or currencies that arose later relied on the credibility of the state to solve the trust problem. In the digital age, there are more transfers and transactions of digital currencies that are done through the internet. These digital currencies are essentially a combination of 0 and 1 codes, and the digital currency can be copied into two copies and issued to two different recipients, which is called the "double spend problem". To avoid such problems, people usually use a centralized system of accounts with a third party, such as a bank, in order to use credit cards and other types of electronic money.
Distributed Ledger: A System Without an Intermediary Third Party
But in reality, are such third-party centralized institutions completely trustworthy? On the one hand, centralized institutions may not be internally open and transparent, leading to misappropriation of funds and inaccurate bookkeeping, and on the other hand, there are external risks such as attacks on the centralized servers used by these institutions.
For example, if there is a centralized management office in a bazaar, all transactions and transfers by stall owners need to be recorded by the management office, and there is usually no problem when the management office performs its own duties. However, if the management office makes changes to some of the transaction transfer records, then there may be a failure to reconcile the accounts.
Therefore, Bitcoin proposes a solution that abandons third-party intermediaries by creating a distributed ledger that allows everyone to participate in bookkeeping.
In the bazaar mentioned above, each vendor is now a bookkeeper, and each holds a copy of the same ledger. If a stallholder wants to make changes to the ledger, he or she needs to notify the other stallholders after making the changes, so that they can confirm the content and copy it to their own ledgers. Only when all stallholders have confirmed and updated their books is the bookkeeping process complete. There is no single intermediate third party to manage this process, which is roughly how the Bitcoin network works.
Byzantine Generals Problems: How to Synchronize Multiple Messages
The problem of Byzantine Generals originated in the medieval period, when Byzantium was a vast country and communication between legions could only be carried out by messengers, and combat information was passed layer by layer. In the process, if a traitor deliberately misrepresented the operational information of the upper leadership, it would lead to a part of the operational plan inconsistent.
To solve this problem, there are two solutions: to send messengers to each other by verbal agreement, and to reach consensus using the minority-majority decision-making method, but if there is a traitor, the traitor may disguise himself by observing the majority decision-making method, or mix in the minority that is difficult to distinguish. Or, they can be done by written agreement, sending messengers to deliver written messages with exclusive signatures that each army has to second, but the delivery is too slow and the signatures may be lost. Neither option was used because both would solve only part of the problem and the time and resources required to reach consensus would be too much.
In the Bitcoin network, there are many centralized nodes that make up a complete network, and each node is a "corps" of independent, autonomous, and equal players. Each node in the network holds its own unique copy of blockchain data, and they all want to be the first to package transactions and earn the bitcoin rewards distributed by the system. How do you decide which node gets bookkeeping rights to successfully bring the entire network to consensus and add new data to blockchain?
PoW Proof of Work: Computation Generates Answers, Network Participates in Verification
In response, the Bitcoin network uses a proof-of-work (PoW) consensus mechanism, commonly known as "mining". This is a process in which nodes perform a large number of operations, and the first node to find the "answer" to a question gets the right to keep track of it. Nodes need to keep trying to change the random number (Nunce) in the block header, and keep calculating the block hash, and finally get a block hash with the first few bits of the value being zero. The Nunce value at this point is the answer to the question. After finding the answer, the node will broadcast it to other network nodes, which will verify the answer and quickly take the block as the new parent node to continue the next round of mining operations.
In the Byzantine General problem, suppose General A first issues the [Attack] command with his own signature and executes it. After receiving it, other generals will follow General A's command with the [Attack] command and their own signature if they also intend to attack, and Ice executes it. If A sends the [attack] order but does not execute it, the other generals can judge that A is a traitor and use it to distinguish the correctness of the message.
However, propagation between nodes takes time, and there exists the possibility that two or even more nodes have found a solution to the problem at the same time before all nodes in the network reach consensus. However, since the two nodes packaged different transaction contents, this will produce two different valid blocks. Due to the different signaling sequences, there will be miner nodes operating on both forks. At this point, the Bitcoin network will adopt the "longest chain principle" and only treat the fork chain with the highest number of blocks as the only recognized block chain. This fork competition will typically be completed within 6 blocks, and all transactions on the other abandoned chain will be voided.
The Nature of Bitcoin: The UXTO Model
Traditional electronic money systems use a centralized account system and create accounts for each user on a centralized server and store the balance data of their respective accounts. After each transaction occurs, the account balance is increased or decreased in chronological order.
Bitcoin, on the other hand, uses the UXTO model, which is called Unspent Transaction Output, and is a special account-keeping model. It's as if you received a bitcoin transfer, but you didn't transact with that bitcoin, Bitcoin is a UXTO for you.
Transactions in Bitcoin are implemented through asymmetric encryption. Each Bitcoin user needs to hold a pair of public and private keys, similar to an account and password in centralized finance. The user needs to use the private key to sign the transaction data and publish his or her transaction data, signature, and public key together. However, during each transaction, the user does not transfer the account balance directly, but uses the "unspent amount", or UTXO, from multiple previous transactions.
Disclaimer
-
Crypto investment involves significant risks. Please proceed with caution. The course shall not be considered investment or financial advice.