为广大币圈朋友提供币圈基础入门专业知识!
当前位置首页 > 比特币基础> 正文

区块链poc共识机制,区块链poa共识算法

发布时间:2023-12-09-12:52:00 来源:网络 比特币基础 区块   共识   原理

区块链poc共识机制,区块链poa共识算法

区块链poc共识机制是一种基于概率的共识机制,它通过激励机制来保证网络的安全性和可靠性。它是一种去中心化的共识机制,不需要任何外部机构或者中央管理者来维护网络的安全性。POC共识机制可以让参与者获得报酬,只要他们提供有效的计算资源,并且有足够的奖励来激励他们参与网络的活动。

第一个相关关键词是挖矿(Mining)。挖矿是指区块链网络中的参与者通过计算机硬件来完成特定的计算任务,以获得报酬。挖矿可以被认为是网络的一种激励机制,它可以让参与者获得报酬,只要他们提供有效的计算资源,并且有足够的奖励来激励他们参与网络的活动。挖矿的过程就是计算机硬件解决特定的计算任务,以获得报酬的过程,而这些计算任务就是POC共识机制的核心。

第二个相关关键词是抵押(Collateral)。抵押是一种激励机制,它可以让参与者抵押资产以获得报酬。抵押物可以是任何资产,例如比特币、以太坊等,只要它们可以被用作抵押,就可以作为抵押物。抵押可以让参与者在提供有效的计算资源的同时,还可以获得报酬,从而激励他们参与网络的活动。

第三个相关关键词是权益证明(Proof of Stake)。权益证明是一种基于投票的共识机制,它可以让参与者抵押资产,以获得报酬。在权益证明机制中,参与者可以抵押资产,以获得报酬,只要他们投票支持网络的活动。这种机制可以让参与者拥有更多的激励,以及更多的参与权,从而更好地支持网络的活动。

总之,区块链poc共识机制是一种基于概率的共识机制,它可以让参与者获得报酬,只要他们提供有效的计算资源,并且有足够的奖励来激励他们参与网络的活动。这种机制的核心是挖矿、抵押和权益证明,它们可以让参与者获得报酬,以及更多的参与权,从而更好地支持网络的活动。


请查看相关英文文档

『一』What is the technical principle of blockchain

The key points involved in blockchain technology include: decentralization (Decentralized), trustlessness ( Trustless), collective maintenance (Collectivelymaintain), reliable database (ReliableDatabase), timestamp (Timestamp), asymmetric encryption (AsymmetricCryptography), etc.

Blockchain technology redefines the way credit is generated in the network: In the system, participants do not need to know the background information of other people, nor do they need to rely on guarantees or guarantees from third-party institutions. Blockchain The technology ensures that the system records, transmits, and stores value transfer activities, and the final result must be credible.

(1) Extended reading on the technical principles of the pop blockchain consensus mechanism

The source of the technical principles of the blockchain can be summarized as a mathematical problem: Byzantine Generals question. The Byzantine Generals Problem extends to Internet life, and its connotation can be summarized as: in the context of the Internet, when it is necessary to conduct value exchange activities with unfamiliar counterparties, how can people prevent themselves from being deceived by malicious saboteurs? Be confused and make wrong decisions.

Further extending the Byzantine Generals Problem to the technical field, its connotation can be summarized as: in the absence of a trustworthy central node and a trustworthy channel, the problems distributed in the network How should each node reach consensus. Blockchain technology solves the long-known Byzantine Generals Problem by providing a way to create a consensus network without trusting individual nodes.

『二』 Consensus mechanism of blockchain

1. How to confirm and reach consensus on transaction information on the network?

Although the consensus mechanism is often mentioned, the meaning and understanding of the consensus mechanism are not clear. Therefore, it is necessary to understand the relevant concepts, principles and implementation methods of the consensus mechanism.

The transaction information of the blockchain is transmitted to each node in the network through network broadcast. How to confirm the broadcast information and reach a consensus among the entire network nodes and finally write it into the block? If there is no corresponding reliable and secure implementation mechanism, it will be difficult to realize its basic functions. Therefore, the consensus mechanism is a key to the operation of the entire network.

The consensus mechanism solves the problem of how the blockchain can achieve consistency in a distributed scenario. The blockchain can reach a relatively balanced state among many nodes because of the consensus mechanism. So how does the consensus mechanism solve the problem of mutual trust between nodes based on the idea of ​​decentralization?

