Blockchain circle

One stop hot information platform

About us:

Blockchain circle provides the latest information about blockchain, digital currency, digital wallet, exchange, metauniverse, bitcoin, Ethereum, contract, financial management and so on, and always pays attention to the latest market...

Dry goods, 5 minutes to understand the blockchain

Time : 11/07/2021 Author : 0xlp21 Click : + -
        Blockchain is undoubtedly the hot topic at present. On the one hand, investors pay close attention to it and encourage everyone to "embrace the blockchain immediately", while on the other hand, entrepreneurs are eager to enter the market. However, there are few easy to understand introductory articles to explain what blockchain is and what is special. The following article will briefly introduce the blockchain in terms of its essence, characteristics and applications, hoping to play a role in attracting jade. If there are any mistakes in the article, I hope you can correct them. First, the main role of the blockchain is to store information. Any information that needs to be saved can be written into the blockchain or read from it, so it is a database.
        Second, anyone can set up a server, join the blockchain network, and become a node. In the world of blockchain, there is no central node, and each node is equal and stores the entire database. You can write / read data to any node, because all nodes will be synchronized in the end to ensure the consistency of the blockchain. There is no administrator in the blockchain, and it is completely centerless. Other databases have administrators, but the blockchain does not. If someone wants to add audit to the blockchain, it cannot be achieved, because its design goal is to prevent the emergence of a central authority. It is precisely because it cannot be managed that the blockchain can not be controlled.
        Otherwise, once large companies and groups control the management rights, they will control the entire platform, and other users must obey them. However, without the administrator, everyone can write data into it. How can we ensure that the data is reliable? What if you are changed by bad people? Please read on. This is the wonderful place of blockchain. The blockchain is composed of blocks. A block is much like a database record. Each time data is written, a block is created. The so-called hash is that the computer can calculate an eigenvalue of the same length for any content. The hash length of the blockchain is 256 bits, which means that no matter what the original content is, a 256 bit binary number will be calculated.
        And it can be guaranteed that as long as the original content is different, the corresponding hash will be different. The above is the calculation formula of block hash. Hash is uniquely determined by the block header. Sha256 is the hash algorithm of the blockchain. As mentioned above, the block header contains many contents, including the hash of the current block body (note that the hash of the block body is not the whole block), and the hash of the previous block. This means that if the content of the current block changes, or the hash of the previous block changes, the hash of the current block will change. This is of great significance to the blockchain.
        If someone modifies a block, the hash of the block will change. In order for the later blocks to be connected to it, the person must modify all the later blocks at the same time, or the changed blocks will be separated from the blockchain. For the reasons to be mentioned later, the calculation of hash is very time-consuming, and it is almost impossible to modify multiple blocks at the same time, unless someone has mastered more than 51% of the computing capacity of the whole network. It is through this linkage mechanism that the blockchain ensures its own reliability. Once data is written, it cannot be tampered with. It's like history. What happens is what happens. It can't be changed from now on. Since the synchronization between nodes must be ensured, the adding speed of new blocks cannot be too fast.
        Just imagine that you have just synchronized a block and are ready to generate the next block based on it. But at this time, new blocks are generated at other nodes. You have to give up half of the calculation and synchronize again. Because each block can only be followed by one block, you can always generate the next block after the latest block. Therefore, you have no choice but to synchronize as soon as you hear the signal. Therefore, the inventor of the blockchain, Satoshi Nakamoto (this is a pseudonym, and the real identity is still unknown) deliberately makes it difficult to add new blocks. His design is that on average every 10 minutes, the whole network can generate one new block, that is, six in an hour.
        This output speed is not achieved by command, but by deliberately setting a massive amount of calculation. That is to say, only through an extremely large number of calculations can the effective hash of the current block be obtained, thereby adding the new block to the blockchain. Because of the large amount of calculation, I can't get up quickly. This process is called mining, because it is difficult to calculate the effective hash. It is like finding a qualified sand in the sand of the world. The machine that calculates hash is called a miner, and the person who operates the miner is called a miner. After reading this, you may have a question. People say that mining is very difficult, but isn't mining just to calculate a hash with a computer? This is the strength of the computer. How can it become difficult and can't be calculated for a long time?.
        It turns out that not all hashes can be used. Only hashes that meet the conditions can be linked by the block. This condition is particularly harsh, which makes most of the hashes fail to meet the requirements and must be recalculated. Originally, the block header contains a difficulty coefficient, which determines the difficulty of calculating hash. For example, the difficulty coefficient of the 100000th block is 14484.16236122. The blockchain protocol stipulates that the target value can be obtained by dividing a constant by the difficulty coefficient. Obviously, the larger the difficulty coefficient, the smaller the target value. The validity of hash is closely related to the target value. Only hash smaller than the target value is valid. Otherwise, hash is invalid and must be recalculated.
        Since the target value is very small, the chance that hash is less than this value is extremely slim. It may be calculated 1 billion times before it can be counted as one time. This is the fundamental reason why mining is so slow. There is also a nonce value in the block header, which records the number of hash recalculations. The nonce value of the 100000th block is 274148111, that is, 274 million times are calculated before an effective hash is obtained, and the block can be added to the blockchain. Even though mining is very difficult, there is no guarantee that a block can be produced in exactly ten minutes. Sometimes it can be produced in one minute, and sometimes it can not be produced in a few hours. Generally speaking, with the improvement of hardware equipment and the increase of the number of mining machines, the calculation speed will be faster and faster.
        In order to keep the output rate constant at 10 minutes, Nakamoto also designed a dynamic adjustment mechanism for the difficulty coefficient. He stipulated that the difficulty coefficient should be adjusted every two weeks (2016 blocks). If the average generation speed of the blocks in these two weeks is 9 minutes, it means that it is 10% faster than the legal speed, so the difficulty coefficient should be increased by 10%; If the average generation speed is 11 minutes, it means that it is 10% slower than the legal speed, so the difficulty coefficient should be reduced by 10%. Even if the blockchain is reliable, there is still a problem to be solved: if two people write data to the blockchain at the same time, that is, two blocks join at the same time, because they are connected to the previous block, forming a fork.
        Which block should be adopted at this time?. The current rule is that new nodes always use the longest blockchain. If the blockchain has a bifurcation, it will see which branch is behind the bifurcation point and reach 6 new blocks first (called six confirmations). According to the calculation of one block in 10 minutes, it can be confirmed in one hour. Since the generation speed of new blocks is determined by the computing power, this rule means that the branch with most computing power is the authentic bit chain. As an unmanaged distributed database, blockchain has been running for 8 years since 2009, without major problems. This proves that it is feasible.
        However, in order to ensure the reliability of data, the blockchain also has its own costs. First, efficiency. It takes at least ten minutes for data to be written into the blockchain. If all nodes synchronize data, it takes more time; Second, energy consumption. The generation of blocks requires numerous meaningless calculations by miners, which is very energy consuming.
Previous:► [animation] is the longest blockchain the right blockchain? Blockchain 100 questions episode 48
Next:No more

Related articles:

© 2005-2032 | Blockchain Circle & & All Rights Reserved    Sitemap1 Sitemap2 If there is infringement, please contact us at: