Blockchain technology learning summary

(1) Bitcoin characteristics

Decentralization. This means that there is no central server, not controlled by one person, and the entire system is directly constituted by the client computer. This kind of technical difficulty is very big. It is not like a mobile app or a small website. You can publish it whenever you want. This requires someone to play with you.
Data is tamper-proof. All transaction records are kept in full and open to everyone, and they are encrypted and verified. It is not that data cannot be tampered with, but that the cost of data tampering is very high.
Fixed circulation. It will not print banknotes indiscriminately like the National Central Bank, causing inflation.

Those who believe in the blockchain believe that the organization of the entire society can be changed through the technology of the blockchain—banks, intermediaries, e-commerce platforms, Alipay and other intermediaries are no longer needed. A P2P financial system controlled and operated to conduct completely free and credible transactions.
Of course, the opinions of anti-blockchain people are also very clear. They believe that the so-called decentralization may seem beautiful, but it is actually impossible. Moreover, judging from the current application of blockchain, there is no subversion, and there is no sign of it. On the contrary, everyone is frantically hyping up concepts that have no real value. There is a lot of speculation in things like ICOs and exchanges, and the bubbles are very big.

(2) Blockchain understanding

Blockchain is also called blockchain. There are blocks one by one, and each block contains a set of transaction information. Then, each block will have an ID (or an address). These blocks pass the record before The ID of a block forms a chain.

Insert picture description here

1. The ID of each block is generated from its content, so as long as there is a slight change in the content, the ID will be completely different.

2. The content of the generated ID also includes the ID of the previous block. So as long as the content of the previous block changes, its ID will also change (otherwise it will be illegal), then the ID that points to this block will also change. Therefore, the ID that points to this block will also be recalculated and become another one, which will form a chain effect-one block is modified, and all subsequent blocks must be modified together. This leads to an increase in the cost of modification.

3. This method of making changes in one place and everywhere does not mean that it cannot be tampered with, but only to make the changes larger and make your changes a little more troublesome.

4. The tampering of the older block will result in a larger area of ​​modification, so the older the block is not easy to be tampered with, and the safer it is. Conversely, the newer the block, the less secure it is.

(3) Workload proof consensus mechanism

Data consistency in a distributed network is the most difficult problem, and it is even more difficult in such a decentralized network cluster. The biggest essential difference is that the nodes in a distributed system within a company are assumed to be trustworthy, while in a decentralized network, the nodes must be assumed to be untrustworthy.

Whose data shall prevail? Any node can modify the ledger that it downloads, that is, anyone can forge the ledger. So, whose data is right? In a decentralized network, we can only think that the data most people know is correct. As long as I control more than half of the nodes, and I let these "most people" fake the same ledger, it is equivalent to the entire ledger being modified by me. Because in a decentralized network without servers, the so-called truth is nothing more than what most people agree with.

Bitcoin uses a Proof-of-Work proof-of-work mechanism, that is, "mining". The so-called "mining" actually uses large-scale calculations to find a block ID that meets the system requirements. To find the block ID that meets the conditions can only be done through brute force, so a lot of system computing resources and power are required.

Application analysis:
Modification becomes almost impossible. Just imagine, if generating a block requires a lot of computing power for a long time. In other words, it takes 10 minutes to complete a package under the best computer cluster in the world. Then, when we are going to modify the data content, the process is the same. As mentioned earlier, if you want to forge a block, then you have to modify all the following blocks. The cost of modifying one block is so high, then the cost of modifying the entire chain is also very high.
It becomes almost impossible for people who can master 51% of the computing power. In addition to the high cost of forging a chain, it also controls the computing power of most people, which means a huge amount of capital investment. When these two difficulties add up, it is almost impossible.
Resolve differences. On the one hand, the block ID found by such a large amount of work has effectively reduced the probability of conflicting opinions. On the other hand, even if there are legally conflicting blocks (multiple reasonable blocks appear at the same time, that is, the blockchain branches/fork), there are multiple legal ledgers. And because the cost of mining is too high, it is impossible to follow up multiple ledgers at the same time, so miners can only bet on one of them. There will be more and more branches of the chain that most people choose, so that no one cares about the other side, and it becomes invalid.

(4) Bitcoin's hash algorithm

The information stored in a block is basically as follows:
Insert picture description here

The blockchain is like a singly linked list, which stores all data blocks into a chain by tracing the address of the previous block. So, we call it BlockChain
Insert picture description here

The encoding of the "address" of each data block uses an algorithm Secure Hash on the computer. Some are transliterated as "secure hash", and some are paraphrased as "secure hash". The blockchain uses the SHA-256 algorithm.
Basic process:
1. According to the description in the figure above, suppose that the first picture on the left is block A. At this time block A has been formed and start to build block B.
2. The content of block A is the data set and the block address is 0007cabfa Do a hash operation to get the address ID of the current block as 000008acbed, as shown in the second picture above on the left.
3. If the data in the pre-data block is changed, then its hash will be completely different, that is to say Your ID or address changes, so others can’t find this data block;
4. Therefore, you have to modify the address that points to you in the data block of others, but the address that points to you in the data block of others (ID/ Hash) changes, which will also cause his own address (ID/hash) to change accordingly. Because he used your address to generate his own address, in this way, you need to change all other people's addresses.

With such a chain reaction, the difficulty of modifying a bit secretly increases a lot. Therefore, in the world of blockchain, the older the block is, the safer it is and the less likely it is to be tampered with, and the newer the block is, the less secure and the easier it is to be tampered with.
Insert picture description here

The picture above is the protocol format of the blockchain.
Among them, the six data fields of Version, Previous Block Hash, Merkle Root, Timestamp, Difficulty Target and Nonce are the block data protocol headers of the blockchain. The following data is transaction data, which are: the number of transactions H in this block and the transaction list
. By hashing these six fields, you can get the hash value of this block, that is, its ID or address. The hash method is as follows (do SHA-256 hash evaluation twice on the block header):
SHA-256(SHA-256 (Block Header))

Bitcoin has requirements for this hash value. The requirements are controlled by the Bits field. Then you can adjust the value of the 32-bit integer Nonce to find the hash value that meets the conditions. We call this thing "mining".

Guess you like

Origin blog.csdn.net/Octopus21/article/details/115263591