When the idea of ​​distribution was proposed, people began to use the FLP theorem and CAP theorem design consensus algorithm. Standardly speaking, the consistency of an ideal distributed system should meet the following three points:

1. Termination: The consistency result can be completed within a limited time.

2. Consensus: The final decision-making results of different nodes should be the same.

3. Validity: The result of the decision must be a proposal put forward by other processes.

However, in actual computer clusters, the following problems may exist:

1. Nodes have different transaction processing capabilities, and the throughput of network node data is different
>
2. The communication channel between nodes may be unsafe

3. There may be malicious nodes

4. When the asynchronous processing capabilities reach a high degree of consistency, The scalability of the system will become worse (cannot tolerate the addition of new nodes).

Scientists believe that it is impossible to achieve complete consistency in a distributed scenario. However, engineers can sacrifice part of the cost in exchange for the consistency of distributed scenarios. The above two major theorems also have this idea. Therefore, various formula mechanisms based on blockchain design can be regarded as sacrificing part of the cost in exchange for more adaptability. My idea is to make a flexible transformation on this idea, that is, sacrificing part of the cost at the appropriate time and space in exchange for consistency adapted to the scene at that time, and a flexible blockchain system can be realized that is pluggable. Pull-out blockchain system. Today I will introduce my views and analysis on various consensus mechanisms. Distributed systems with or without malicious nodes are divided into Byzantine fault-tolerant and non-Byzantine fault-tolerant mechanisms.

The FLP theorem is the impossibility of FLP. It proves that in a distributed scenario, no matter any algorithm, even if only one process hangs up, there is an inability to reach consensus for other non-failed processes. possible.

FLP is based on the following assumptions:

Can only be modified once: Each process initially records a value (0 or 1). The process can receive messages, change the value, and send messages. When the process enters the decide state, the value will no longer change. The protocol ends successfully when all non-failed processes enter the decided state. This is relaxed to the extent that some processes enter the decided state, even if the agreement is successful.

Asynchronous communication: The biggest difference from synchronous communication is that there is no clock, no time synchronization, no timeout, no detection failure, messages can be delayed arbitrarily, and messages can be out of order.

Robust communication: As long as the process does not fail, although the message will be delayed indefinitely, it will eventually be delivered; and the message will only be delivered once (no duplication).

Fail-Stop model: A process failure is like a downtime and no longer processes any messages.

Number of failed processes: At most one process fails.

CAP is the most discussed theory in distributed systems, especially in the field of distributed storage. CAP was proposed by Eric Brewer at the PODC meeting in 2000. It was a result of Eric Brewer's research on data consistency (consistency), service availability (availability), and partition fault tolerance (partition- tolerance) conjecture:

Data consistency (consistency): If the system returns success for a write operation, then subsequent read requests must read the new data; if the system returns failure, then all read operations No one can read this data. For the caller, the data has strong consistency (also called atomic and linearizable consistency) [5]

Service availability (availability) : All read and write requests are responded to within a certain period of time, can be terminated, and will not wait forever

Partition-tolerance: In the case of network partitions, the separated nodes can still function normally External services

If AP is met at a certain moment, the separated nodes can provide external services at the same time but cannot communicate with each other, which will lead to inconsistent status, that is, C cannot be met; if CP is met, C will not be achieved in the case of network partitions. , the request can only wait forever, that is, A is not satisfied; if CA is to be satisfied, the node status must be consistent within a certain period of time, and network partitions must not occur, then P cannot be satisfied.

C, A, and P can only satisfy at most two of them. Like the FLP theorem, the CAP theorem also indicates an unreachable result (impossibility result).

『三』 What exactly is blockchain? Decrypt the concept of blockchain

『四』 The blockchain consensus mechanism is to allow everyone in the system to Everyone knows what each other has done

