WO2020015447A1 - 共识机制的部署方法、装置、设备和存储介质 - Google Patents

共识机制的部署方法、装置、设备和存储介质 Download PDF

Info

Publication number
WO2020015447A1
WO2020015447A1 PCT/CN2019/087574 CN2019087574W WO2020015447A1 WO 2020015447 A1 WO2020015447 A1 WO 2020015447A1 CN 2019087574 W CN2019087574 W CN 2019087574W WO 2020015447 A1 WO2020015447 A1 WO 2020015447A1
Authority
WO
WIPO (PCT)
Prior art keywords
custom
consensus mechanism
consensus
voting
custom consensus
Prior art date
Application number
PCT/CN2019/087574
Other languages
English (en)
French (fr)
Inventor
肖伟
Original Assignee
百度在线网络技术(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 百度在线网络技术(北京)有限公司 filed Critical 百度在线网络技术(北京)有限公司
Priority to JP2020533673A priority Critical patent/JP7041749B2/ja
Priority to US16/963,491 priority patent/US11614926B2/en
Publication of WO2020015447A1 publication Critical patent/WO2020015447A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3263Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements
    • H04L9/3268Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving certificates, e.g. public key certificate [PKC] or attribute certificate [AC]; Public key infrastructure [PKI] arrangements using certificate validation, registration, distribution or revocation, e.g. certificate revocation list [CRL]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the embodiments of the present application relate to the field of blockchain technology, for example, to a method, an apparatus, a device, and a storage medium for deploying a consensus mechanism.
  • the blockchain network can support different consensus mechanisms.
  • the consensus mechanism assists the blockchain network to verify and confirm the transactions generated within the blockchain, ensuring all honest nodes in the blockchain network. Consistency and the validity of transaction records.
  • the blockchain network has already completed the configuration of the internal consensus mechanism in the early stage of its creation.
  • the genesis block is created, the corresponding consensus mechanism is configured, so that the nodes in the blockchain network are embedded according to the blockchain network.
  • the consensus mechanism completes the verification and confirmation of transactions generated within the blockchain network.
  • the consensus mechanism embedded in the Bitcoin application scenario is Proof of Work (POW)
  • the consensus mechanism embedded in the Ethereum application scenario is POW or Proof of Stake (POS).
  • POW Proof of Work
  • POS Proof of Stake
  • the consensus mechanism embedded in the ledger (Hyperledger Fabric) application scenario is a practical Byzantine Fault Tolerance (PBFT) or a distributed queue mechanism (Kafka).
  • PBFT Byzantine Fault Tolerance
  • Kafka distributed queue mechanism
  • the consensus mechanism is configured in the blockchain network in a fixed and unmodifiable form.
  • the consensus mechanism embedded in the system cannot be upgraded and cannot meet the increasing or changing business of blockchain creators. demand.
  • the embodiments of the present application provide a method, an apparatus, a device, and a storage medium for deploying a consensus mechanism, which can deploy a custom consensus mechanism for a blockchain network.
  • an embodiment of the present application provides a method for deploying a consensus mechanism, which is executed by a node in a blockchain network.
  • the method includes:
  • custom consensus plug-in Obtain a custom consensus plug-in, where the custom consensus plug-in is obtained by compiling a custom consensus mechanism written based on a standardized consensus mechanism framework;
  • an embodiment of the present application provides a device for deploying a consensus mechanism, which is configured in a node in a blockchain network.
  • the device includes:
  • a plug-in obtaining module is used to obtain a custom consensus plug-in, where the custom consensus plug-in is obtained by compiling a custom consensus mechanism written based on a standardized consensus mechanism framework;
  • the plugin deployment module is configured to deploy the custom consensus plugin in a local node.
  • an embodiment of the present application provides a device, including:
  • One or more processors are One or more processors;
  • Memory for storing one or more programs
  • the one or more processors are enabled to implement the method for deploying the consensus mechanism described in any embodiment of the present application.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored.
  • the program is executed by a processor, the method for implementing a consensus mechanism described in any embodiment of the present application is deployed.
  • the embodiment of the present application uses a standardized consensus mechanism framework to write a custom consensus mechanism, compiles the written custom consensus mechanism into a custom consensus plugin, and deploys the custom consensus mechanism in a local node in the form of a plugin.
  • the embodiment of the present application writes a custom consensus mechanism based on a standardized consensus mechanism framework, implements a consensus mechanism for the blockchain network to meet the business needs of the blockchain creator, and provides a modification or upgrade of the consensus mechanism in the blockchain network. Method to improve the transaction processing ability and user experience of the blockchain network.
  • FIG. 1 is a flowchart of a method for deploying a consensus mechanism according to the first embodiment of the present application
  • FIG. 2 is a flowchart of a method for deploying a consensus mechanism provided in Embodiment 2 of the present application;
  • FIG. 3 is a flowchart of a method for deploying a consensus mechanism according to a third embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a deployment mechanism for a consensus mechanism according to a fourth embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a device provided in Embodiment 5 of the present application.
  • FIG. 1 is a flowchart of a method for deploying a consensus mechanism according to Embodiment 1 of the present application.
  • This method is applied to nodes in a blockchain network.
  • the blockchain can be a public chain, an alliance chain, or a private chain.
  • a blockchain network usually includes multiple nodes.
  • the embodiments of the present application may be applicable to a case where a custom consensus mechanism is proposed according to user requirements, and the method may be executed by a deployment device of a consensus mechanism configured in a node of a blockchain network.
  • the method includes the following steps:
  • the custom consensus plug-in is obtained by compiling a custom consensus mechanism written based on a standardized consensus mechanism framework.
  • the custom consensus mechanism refers to a code segment that is executed by a node in the blockchain network according to the user's business requirements and can be executed by each node in the blockchain network for transaction verification and confirmation.
  • a custom consensus plug-in refers to an executable file compiled by a node that writes a custom consensus mechanism code, and configured in the form of a plug-in on a node of a blockchain website. It should be noted that the custom consensus plug-in can be written and compiled by the user of the local node, or other users can write custom consensus mechanism code in other nodes in the blockchain network, and compile the custom consensus mechanism code into Execute the file and publish it to the native node.
  • this embodiment uses a standardized consensus mechanism framework to write a custom consensus mechanism.
  • the standardized consensus mechanism framework standardizes the consensus mechanism architecture, which can uniformly limit the writing format, existence form, and naming rules of the consensus mechanism. Therefore, when the nodes in the blockchain network write a custom consensus mechanism, they can customize the corresponding content of the consensus mechanism based on the standardized consensus mechanism framework based on the writing rules in the framework.
  • the standardized consensus mechanism framework in this embodiment not only unifies the writing method of the consensus mechanism, brings convenience to users' writing, but also facilitates the unified call of the consensus mechanism in the later stage.
  • a custom consensus mechanism may be written using a blockchain native language, where the blockchain native language refers to a language that can write the underlying network architecture of the blockchain, such as GO, Java, or C ++.
  • the standardized consensus mechanism framework in this embodiment includes at least three basic consensus operation functions, which are an initialization function, a block generation right verification function, and a block validity verification function, respectively.
  • the initialization function is used to initialize the custom consensus mechanism based on the current state of the blockchain network when the custom consensus mechanism is first deployed in a node in the blockchain network, such as in the custom consensus mechanism.
  • the included parameters or conditions are given initial values;
  • the block generation right verification function is used to verify whether the transaction processing right is obtained;
  • the block validity verification function is used to verify the validity of the transactions recorded in the new block.
  • the existing consensus mechanism needs to be standardized in accordance with the standardized consensus mechanism framework in order to format or The formal transformation is in line with the framework of the consensus mechanism in the current blockchain network.
  • the POW mechanism if the POW mechanism is adopted as the consensus mechanism of the current blockchain network, the POW mechanism needs to be converted into three types: an initialization function, a block generation right verification function, and a block validity verification function.
  • the existence form of the function, and the naming of the function is standardized according to the naming rules.
  • the local node when obtaining a custom consensus plug-in, if the local node initiates a custom consensus mechanism, the local node can obtain a custom consensus mechanism written based on a standardized consensus mechanism framework, and compile the custom consensus mechanism to obtain a self-defined consensus mechanism. Define consensus plugins. And send the custom consensus plug-in to other nodes included in the blockchain network, so that other nodes deploy the custom consensus plug-in. If the custom consensus mechanism initiated by other nodes in the blockchain network, the local node can receive custom consensus plugins sent by other nodes in the blockchain network. Realize the unified deployment of custom consensus mechanism in each node of the blockchain network.
  • the custom consensus plug-in will be published to each of the blockchain networks.
  • all nodes in the blockchain network can verify and confirm the internal affairs of the blockchain according to the consensus mechanism.
  • the local node obtains the custom consensus plug-in, it deploys the custom consensus plug-in to the local node. It is understandable that the custom consensus plug-in can be deployed in the form of a plug-in on the physical machine of the local node.
  • the custom consensus mechanism can be used as the consensus mechanism adopted by the blockchain network based on different blockchain types and node permissions. Among them, when the blockchain is created, the consensus mechanism configured for the blockchain network is the consensus mechanism adopted by the blockchain network. In addition, it is also possible to determine whether a custom consensus mechanism can be used as the consensus mechanism adopted by the blockchain network through voting of nodes in the blockchain network or designation of authorized nodes.
  • the custom consensus mechanism can be used as a pending transaction within the blockchain network.
  • Most nodes in the blockchain network need to be based on the existing consensus mechanism of the current blockchain network.
  • Verify the deployed custom consensus mechanism to verify whether the custom consensus mechanism can be used as the consensus mechanism used by the blockchain network.
  • the node issuing the custom consensus mechanism generates an upgrade request including the custom consensus mechanism, and initiates a voting proposal transaction according to the upgrade request.
  • the voting effective block height may be determined, and a voting proposal transaction may be initiated according to the upgrade request and the voting effective block height, so that if the block generation node detects that the current block height to be generated is voting effective Block height, then vote in response to the voting proposal transaction.
  • the voting effective proportion threshold of the voting proposal transaction can also be determined, and the voting proposal transaction is initiated according to the upgrade request and the voting effective proportion threshold, so that if the block generation node passes the voting greater than the voting effective proportion threshold, the voting approval is determined.
  • the voting effective proportion threshold is obtained by obtaining the voting effective proportion threshold set by the local node.
  • the system voting effective proportion threshold is used as the vote for the voting proposal transaction.
  • Effective proportion threshold otherwise, the set voting effective proportion threshold is used as the voting effective proportion threshold of the voting proposal transaction.
  • the voting proposal transaction is transmitted in the blockchain network, so that the block generation node can vote in response to the voting proposal transaction.
  • the custom consensus mechanism is used as the consensus mechanism adopted by the blockchain network to implement the blockchain network. Upgrade of consensus mechanism. It can be understood that when upgrading the consensus mechanism in the blockchain network, it is necessary to replace the upgraded consensus mechanism with a custom consensus mechanism based on a standardized consensus mechanism framework. For example, on the basis of the above-mentioned consensus mechanism framework containing three basic consensus operation functions, it is necessary to replace the three functions in the upgraded consensus mechanism with the corresponding three functions in the custom consensus mechanism.
  • the current blockchain network is an alliance chain or a private chain
  • specific nodes in the blockchain network have certain permissions, and the consensus mechanism adopted by the blockchain can be specified.
  • such nodes can specify in the blockchain network to adopt a custom consensus mechanism deployed in each node.
  • the custom consensus mechanism also includes an initialization function. Furthermore, the custom consensus mechanism is used as a brand new consensus mechanism in the blockchain network. If the node detects that the custom consensus mechanism is used as the consensus mechanism adopted by the blockchain network, the initialization function in the custom consensus mechanism is used to The state of the custom consensus mechanism is initialized. For example, on the basis of a standardized consensus mechanism framework, an initialization function in a custom consensus mechanism may be used to initialize at least two consensus operation functions in the custom consensus mechanism, where at least two consensus operation functions include blocks Generate weight verification function and block validity verification function. Finally, the corresponding consensus operation function is called from the custom consensus mechanism based on the initialized custom consensus mechanism and the name of the consensus operation function in the framework of the consensus mechanism.
  • the technical solution of this embodiment uses a standardized consensus mechanism framework to write a custom consensus mechanism, and compiles the written custom consensus mechanism into a custom consensus plug-in, and deploys the custom consensus mechanism to the local node in the form of a plug-in.
  • the embodiment of the present application writes a custom consensus mechanism based on a standardized consensus mechanism framework, implements a consensus mechanism for the blockchain network to meet the business needs of the blockchain creator, and provides a modification or upgrade of the consensus mechanism in the blockchain network. Method to improve the transaction processing ability and user experience of the blockchain network.
  • FIG. 2 is a flowchart of a method for deploying a consensus mechanism provided in Embodiment 2 of the present application. As shown in FIG. 2, the method includes the following specific steps:
  • the custom consensus plug-in is obtained by compiling a custom consensus mechanism written based on a standardized consensus mechanism framework.
  • the standardized consensus mechanism framework standardizes the consensus mechanism architecture, which can uniformly limit the writing format, existence form, and naming rules of the consensus mechanism.
  • the consensus mechanism framework of this embodiment includes at least three basic consensus operation functions, which are an initialization function, a block generation right verification function, and a block validity verification function.
  • a custom consensus mechanism written based on a standardized consensus mechanism framework is obtained; the custom consensus mechanism is compiled to obtain a custom consensus plug-in.
  • a custom consensus plugin is sent to other nodes included in the blockchain network, enabling other nodes to deploy custom consensus plugins. Since the consensus mechanism followed by each node of the blockchain network is consistent, after the local node has completed compiling the custom consensus plugin, it needs to issue a custom consensus plugin to all other nodes in the blockchain network. To ensure the consistency of the consensus mechanism within the network. If the custom consensus mechanism initiated by other nodes in the blockchain network is optional, the custom consensus plugin sent by other nodes in the blockchain network is optional. At this time, the local node only needs to wait for receiving the custom consensus plug-in.
  • the local node deploys the custom consensus plug-in to the local node. It is understandable that the custom consensus plug-in can be deployed in the form of a plug-in on the physical machine of the local node.
  • the initialization function included in the custom consensus mechanism may be an initialization rule of the custom consensus mechanism, or may be initialized for an executable code segment. In the form of a function, it can be called by the blockchain network and initialized. , Used to assign initial values for each parameter or condition in the custom consensus mechanism configured in the local node for the first time, providing a basis for the operation of the custom consensus mechanism.
  • the custom consensus mechanism can be used as the consensus mechanism adopted by the blockchain network according to different blockchain types and node permissions.
  • the consensus mechanism configured for the blockchain network is the consensus mechanism adopted by the blockchain network.
  • the custom consensus mechanism is a brand new consensus mechanism in the blockchain network. Nodes use the initialization function in the custom consensus mechanism to initialize the state of the custom consensus mechanism.
  • At least two consensus operation functions in the custom consensus mechanism are initialized by using an initialization function in the custom consensus mechanism, where at least two consensus operation functions include a block generation right check function and a block validity verification function.
  • the consensus mechanism framework includes at least three basic consensus operation functions: an initialization function, a block generation right verification function, and a block validity verification function
  • initialization can be performed according to the current state of the blockchain network.
  • the function initializes the block generation right verification function and the block validity verification function.
  • the corresponding consensus operation function is called from the custom consensus mechanism based on the name of the consensus operation function in the framework of the consensus mechanism.
  • this embodiment can call the corresponding consensus from the custom consensus mechanism based on the name of the consensus operation function in the consensus mechanism framework. Run the function.
  • a block validity verification function with a matching function name is found from the custom consensus mechanism and is called to The transaction records in the new block are validated.
  • the technical solution of this embodiment is to obtain a custom consensus plug-in and deploy it in each node in the blockchain network to initialize the custom consensus mechanism adopted, so that the corresponding in the custom consensus mechanism can be called according to the consensus mechanism framework.
  • Consensus running function The embodiment of the present application writes a custom consensus mechanism based on a standardized consensus mechanism framework, implements a consensus mechanism for the blockchain network to meet the business needs of the blockchain creator, and provides a modification or upgrade of the consensus mechanism in the blockchain network. Method to improve the transaction processing ability and user experience of the blockchain network.
  • FIG. 3 is a flowchart of a method for deploying a consensus mechanism provided in Embodiment 3 of the present application. As shown in FIG. 3, the method includes the following specific steps:
  • the custom consensus plug-in is obtained by compiling a custom consensus mechanism written based on a standardized consensus mechanism framework. If the custom consensus mechanism initiated by the local node is optional, the custom consensus mechanism written based on the standardized consensus mechanism framework is obtained; the custom consensus mechanism is compiled to obtain a custom consensus plug-in. Further, a custom consensus plug-in is sent to other nodes included in the blockchain network, so that other nodes deploy a custom consensus plug-in. So that all nodes in the blockchain network can obtain custom consensus plugins. If the custom consensus mechanism initiated by other nodes in the blockchain network is optional, the custom consensus plugin sent by other nodes in the blockchain network is optional.
  • the local node deploys the custom consensus plug-in to the local node.
  • this embodiment when the existing consensus mechanism in the blockchain network is upgraded, this embodiment can generate an upgrade request including the custom consensus mechanism after acquiring and deploying the custom consensus mechanism, and initiate the upgrade request according to the upgrade request. Voting proposal business.
  • determine the height of the voting effective block initiate a voting proposal transaction based on the upgrade request and the voting effective block height, so that the block generation node responds to the vote if it detects that the current block height to be generated is the height of the voting effective block. Voting on proposal matters.
  • the time node at which voting starts can be limited. Since the block production time in the blockchain network is fixed and the block height is increased in order, the height of the voting effective block can be set, that is, the node that starts the voting operation is determined. Based on the upgrade request and the voting effective block height, a voting proposal is initiated. This voting proposal transaction is used to instruct the block generation node to detect the current block height. If it is detected that the current block height to be generated is the voting effective block height, it responds to the voting proposal transaction and instructs the block network Most nodes or special nodes vote on the voting proposal transaction associated with the upgrade request.
  • the height of the voting effective block is determined to be 469739.
  • a voting proposal transaction including a voting effective block height of 469739 is initiated, so that the block generation node always detects whether the current block height to be generated is 469739, and determines that the block height exists
  • the controlling blockchain network starts voting and gets the voting result.
  • the voting result is judged according to the default voting effective percentage threshold of the system. If the percentage of votes passed is greater than the default voting effective percentage threshold of the system, the voting is determined to be passed, and the consensus mechanism can be upgraded.
  • the three functions correspond to the three functions in the upgraded consensus mechanism in the blockchain network.
  • the voting effective proportion threshold of the voting proposal transaction is determined; the voting proposal transaction is initiated according to the upgrade request and the voting effective proportion threshold, so that if the block generating node passes the voting greater than the voting effective proportion threshold, it determines that the voting passes.
  • voting effective ratio threshold there is a default voting effective ratio threshold in the blockchain system.
  • the initiator can also set a voting effective ratio threshold. For example, you can set the voting effective percentage threshold to 80%.
  • the voting effective ratio threshold reflects the ratio of the number of nodes that agree to the upgrade request to the total number of nodes that vote. It is understandable that the higher the voting effective ratio, the better, indicating that more nodes in the blockchain network agree with the consensus Upgrade of mechanism.
  • the voting effective proportion threshold set by the local node is obtained; if the set voting effective proportion threshold is equal to or smaller than the system voting effective proportion threshold, the system voting effective proportion threshold is used as the voting effective proportion threshold of the voting proposal transaction; otherwise , Use the set voting effective proportion threshold as the voting effective proportion threshold of the voting proposal transaction.
  • the initiator sets the voting effective proportion threshold
  • the larger one is selected from the voting effective proportion threshold set by the local node and the system default voting effective proportion threshold to be determined as the voting proposal transaction. Threshold for voting effectiveness.
  • the voting proposal transaction when the voting effective proportion threshold of the voting proposal transaction is determined, the voting proposal transaction is initiated according to the upgrade request and the voting effective proportion threshold of the voting proposal transaction.
  • the voting proposal transaction is used to instruct the block generation node to control the blockchain network to vote on the voting proposal transaction associated with the upgrade request and obtain the voting result. Finally, the voting result is judged according to the determined voting effective proportion threshold. If the voting passing proportion is greater than the voting effective proportion threshold, it is determined that the voting passes and the consensus mechanism can be upgraded.
  • the voting effective percentage threshold set by the node is the voting effective of the voting proposal transaction.
  • Proportional threshold ie 80%.
  • a voting proposal transaction including a voting effective ratio threshold of 80% is initiated, so that the block generating node controls the nodes in the blockchain network to start voting and obtain the voting result.
  • the voting result is judged based on the 80% voting effective percentage threshold. If the percentage of votes passed is greater than 80%, the vote is determined to pass and the consensus mechanism can be upgraded.
  • the three functions in the custom consensus mechanism are used to correspond to the replacement area. Three functions in the upgraded consensus mechanism in a blockchain network.
  • the two methods of initiating the voting proposal transaction can be used independently or in combination, and the setting of specific parameters in the voting proposal transaction is not limited to the above two methods.
  • the voting proposal transaction is transmitted in the blockchain network, so that the block generation node performs the following operations: voting in response to the voting proposal transaction, and if the vote passes, the custom consensus mechanism is used as the consensus mechanism adopted by the blockchain network.
  • the voting proposal transaction is transmitted to the blockchain network so that most nodes or specific nodes in the blockchain network and the current
  • the block generation node receives the voting proposal transaction. Furthermore, the block generation node supervises all transactions associated with the voting proposal transaction in the blockchain network, and judges the blockchain network environment, the initiator of the upgrade request, and the content associated with the upgrade request based on the voting proposal transaction, and based on A decision is made to determine whether to respond to the voting proposal transaction. For example, the judgment can be made based on data information specified in the voting proposal affairs such as block height. If the voting proposal transaction can be voted on, the majority of nodes or specific nodes in the blockchain network vote on the voting proposal transaction.
  • the block generation node upgrades the consensus mechanism in response to the upgrade request based on the voting results.
  • the custom consensus mechanism replaces the upgraded consensus mechanism to achieve the upgrade of the consensus mechanism.
  • an initialization function in the custom consensus mechanism is used to initialize the state of the custom consensus mechanism.
  • the initialization function included in the custom consensus mechanism may be an initialization rule of the custom consensus mechanism, or may be initialized for an executable code segment. In the form of a function, it can be called by the blockchain network and initialized. , Used to assign initial values for each parameter or condition in the custom consensus mechanism configured in the local node for the first time, providing a basis for the operation of the custom consensus mechanism.
  • an initialization function in the custom consensus mechanism is used to initialize at least two consensus operation functions in the custom consensus mechanism, where at least two consensus operation functions include a block generation right check function and block validity sexual verification function.
  • this embodiment can call the corresponding consensus from the custom consensus mechanism based on the name of the consensus operation function in the consensus mechanism framework. Run the function.
  • this embodiment considers that the custom consensus mechanism meets the user needs of its initiator, and accordingly, the initiator needs to pay a certain price for it. Therefore, in this embodiment, when a voting proposal transaction including a custom consensus mechanism is initiated, a frozen certificate for initiating a proposal can also be determined, and a voting proposal transaction including a custom consensus mechanism and a freezing certificate can be initiated. Among them, the frozen certificate is used to allow the blockchain The network freezes the assets of the initiator. The freezing conditions can be limited or frozen when the freezing time reaches a certain block height.
  • the voting effective area associated with the voting proposal transaction is generated according to the upgrade request.
  • Setting the block height and / or voting effective percentage threshold initiating a voting proposal transaction associated with an upgrade request, and finally transmitting it to the blockchain network, so that the block generation node responds and controls the nodes in the blockchain network to vote And obtain the voting results, and use the custom consensus mechanism passed by the vote to upgrade the consensus mechanism.
  • the custom consensus mechanism adopted by the initialization is initialized, and the corresponding consensus operation function in the custom consensus mechanism is called according to the framework of the consensus mechanism.
  • the embodiment of the present application writes a custom consensus mechanism based on a standardized consensus mechanism framework, realizes the upgrade of the consensus mechanism in the blockchain network, and provides a block for the blockchain network to deploy a consensus mechanism that meets the business needs of the blockchain creator.
  • the modification or upgrade of the consensus mechanism in the chain network improves the transaction processing ability and user experience of the blockchain network.
  • FIG. 4 is a schematic structural diagram of a deployment mechanism for a consensus mechanism provided in Embodiment 4 of the present application.
  • Embodiments of the present application may be applicable to a case where a custom consensus mechanism is proposed according to user requirements.
  • the method for deploying the consensus mechanism described in any embodiment of the present application can be implemented.
  • the device specifically includes:
  • the plug-in obtaining module 410 is configured to obtain a custom consensus plug-in, where the custom consensus plug-in is obtained by compiling a custom consensus mechanism written based on a standardized consensus mechanism framework;
  • the plugin deployment module 420 is configured to deploy the custom consensus plugin in a local node.
  • the apparatus further includes a voting module 430; the voting module 430 includes:
  • a voting proposal initiation unit configured to generate an upgrade request including the custom consensus mechanism after the custom consensus plugin is deployed in the local node, and initiate a voting proposal transaction according to the upgrade request;
  • a voting proposal transaction transmission unit is configured to transmit the voting proposal transaction in a blockchain network, so that a block generating node performs the following operations: to vote in response to the voting proposal transaction, and to pass the custom consensus mechanism if the vote passes As a consensus mechanism adopted by the blockchain network.
  • the apparatus further includes:
  • An initialization module 440 is configured to use the custom consensus mechanism if the custom consensus mechanism is detected as the consensus mechanism adopted by the blockchain network after the custom consensus plugin is deployed in the local node.
  • the initialization function initializes the state of the custom consensus mechanism.
  • the initialization module 440 is specifically configured to:
  • the initialization function in the custom consensus mechanism is used to initialize at least two consensus operation functions in the custom consensus mechanism, where the at least two consensus operation functions include a block generation right check function and a block validity verification function.
  • the apparatus further includes:
  • a calling module 450 configured to initialize the state of the custom consensus mechanism by using an initialization function in the custom consensus mechanism, and then from the custom consensus mechanism based on a name of a consensus operation function in the consensus mechanism framework Call the corresponding consensus run function in.
  • the voting proposal initiation unit includes:
  • the voting start time determination subunit is used to determine the height of the voting effective block
  • the voting proposal initiation sub-unit is configured to initiate a voting proposal transaction according to the upgrade request and the voting effective block height, so that if the block generating node detects that the current block height to be generated is the voting effective block High, vote in response to the voting proposal transaction.
  • the voting proposal initiation unit includes:
  • a voting effective threshold determining subunit configured to determine a voting effective proportion threshold of the voting proposal transaction
  • the voting proposal initiation subunit is configured to initiate a voting proposal transaction according to the upgrade request and the voting effective proportion threshold, so that if the block generating node passes a voting value greater than the voting effective proportion threshold, then OK vote.
  • the voting effective threshold determination subunit is specifically configured to:
  • the system voting effective proportion threshold is used as the voting effective proportion threshold of the voting proposal transaction; otherwise, the set voting effective proportion threshold is used as the voting Threshold for the voting percentage of proposals.
  • the plug-in acquisition module 410 includes:
  • Custom consensus mechanism acquisition unit used to obtain a custom consensus mechanism written based on a standardized consensus mechanism framework
  • a compiling unit is configured to compile the custom consensus mechanism to obtain the custom consensus plug-in.
  • the apparatus further includes:
  • a mechanism sending module 460 is configured to send the custom consensus plug-in to other nodes included in the blockchain network after the custom consensus mechanism is compiled to obtain the custom consensus plug-in, so that the other The node deploys the custom consensus plugin.
  • the apparatus further includes:
  • the mechanism receiving module 470 is configured to receive a custom consensus plug-in sent by other nodes in the blockchain network.
  • the technical solution of this embodiment through the cooperation between each functional module, implements the writing of consensus mechanism code based on a standardized consensus mechanism framework, the compilation of consensus plugins, the reception or sending of custom consensus plugins, the deployment of consensus plugins, Generation of upgrade requests, initiation of voting proposal transactions, detection and initialization of consensus mechanisms, and invocation of consensus running functions.
  • the embodiment of the present application writes a custom consensus mechanism based on a standardized consensus mechanism framework, realizes the upgrade of the consensus mechanism in the blockchain network, and provides a block for the blockchain network to deploy a consensus mechanism that meets the business needs of the blockchain creator.
  • the modification or upgrade of the consensus mechanism in the chain network improves the transaction processing ability and user experience of the blockchain network.
  • FIG. 5 is a schematic structural diagram of a device provided in Embodiment 5 of the present application, and FIG. 5 shows a block diagram of an exemplary device suitable for implementing the implementation manner of the embodiment of the present application.
  • the device shown in FIG. 5 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present application.
  • the device 12 shown in FIG. 5 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present application.
  • the device 12 is represented in the form of a general-purpose computing device.
  • the components of the device 12 may include, but are not limited to, one or more processors 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processor 16).
  • the bus 18 represents one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local area bus using any of a variety of bus structures.
  • these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the enhanced ISA bus, the Video Electronics Standards Association (VESA) local area bus, and peripheral component interconnects ( PCI) bus.
  • the device 12 typically includes a variety of computer system-readable media. These media can be any available media that can be accessed by the device 12, including volatile and non-volatile media, removable and non-removable media.
  • System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32.
  • the device 12 may further include other removable / non-removable, volatile / nonvolatile computer system storage media.
  • the storage system 34 may be used to read and write non-removable, non-volatile magnetic media (not shown in FIG. 5 and is commonly referred to as a "hard drive").
  • a disk drive for reading and writing to a removable non-volatile disk (for example, a “floppy disk”) and a removable non-volatile optical disk (for example, CD-ROM, DVD-ROM) Or other optical media).
  • each drive may be connected to the bus 18 through one or more data medium interfaces.
  • the system memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present application.
  • a program / utility tool 40 having a set (at least one) of program modules 42 may be stored in, for example, system memory 28.
  • Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and programs Data, each or some combination of these examples may include an implementation of the network environment.
  • the program module 42 generally performs functions and / or methods in the embodiments described in the embodiments of the present application.
  • the device 12 may also communicate with one or more external devices 14 (such as a keyboard, pointing device, display 24, etc.), and may also communicate with one or more devices that enable a user to interact with the device 12, and / or with the device that enables
  • the device 12 can communicate with any device (e.g., a network card, modem, etc.) that can communicate with one or more other computing devices. This communication can be performed through an input / output (I / O) interface 22.
  • the device 12 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 20. As shown, the network adapter 20 communicates with other modules of the device 12 via the bus 18.
  • LAN local area network
  • WAN wide area network
  • public network such as the Internet
  • the processor 16 executes various functional applications and data processing by running a program stored in the system memory 28, for example, a method for deploying a consensus mechanism provided by the embodiment of the present application.
  • Embodiment 6 of the present application further provides a computer-readable storage medium storing a computer program (or computer-executable instructions) stored thereon, which is executed by a processor to execute a deployment method of a consensus mechanism.
  • Methods include:
  • custom consensus plug-in Obtain a custom consensus plug-in, where the custom consensus plug-in is obtained by compiling a custom consensus mechanism written based on a standardized consensus mechanism framework;
  • the computer storage medium in the embodiments of the present application may adopt any combination of one or more computer-readable media.
  • the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium.
  • the computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in combination with an instruction execution system, apparatus, or device.
  • the computer-readable signal medium may include a data signal in baseband or propagated as part of a carrier wave, which carries a computer-readable program code. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
  • the computer program code for performing the operations of the embodiments of the present application may be written in one or more programming languages or a combination thereof, the programming language including an object-oriented programming language such as Java, Smalltalk, C ++, and also Regular procedural programming language—such as "C" or similar programming language.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, as an independent software package, partly on the user's computer, partly on a remote computer, or entirely on a remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider) Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider Internet service provider

Abstract

本文公开了一种共识机制的部署方法、装置、设备和存储介质。该方法包括:获取自定义共识插件,其中所述自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的;在本机节点中部署所述自定义共识插件。本文实施例基于标准化的共识机制框架编写自定义共识机制,实现了为区块链网络部署满足区块链创建者业务需求的共识机制,提供了区块链网络中共识机制的修改或升级的方式,提高了区块链网络的事务处理能力和用户体验。

Description

共识机制的部署方法、装置、设备和存储介质
本申请要求在2018年7月16日提交中国专利局、申请号为201810779236.8的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及区块链技术领域,例如涉及一种共识机制的部署方法、装置、设备和存储介质。
背景技术
随着互联网技术的不断发展,一种去中心化且公开透明的区块链技术应运而生。区块链网络可以支持不同的共识机制,共识机制作为区块链技术的重要组件,辅助区块链网络实现对区块链内部产生的事务进行验证和确认,保证区块链网络中所有诚实节点的一致性以及事务记录的有效性。
目前,区块链网络在创建前期就已经完成了内部共识机制的配置,例如在创建创世区块时就配置了相应的共识机制,从而区块链网络中的节点依据区块链网络内嵌的共识机制,完成对区块链网络内部产生的事务进行验证和确认。例如,比特币应用场景中内嵌的共识机制为工作量证明机制(Proof of Work,POW),以太坊应用场景中内嵌的共识机制为POW或权益证明机制(Proof of Stake,POS),超级账本(Hyperledger Fabric)应用场景中内嵌的共识机制为 实用拜占庭容错机制(Practical Byzantine Fault Tolerance,PBFT)或分布式队列机制(Kafka)。
然而,在创建区块链之后,共识机制以固定且不可修改的形式配置于区块链网络中,系统内嵌的共识机制得不到升级,无法满足区块链创建者日渐增加或变化的业务需求。
发明内容
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本申请实施例提供了一种共识机制的部署方法、装置、设备和存储介质,能够为区块链网络部署自定义共识机制。
第一方面,本申请实施例提供了一种共识机制的部署方法,由区块链网络中的节点执行,所述方法包括:
获取自定义共识插件,其中所述自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的;
在本机节点中部署所述自定义共识插件。
第二方面,本申请实施例提供了一种共识机制的部署装置,配置于区块链网络中的节点中,所述装置包括:
插件获取模块,用于获取自定义共识插件,其中所述自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的;
插件部署模块,用于在本机节点中部署所述自定义共识插件。
第三方面,本申请实施例提供了一种设备,包括:
一个或多个处理器;
存储器,用于存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本申请任意实施例所述的共识机制的部署方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现本申请任意实施例所述的共识机制的部署方法。
本申请实施例通过采用标准化的共识机制框架来编写自定义共识机制,并将编写的自定义共识机制编译为自定义共识插件,以插件的形式将自定义共识机制部署于本机节点中。本申请实施例基于标准化的共识机制框架编写自定义共识机制,实现了为区块链网络部署满足区块链创建者业务需求的共识机制,提供了区块链网络中共识机制的修改或升级的方式,提高了区块链网络的事务处理能力和用户体验。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图说明
图1为本申请实施例一提供的一种共识机制的部署方法的流程图;
图2为本申请实施例二提供的一种共识机制的部署方法的流程图;
图3为本申请实施例三提供的一种共识机制的部署方法的流程图;
图4为本申请实施例四提供的一种共识机制的部署装置的结构示意图;
图5为本申请实施例五提供的一种设备的结构示意图。
具体实施方式
下面结合附图和实施例对本申请实施例作进一步的详细说明。可以理解的 是,此处所描述的具体实施例仅仅用于解释本申请实施例,而非对本申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本申请实施例相关的部分而非全部结构。
实施例一
图1为本申请实施例一提供的一种共识机制的部署方法的流程图。该方法应用于区块链网络中的节点,区块链可以是公有链、联盟链或私有链,区块链网络通常都会包括多个节点。本申请实施例可适用于依据用户需求提出自定义共识机制的情况,该方法可由配置于区块链网络的节点中的一种共识机制的部署装置来执行。该方法具体包括如下步骤:
S110、获取自定义共识插件,其中自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的。
在本实施例中,自定义共识机制是指区块链网络中的一个节点依据用户业务需求所编写的可供区块链网络中的每个节点进行事务验证和确认时所执行的代码段。自定义共识插件是指编写自定义共识机制的节点将自定义共识机制代码编译成的可执行文件,并以插件的形式配置于区块链网站的节点中。需要说明的是,自定义共识插件可以是本机节点用户自己编写并编译的,也可以是其他用户在区块链网络中其他节点编写自定义共识机制代码,将自定义共识机制代码编译成可执行文件,并发布到本机节点中的。
具体的,本实施例采用标准化的共识机制框架来编写自定义共识机制。其中,标准化的共识机制框架将共识机制架构进行了规范化处理,其中可以对共识机制的编写格式、存在形式以及命名规则等编写方式进行了统一的限制。因此区块链网络中的节点在编写自定义共识机制时,依据框架内的编写规则,在标准化的共识机制框架的基础上自定义共识机制相应的内容即可。本实施例中 的标准化的共识机制框架不仅对共识机制的编写方式进行了统一,为用户的编写带来了便利,而且便于后期共识机制的统一调用。
进一步的,本实施例可以采用区块链原生语言来编写自定义共识机制,其中区块链原生语言是指可以编写区块链底层网络架构的语言,例如GO语言、Java语言或者C++语言等。
示例性的,本实施例中的标准化的共识机制框架中包括至少三个基本的共识运行函数,分别为初始化函数、区块生成权验证函数以及区块有效性验证函数。可以理解的是,初始化函数用于在自定义共识机制首次部署于区块链网络中的节点中时,依据当前区块链网络的状态为自定义共识机制进行初始化,例如对自定义共识机制中包括的参数或条件赋予初始值;区块生成权验证函数用于验证是否争取到事务处理权;区块有效性验证函数用于验证新的区块中所记录的事务的有效性。
值得注意的是,本实施例即使采用现有的共识机制作为当前区块链网络的共识机制时,仍然需要按照标准化的共识机制框架对现有的共识机制进行标准化处理,以对其进行格式或形式上的转换,符合当前区块链网络中的共识机制框架。示例性的,在上述示例中,若采用POW机制作为当前区块链网络的共识机制,则需要将POW机制转换为包括初始化函数、区块生成权验证函数以及区块有效性验证函数三种函数的存在形式,并依据命名规则规范函数的命名。
进一步的,在获取自定义共识插件时,若本机节点发起的自定义共识机制,则本机节点可以获取基于标准化的共识机制框架编写的自定义共识机制,对自定义共识机制进行编译得到自定义共识插件。并向区块链网络中包括的其他节点发送该自定义共识插件,使其他节点部署该自定义共识插件。若区块链网络中的其他节点发起的自定义共识机制,则本机节点可以接收区块链网络中其他 节点发送的自定义共识插件。实现区块链网络的每个节点中自定义共识机制的统一部署。
S120、在本机节点中部署自定义共识插件。
在本实施例中,无论是本机节点下发的自定义共识机制还是区块链网络中的其他节点下发的自定义共识机制,自定义共识插件都会发布到区块链网络中的每个节点当中,以使区块链网络内部的共识机制得到统一,区块链网络中的所有节点都可以依据一致的共识机制对区块链内部事务进行验证和确认。进而本机节点在获取到自定义共识插件后,将自定义共识插件部署在本机节点中。可以理解的是,自定义共识插件以插件的形式可以部署在本机节点的物理机中。
进一步的,在本机节点中部署自定义共识插件之后,还可以依据不同的区块链类型以及节点的权限,判断是否可以将该自定义共识机制作为区块链网络采用的共识机制。其中在区块链创建时,为区块链网络配置的共识机制即为区块链网络采用的共识机制。此外,还可以通过区块链网络中节点的投票或者有权限节点的指定,来确定自定义共识机制是否可以作为区块链网络采用的共识机制。
示例性的,若当前区块链为公有链,则自定义共识机制可以作为区块链网络内部的待处理事务,区块链网络中的多数节点需要依据当前区块链网络现有的共识机制,对部署后的自定义共识机制进行验证,以验证是否可以将该自定义共识机制作为区块链网络采用的共识机制。相应的,发布自定义共识机制的节点生成包括自定义共识机制的升级请求,并依据升级请求发起投票提案事务。具体的,在发起投票提案事务时,可以确定投票生效区块高度,依据升级请求以及投票生效区块高度发起投票提案事务,使区块生成节点若检测到待生成的当前区块高度是投票生效区块高度,则响应投票提案事务进行投票。还可以确 定投票提案事务的投票生效比例阈值,依据升级请求以及投票生效比例阈值发起投票提案事务,使区块生成节点在若投票通过的比例值大于所述投票生效比例阈值,则确定投票通过。其中,投票生效比例阈值是通过获取本机节点设定的投票生效比例阈值,若设定的投票生效比例阈值等于或小于系统投票生效比例阈值,则将系统投票生效比例阈值作为投票提案事务的投票生效比例阈值;否则,将设定的投票生效比例阈值作为投票提案事务的投票生效比例阈值。进而在区块链网络中传输投票提案事务,使区块生成节点响应投票提案事务进行投票,若投票通过则将自定义共识机制作为区块链网络采用的共识机制,实现对区块链网络中共识机制的升级。可以理解的是,在对区块链网络中的共识机制进行升级时,需要基于标准化的共识机制框架,使用自定义共识机制全部替换掉被升级的共识机制。例如,在上述包含三个基本共识运行函数的共识机制框架的基础上,需要采用自定义共识机制中的三个函数对应替换掉被升级的共识机制中的三个函数。
示例性的,若当前区块链网络为联盟链或私有链,则区块链网络中的特定节点具有一定的权限,可以指定区块链采用的共识机制。进而这样的节点可以在区块链网络中指定采用每个节点中部署的自定义共识机制。
其中,自定义共识机制还包括初始化函数。进而自定义共识机制作为区块链网络中的一个全新的共识机制,若节点检测到将自定义共识机制作为区块链网络采用的共识机制,则采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化。示例性的,在标准化的共识机制框架的基础上,可以采用自定义共识机制中的初始化函数对自定义共识机制中的至少两个共识运行函数进行初始化,其中至少两个共识运行函数包括区块生成权校验函数和区块有效性验证函数。最终基于初始化后的自定义共识机制以及共识机制框架中 的共识运行函数名称,从自定义共识机制中调用相应的共识运行函数。
本实施例的技术方案,通过采用标准化的共识机制框架来编写自定义共识机制,并将编写的自定义共识机制编译为自定义共识插件,以插件的形式将自定义共识机制部署于本机节点中。本申请实施例基于标准化的共识机制框架编写自定义共识机制,实现了为区块链网络部署满足区块链创建者业务需求的共识机制,提供了区块链网络中共识机制的修改或升级的方式,提高了区块链网络的事务处理能力和用户体验。
实施例二
本实施例在上述实施例一的基础上,提供了共识机制的部署方法的一个优选实施方式,能够对节点中部署的自定义共识机制进行初始化和调用。图2为本申请实施例二提供的一种共识机制的部署方法的流程图,如图2所示,该方法包括以下具体步骤:
S210、获取自定义共识插件。
在本实施例中,自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的。标准化的共识机制框架将共识机制架构进行了规范化处理,其中可以对共识机制的编写格式、存在形式以及命名规则等编写方式进行了统一的限制。本实施例的共识机制框架中包括至少三个基本的共识运行函数,分别为初始化函数、区块生成权验证函数以及区块有效性验证函数。
具体的,若本机节点发起的自定义共识机制,可选的,获取基于标准化的共识机制框架编写的自定义共识机制;对自定义共识机制进行编译得到自定义共识插件。其中,本机节点用户自己编写的自定义共识机制,并将其编译为插件形式的可执行文件。进一步的,向区块链网络中包括的其他节点发送自定义 共识插件,使其他节点部署自定义共识插件。由于区块链网络的每个节点所遵循的共识机制是一致的,因此本机节点在完成对自定义共识插件的编译后,需要向区块链网络中的所有其他节点下发自定义共识插件,以保证网络内部共识机制的一致性。若区块链网络中的其他节点发起的自定义共识机制,可选的,接收区块链网络中其他节点发送的自定义共识插件。此时本机节点只需等待接收自定义共识插件即可。
S220、在本机节点中部署自定义共识插件。
在本实施例中,本机节点在获取到自定义共识插件后,将自定义共识插件部署在本机节点中。可以理解的是,自定义共识插件以插件的形式可以部署在本机节点的物理机中。
S230、若检测到将自定义共识机制作为区块链网络采用的共识机制,则采用自定义共识机制中的初始化函数对自定义共识机制的状态进行初始化。
在本实施例中,自定义共识机制包括的初始化函数可以为自定义共识机制的初始化规则,也可以为可执行代码段进行初始化,以函数的形式能够被区块链网络调用并完成初始化即可,用于为首次配置于本地节点中的自定义共识机制中的每个参数或条件进行初始值的赋值,为自定义共识机制的运行提供依据。
具体的,在本机节点中部署自定义共识插件之后,可以依据不同的区块链类型以及节点的权限,判断是否可以将该自定义共识机制作为区块链网络采用的共识机制。其中,在区块链创建时,为区块链网络配置的共识机制即为区块链网络采用的共识机制。此外,还可以通过区块链网络中节点的投票或者有权限节点的指定,来确定自定义共识机制是否可以作为区块链网络采用的共识机制。若创建区块链时配置了共识机制,或者对包含自定义共识机制的投票提案事务投票通过,或者具备权限的节点指定了采用的共识机制,则视为检测到了 将自定义共识机制作为区块链网络采用的共识机制。自定义共识机制作为区块链网络中的一个全新的共识机制,节点采用自定义共识机制中的初始化函数对自定义共识机制的状态进行初始化。
可选的,采用自定义共识机制中的初始化函数对自定义共识机制中的至少两个共识运行函数进行初始化,其中至少两个共识运行函数包括区块生成权校验函数和区块有效性验证函数。
在本实施例中,鉴于共识机制框架中至少包括初始化函数、区块生成权验证函数以及区块有效性验证函数这三个基本的共识运行函数,因此可以依据当前区块链网络状态,采用初始化函数对区块生成权验证函数和区块有效性验证函数进行初始化。
S240、基于共识机制框架中的共识运行函数名称从自定义共识机制中调用相应的共识运行函数。
在本实施例中,鉴于共识机制框架规定了共识机制的编写格式、存在形式以及命名规则等,因此本实施例可以基于共识机制框架中的共识运行函数名称从自定义共识机制中调用相应的共识运行函数。示例性的,在区块链网络中有新的区块产生时,则依据统一的命名规则,从自定义共识机制中查找到函数名称相符的区块有效性验证函数,并进行调用,以对新的区块中的事务记录进行有效性验证。
本实施例的技术方案,通过获取自定义共识插件并部署于区块链网络中的每个节点中,对采用的自定义共识机制进行初始化,从而可以依据共识机制框架调用自定义共识机制中相应的共识运行函数。本申请实施例基于标准化的共识机制框架编写自定义共识机制,实现了为区块链网络部署满足区块链创建者业务需求的共识机制,提供了区块链网络中共识机制的修改或升级的方式,提 高了区块链网络的事务处理能力和用户体验。
实施例三
本实施例在上述实施例一的基础上,提供了共识机制的部署方法的一个优选实施方式,能够基于自定义的共识机制对区块链网络中的共识机制进行升级。图3为本申请实施例三提供的一种共识机制的部署方法的流程图,如图3所示,该方法包括以下具体步骤:
S310、获取自定义共识插件。
在本实施例中,自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的。若本机节点发起的自定义共识机制,可选的,获取基于标准化的共识机制框架编写的自定义共识机制;对自定义共识机制进行编译得到自定义共识插件。进一步的,向区块链网络中包括的其他节点发送自定义共识插件,使其他节点部署自定义共识插件。以使区块链网络中的所有节点都获取自定义共识插件。若区块链网络中的其他节点发起的自定义共识机制,可选的,接收区块链网络中其他节点发送的自定义共识插件。
S320、在本机节点中部署自定义共识插件。
在本实施例中,本机节点在获取到自定义共识插件后,将自定义共识插件部署在本机节点中。
S330、生成包括自定义共识机制的升级请求,并依据升级请求发起投票提案事务。
在本实施例中,对于区块链网络中现有的共识机制进行升级时,本实施例可以在获取并部署自定义共识机制后,生成包括自定义共识机制的升级请求,并依据升级请求发起投票提案事务。
可选的,确定投票生效区块高度;依据升级请求以及投票生效区块高度发起投票提案事务,使区块生成节点若检测到待生成的当前区块高度是投票生效区块高度,则响应投票提案事务进行投票。
在本实施例中,可以限制投票开始的时间节点。由于区块链网络中的出块时间是固定的,区块高度是依次递增的,因此可以对投票生效区块高度进行设定,即确定投票操作的开始执行时间节点。进而依据升级请求以及投票生效区块高度发起投票提案事务。该投票提案事务用于指示区块生成节点对当前区块高度进行检测,若检测到待生成的当前区块高度是投票生效区块高度,则响应投票提案事务,并指示区块链网络中的多数节点或特殊节点对关联有升级请求的投票提案事务进行投票。
示例性的,确定投票生效区块高度为469739。则依据升级请求以及投票生效区块高度发起包含投票生效区块高度为469739的投票提案事务,以使区块生成节点时刻检测待生成的当前区块高度是否为469739,并在确定存在区块高度为469739的区块生成时,控制区块链网络开始投票并获取投票结果。最终依据系统默认的投票生效比例阈值对投票结果进行判定,若投票通过的比例值大于该系统默认的投票生效比例阈值,则确定投票通过,可以对共识机制进行升级,采用自定义共识机制中的三个函数对应替换区块链网络中被升级的共识机制中的三个函数。
可选的。确定投票提案事务的投票生效比例阈值;依据升级请求以及投票生效比例阈值发起投票提案事务,使区块生成节点在若投票通过的比例值大于所述投票生效比例阈值,则确定投票通过。
在本实施例中,区块链系统中存在默认的投票生效比例阈值,此外,发起方也可以设定投票生效比例阈值。例如,可以设定投票生效比例阈值为80%。 投票生效比例阈值反映了认同升级请求的节点数量与进行投票的全部节点数量的比值,可以理解的是,投票生效比例越高越好,表示区块链网络中存在更多的节点认同此次共识机制的升级。
进一步的,获取本机节点设定的投票生效比例阈值;若设定的投票生效比例阈值等于或小于系统投票生效比例阈值,则将系统投票生效比例阈值作为投票提案事务的投票生效比例阈值;否则,将设定的投票生效比例阈值作为投票提案事务的投票生效比例阈值。
在本实施例中,当发起方设定投票生效比例阈值时,则从本机节点设定的投票生效比例阈值以及系统默认的投票生效比例阈值中,选择阈值较大的一个确定为投票提案事务的投票生效比例阈值。
本实施例在确定投票提案事务的投票生效比例阈值时,依据升级请求以及投票提案事务的投票生效比例阈值发起投票提案事务。该投票提案事务用于指示区块生成节点控制区块链网络对关联有升级请求的投票提案事务进行投票,并获取投票结果。最终依据确定的投票生效比例阈值对投票结果进行判定,若投票通过的比例值大于该投票生效比例阈值,则确定投票通过,可以对共识机制进行升级。
示例性的,假设系统默认的投票生效比例阈值为60%,节点设定的投票生效比例阈值为80%,则通过比较,即可确定节点设定的投票生效比例阈值为投票提案事务的投票生效比例阈值,即80%。进而依据升级请求以及投票生效比例阈值发起包含投票生效比例阈值为80%的投票提案事务,以使区块生成节点控制区块链网络中的节点开始投票并获取投票结果。最终依据80%的投票生效比例阈值对投票结果进行判定,若投票通过的比例值大于80%,则确定投票通过,可以对共识机制进行升级,采用自定义共识机制中的三个函数对应替换区 块链网络中被升级的共识机制中的三个函数。
需要说明的是,上述两种投票提案事务的发起方式可以独立使用,也可以结合使用,且投票提案事务中的具体参数的设置不局限于上述两种方式。
S340、在区块链网络中传输投票提案事务,使区块生成节点执行如下操作:响应投票提案事务进行投票,若投票通过则将所述自定义共识机制作为区块链网络采用的共识机制。
在本实施例中,当升级请求的发起方发起投票提案事务时,则将该投票提案事务传输至区块链网络中,以使区块链网络中的多数节点或特定的节点,以及当前的区块生成节点接收到投票提案事务。进而区块生成节点对区块链网络中与该投票提案事务关联的一切事务进行监督,依据投票提案事务对区块链网络环境、升级请求的发起方以及升级请求关联的内容进行判定,并依据判定结果来确定是否响应该投票提案事务。例如,可以依据区块高度等投票提案事务规定的数据信息进行判定。若可以对该投票提案事务进行投票,则区块链网络中的多数节点或特定的节点对该投票提案事务进行投票。区块生成节点依据投票结果,若投票通过则响应升级请求进行共识机制升级,即将自定义共识机制替换被升级的共识机制,实现对共识机制的升级。
S350、若检测到将自定义共识机制作为区块链网络采用的共识机制,则采用自定义共识机制中的初始化函数对自定义共识机制的状态进行初始化。
在本实施例中,自定义共识机制包括的初始化函数可以为自定义共识机制的初始化规则,也可以为可执行代码段进行初始化,以函数的形式能够被区块链网络调用并完成初始化即可,用于为首次配置于本地节点中的自定义共识机制中的每个参数或条件进行初始值的赋值,为自定义共识机制的运行提供依据。可选的,采用自定义共识机制中的初始化函数对所述自定义共识机制中的至少 两个共识运行函数进行初始化,其中至少两个共识运行函数包括区块生成权校验函数和区块有效性验证函数。
S360、基于共识机制框架中的共识运行函数名称从自定义共识机制中调用相应的共识运行函数。
在本实施例中,鉴于共识机制框架规定了共识机制的编写格式、存在形式以及命名规则等,因此本实施例可以基于共识机制框架中的共识运行函数名称从自定义共识机制中调用相应的共识运行函数。
除此之外,本实施例考虑到自定义共识机制满足了其发起方的用户需求,相应的,发起方需要为其付出一定的代价。因此本实施例在发起包括自定义共识机制的投票提案事务时,还可以确定发起提案的冻结证明,发起包括自定义共识机制和冻结证明的投票提案事务;其中,冻结证明用于允许区块链网络对发起方的资产进行冻结,其中可以限定冻结条件或者冻结时间即到一定的区块高度时进行冻结。
本实施例的技术方案,在获取自定义共识插件并部署于区块链网络中的每个节点之后,通过生成包含自定义共识机制的升级请求,依据升级请求对投票提案事务关联的投票生效区块高度和/或投票生效比例阈值的设定,发起关联有升级请求的投票提案事务,最终传输至区块链网络中,以使区块生成节点响应并控制区块链网络中的节点进行投票并获取投票结果,采用投票通过的自定义共识机制进行共识机制的升级。从而对接纳采用的自定义共识机制进行初始化,依据共识机制框架调用自定义共识机制中相应的共识运行函数。本申请实施例基于标准化的共识机制框架编写自定义共识机制,实现了区块链网络中共识机制的升级,为区块链网络部署满足区块链创建者业务需求的共识机制,提供了区块链网络中共识机制的修改或升级的方式,提高了区块链网络的事务处理能 力和用户体验。
实施例四
图4为本申请实施例四提供的一种共识机制的部署装置的结构示意图,本申请实施例可适用于依据用户需求提出自定义共识机制的情况,该装置配置于区块链网络中的节点中,可实现本申请任意实施例所述的共识机制的部署方法。该装置具体包括:
插件获取模块410,用于获取自定义共识插件,其中所述自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的;
插件部署模块420,用于在本机节点中部署所述自定义共识插件。
在一实施例中,所述装置还包括投票模块430;所述投票模块430包括:
投票提案发起单元,用于在所述在本机节点中部署所述自定义共识插件之后,生成包括所述自定义共识机制的升级请求,并依据所述升级请求发起投票提案事务;
投票提案事务传输单元,用于在区块链网络中传输所述投票提案事务,使区块生成节点执行如下操作:响应所述投票提案事务进行投票,若投票通过则将所述自定义共识机制作为区块链网络采用的共识机制。
在一实施例中,所述装置还包括:
初始化模块440,用于在所述在本机节点中部署所述自定义共识插件之后,若检测到将所述自定义共识机制作为区块链网络采用的共识机制,则采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化。
在一实施例中,所述初始化模块440具体用于:
采用自定义共识机制中的初始化函数对所述自定义共识机制中的至少两个共识运行函数进行初始化,其中所述至少两个共识运行函数包括区块生成权校验函数和区块有效性验证函数。
在一实施例中,所述装置还包括:
调用模块450,用于在所述采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化之后,基于所述共识机制框架中的共识运行函数名称从所述自定义共识机制中调用相应的共识运行函数。
在一实施例中,所述投票提案发起单元包括:
投票开始时间确定子单元,用于确定投票生效区块高度;
投票提案发起子单元,用于依据所述升级请求以及所述投票生效区块高度发起投票提案事务,使所述区块生成节点若检测到待生成的当前区块高度是所述投票生效区块高度,则响应所述投票提案事务进行投票。
在一实施例中,所述投票提案发起单元包括:
投票生效阈值确定子单元,用于确定所述投票提案事务的投票生效比例阈值;
所述投票提案发起子单元,用于依据所述升级请求以及所述投票生效比例阈值发起投票提案事务,使所述区块生成节点在若投票通过的比例值大于所述投票生效比例阈值,则确定投票通过。
在一实施例中,所述投票生效阈值确定子单元具体用于:
获取本机节点设定的投票生效比例阈值;
若设定的投票生效比例阈值等于或小于系统投票生效比例阈值,则将系统投票生效比例阈值作为所述投票提案事务的投票生效比例阈值;否则,将设定的投票生效比例阈值作为所述投票提案事务的投票生效比例阈值。
在一实施例中,所述插件获取模块410包括:
自定义共识机制获取单元,用于获取基于标准化的共识机制框架编写的自定义共识机制;
编译单元,用于对所述自定义共识机制进行编译得到所述自定义共识插件。
在一实施例中,所述装置还包括:
机制发送模块460,用于在所述对所述自定义共识机制进行编译得到所述自定义共识插件之后,向区块链网络中包括的其他节点发送所述自定义共识插件,使所述其他节点部署所述自定义共识插件。
在一实施例中,所述装置还包括:
机制接收模块470,用于接收区块链网络中其他节点发送的自定义共识插件。
本实施例的技术方案,通过每个功能模块之间的相互配合,实现了基于标准化的共识机制框架编写共识机制代码、共识插件的编译、自定义共识插件的接收或发送、共识插件的部署、升级请求的生成、投票提案事务的发起、共识机制的检测和初始化以及共识运行函数的调用等功能。本申请实施例基于标准化的共识机制框架编写自定义共识机制,实现了区块链网络中共识机制的升级,为区块链网络部署满足区块链创建者业务需求的共识机制,提供了区块链网络中共识机制的修改或升级的方式,提高了区块链网络的事务处理能力和用户体验。
实施例五
图5为本申请实施例五提供的一种设备的结构示意图,图5示出了适于用来实现本申请实施例实施方式的示例性设备的框图。图5显示的设备仅仅是一 个示例,不应对本申请实施例的功能和使用范围带来任何限制。
图5显示的设备12仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。
如图5所示,设备12以通用计算设备的形式表现。设备12的组件可以包括但不限于:一个或者多个处理器16,系统存储器28,连接不同系统组件(包括系统存储器28和处理器16)的总线18。
总线18表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA)总线,微通道体系结构(MAC)总线,增强型ISA总线、视频电子标准协会(VESA)局域总线以及外围组件互连(PCI)总线。
设备12典型地包括多种计算机系统可读介质。这些介质可以是任何能够被设备12访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。
系统存储器28可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(RAM)30和/或高速缓存存储器32。设备12可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统34可以用于读写不可移动的、非易失性磁介质(图5未显示,通常称为“硬盘驱动器”)。尽管图5中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CD-ROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线18相连。系统存储器28可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序 模块被配置以执行本申请实施例各实施例的功能。
具有一组(至少一个)程序模块42的程序/实用工具40,可以存储在例如系统存储器28中,这样的程序模块42包括但不限于操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块42通常执行本申请实施例所描述的实施例中的功能和/或方法。
设备12也可以与一个或多个外部设备14(例如键盘、指向设备、显示器24等)通信,还可与一个或者多个使得用户能与该设备12交互的设备通信,和/或与使得该设备12能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口22进行。并且,设备12还可以通过网络适配器20与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器20通过总线18与设备12的其它模块通信。应当明白,尽管图中未示出,可以结合设备12使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。
处理器16通过运行存储在系统存储器28中的程序,从而执行各种功能应用以及数据处理,例如实现本申请实施例所提供的共识机制的部署方法。
实施例六
本申请实施例六还提供一种计算机可读存储介质,其上存储有计算机程序(或称为计算机可执行指令),该程序被处理器执行时用于执行一种共识机制的部署方法,该方法包括:
获取自定义共识插件,其中所述自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的;
在本机节点中部署所述自定义共识插件。
本申请实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于无线、电线、光缆、RF等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言或其组合来编写用于执行本申请实施例操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如 Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如”C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。

Claims (21)

  1. 一种共识机制的部署方法,由区块链网络中的节点执行,所述方法包括:
    获取自定义共识插件,其中所述自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的;
    在本机节点中部署所述自定义共识插件。
  2. 根据权利要求1所述的方法,在所述在本机节点中部署所述自定义共识插件之后,还包括:
    生成包括所述自定义共识机制的升级请求,并依据所述升级请求发起投票提案事务;
    在区块链网络中传输所述投票提案事务,使区块生成节点执行如下操作:响应所述投票提案事务进行投票,若投票通过则将所述自定义共识机制作为区块链网络采用的共识机制。
  3. 根据权利要求1所述的方法,在所述在本机节点中部署所述自定义共识插件之后,还包括:
    若检测到将所述自定义共识机制作为区块链网络采用的共识机制,则采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化。
  4. 根据权利要求3所述的方法,其中,所述采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化,包括:
    采用自定义共识机制中的初始化函数对所述自定义共识机制中的至少两个共识运行函数进行初始化,其中所述至少两个共识运行函数包括区块生成权校验函数和区块有效性验证函数。
  5. 根据权利要求3所述的方法,在所述采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化之后,还包括:
    基于所述共识机制框架中的共识运行函数名称从所述自定义共识机制中调用相应的共识运行函数。
  6. 根据权利要求2所述的方法,其中,所述依据所述升级请求发起投票提案事务,包括:
    确定投票生效区块高度;
    依据所述升级请求以及所述投票生效区块高度发起投票提案事务,使所述区块生成节点若检测到待生成的当前区块高度是所述投票生效区块高度,则响应所述投票提案事务进行投票。
  7. 根据权利要求2所述的方法,其中,所述依据所述升级请求发起投票提案事务,包括:
    确定所述投票提案事务的投票生效比例阈值;
    依据所述升级请求以及所述投票生效比例阈值发起投票提案事务,使所述区块生成节点在若投票通过的比例值大于所述投票生效比例阈值,则确定投票通过。
  8. 根据权利要求7所述的方法,其中,所述确定所述投票提案事务的投票生效比例阈值,包括:
    获取本机节点设定的投票生效比例阈值;
    若设定的投票生效比例阈值等于或小于系统投票生效比例阈值,则将系统投票生效比例阈值作为所述投票提案事务的投票生效比例阈值;否则,将设定的投票生效比例阈值作为所述投票提案事务的投票生效比例阈值。
  9. 根据权利要求1所述的方法,其中,所述获取自定义共识插件,包括:
    获取基于标准化的共识机制框架编写的自定义共识机制;
    对所述自定义共识机制进行编译得到所述自定义共识插件。
  10. 根据权利要求9所述的方法,在所述对所述自定义共识机制进行编译得到所述自定义共识插件之后,还包括:
    向区块链网络中包括的其他节点发送所述自定义共识插件,使所述其他节点部署所述自定义共识插件。
  11. 根据权利要求9所述的方法,其中,所述获取自定义共识插件,包括:
    接收区块链网络中其他节点发送的自定义共识插件。
  12. 一种共识机制的部署装置,配置于区块链网络中的节点中,所述装置包括:
    插件获取模块,用于获取自定义共识插件,其中所述自定义共识插件是对基于标准化的共识机制框架编写的自定义共识机制进行编译得到的;
    插件部署模块,用于在本机节点中部署所述自定义共识插件。
  13. 根据权利要求12所述的装置,还包括投票模块;所述投票模块包括:
    投票提案发起单元,用于在所述在本机节点中部署所述自定义共识插件之后,生成包括所述自定义共识机制的升级请求,并依据所述升级请求发起投票提案事务;
    投票提案事务传输单元,用于在区块链网络中传输所述投票提案事务,使区块生成节点执行如下操作:响应所述投票提案事务进行投票,若投票通过则将所述自定义共识机制作为区块链网络采用的共识机制。
  14. 根据权利要求12所述的装置,还包括:
    初始化模块,用于在所述在本机节点中部署所述自定义共识插件之后,若检测到将所述自定义共识机制作为区块链网络采用的共识机制,则采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化。
  15. 根据权利要求14所述的装置,其中,所述初始化模块具体用于:
    采用自定义共识机制中的初始化函数对所述自定义共识机制中的至少两个共识运行函数进行初始化,其中所述至少两个共识运行函数包括区块生成权校验函数和区块有效性验证函数。
  16. 根据权利要求14所述的装置,还包括:
    调用模块,用于在所述采用自定义共识机制中的初始化函数对所述自定义共识机制的状态进行初始化之后,基于所述共识机制框架中的共识运行函数名称从所述自定义共识机制中调用相应的共识运行函数。
  17. 根据权利要求12所述的装置,其中,所述插件获取模块包括:
    自定义共识机制获取单元,用于获取基于标准化的共识机制框架编写的自定义共识机制;
    编译单元,用于对所述自定义共识机制进行编译得到所述自定义共识插件。
  18. 根据权利要求12所述的装置,还包括:
    机制发送模块,用于在所述对所述自定义共识机制进行编译得到所述自定义共识插件之后,向区块链网络中包括的其他节点发送所述自定义共识插件,使所述其他节点部署所述自定义共识插件。
  19. 根据权利要求12所述的装置,还包括:
    机制接收模块,用于接收区块链网络中其他节点发送的自定义共识插件。
  20. 一种设备,包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1至11中任一项所述的共识机制的部署方法。
  21. 一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器 执行时实现如权利要求1至11中任一项所述的共识机制的部署方法。
