Block Chain Entry Notes __ block chain

Source: Internet
Author: User
1. Nature

Special Distributed Database , mainly used for storing information, any information can be read and written in the block chain. 2. Features

The block chain has no administrator and is not centralized, and its design goal is to prevent the emergence of a central authority. 3. Block

Block chain consists of blocks (block)
A chunk is like a record of a database, writing one data at a time, creating a block

The block is made up of two parts

-Block Header (head): Log the meta information of the current block
-Block (body): Actual data

The block header contains multiple meta information for the current block
-Build time
-Hash of actual data (block body), not whole block
-Hash of the previous block
- ...

Hash means that a computer can compute a characteristic value of the same length for any content. The Hash length of the block chain is 256 bits, which means that no matter what the original content is, a 256-bit binary number is computed at the end. and can guarantee that, as long as the original content is different, the corresponding Hash must also be different.

So there are two inferences.
* Each chunk of the hash is not the same, can be labeled by the hash block
* If the contents of the block change, its Hash will definitely change the 4.Hash is not modifiable

The chunk corresponds to the hash one by one, and the hash of each block is computed for the block header (head).

Calculation formula: Hash = SHA256 (block size)

SHA256 is a Hash algorithm of block chain

If a block is modified, then the Hash of the block changes, in order to link the back of the block, the next block must also change, the previous change.
and Hash calculation is very time-consuming, so unless a person has mastered the entire Network 51% computing power, otherwise can not modify multiple blocks at the same time.

This linkage mechanism makes it impossible to modify data once it is written to 5. Mining

Due to the need to ensure synchronization between the nodes, the new block can not be added fast, each block after only a block, mining people can always follow the latest block. Once you hear the signal, you must sync .

The inventor of the block chain (kana: Ben Cong) deliberately made it difficult to add new zone blocks. His design rule: a new block/10min, which is 1 hours and 6.

Only after a large number of operations to calculate the current block of valid Hash, so can not get up.

This process is called Mining (mining) 6. Difficulty coefficient

Only Hash that satisfies the condition will be accepted by the block chain.

The area header contains a difficulty factor (difficulty)

Target value = targetmax/difficulty

The validity of the hash is closely related to the target value, only the hash that is less than the target value is valid, otherwise the hash is invalid and must be counted. Because the target value is very small, the chance for the hash to be less than this value is extremely slim, and may be calculated 1 billion times before it is counted once. That is the root cause of such a slow mining.

There is also a Nonce value in the block header, which records the number of Hash counts. The Nonce value of the 100,000th block is 274148111, which is calculated 274 million times before a valid Hash can be added to the block chain. 7. Dynamic adjustment of the difficulty coefficient

In order to ensure a block/10min, Ben Cong Design The dynamic adjustment mechanism of the difficulty coefficient

Adjust the difficulty factor once every two weeks

The higher the difficulty coefficient-> the smaller the target value-> the harder it is to 8. Bifurcation of a block chain

When two people write data to the block chain at the same time, the new node always takes the longest chunk chain (which branch is followed by the first 6 blocks, and which fork is used). 9. Summary

Block chain data is reliable, but time-consuming and energy consuming.

Limited use of scenarios
* There is no regulatory authority that all Members trust
* Write data not to be used in real time
* Mining benefits > Cost per se

Please pay attention to my blog, Jianshu, CSDN, GitHub
Please pay attention to my blog, Jianshu, CSDN, GitHub

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.