1. What is the technology of blockchain? If we assume that the database is a ledger, reading and writing the database can be regarded as an accounting behavior. Blockchain The principle of technology is to find the fastest accounting method within a period of timeThe best person will keep accounts, and then send this page of information to everyone else in the entire system. This is equivalent to changing all the records in the database and sending them to every other node in the entire network, so blockchain technology is also called a distributed ledger. Blockchain refers to a technical solution that collectively maintains a reliable database through decentralization and trustlessness. This technical solution mainly allows any number of nodes participating in the system to associate and generate a series of data blocks (blocks) using cryptographic methods. Each data block contains all the information exchange data of the system within a certain period of time, and generates The data fingerprint is used to verify the validity of its information and chain to the next database block. Blockchain is a general term for technical solutions similar to NoSQL (non-relational database). It is not a specific technology and can be implemented through many programming languages ​​and architectures. There are also many ways to implement blockchain. Common ones currently include POW (Proof of Work), POS (Proof of Stake), DPOS (Delegate Proof of Stake), etc. The concept of blockchain was first proposed in the paper "Bitcoin: A Peer-to-Peer Electronic Cash System", written by an individual who calls himself Satoshi Nakamoto (or group). Therefore, Bitcoin can be regarded as the first application of blockchain in the field of financial payments. 2. What is the principle of blockchain? Combined with the definition of blockchain, we need these four characteristics to consider: decentralized, trustless, collectively maintained, and reliable database (Reliable Database). And the four characteristics will lead to two other characteristics: open source (Open Source) and anonymity (Anonymity). If a system does not possess these characteristics, it will not be considered an application based on blockchain technology. Decentralized: The entire network has no centralized hardware or management organization. The rights and obligations between any nodes are equal, and the damage or loss of any node will not affect the operation of the entire system. Therefore, the blockchain system can also be considered to have excellent robustness. Trustless: Data exchange between each node participating in the entire system does not require mutual trust. The operating rules of the entire system are open and transparent, and all data content is also public, so it is within the scope of the rules specified by the system. and timeWithin the scope, nodes cannot and cannot deceive other nodes. Collectively maintain: The data blocks in the system are jointly maintained by all nodes with maintenance functions in the entire system, and anyone can participate in these nodes with maintenance functions. Reliable Database: The entire system will be divided into databases so that each participating node can obtain a copy of the complete database. Unless more than 51% of the nodes in the entire system can be controlled at the same time, modifications to the database on a single node are invalid and cannot affect the data content on other nodes. Therefore, the more nodes and stronger computing power participating in the system, the higher the data security in the system. Open Source: Since the operating rules of the entire system must be open and transparent, for the program, the entire system must be open source. Anonymity: Since nodes do not need to trust each other, there is no need to disclose their identities between nodes, and every participating node in the system is anonymous. 3. What is blockchain finance? In 2016, innovators will be innovated. The new round of technological revolution will address the challenge of trust between strangers in the sharing economy while destroying the basis for such platforms to make money. Although the traditional intermediary sharing economy effectively challenges the status quo and has strong innovative attributes, it still adopts a very traditional business model. The most common method of charging commissions on transactions has been used for centuries. Today, technology has made many things possible, but it still cannot completely replace intermediaries. When P2P platforms and other online marketplaces first emerged, there was a lot of talk about disintermediation, a new way of connecting people directly through the Internet, bypassing traditional intermediaries. Indeed, even though we have experienced how much more convenient new markets are and the possibilities of transacting with a variety of suppliers, we still rely heavily on intermediaries today. The fact is that today’s biggest new businesses are giant intermediaries, whose scale is beyond imagination, like Alibaba, Amazon, eBay, and Uber. Is there a technological solution that can completely remove the intermediary between transaction parties? Is there a system where you can trade directly with anyone and be safe from being cheated, but no one owns the system so there is no commission taker. Blockchain technology makes this possible. Blockchain is the core technology of Bitcoin. It is extremely innovative and can be used to build a completely transparent, ownerless and decentralized system. It can ensure the safety of various transaction parties without any form of intermediary. These transactions Parties include people and businesses. Naturally, a lot of resources are flowing to blockchain. Blockchain has also brought considerable impact to the financial and legal industries, and will eventually wreak havoc in these two industries, or provide the best opportunities. It all depends on how you look at it. it. Go to the centerIn 2015, nine investment banks jointly developed open standards for blockchain technology financial services, possibly due to their high sensitivity to the growth of the alternative finance market. Last year saw constant activity discussing the future of blockchain technology and the launch of Slock.it, one of the first technology stacks for the decentralized sharing economy. What does the sharing economy look like under the blockchain? If you want to continue to earn commissions in the sharing economy, you need to create new business models. Of course, the blockchain market will still require some investment. Developers may be happy to spend time solving code that plagues the system. However, I have yet to meet the overdue branding consultants, designers or businesspeople who have similar ideas or are willing to invest. Code alone cannot help the blockchain market enter the mainstream. But blockchain will flourish, and by getting rid of annoying intermediaries, it will almost certainly become cheaper than the existing sharing economy, and by then the giants will be forced to deal with it. Will the old sharing economy repeat history, decline due to its belief that it is indestructible, and be quickly replaced by competitors that are more flexible and equipped with technology? Or will you experiment, find a profitable market in Sharing Economy 2.0, and beat the game? What about credit? Credit is the most frequent word in all discussions related to the sharing economy, and it is quite complex and tricky. The current collaboration platforms have made it very clear: we can improve the level of trust in the sharing economy; we can take optimal measures to ensure that users trust our platform and transact on it, but we cannot guarantee that transactions between people are trustworthy. The blockchain solution solves the above problems. The transaction system in the blockchain is immutable and each transaction can be tracked within the assigned ledger. Smart contracts fully set parameters and conditions for all transactions between both parties, so the blockchain no longer requires any "trusted intermediary" or A guarantor of credit between strangers. By 2017, regulators will realize they need to radically rethink the rules and regulations governing the sharing economy. At that time, each transaction party will reach hundreds of millions of independent contracts in the blockchain. One solution is to type rule code into the system. When the sharing economy first appeared around 2008, many people cheered, believing it to be a phenomenon that would lead us into a new inclusive and sustainable economy, and a democratizing force that would lead us into the post-capital paradigm in the future. However, (so far) this is not the case. The same was true when the Internet first emerged. It was utopian in its initial stages, so people who hold the same transformative expectations for blockchain are likely to be disappointed. Even so, it won’t hurt in the least that blockchain will shake up the giants of the sharing economy. 4. Blockchain community Bubi Blockchain focuses on the innovation of blockchain technology and products. It already possesses a number of core technologies and has developed its own blockchain service platform. With decentralized trust as the core, we are committed to building an open value circulation network to allow digital assets to flow freely. Features and Advantages It has achieved a number of core technological innovations and developed its own blockchain basic services.It is a service platform that has been applied in equity, supply chain, points, credit and other fields. Fast transaction verification By optimizing key transaction links such as signature algorithms, consensus mechanisms, and ledger storage, Bubi Blockchain can achieve fast transaction verification in seconds. Efficient Ledger Access Bubi Blockchain’s adjustments to the ledger storage structure can save 90% of storage space and reduce the risk of long-term system operation, resulting in reduced ledger access performance. Multiple asset issuance Bubi blockchain supports the issuance and trading of multiple assets by different users. Each asset can track and record the issuer, issuance quantity, transaction circulation and other details. Joint signature control allows multiple users to be set up under the same account, and corresponding permissions are set for different operations to meet the usage scenarios of multi-party signature control. Built-in smart contract A smart contract is a set of promises defined in digital form. The blockchain becomes a participant in the contract and is responsible for maintaining, saving and automatically executing the contract. Compared with traditional centralized exchanges, on-chain exchanges use blockchain to build a trading platform where all transactions are verified, completed and saved on the chain to ensure user transaction security. What Bubi Blockchain wants to do is to create a new technology and product - to realize real value circulation and bring the Internet to a new level. With the application of this technology, there will be no central organization when transferring assets, and direct transfer of assets between us can be achieved. In the future, if the network itself can checkout, we can transfer directly without going through an intermediary.