PCT/CN2019/087574 2018-07-16 2019-05-20 共识机制的部署方法、装置、设备和存储介质 WO2020015447A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2020533673A JP7041749B2 (ja) 2018-07-16 2019-05-20 コンセンサスメカニズムのデプロイ方法、装置、機器及び記憶媒体
US16/963,491 US11614926B2 (en) 2018-07-16 2019-05-20 Consensus mechanism deployment method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810779236.8 2018-07-16
CN201810779236.8A CN109002297B (zh) 2018-07-16 2018-07-16 共识机制的部署方法、装置、设备和存储介质

Publications (1)

Publication Number Publication Date
WO2020015447A1 true WO2020015447A1 (zh) 2020-01-23

Family

ID=64600089

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/087574 WO2020015447A1 (zh) 2018-07-16 2019-05-20 共识机制的部署方法、装置、设备和存储介质

Country Status (4)

Country Link
US (1) US11614926B2 (zh)
JP (1) JP7041749B2 (zh)
CN (1) CN109002297B (zh)
WO (1) WO2020015447A1 (zh)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002297B (zh) 2018-07-16 2020-08-11 百度在线网络技术(北京)有限公司 共识机制的部署方法、装置、设备和存储介质
CN109698753B (zh) * 2018-12-17 2022-05-03 成都四方伟业软件股份有限公司 基于区块链的上链共识算法匹配方法及装置
CN109544982B (zh) * 2019-01-04 2021-06-04 通链(北京)科技有限公司 停车信息共享方法及共享系统
CN110069295B (zh) * 2019-05-06 2022-06-17 百度在线网络技术(北京)有限公司 区块链处理方法、装置、设备和介质
CN111131184B (zh) * 2019-12-06 2022-07-29 长沙理工大学 一种区块链共识机制的自主调节方法
CN111596937B (zh) * 2020-05-14 2023-09-15 北京众享比特科技有限公司 一种区块链中节点的新特征同步生效的实现方法和系统
CN111861469A (zh) * 2020-07-27 2020-10-30 北京金山云网络技术有限公司 区块链中共识机制的处理方法、装置和电子设备
EP4082155A4 (en) * 2021-01-11 2023-12-06 Micro Focus LLC BLOCKCHAIN AUDIT SYSTEM AND PROCEDURES
CN113596168A (zh) * 2021-08-02 2021-11-02 中国民生银行股份有限公司 基于区块链联盟链的验证方法及装置
CN113783708A (zh) * 2021-08-25 2021-12-10 山东区块链研究院 一种基于可靠广播的可再投票二元共识方法及装置
CN115118436B (zh) * 2022-08-23 2022-11-22 北京优品三悦科技发展有限公司 区块链共识方法及装置、存储介质及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107147704A (zh) * 2017-04-21 2017-09-08 杭州趣链科技有限公司 一种面向区块链的通用服务中间件系统
CN107360248A (zh) * 2017-07-31 2017-11-17 众安信息技术服务有限公司 用于配置局部共识的方法和装置及计算机可读存储介质
CN107402824A (zh) * 2017-05-31 2017-11-28 阿里巴巴集团控股有限公司 一种数据处理的方法及装置
WO2018020944A1 (ja) * 2016-07-28 2018-02-01 日本電気株式会社 掲示板情報管理システム
CN109002297A (zh) * 2018-07-16 2018-12-14 百度在线网络技术(北京)有限公司 共识机制的部署方法、装置、设备和存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8676937B2 (en) * 2011-05-12 2014-03-18 Jeffrey Alan Rapaport Social-topical adaptive networking (STAN) system allowing for group based contextual transaction offers and acceptances and hot topic watchdogging
US9386079B2 (en) * 2014-06-10 2016-07-05 American Megatrends, Inc. Method and system of virtual desktop infrastructure deployment studio
KR102294118B1 (ko) * 2014-10-21 2021-08-26 삼성전자주식회사 보안 연결 장치 및 방법
CN107579848B (zh) * 2017-08-30 2020-08-25 上海保险交易所股份有限公司 实用拜占庭容错共识机制中动态更改共识节点的方法
CN107733855B (zh) * 2017-08-31 2019-11-05 中国科学院信息工程研究所 一种可同时支持公有链、联盟链及私有链的区块链系统及应用方法
US20190238316A1 (en) * 2018-01-31 2019-08-01 Salesforce.Com, Inc. Systems, methods, and apparatuses for implementing intelligent consensus, smart consensus, and weighted consensus models for distributed ledger technologies in a cloud based computing environment
AU2018100566A4 (en) * 2018-04-30 2018-05-31 Govindarajula, Srikar MR Decentralized financial intelligence based on decentralized consensus and anonymized transaction history
CN108958787B (zh) * 2018-06-25 2021-11-12 百度在线网络技术(北京)有限公司 区块链系统升级方法、装置、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018020944A1 (ja) * 2016-07-28 2018-02-01 日本電気株式会社 掲示板情報管理システム
CN107147704A (zh) * 2017-04-21 2017-09-08 杭州趣链科技有限公司 一种面向区块链的通用服务中间件系统
CN107402824A (zh) * 2017-05-31 2017-11-28 阿里巴巴集团控股有限公司 一种数据处理的方法及装置
CN107360248A (zh) * 2017-07-31 2017-11-17 众安信息技术服务有限公司 用于配置局部共识的方法和装置及计算机可读存储介质
CN109002297A (zh) * 2018-07-16 2018-12-14 百度在线网络技术(北京)有限公司 共识机制的部署方法、装置、设备和存储介质

