"Nodejs Development Crypto Currency" 17: Consensus mechanism, programmable benefit transfer rules

Source: Internet
Author: User

This article is about the last article in the Crypto Currency primer article. Cryptocurrency introductory article mainly for developers, from the theoretical level to describe the concept of crypto-currency architecture, a total of 3. The title of this article in the real writing when the change, did not continue the last hint of "mechanism, the root of the future of society." When writing this article, Bitcoin experienced a crazy rise, currently 3876 yuan/bitcoin.

Objective

In the previous article, we have said that the crypto currency is to be centralized, the basis of the central point is that there are many peers, then how to attract users to join the network as a node, there are those incentive mechanism? At the same time, the focus of development is to have multiple nodes maintain a database, so how to decide which node to write? When is it written? Once written, how is it guaranteed not to be changed by other nodes (irreversible)? The answer to these questions is the consensus mechanism.

Consensus mechanism, programmable benefit transfer rules. This topic is written, it is a little excited, programming development for so many years, we have tried many ways, trying to use some kind of incentive means to improve user stickiness, the user retention. For example, the common integration mechanism, user level, but there is no way, can be compared with the crypto-currency consensus mechanism. Each blockchain product, itself is a small society, a network of nodes composed of self-adaptive organization, the operation of this Organization, by consensus mechanism to standardize.

This article answers "Why crypto currency does not need to be regulated", including the role of mechanisms, the types of crypto-currency consensus mechanisms, their merits and demerits, and the improvement plans of billions of books.

Mechanism, the origin of product trends

The term "mechanism" refers to the structure and movement principle of the machine, and the connotation in sociology can be expressed as "the concrete operation mode of coordinating the relations between the various parts to better function." ”

Have met a good leader in the work, he is very fair and decent, all things according to the rules, with the system to speak. Under his leadership, the whole department is very passionate, no distractions, focus on work, the superior leadership is also very recognized that the promotion of pay is often the thing, everyone can harvest full. Later, because of work adjustment, many of us went to the new department, we reflect, no longer the original passion, because work is not necessarily recognized, pay does not necessarily have a harvest.

This example, many people have encountered, is the most direct experience of a social, organizational or departmental mechanism of the operation of the law. In any system, the mechanism plays a fundamental role, which is about the development trend of the system. Ideally, there is a good mechanism to bring a social system closer to an adaptive system (which automatically responds quickly when external conditions change). The normal organism (such as the human body) has this mechanism and ability.

The construction of mechanism is a complicated system engineering. For cryptocurrency, the consensus mechanism includes various incentive systems and specific algorithms, such as transaction costs, block incentives, and so on. The key factor of the mechanism is people, judging a mechanism is good or bad, often through a period of observation, to see whether the enthusiasm of people to participate and implementation can be sustained. If it does not last, it indicates that the mechanism has failed and that the system or product will perish.

In fact, the goal of cryptocurrency is to create an "unregulated and adaptive economic system". At present, there are three kinds of mechanisms that support the adaptive economic system, they are: Pow,pos,dpos and so on, and can find corresponding economic models in real life. These mechanisms attract people to participate, to form a secure network, and to operate in an orderly fashion. However, in the long run, they have advantages and disadvantages, there is a possibility of failure.

Let's look at the evolutionary process of these mechanisms.

1.PoW (Proof of work): Fundamentals of the proof of workload mechanism

This is the consensus mechanism used by Bitcoin, and also the earliest. To understand, it is simple, that is, "evaluated", how much labor you pay (work), you will be paid (Bitcoin and other cryptocurrency). In the online world, the labor here is the computing service you provide for the network (the Force x duration), the process of providing this service is "mining".

So how does the "reward" be distributed? If it is the real mineral deposits, obviously in the premise of uniform distribution, people "mining" the proportion of the gain and the respective calculation force is proportional, popular point is that the stronger the ability to obtain more.

Advantages

The mechanism itself is, of course, complex, with a lot of details, such as the automatic adjustment of mining difficulty, the gradual halving of block incentives, which are based on economic principles that attract and encourage more people to participate.

Ideally, this mechanism can attract many users to participate in it, in particular, the more involved in the acquisition of more, will promote the initial phase of cryptocurrency development rapidly, the node network rapidly expanded. In the era of CPU mining, Bitcoin attracted a lot of people to participate in "mining", is very good proof.

By "mining" the way to issue the currency, the bitcoin dispersed to individuals, achieving a relatively fair (compared to those who do not have to dig, direct IPO of the currency to be more fair).