『Wu』What is the consensus mechanism of blockchain

How to achieve consensus in a decentralized network? In the blockchain system, there is no centralized accounting institution like a bank. It is crucial to ensure the consistency of each transaction on all accounting nodes, that is, to achieve consensus across the entire network. The consensus mechanism solves this problem. At present, the main consensus mechanisms include the proof-of-work mechanism PoW and the proof-of-stake mechanism PoS. PoW determines your probability of obtaining accounting rights by evaluating your workload. The greater the workload, the more likely you are to obtain this accounting opportunity. PoS determines your probability of obtaining accounting rights by evaluating the number and length of time you hold tokens. This is similar to the dividend system of stocks. People who hold relatively large shares can receive more dividends. The principle of DPOS is similar to that of POS, except that some "people's congress representatives" are selected. The main difference from PoS is that nodes elect several agents, who verify and keep accounts. With the development of technology, more advanced consensus mechanisms may be born in the future.

『Lu』 Blockchain consensus mechanism POS and DPOS

As the first consensus mechanism in the blockchain and one that has withstood sufficient practical testing, the workload proof algorithm solves the problem of The problem is the consistency of transaction information in distributed systems. Building a trust mechanism for nodes that do not trust each other in a decentralized network is also a key technical link for the successful application of Bitcoin.

