Blockchain in China (4): Bitcoin workload proof __ Blockchain

Source: Internet
Author: User
Tags current time hash

Bitcoin requires each block to prove that it has put enough effort into creating them to ensure that malicious nodes that want to tamper with historical chunks of information will have to pay more for the effort, rather than simply modifying a single record-proof of workload.
Chaining the chunks together (hash-linked) makes it impossible to modify only one transaction without modifying all subsequent trades. Proof of workload (Proof-of-work)

Use SHA-256 to hash a value to see if the result has the required number of leading zeros, for example we require a hash to get a value of 0000 ..., with four leading zeros. In Bitcoin, we are SHA-256 hash a block, so we add a nonce to the block, and you can understand that the nonce is a value that can become an integer, so that we can constantly increment this nonce, Until the hash result of the entire block has the required leading zeros.

Some people want to maliciously tamper with a block of the transaction information, because it is a front-to-back blockchain, he had to have all the blocks after the block after his malicious tampering with the block as the benchmark to recalculate again, the cost is huge. Unlike an IP-one ticket (a malicious attacker who controls a large number of IP rights is dangerous), Bitcoin is a CPU-to-vote mechanism, meaning that the power of calculation has the power to decide, the longest block chain in the network as the legal chain, it represents the largest workload proof. If the majority (51% or more) of the network is controlled by an honest node, then the legitimate chain generated by these honest nodes will grow fastest, exceeding any chain of competing lengths, and thus preventing malicious occurrences. As mentioned earlier, if an attacker were to modify a block in the past, he would need to redo the block and all of the block's work proof, and then need to catch up and exceed the legitimate chain created by the honest node. But as the legal connection continues to add a new block, the likelihood that the attacker will catch up is exponentially lower. Trading Network new transactions are broadcast to all nodes each node takes the transaction into a block each node starts its own block of work, they all want to be able to produce a difficult workload proof, so that the whole network to accept and convince When a node completes its own proof of work, it broadcasts its own block to all other nodes to receive the block's node to determine whether all the transactions in the block are legitimate and has occurred, and if it is legal and has not happened, accept the block After the node accepts this block, it will use the block hash as the previous hash to continue digging the next block.

Nodes always think of the longest chain as a legitimate chain, and try to expand the chain. If two nodes broadcast their own block at the same time, the other nodes will start their own mining with the block that they first received, but also retain another block. As a result, some nodes receive a block and start digging on it, while retaining the block of B to prevent the branch of Block B from becoming a longer branch in the future. Until one of the branches becomes longer in the next proof of work, the nodes that work on the other branch will turn to this longer.

The broadcast of the transaction is not necessary for all nodes to be received, as long as many of the nodes receive it, and the received node is committed to block mining. Block broadcasts can also tolerate loss, that is, there is no need for all nodes to be received, if a node does not receive this block, when it receives the next block will be aware that it missed the block, and actively request the lost block. Block

The general Bitcoin network will make 2016 blocks per generation time spent in two weeks, that is, every 10 minutes to generate a block , if the time is less than two weeks, the difficulty will increase, if the more than two weeks, the difficulty will be reduced, so no matter how much digging capacity throughout the network, every 10 minutes will only produce a new block. Bitcoin blocks consist of a block size and a list of transactions included in the chunk, with a chunk header of 80 bytes, a 4-byte version number, a hash value of 32 bytes from the previous chunk, a 32-byte Merkle Root hash, a 4-byte time-prefix (current time), a 4-byte current difficulty value, A random number of 4 bytes. The list of transactions included in the chunk is appended to the block size. We hash only the chunk header.
hidden behind the unfavorable principle

If everyone is a credible and considerate good person, the world will be very simple, there will be no such constraints, but the reality is that we need to develop a set of laws and statutes to make this complex society safe operation, not out of control. The same is true of the Bitcoin network, where each node inherently has a potential moral problem, so it becomes very difficult to reach a consensus, and there will always be malicious nodes that sabotage their own interests.

There is a biological principle called the disadvantage principle (the handicap Principle), which helps us to explain the process of proof of work. This principle says that when two animals have a motive for cooperation, they must be persuasive in their goodwill toward each other. In order to dispel their doubts, they must attach their own price to each other, so that they have to pay dearly for betraying each other. In other words, the way of expression itself must be detrimental to itself.

The work of the

Bitcoin proves to be a good use of the unfavorable principle to solve a social problem in one's own network: the creation of a new chunk is based on the enormous cost of time consuming, so when the block is born, a absenteeism either ignores it, continues to look for its new block, or accepts it, Then it proceeds to the mining of its own updated chunks. Obviously the former is unwise, because in the Bitcoin network, with the longest chain as the legal chain, the absenteeism choose to neglect and a new one, we have to persuade enough absenteeism to go along his route, on the contrary if he chooses to accept, not only will not pay extra hard, and can continue their own update block mining, only to harm, And this belongs to the entire network members in compliance with an unwritten rule, after which the absenteeism himself found the new block more advantageous, will not appear again you walk your I walk my, is a benign construction of the whole network. Bitcoin constrains the behavior of nodes through unfavorable principles, because this philosophy can be used in many aspects of today's Internet construction, such as anti-spam, anti-DDoS attacks, we have reason to believe that the Internet or distributed network systems and the reality of social operation is inextricably linked, because of this, The development of blockchain is not a product of the universe.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.