Disadvantages

First, the computing power is the computer hardware (CPU, GPU, etc.) to provide, to consume electricity, is the direct consumption of energy, and human pursuit of energy-saving, clean, environmental protection of the concept of the contrary. However, this should be the strongest evidence if the "cryptocurrency" is to be sought for the meaning of "monetary value".

Second, this mechanism developed to today, the provision of the calculation is no longer a simple CPU, but gradually developed to the GPU, FPGA, and even ASIC mining machine. The user also from the individual mining development to the large mine pool, the mine, the calculation force concentration is more and more obvious. This is in line with the direction of the center, the gradual drift away, the network security gradually threatened. There is evidence that GHash (a mine pool) has carried out a double-flower attack on a gambling website (simply saying that it costs two times a sum of money).

Third, the Bitcoin block reward every 4 years will halve, when the cost of mining is higher than the mining proceeds, people to reduce the enthusiasm of mining, there will be a lot of calculation, the security of the Bitcoin network is further worrying.

2.PoS (Proof of Stake): proof of ownership mechanism. Basic principle

This is the innovation of Point coin (PPC). No mining process, in the creation of the block in the allocation of equity distribution, and then through the transfer, transaction mode (usually IPO), gradually dispersed to the user, and through the "interest" way to add money, to achieve the reward node.

Simply put, it is a system of interest payments based on the amount and time (currency age) of the user holding the currency. The most typical example in reality is stocks, or bank deposits. If a user wants to get more money, open the client, keep it online, and benefit from "interest" while keeping the network secure.

Advantages

One is energy saving. No digging, no need to expend electricity and energy.

The second is to be more centralized. First of all, to be central is relative. Relative to the type of crypto currency such as Bitcoin, POS mechanism of cryptographic currency pairs of computer hardware is basically not too high requirements, everyone can dig mine (get interest), do not worry about the concentration of concentrated result in the emergence of centralized (single-user through the purchase of 51% of money, higher cost), the network more secure.

The third is to avoid austerity. The POW mechanism of crypto currency, because the user is lost and other reasons, may lead to deflation, but the POS mechanism of crypto currency at a certain annual interest rate of new currency, can effectively avoid the contraction appears, maintain basic stability. After bitcoin, many of the SGD use POS mechanism, many use the proof mechanism of old coins, also have to modify the protocol, "hard fork" upgrade to POS mechanism.

Disadvantages

The pure POS mechanism of cryptocurrency can only be issued by way of an IPO, which leads to a "minority" (usually a developer) having access to a large amount of extremely low-cost cryptocurrency, and it is difficult to ensure that they do not sell much in the interests of the profits. Therefore, the POS mechanism of the crypto currency, the credit base is not strong enough. To solve this problem, many use the dual mechanism of pow+pos, through the POW mining issue crypto currency, using POS to maintain network stability. or adopt the DPOS mechanism to strengthen trust through the way of community elections.

3.DPoS (Delegated Proof of Stake): Fundamentals of the mechanism of authorized equity certification

This is the first introduction of the bit stock (BTS). For the first time, bit shares proposed the idea of DACs Autonomous company. The purpose of the bit shares is to publish DACs. These unmanned companies issue shares, generate profits, and distribute profits to shareholders. There is no need to trust anyone to do this, because everything is hardcoded into the software. In layman's words, the company creates profitable companies (stock), shareholders hold shares in these companies, and companies pay dividends to shareholders. There is no need to dig mine.

For the cryptographic currency of the POS mechanism, each node can create chunks and receive "interest" in proportion to the individual's shareholding. Dpos is created by the community-elected trusted account (the trustee, who gets the top 101 votes) to create the block. In order to become the official trustee, the user wants to go to the community canvassing, obtains enough user's trust. The user votes according to the percentage of the total number of encrypted currencies they hold. Dpos mechanism is similar to joint-stock companies, ordinary investors can not enter the board of directors, to vote for their representatives (trustees) to make decisions on their behalf.

These 101 trustees can be understood as 101 mineral pools, and the 101 pools each have exactly the same rights as each other. Those who hold the cryptocurrency can vote to replace these delegates at any time, as long as they provide erratic computing power, computer outages, or attempt to exploit the power of the hands to do evil, they will immediately be kicked out of the system by an angry voter, and the reserve representative can go up at any time.

Advantages