After several years of actual operation, the shortcomings of this algorithm have also been revealed. The Bitcoin network completes 600 trillion transactions per second.SHA256 operations consume a large amount of power resources, and in the end these calculations have no practical or scientific value. The only purpose of these operations is to solve the proof-of-work problem. Another real threat is the concentration of computing power. Proof-of-work is essentially a process of using exhaustive methods to find hash values ​​that meet specified conditions. The stronger it is, the higher the possibility of obtaining accounting rights (that is, mining). At first, it was the first people to use graphics cards to mine, and later to use FPGA mining machines, and then to use ASIC special chips to mine. People are now the ones who are constantly making better ASICs. In addition, there are "miner" nodes that unite to form mining pools, such as Ghash. Ghash issued a statement in 2014 that it will ensure that no more than 40% of the computing power of the entire network will be exceeded in the future. , this kind of self-discipline statement is a great irony of Bitcoin’s trustless mechanism.

Since the birth of Bitcoin, people have begun to try other consensus mechanisms besides the proof-of-work algorithm, such as the representative proof-of-stake POS, delegated proof-of-stake DPOS, and Byzantine Fault Tolerance (BFT). and Practical Byzantine Fault Tolerance (PBFT), etc. Below we will mainly introduce POS and DPOS, leaving BFT and PBFT for the next article.

Proof of Stake POS

POS is a type of consensus algorithm, or the design idea of ​​a type of consensus algorithm, not one. The first to adopt POS was Peercoin. Peercoin is a type of cryptocurrency launched by a geek with the pseudonym Sunny King in August 2012. It adopts the proof-of-work mechanism + the proof-of-stake mechanism, and introduces the proof-of-stake mechanism into cryptocurrency for the first time. Peercoin introduces the concept of "coin age". Each coin generates 1 coin age every day. For example, if you hold 100 coins for a total of 30 days, then your coin age will be 3000 at this time. When a new block is generated, other nodes that want to obtain accounting rights also need to calculate the hash value of Bitcoin. The difficulty of obtaining the hash value that meets the conditions is related to the difficulty value. This difficulty value here is related to the age of the currency. Inversely proportional, that is, the older your currency is, the greater the probability of obtaining a hash value that meets the conditions. At the same time, your currency age is cleared, and the system will give you corresponding "interest" after accounting. You will get 365 coins every time it is cleared. Age, the interest earned is: 3000 * interest rate / 365, the interest rate of Peercoin is 1%, which is 0.08 coins.

It can be seen that under the POS mechanism, the more coins you hold, the easier it is to obtain accounting rights, which is close to the winner-takes-all feeling. But the more coins you hold, the closer it is to an honest person. nodes, the greater the loss caused by destroying the entire network. There is a loophole in Peercoin's POS mechanism. For people who do not hold coins, they have little benefit, so some malicious attacks have no loss for them. This is a Nothing-at-stake attack. Follow-upThe more successful POSs have introduced mechanisms to deal with this kind of attack.

The Ethereum system aims to introduce proof of stake, known as Casper, this year. Under the proof-of-stake consensus mechanism, users will be able to have “currency rights” in the Ethereum network. Users who act honestly and confirm legitimate transactions will receive interest proportional to their equity; users who act maliciously and attempt to cheat the network will lose their equity.

Delegated Proof of Equity DPOS

Delegated Proof of Equity DPOS is a variant of POS. Typical examples of using DPOS are BitShares. The basic principle is that the entire network votes to select 101 node agents. Account permissions, the permissions of these representative nodes are exactly the same. The representative nodes take turns keeping accounts and can choose to create blocks or not. But they cannot change the details of the transaction, and the behavior of malicious or late representative nodes will be made public, and the network may vote them out simply and quickly. Representative nodes that are expelled will lose their accounting rights and corresponding income.

As a weakly centralized consensus mechanism, DPOS retains some key advantages of centralized systems, such as transaction speed (the time of each block is 10 seconds, and a transaction gets 6- It takes about 1 minute after 10 confirmations, and a complete 101 block cycle only takes about 16 minutes), but each currency holder has the ability to decide which nodes can be trusted, and in fact, representative nodes will actively lower their own To win more votes, the remaining income will be paid as dividends to all BitShares holders. DPOS is somewhat similar to representative democracy and the joint-stock company board of directors system. It is an elite system, but its identity is subject to the people below. In DPOS, the holders of the currency at least have the right to decide the identity of the representative node-or miner.

