Judging from the recent BCH bifurcation process, the governance of pow type chains such as bitcoin has been completely monopolized by large-scale mine owners (ore bullies), and has become a arena for the power and profit of mining bullies, which has greatly damaged people’s belief in the decentralized transformation of blockchain. Although Ethereum has community governance, it appears to be inefficient in dealing with sudden or urgent changes; at the same time, there is also the risk of “shadow government” controlling rights. EOS has improved the above problems slightly through the “centralized” architecture and community constitution, but it still can not meet the governance needs of the future blockchain.
Therefore, the on chain governance scheme characterized by automation and certainty has become the direction of exploration. One of the most representative is the DGP of quantum chain (qtum).
Functions of DGP
The full name of DGP is decentralized governance protocol. The key is to solidify the governance framework and rules into the contract by taking advantage of the certainty of the results and the openness of the rules of the smart contract, so that decisions can be made in a democratic way when necessary, and the blockchain state management can be completed automatically.
DGP framework includes community process, smart contract (framework contract, feature contract), contract effective process, management team, etc. Management team refers to who can participate in management, role division, democracy and centralization mechanism; management team can be called management committee, because all members (except initial administrators) are elected by vote, including administrators and governors. The administrative personnel are responsible for the maintenance of the operation mechanism of the Committee; they also participate in the exercise of rights, that is, voting on various proposals (including characteristic contracts). The managers are responsible for the exercise of the committee’s external rights, that is, to vote on the specific contract proposal.
The ideal DGP process should look like this:
1. Propose a proposal (feature contract) after community discussion.
2. The executive of the management committee submits the proposal to the DGP framework contract and initiates a vote.
3. All members of the management committee shall vote on the proposal.
4. If the vote is passed, the voting of DGP framework contract will end and the characteristic contract will take effect. After the specified number of blocks, the new features of the feature contract are applied to the new block.
5. If the voting fails within the scheduled time, the process will be terminated.
There are two types of DGP smart contracts, one is framework contract, which is responsible for completing the work of the management committee, that is, authority management and voting; the other is feature contract, which is responsible for providing feature data. Qtum’s framework contracts are preset, and currently there are six (five have been used); feature contracts are deployed as required, but the current rule is that one framework contract is only used for one feature contract, that is, up to six feature contracts can be deployed and effective. Only when the two types of contracts are combined together can qtum’s chain governance function be completed.
Briefly introduce the functions of the two types of contracts.
The framework contract mainly completes the personnel management and voting functions of the management committee. The personnel management includes the addition and deletion of two roles (admin and gov), and the voting function includes the voting process and voting result management.
Functional definition of framework contract:
1. Proposals and votes. according to msg.sender Counting of votes
2. Key managemant
3. Manage feature data (feature contract address)
4. Disable yourself (not implemented)
5. Support modified rollback (not implemented directly, but can be implemented by re voting the feature contract before deployment)
At present, the implementation of feature contract of qtum is relatively simple. It mainly provides feature data and does not do more logic, that is, it only provides a const get function.
The implementation of DGP mainly depends on the framework contract. The implementation of personnel management function in framework contract is illustrated by the process of adding govkey, as shown in figure (1). (it’s actually a voting process). The process of adding an administrative key is the same as that of adding a manager; the process of deleting an administrator is the same. (the flow chart below is based on the public code extraction on GitHub).
In addition to personnel management, it is the voting function. Before starting voting, you need to deploy the feature contract to the blockchain, and then add the address of the feature contract to the framework contract to start the voting. The flow chart is as follows (2).
If you pay attention to the flow chart, you can find that the framework contract needs to set up an initial administrative staff to make the framework contract work. This initial administrator is also the administrative key of the management committee as we define it. Each framework contract has an independent management committee, and he is the first administrator of this committee. Only administrative personnel (adminkey) have the right to vote, including adding or deleting Management Committee personnel and adding feature contract address. Therefore, after deploying the framework contract, it is necessary to initialize an administrator (adminkey).
The implementation of DGP function is mainly concentrated in three functions: address proposal, remove address proposal and change value proposal. The specific implementation of the code is not described in detail. If you are concerned about the implementation details, it is recommended to study the addressproposal function carefully.
Smart contract. DGP is implemented by smart contract, which integrates the capability of smart contract, so that it can open rules, deploy in advance and execute reliably.
Multi signature. The Management Committee of DGP usually has more than one person, and the maximum number is 30 at present. The voting process for the effectiveness of feature contract is actually the implementation of multi signature.
Hot update, soft bifurcation. At present, the use of DGP by qtum is only the dynamic modification of the basic attributes of blockchain. The feature contract only provides new attribute data, which can be deployed online, and its effective process will not lead to hard bifurcation.
Defects and deficiencies
Although the DGP implementation of qtum is simplified as much as possible, we can still find some defects and deficiencies from the above function implementation analysis.
First, the current DGP framework has limited flexibility. DGP functions are completely dependent on the default framework contracts, and each framework contract can only manage a single attribute. Therefore, for a framework contract, only one proposal can be in the voting state, that is, the current proposal.
Second, the DGP framework contract has no constructor. The management parameters are not initialized, which is inconvenient to use. At the beginning of deployment, the management committee has only one adminkey. Although the management parameters can be set by calling the changevalueproposal interface directly, this is a voting process, and the initialization voting process is far fetched.
Thirdly, the boundary of role division is not clear. Although adminkey and govkey have different roles, adminkey can participate in all behaviors, including voting on feature contracts, so the function of govkey role is not highlighted. It is suggested that adminkey is only responsible for the administrative affairs of the management committee, such as voting, but not participating in decision-making; govkey is responsible for all legislative processes, that is, voting, which reflects that the decision-making results are generated through public power.
Fourth, the framework contract can not be used indefinitely. The paramhistory used to save the historical value is an array, which is stored on the blockchain as a contract state. However, it is used to increase elements without reducing them. This will result in the higher cost of use.
Fifthly, the ending condition of voting state is not reliable. If a vote fails to reach the number of votes within the specified time (number of blocks), if no one continues to vote, the vote will continue to be in the voting state and cannot automatically end. Voting for a new feature contract cannot be started on the framework contract. Someone must call it again with the original contract address and type. (this is mainly limited by the ability of smart contracts. We all know that smart contracts will not run spontaneously. Therefore, it is not possible to achieve timing function by relying on the internal of smart contracts. We need to ensure the reliability of timing through external means.)
In addition, there is no systematic security. Although some security designs are mentioned in the white paper, such as delaying the entry into force and not allowing DGP contracts for specific addresses, it has not been systematized and the security guarantee is not perfect. For example, there is no security review mechanism for feature contracts, how to ensure security for complex feature contracts, and so on.
The future of DGP
Although qtum’s on chain governance scheme is not perfect, it has to be said that DGP itself is a very creative design. It provides an exploration direction for the blockchain industry to study the on chain governance scheme.
DGP combines the ability of smart contract, and the capability of smart contract has infinite space to improve in theory. With the improvement of virtual machine capability, smart contract will be able to do more intelligent work. Everyone is imagining that in the future, when relatively complex AI algorithms can be written into smart contracts, and even when smart contracts can access the data of the external world, the day when the blockchain can realize automatic management and self-management is near. In my understanding, the ideal on chain governance scheme should be automatic management based on algorithms, rather than an inefficient management mode realized by voting by people; or at least it should be based on automatic management, with human participation only in special situations.
At present, qtum DGP has only made a simple framework, but in this direction, there is a lot of space for further design and expansion, and the ability of on chain governance can be further improved.
The meaning of DGP
In a word, although qtum DGP is not perfect, it is of great significance. It makes a visible attempt for on Chain Governance and leads a valuable exploration direction.
allanzeng, Senior Engineer on BlockChain