Also Published As

Publication number Publication date
JP7041749B2 (ja) 2022-03-24
JP2021508110A (ja) 2021-02-25
CN109002297B (zh) 2020-08-11
CN109002297A (zh) 2018-12-14
US20210132928A1 (en) 2021-05-06
US11614926B2 (en) 2023-03-28

Similar Documents

Publication Publication Date Title
WO2020015447A1 (zh) 共识机制的部署方法、装置、设备和存储介质
CN109032706B (zh) 智能合约执行方法、装置、设备和存储介质
KR101872141B1 (ko) 확장자가 애플리케이션의 기능을 다른 애플리케이션으로 확장하게 하는 고정적 확장 포인트
CN108958787B (zh) 区块链系统升级方法、装置、设备及存储介质
JP6192534B2 (ja) 仮想アプリケーション拡張ポイント
US8904382B2 (en) Creating instances of cloud computing environments
US9830135B2 (en) Declarative and pluggable business logic for systems management
US10656971B2 (en) Agile framework for vertical application development and delivery
US9413746B2 (en) Extension point application and configuration of a login module
US20100058321A1 (en) Approach for deploying software to network devices
JP2009514099A (ja) 分離されたエクステンションおよびデバイスドライバの構成
US11526431B2 (en) Systems and methods for automated provisioning of a virtual mainframe test environment
JP7293314B2 (ja) イーサリアム仮想マシンのトランザクション処理方法、装置、機器、プログラムおよび媒体
US10430589B2 (en) Dynamic firmware module loader in a trusted execution environment container
CN109951553B (zh) 数据处理方法、系统、电子设备以及计算机可读存储介质
CN105518698A (zh) 用于评估访问外围设备的应用请求的代理器
US9626251B2 (en) Undo configuration transactional compensation
CN108846129B (zh) 存储数据访问方法、装置及存储介质
JP7291764B2 (ja) イーサリアム仮想マシンのトランザクション処理方法、装置、機器、プログラムおよび媒体
CN114048415A (zh) 表单生成方法及装置、电子设备和计算机可读存储介质
US11023220B2 (en) Firmware update with integrated smart sequence and action engine
US20150212866A1 (en) Management system for service of multiple operating environments, and methods thereof
CN114461223A (zh) 一种代码生成方法、装置及终端设备
CN111970349B (zh) 基于远程过程调用的通讯系统、方法、装置、设备及介质
US20200065182A1 (en) Leak protection of executables with debug information

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19836956

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020533673

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19836956

Country of ref document: EP

Kind code of ref document: A1