『撒』 Learn more about the consensus mechanism and algorithm principles of the blockchain

The so-called "consensus mechanism" is to complete transactions in a very short time through the voting of special nodes Verification and confirmation; for a transaction, if several nodes with unrelated interests can reach a consensus, we can think that the entire network can also reach a consensus on it. To put it more simply, if a Chinese Weibo influencer, a virtual currency player in the United States, an African student and a European traveler do not know each other, but they all agree that you are a good person, then it can basically be concluded that You're not a bad person.

In order for the entire blockchain network node to maintain the same data and ensure the fairness of each participant, all participants in the entire system must have a unified agreement, which is what we have here The consensus algorithm to be used. All Bitcoin nodes follow unified protocol specifications. The protocol specification (consensus algorithm) consists of relevant consensus rules, which can be divided into two major cores: proof of work and the longest chain mechanism. The ultimate expression of all rules (consensus) is the longest chain of Bitcoin. The purpose of the consensus algorithmIt is to ensure that Bitcoin keeps running on the longest chain, thereby ensuring the consistency and reliability of the entire accounting system.

Users in the blockchain do not need to consider the credit of the other party when conducting transactions, do not need to trust the other party, and do not need a trusted intermediary or central agency. They only need to follow the blockchain protocol. Realize the transaction. The premise for smooth transactions without the need for a trusted third-party intermediary is the consensus mechanism of the blockchain, that is, in a market environment of mutual understanding and trust, each node participating in the transaction considers its own interests and does not violate any regulations. Motives and behaviors of cheating, so each node will actively and consciously abide by the preset rules to judge the authenticity and reliability of each transaction, and write the record of passing inspection into the blockchain. The interests of each node are different, and logically there is no incentive for them to collude to deceive. This is especially obvious when some nodes in the network have public reputation. Blockchain technology uses a consensus algorithm based on mathematical principles to establish a "trust" network between nodes, and uses technical means to achieve an innovative credit network.

At present, the mainstream consensus algorithm mechanisms in the district industry include: workload proof mechanism, equity proof mechanism, share authorization proof mechanism and Pool verification pool.

The workload proof mechanism is the proof of workload, which is a requirement that must be met when generating a new transaction information (i.e. a new block) to be added to the blockchain. In a blockchain network built based on the proof-of-work mechanism, nodes compete for accounting rights by calculating the numerical solution of random hashing. The ability to obtain the correct numerical solution to generate blocks is a specific manifestation of the node's computing power. The proof-of-work mechanism has the advantage of being completely decentralized. In a blockchain with a proof-of-work mechanism as the consensus, nodes can enter and exit freely. The well-known Bitcoin network uses a proof-of-work mechanism to produce new currencies. However, since the application of the workload proof mechanism in the Bitcoin network has attracted most of the computing power of computers around the world, it is difficult for other blockchain applications that want to try to use this mechanism to obtain the same scale of computing power to maintain their own security. At the same time, mining based on the proof-of-work mechanism also causes a lot of waste of resources, and the period required to reach consensus is also long, so this mechanism is not suitable for commercial applications.

In 2012, a netizen with the pseudonym Sunny King launched Peercoin. This encrypted electronic currency uses a proof-of-work mechanism to issue new coins and a proof-of-stake mechanism to maintain network security. This is the role of the proof-of-stake mechanism in encrypted electronic currency. first application in . Instead of requiring the certifier to perform a certain amount of computational work, Proof of Stake simply requires the certifier to provide ownership of a certain amount of cryptocurrency. The way the proof-of-stake mechanism works is that when a new block is created, the miner needs to create a "coin rights" transaction, which sends a number of coins to the miners themselves according to a preset ratio. The proof of equity mechanism is based on eachAccording to the proportion and time of tokens owned by each node, the mining difficulty of the node is reduced proportionally according to the algorithm, thus 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 in the commercial field.

The share authorization certification mechanism is a new consensus mechanism to ensure network security. While trying to solve the problems of the traditional PoW mechanism and PoS mechanism, it can also offset the negative effects of centralization by implementing technological democracy.