First, the energy consumption is lower. Dpos mechanism to reduce the number of nodes to 101, in order to ensure network security, the entire network of energy consumption is further reduced, the lowest network operating costs.

Second, to be more centralized. At present, for Bitcoin, the individual mining is not realistic, the calculation of bitcoin is concentrated in several large pool hands, each pool is centralized, like a trustee of Dpos, so the dpos mechanism of the crypto currency more to the center. The POS mechanism of the crypto currency (such as future coins), the user is required to open the client, in fact, the user does not open the computer every day, so the real network node is maintained by several shareholders, to the degree of centrality can not be compared with the dpos mechanism of the crypto currency.

Third, faster confirmation speed. For example, billion books use the dpos mechanism, each block of time is 10 seconds, a trade (after 6-10 confirmed) about 1 minutes, a complete 101 block cycle of about just 16 minutes. While Bitcoin (POW mechanism) takes 10 minutes to generate a chunk, it takes 1 hours for a transaction to complete (after 6 blocks are confirmed). Point coin (POS mechanism) confirms that a transaction takes about 1 hours.

Disadvantages

A few days ago, the author of the bit shares published a widely considered silly article (see Reference), predicting that DAO (DE-centric organization) and DAC (DE-centric) will fail. The paper discloses a lot of practical experience, which is basically regarded as a dpos problem. To sum up, the main is:

One is that the enthusiasm for voting is not high. The vast majority of shareholders (90%+) have never participated in voting. This is because voting takes time, energy and skills, which is what most investors lack.

Second, there are many difficulties in dealing with bad nodes. Community elections can not effectively prevent the emergence of some of the destruction of nodes, the network caused security risks.

4. The improvement of dpos mechanism by billion books

However, there is no denying that the dpos mechanism is still the most safe, environmentally friendly and efficient consensus mechanism. There are problems that can be overcome and solved. In view of the problem of Dpos, billion books combined with their own characteristics, innovation proposed four points improvement plan.

(1) Fusing mechanism

To increase the anti-voting function, the anti-turnout rate of the broken node reaches a certain number, it will promote the "fuse mechanism", forcing individual trustee node demotion, reduce the possibility of damage to the network.

(2) Credit system

Billion books, encourage knowledge sharing, nodes and users will have frequent interaction between users of the user feedback and praise, will be a part of the node credit accumulation. Billion book will make full use of these credit information to help community users to select good nodes.

(3) Expand the scale

101 Trustees, is only a relatively reasonable number of experience. Billion book, will further optimize the algorithm, improve the performance of network selection, to take leasing, sale and other means, encourage the application of the center of the developers, publishers and other third-party users to build their own nodes, thereby better service users.

(4) Real-name authentication

Anonymity and security are relatively balanced processes. Billion book advocates the provision of open and transparent services, encourage the node trustee real-Name certification, public information, acceptance of supervision, so as to obtain broad community recognition. For long-term performance of the node, billion will give a list of lists, displayed in the user account.

Summarize

This article introduces the consensus mechanism (algorithm) used in most cryptocurrency, and does not introduce the Rayleigh consensus mechanism adopted by ripple, because in strict sense, it is considered that the ripple currency is not to be centralized, and the Rayleigh wave mechanism has not been found to be adopted by other crypto currencies, so it does not have universality, This is no longer discussed here.

The practice proves that the well-designed adaptive system must have a perfect mechanism to support and fully consider the human factors. Human beings are complex, especially human group behavior, more unpredictable, these mechanisms are initially well designed, but who can expect other conditions in the near future. Satoshi may not have thought that Bitcoin would come to this day.

This is the point of design and coding, and the next step is to have to encode the point. Let's strike the hard, read the code to learn more about these fantastic ideas, see next:"Nodejs Development cryptocurrency" 16: the implementation of the Dpos mechanism (source interpretation)

Link

This series of articles is updated immediately, to keep up to date, please follow the link below

Source Address: Https://github.com/imfly/bitcoin-on-nodejs

Starting Blockchain Club: http://chainclub.org

Billion Book official website: http://ebookchain.org

Billion book development QQ Group: 185046161 (Billion book for open source projects, welcome all the small partners to participate)

Reference

Why Pos and POW are not comparable

"Centralized Bitcoin: from self-organization to specialization"

Bitshares DPoS.

Founder of Bit shares: The DAO is on the old road of BTS, or is not far from its death

Mechanism analysis

"Nodejs Development Crypto Currency" 17: Consensus mechanism, programmable benefit transfer rules

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.