“Briefly describe the working principle of the blockchain. A wants to send money to B. This transaction is represented by a block on the network, and the block is broadcast to all participants in the network. The participants agree that the transaction is valid, and the area is changed. Blocks are added to the chain, which provides a permanent and transparent record of transactions, and funds are transferred from A to B. One account on the whole network, everyone can find it.
How Blockchain Works
Briefly describe the working principle of the blockchain. A wants to send money to B. This transaction is represented by a block on the network, and the block is broadcast to all participants in the network. The participants agree that the transaction is valid, and the area is changed. Blocks are added to the chain, which provides a permanent and transparent record of transactions, and funds are transferred from A to B. One account on the whole network, everyone can find it.
What we can see is that in this distributed database, the accounting is not controlled by individuals or a centralized subject, but is maintained and jointly recorded by all nodes. All single nodes cannot be tampered with. If you want to tamper with a record, you need to control more than 51% of the nodes or computing power of the entire network at the same time. The number of nodes in the blockchain is infinite and new nodes are being added all the time. This basically is impossible.
The essence of the blockchain is a public accounting system for mutual verification. What this system does is to record all transactions that occur in all accounts. Every change in the amount of each account will be recorded in the general ledger of the entire network. And everyone has a complete ledger in their hands. Everyone can independently count all the accounts of each account in the Bitcoin system in history, and can also calculate the current balance of any account.
Since all data is open and transparent, anyone can view its source code, and people will trust this decentralized system without worrying about whether there is any conspiracy hidden in it.
The 6-layer model of blockchain
The basic model of blockchain is divided into 6 layers: data layer, network layer, consensus layer, incentive layer, contract layer, and application layer. Each layer completes a core function and cooperates with each other to realize a decentralized trust mechanism.
Data layer: data block, chain structure, timestamp, hash function, Merkle tree, asymmetric encryption;
Network layer: P2P (peer-to-peer) network, propagation mechanism, verification mechanism;
Consensus layer: pow (workload proof), pos (stake proof), dpos (share authorization proof);
Incentive layer: issuance mechanism, distribution mechanism;
Contract layer: script code, algorithm mechanism, smart contract;
Application layer: programmable currency, programmable finance, programmable society;
Most of them belong to the technical category, so I won’t go into too much detail.
The development of blockchain
Blockchain 1.0: Programmable currency represented by Bitcoin, which refers more to innovations in the field of digital currency, such as currency transfer, redemption and payment systems;
Blockchain 2.0: Blockchain-based programmable finance. It is more about some innovations in contracts, especially commercial contracts and innovations in transactions, such as stocks, securities, loans, clearing and settlement, so-called smart contracts, etc.
Blockchain 3.0: The application of blockchain in other industries. It corresponds more to the transformation of human organization, including health, science, culture and blockchain-based justice, voting, etc.
Basic types of blockchains:
A public chain refers to a blockchain in which anyone in the world can read and send transactions, and transactions can be effectively confirmed, and can also participate in the consensus process.
The public chain has the following characteristics:
1. Protect users from the influence of developers. In the public chain, program developers have no right to interfere with users, and blockchain can protect their users;
2. The access threshold is low, anyone can access, as long as there is a computer that can connect to the Internet, it can meet the basic access conditions;
3. All data is public by default, and each participant in the public chain can see all transaction records of the entire distributed ledger.
A private chain refers to a blockchain whose write permission is only in the hands of one organization, in order to limit read permission or open permission to the outside world.
The private chain has the following characteristics:
1. The transaction speed is very fast. The transaction speed of a private chain can be faster than any other blockchain, even close to the speed of a regular database that is not a blockchain. This is because even a small number of nodes have a high degree of trust, and each node is not required to verify a transaction.
3. The transaction cost is greatly reduced or even zero The private chain can conduct completely free or at least very cheap transactions. If one entity controls and handles all transactions, then they no longer need to be charged for the work.
4. It helps to protect basic products from being destroyed. The use of private chains by banks and traditional financial institutions can ensure their existing interests, and even the original ecosystem is not destroyed.
A consortium chain refers to a blockchain whose consensus process is controlled by pre-selected nodes. Only for members of a specific group and limited third parties, multiple pre-selected nodes are designated as bookkeepers, and the generation of each block is jointly determined by all pre-selected nodes.
Several characteristics of the alliance chain:
1. The transaction cost is cheaper. Transactions only need to be verified by a few trusted nodes with high computing power, without the need for confirmation by the entire network.
2. Nodes can be well connected, failures can be quickly repaired by manual intervention, and allow the use of consensus algorithms to reduce block times, thus completing transactions faster.
3. If the read permission is restricted, it can provide better privacy protection. Fourth, it is more flexible. A community or company running a private blockchain can easily modify the rules of that blockchain, restore transactions, modify balances, etc., if needed.
Consensus mechanism of blockchain
The purpose of the consensus mechanism of the blockchain is to solve the problem of trust, to solve the problem of trust between two complete strangers. Verification and confirmation of transactions are completed in a very short period of time through voting by special nodes.
There are many consensus mechanisms on the blockchain, and not all of them are suitable for all specific application scenarios. Consensus needs to be discussed in specific application scenarios. Here we discuss the three most common consensus mechanisms:
1. Proof of Work
Short for Pow, it can usually only be proven from the results because monitoring the work process is often tedious and inefficient. Bitcoin uses the pow mechanism during block generation.
Pow relies on machines to perform mathematical operations to obtain accounting rights, which consumes a lot of resources, has a high consensus mechanism, and is weakly regulated. At the same time, each time a consensus is reached, the entire network needs to participate in the calculation, and the performance efficiency is relatively low. In terms of fault tolerance, 50% of the entire network is allowed. Node error.
Advantages of Pow: Completely decentralized, nodes come in and out freely
Disadvantages of Pow: At present, Bitcoin has attracted most of the computing power in the world. It is difficult for other blockchain applications that use the Pow consensus mechanism to obtain the same computing power to ensure their own security. Mining causes a lot of waste of resources. period is longer.
2. Proof of Equity
Referred to as POS, the proof-of-stake mechanism works in such a way that when a new block is created, the miner needs to create a “coin right” transaction, which sends some coins to the miner itself in a pre-set ratio.
The proof-of-stake mechanism reduces the mining difficulty of nodes proportionally according to the proportion and time of tokens owned by each node and according to the algorithm, thereby speeding up the search for random numbers. This consensus mechanism can shorten the time required to reach consensus, but essentially still requires nodes in the network to perform mining operations. Therefore, the PoS mechanism does not fundamentally solve the problem that the PoW mechanism is difficult to apply to the commercial field.
Advantages of POS: It shortens the time for reaching consensus to a certain extent, and does not require a lot of energy to mine.
Disadvantages of POS: mining is still required, and it does not essentially solve the pain points of commercial applications; all confirmations are only a probabilistic expression, not a deterministic thing, theoretically, there may be other attack effects.
3. Share authorization certificate
DPOS for short, similar to board voting, token holders vote a certain number of nodes for proxy verification and accounting.
The working principle of DPOS, each shareholder has corresponding influence in proportion to their shareholding, the result of 51% shareholder vote will be irreversible and binding, the challenge is to achieve “51% approval” through a timely and efficient method. To achieve this, each shareholder can delegate its voting rights to a representative. The top 100 delegates with the most votes take turns producing blocks according to the established schedule. Each delegate is assigned a time period to produce blocks.
The voting mode of DPOS can generate a new block every 30 seconds, and under normal network conditions, the possibility of a blockchain fork is extremely small, and even if it occurs, it can be resolved within minutes.
The Internet has solved many problems that traditional business cannot solve. Blockchain can solve many problems that cannot be solved by the Internet, especially the problems of information flooding and lack of trust. These are the foundation of business.