The share authorization certification mechanism is similar to board voting. This mechanism has a built-in real-time shareholder voting system, just like the system is convening a never-ending shareholders' meeting at any time, where all shareholders vote. determine company decisions. The decentralization of the blockchain established based on the DPoS mechanism relies on a certain number of representatives rather than all users. In such a blockchain, all nodes vote to elect a certain number of node representatives, who act on behalf of all nodes to confirm blocks and maintain the orderly operation of the system. At the same time, all nodes in the blockchain have the power to remove and appoint representatives at any time. If necessary, all nodes can vote to disqualify the current node representatives and re-elect new representatives to achieve real-time democracy.

The share authorization certification mechanism can greatly reduce the number of nodes participating in verification and accounting, thereby achieving second-level consensus verification. However, this consensus mechanism still cannot perfectly solve the application problems of blockchain in business, because this consensus mechanism cannot get rid of its dependence on tokens, and the existence of tokens is not required in many commercial applications.

The Pool verification pool is established based on traditional distributed consistency technology and is supplemented by a data verification mechanism. It is a consensus mechanism widely used in current blockchains.

The Pool verification pool can work without relying on tokens. Based on mature distributed consensus algorithms (Pasox, Raft), it can achieve second-level consensus verification, which is more suitable for multi-party participation. Polycentric business model. However, the Pool verification pool also has some shortcomings. For example, the degree of distribution that the consensus mechanism can achieve is not as good as the PoW mechanism.

Here we mainly explain some algorithm principles of the blockchain workload proof mechanism and the Bitcoin network. How to prove your workload? I hope everyone can have a basic understanding of the consensus algorithm.

The main feature of the workload proof system is that the client has to do a certain amount of difficult work to get a result, and the verifier can easily use the results to check whether the client has done the corresponding work. A core feature of this scheme is asymmetry: the work is modest for the requester and easy to verify for the verifier. It is different from the verification code, which is easyeasier to be solved by humans than by computers.

The figure below shows the workload proof process.

For example, give a basic character "hello, world!", the workload requirement we give is that you can add a nonce (random number) after this character creation Integer value, perform SHA-256 operation on the changed (nonce added) character creation, if the result (expressed in hexadecimal form) starts with "0000", the verification is passed. In order to achieve this proof-of-work goal, it is necessary to continuously increment the nonce value and perform a SHA-256 hash operation on the resulting character creation. According to this rule, it takes 4251 operations to find the hash with leading 4 zeros.

Through this example, we have a preliminary understanding of the proof-of-work mechanism. Some people may think that if proof of work is just such a process, then it is enough to remember that the nonce is 4521 so that the calculation can pass verification. Of course not, this is just an example.

Next, we simply change the input to "Hello, World! + integer value". The integer value ranges from 1 to 1000, which means that the input is turned into an array of 1 to 1000: Hello, World !1;Hello,World!2;...;Hello,World!1000. Then perform the above proof of work on each input in the array in turn - find the hash with leading 4 zeros.

Due to the pseudo-random nature of the hash value, it is easy to calculate based on the relevant knowledge of probability theory. It is expected that it will take 2 to the 16th power of attempts to obtain a hash hash with four leading zeros. List. If you count the actual results of the 1,000 calculations just performed, you will find that the average number of calculations is 66,958, which is very close to 2 raised to the 16th power (65,536). In this example, the number of calculations expected by mathematics is actually the required "workload". Repeating the workload proof multiple times will be a probability event that conforms to statistical laws.

The actual number of calculations used to count the input characters and obtain the corresponding target result is as follows:

For any node in the Bitcoin network, if you want to generate a new block To join the blockchain, you must solve this puzzle of the Bitcoin network. The key elements of this question are the proof-of-work function, block and difficulty value. The workload proof function is the calculation method of this question, the block is the input data of this question, and the difficulty value determines the amount of calculation required to understand this question.

Used in the Bitcoin networkThe proof-of-work function is the SHA-256 mentioned above. Blocks are actually generated in the proof-of-work process. Kuangong constantly constructs block data and checks whether each calculated result meets the required workload, thereby determining whether the block meets the network difficulty. The block header is the input data of the Bitcoin proof-of-work function.

The difficulty value is an important reference indicator for miners to mine. It determines how many hash operations it takes for miners to generate a legal block. The Bitcoin network generates a block approximately every 10 minutes. If the generation of new blocks basically maintains this speed under different network computing power conditions, the difficulty value must be adjusted according to changes in the computing power of the entire network. The general principle is to ensure that the network always generates a new block in 10 minutes, regardless of the mining power.

