Take Bitcoin as an example to understand the working process of blockchain

Taking the Bitcoin network as an example, we can see how blockchain technology is used in it.

First, a Bitcoin client initiates a transaction, broadcasts it to the Bitcoin network, and waits for confirmation. Nodes in the network will package together some received transaction records waiting for confirmation (in addition to information such as the hash value of the previous block header) to form a candidate block. Then, try to find a nonce string (random string) to put in the block, so that the hash result of the candidate block satisfies a certain condition (such as less than a certain value). The search for this nonce string takes a certain amount of time to perform a calculation attempt.

Once the node calculates the nonce string that meets the conditions, the block is considered "legal" in format and can try to broadcast it in the network. Other nodes receive the candidate block, verify it, and find that it meets the agreed conditions. When a majority of nodes add a block to the blockchain structure they maintain, the block is accepted by the network, and the transactions included in the block are confirmed.

Of course, there will be a lot of additional details in the implementation. There are two key steps here: one is to complete the consensus on a batch of transactions (create a block structure); the other is to add a new block to the blockchain structure and be recognized by everyone to ensure that it cannot be tampered with in the future.

Bitcoin's consensus mechanism for finding nonce strings based on computing power is called Proof of Work (PoW). At present, there is no known fast heuristic algorithm to make the hash result meet certain conditions, and only tentative brute force calculations can be performed. The more attempts (and the greater the workload), the greater the calculated probability.

By adjusting the limits on hash results, the Bitcoin network controls an average of about 10 minutes to produce a legitimate block. The node that calculates the block will receive the management fee for all transactions in the block and the reward fee fixed by the protocol (currently 12.5 bitcoins, halved every four years). This process of calculating new blocks is commonly known as mining.

Readers may be concerned that anyone can join the Bitcoin network. If there are malicious nodes in the network, can malicious operations be performed to tamper with the records in the blockchain, thereby destroying the entire Bitcoin network system. For example, in the simplest case, it deliberately does not recognize the legitimate candidate blocks generated by others, or simply rejects transactions from other nodes.

In fact, there are a large number (by an estimate of thousands) of maintenance nodes in the Bitcoin network, and most of them are functional, defaulting to only acknowledging the longest chain structure they see. As long as more than half of the nodes in the network do not collude to take malicious actions in advance, the longest chain will become the final legitimate chain with a high probability. And as time goes on, this probability will get bigger and bigger. For example, after 6 blocks are generated, even if half of the nodes join forces to overturn the confirmed result, the probability is only (1/2)6 ≈ 1.6%, which is less than 1/60 of the probability.

Of course, if most of the nodes in the entire network work together to do evil, it can cause the entire system to fail to work properly. To do this often means paying a high price, which is more than worth the gains compared to the gains from doing evil.

It is suggested that the blockchain structure and the directed acyclic graph data structure of Git version management are similar in design.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324652035&siteId=291194637