The adjustment of the difficulty value occurs independently and automatically in each complete node. Every 2016 blocks, all nodes will automatically adjust the difficulty value according to a unified format. This formula is based on the time spent in the latest 2016 blocks and the expected time (assuming a withdrawal is generated every 10 minutes, the expected time is 20160 minutes) and adjusted according to the ratio of actual duration to expected duration. That is, if blocks are generated faster than 10 minutes, increase the difficulty value; anyway, decrease the difficulty value. The formula is expressed as follows:

New difficulty value = old difficulty value * (20160 minutes/time spent in the past 2016 blocks).

Proof of work requires a target value. The calculation formula of the target value (Target) of Bitcoin's proof of work is as follows:

Target value = maximum target value/difficulty value, where the maximum target value is a constant value

The size of the target value is inversely proportional to the difficulty value. To achieve the Bitcoin workload proof, the block hash value calculated in the mine must be less than the target value.

We can also simply understand the process of Bitcoin workload as performing SHA-256 hash operation by constantly changing the block header (that is, trying different nonce values) and using it as input. Find a process that has a hash value in a specific format (that is, requires a certain number of leading 0s), and the more leading 0s required, the more difficult it becomes.

The steps of Bitcoin’s proof-of-work puzzle can be roughly summarized as follows:

The process can be represented by the following figure:

Bitcoin’s proof of work is the main work we commonly call “mining”. Understanding the workload proof mechanism will lay the foundation for us to further understand the consensus mechanism of the Bitcoin blockchain.

『8』 Consensus mechanism of blockchain

The so-called "consensus mechanism" is to complete the verification and confirmation of transactions in a very short time through the voting of special nodes; For transactions, if several nodes with unrelated interests can reach a consensus, we can think that the entire network can also reach a consensus on this. Beijing Muqi Mobile Technology Co., Ltd., a professional blockchain outsourcing development company, welcomes discussions for cooperation. Below we will look at several consensus mechanisms of blockchain, hoping to help everyone understand the basic technology of blockchain.

Due to the development of blockchain technology, everyone is no longer unfamiliar with the term consensus mechanism. With the development of technology, various innovative consensus mechanisms are also developing.

POW proof of work

Bitcoin uses the PoW proof of work mechanism, and later Ethereum used the PoW consensus mechanism. Pow is equivalent to calculating a difficult mathematical problem, which is to calculate the hash value of a new block, and the difficulty of the calculation will be adjusted every period of time. Although PoW is a consensus mechanism that is relatively recognized by everyone, calculations will consume a lot of energy and may pollute the environment.

POS Equity Proof

The probability of obtaining accounting rights is determined by the number and duration of holding Tokens. Compared with POW, POS avoids a large amount of resource waste caused by mining and shortens the time for each node to reach consensus. If the network environment is good, it can be achieved in milliseconds and has low requirements on node performance.

However, the shortcomings of POS are also obvious. Nodes holding more Tokens have a greater chance of obtaining accounting rights. This will lead to the "Matthew Effect", where the rich will get richer, destroying the decentralization of the blockchain. Centralization.

DPOS Proof of Equity

The principle of DPOS Delegated Proof of Equity is the same as that of POS. The main difference is that DPOS Token holders can vote to elect agents as super nodes, responsible for Produce blocks and maintain consensus rules on the network. If these nodes fail to perform their duties, new nodes will be voted in. The same disadvantage also tends to be centralized.

POA Proof of Authority

POA nodes can reach consensus without communication, so it is extremely efficient. And it can also resist computing power attacks very well and has high security. But POA requires a centralized authoritative node to verify identity, which means it will harm the decentralization of the blockchain, which is also a compromise between decentralization and improved efficiency.

『九』 What is the consensus mechanism in blockchain technology

1. What is the consensus mechanism
In a decentralized structure system, due to the various participants The status of both parties is equal. When disagreements arise, how to reach consensus becomes a problem.
Therefore, a well-designed and simple-to-operate consensus mechanism is the key to the smooth operation of a distributed system.
In short, the consensus mechanism is an algorithm that reaches consensus on the order of things within a period of time. It is a mechanism for blockchain nodes to reach a consensus across the entire network on block information.

博客主人唯心底涂
男,单身,无聊上班族,闲着没事喜欢研究股票,无时无刻分享股票入门基础知识,资深技术宅。
  • 37644 文章总数
  • 3637286访问次数
  • 3081建站天数