CN112202581A - Group joining method and device and electronic equipment - Google Patents

Group joining method and device and electronic equipment Download PDF

Info

Publication number
CN112202581A
CN112202581A CN202011013697.8A CN202011013697A CN112202581A CN 112202581 A CN112202581 A CN 112202581A CN 202011013697 A CN202011013697 A CN 202011013697A CN 112202581 A CN112202581 A CN 112202581A
Authority
CN
China
Prior art keywords
node
group
transaction
consensus
identifier
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202011013697.8A
Other languages
Chinese (zh)
Inventor
刘昱
邓柯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Quality Starker Technology Co Ltd
Original Assignee
Chengdu Quality Starker Technology Co Ltd
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 Chengdu Quality Starker Technology Co Ltd filed Critical Chengdu Quality Starker Technology Co Ltd
Priority to CN202011013697.8A priority Critical patent/CN112202581A/en
Publication of CN112202581A publication Critical patent/CN112202581A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • H04L12/185Arrangements for providing special services to substations for broadcast or conference, e.g. multicast with management of multicast group membership
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • 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

Abstract

In order to meet the requirement of a new group to join a blockchain network, embodiments of the present invention provide a group joining method, an apparatus, and an electronic device, where the group joining method includes: obtaining a group joining transaction and a first consensus vote, wherein the group joining transaction carries a first group identifier; determining a first consensus result of the group joining transaction according to a first consensus strategy and the first consensus vote; writing the first group identifier into a block chain if the first consensus result is that consensus passes; obtaining a node joining transaction, wherein the node joining transaction carries a node identifier and a second group identifier, and the second group identifier is an identifier of a group to which a new node is to join; and judging whether the block chain records the second group identification, and writing the corresponding relation between the node identification and the second group identification into the block chain under the condition that the block chain records the second group identification.

Description

Group joining method and device and electronic equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a group joining method and apparatus, and an electronic device.
Background
The block chain technology is built on a transmission network (also called as a block chain network), distributed node equipment (hereinafter referred to as nodes) in the transmission network generates block data by a preset consensus strategy through running a block chain program, and verifies and stores the block data by using a chain data structure, so that a data tamper-proof mechanism is finally realized, and a safe and reliable new technical idea is provided for business development.
The block chain technology can be applied to various service scenes, such as the financial field, the electronic commerce field, the commodity or raw material tracing field, the electronic evidence storage field and the like.
In the related art, when a plurality of enterprise-level users (e.g., banks) perform business using the blockchain technique, the plurality of enterprise-level users typically participate in managing the blockchain network together, and specifically, each enterprise-level user operates one or more nodes in the blockchain network. One or more nodes operated by one enterprise-level user can be regarded as a node group (hereinafter referred to as a group). During use of blockchain networks, when a new enterprise-level user wants to join a blockchain network, a need arises for a new group to join the blockchain network.
Disclosure of Invention
In order to meet the requirement of a new group for joining a block chain network, embodiments of the present invention provide a group joining method, apparatus and electronic device, and the specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, a group joining method is provided, which is applied to any node in a blockchain network, and the method includes:
obtaining a group join transaction and a first consensus vote, wherein the group join transaction carries a first group identifier, the first group identifier is an identifier of a new group to be joined, and the first consensus vote is a consensus vote of a node of a first designated group in the blockchain network to the group join transaction;
determining a first consensus result of the group joining transaction according to a first consensus strategy and the first consensus vote;
if the first consensus result is that consensus passes, executing the group join transaction to write the first group identifier into a block chain;
obtaining a node joining transaction, wherein the node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is to be joined;
and judging whether the second group identifier is recorded in the block chain, and executing the node joining transaction under the condition that the second group identifier is recorded in the block chain so as to write the corresponding relation between the node identifier and the second group identifier into the block chain.
In a second aspect of the embodiments of the present invention, there is provided another group joining method, including:
a first target node in a block chain network receives a group join transaction, responds to the group join transaction, and sends the group join transaction to a node of an appointed group in the block chain network, wherein the group join transaction carries a first group identifier which is an identifier of a new group to be joined;
each designated group node responds to the group joining transaction, carries out consensus voting on the group joining transaction to generate consensus voting aiming at the group joining transaction, and the node returns the consensus voting to the first target node;
the first target node receives consensus votes returned by each node, packages and submits the group join transactions and the consensus votes to transaction sorting nodes in the block chain network, wherein the transaction sorting nodes are used for receiving transactions submitted by the nodes, sorting the transactions to obtain transaction sets, and distributing the transaction sets to each node;
the transaction sequencing node arranges the group joining transactions into a first transaction set and distributes the first transaction set to each node;
after receiving the first transaction set, any node in the block chain network sequentially executes each transaction in the first transaction set, when the group joining transaction is executed, determining a consensus result of the group joining transaction according to a preset consensus strategy and consensus votes carried by the group joining transaction, and executing the group joining transaction to write the first group identifier into a block chain under the condition that the consensus result is consensus pass;
a second target node in the block chain network receives a node joining transaction sent by a new node to be joined, wherein the node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of the new node, and the second group identifier is an identifier of a group to which the new node is to be joined;
the second target node adds the node into a transaction and submits the node into the transaction sequencing node;
the transaction sequencing node arranges the node adding transactions into a second transaction set and distributes the second transaction set to each node;
after receiving the second transaction set, any node in the blockchain network sequentially executes each transaction in the second transaction set, when the node joins in the transaction, whether the blockchain records the second group identifier is judged, and under the condition that the blockchain records the second group identifier, the node joins in the transaction, so that the corresponding relation between the node identifier and the second group identifier is written into the blockchain.
In a third aspect of the embodiments of the present invention, there is provided a group joining apparatus, applied to any node in a blockchain network, the apparatus including: the device comprises a transaction obtaining module, a consensus result determining module, a group joining transaction executing module and a node joining transaction executing module, wherein:
the transaction obtaining module is configured to obtain a group join transaction and a first consensus vote, where the group join transaction carries a first group identifier, the first group identifier is an identifier of a new group to be joined, and the first consensus vote is a consensus vote of a node of a first designated group in the blockchain network to the group join transaction;
the consensus result determining module is used for determining a first consensus result of the group joining transaction according to a first consensus strategy and the first consensus vote;
the group join transaction execution module is configured to execute the group join transaction to write the first group identifier into a block chain when the first consensus result is that the consensus passes;
the transaction obtaining module is further configured to obtain a node join transaction, where the node join transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is to join;
and the node joining transaction execution module is used for judging whether the second group identifier is recorded in the block chain or not, and executing the node joining transaction under the condition that the second group identifier is recorded in the block chain so as to write the corresponding relation between the node identifier and the second group identifier into the block chain.
In a fourth aspect of the embodiments of the present invention, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the group joining method provided in any embodiment of the present invention when executing the program stored in the memory.
In the invention, after any node in the block chain network obtains the group joining transaction and the first consensus vote, the first consensus result of the group joining transaction is determined according to the first consensus strategy and the first consensus vote, and the group joining transaction is executed under the condition that the first consensus result is consensus pass so as to write the group identifier of a new group into the block chain. This corresponds to a new group being registered in the blockchain network. After any node in the block chain network acquires the node joining transaction, whether a group identifier carried by the node joining transaction is recorded in the block chain is judged. And if so, executing node joining transaction so as to correspondingly write the node identification and the group identification carried by the node joining transaction into the block chain. This is equivalent to adding a new node to the already registered group. Through the process, the new group is added in the block chain network.
In addition, before performing the group join transaction, the node needs to determine whether the first common result is a common pass, and only performs the group join transaction if the first common result is a common pass. Therefore, the supervision control of the first appointed group on the new group joining can be realized, and the safety of the block chain network is improved.
In addition, before the node performs the node joining transaction, it needs to determine whether the blockchain records the group identifier carried by the node joining transaction. In other words, it is necessary to determine whether the group to which the new node is about to join is a group that is already registered in the blockchain network. Therefore, illegal nodes (namely nodes not belonging to any group) are prevented from being mixed in the block chain network, and the safety of the block chain network is further improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a schematic diagram of a block chain network according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a first stage of a group joining method according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a second phase of a group join method according to an embodiment of the present invention;
fig. 4 is a flowchart of a group joining method according to an embodiment of the present invention;
FIG. 5 is a flowchart of a group join method according to another embodiment of the present invention;
fig. 6 is a schematic diagram of a group joining device according to an embodiment of the present invention;
fig. 7 is a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the field of blockchain technology, particularly in the field of alliance chain technology, a plurality of enterprise-level users (e.g., banks) typically participate together in managing a blockchain network when conducting business using blockchain technology, and specifically, each enterprise-level user runs one or more nodes within the blockchain network. One or more nodes operated by one enterprise-level user can be regarded as a node group (hereinafter referred to as a group). During use of blockchain networks, when a new enterprise-level user wants to join a blockchain network, a need arises for a new group to join the blockchain network.
In view of this, the present invention provides a blockchain network, a group joining method, an apparatus, and an electronic device through the following embodiments, so as to dynamically join a new group in the blockchain network.
Referring to fig. 1, fig. 1 is a schematic diagram of a block chain network according to an embodiment of the present invention. As shown in fig. 1, the blockchain network includes a plurality of node groups (hereinafter referred to simply as groups), each group including one or more distributed node devices (hereinafter referred to simply as nodes). And a plurality of nodes of a plurality of groups jointly form the block chain network. The plurality of nodes implement the blockchain technique by running a blockchain program. In fig. 1, each of the oval dashed boxes represents a group, and the circular solid boxes around the oval dashed boxes represent block chain networks.
In the present invention, a group of nodes may be operated by a user (e.g., a bank). For ease of understanding, the nodes included in group a of the blockchain network are operated by bank a, and the nodes included in group B of the blockchain network are operated by bank B, based on which business can be carried out between bank a and bank B, by way of example.
In the invention, the block chain network is mainly applied to the financial field, financial institutions such as banks, security companies, fund companies and the like serve as users, and the users develop business based on the block chain network. It is considered that the benefit of multiple users may be involved during the service deployment. In order to make business development meet business logic, contractual provisions or legal requirements, it is necessary for multiple users to conduct business-level consensus voting on business transactions through the nodes operated by the users. A consensus vote of the transaction by each user is used to characterize whether the user agrees to perform the transaction. However, it is considered that if a certain user runs most of nodes in the whole blockchain network, the weight of consensus voting of the user is too large, and the consensus voting result of the user may affect the consensus voting result of the whole blockchain network, so that the fairness of service consensus is lost.
For ease of understanding, assume by way of example that the entire blockchain network includes a total of 50 nodes, with bank a running 30 nodes, bank B running 12 nodes, and bank C running 8 nodes. Thus, since the bank a runs most of the nodes, the bank a has a voting weight of 60% during the consensus voting at the service level, and the bank a can easily handle the consensus voting result of the whole block chain network.
To this end, the present invention introduces the concept of groups, one for each user. Each node in the blockchain network has stored in its local ledger: and the corresponding relation between the group and the node. In this way, each node may determine to which group any node of the blockchain network specifically belongs, or determine which nodes a group specifically includes, by querying the correspondence.
When a target node in the blockchain network receives a transaction sent by a client, the transaction needs to be sent to an appointed group (namely, an appointed user) to perform consensus voting at a service level. Wherein the target node is any node within a blockchain network. Specifically, the target node queries the corresponding relation stored in the local account book of the target node, so that the nodes specifically included in each designated group are determined, and then the target node sends the transaction to each determined node, so that each node performs consensus voting on the transaction level. It should be noted that the consensus votes of all the nodes in a group are first grouped into a consensus vote, which is used as the consensus vote of the group, and then the consensus result is determined according to the consensus vote of each group. Therefore, the influence of the number of the nodes of the group on the voting weight is eliminated, and the fairness of service consensus is ensured.
It should be noted that, for how to group the consensus votes of all the nodes in a group into a consensus vote, a corresponding grouping strategy may be adopted according to the service type. For example, for some traffic types, the consensus votes of all nodes in a group are grouped together as a "perform-approved" consensus vote as long as one node in the group casts a "perform-approved" consensus vote, and are grouped together as a "perform-disapproved" consensus vote otherwise. Or, for example, for other traffic types, the consensus votes of all nodes in a group are grouped together as a "perform-approved" consensus vote only if all nodes in the group cast a "perform-approved" consensus vote, and otherwise are grouped together as a "perform-disapproved" consensus vote.
From the above description, it can be seen that the concept of groups plays an important role in blockchain networks. However, in the related art, when a new group (i.e., a new user) wants to join the blockchain network during the operation of the blockchain network, the dynamic joining of the new group cannot be realized. In order to realize the dynamic joining of a new group, the invention provides that: the joining plan of the new group is regarded as a transaction (hereinafter, the transaction is referred to as a group joining transaction), and the group joining transaction is executed by each node to realize dynamic joining of the new group.
In order to further realize the supervision control of the new group joining, the invention also pre-configures part of groups in a plurality of groups of the block chain network into first designated groups, and the first designated groups are used for carrying out service-level consensus voting on the group joining transaction. The consensus voting of the first appointed group to the group joining transaction is used for representing whether the first appointed group agrees with the joining of a new group.
As shown in fig. 1, the plurality of nodes of the blockchain network further include a transaction sequencing node, which may be manually designated directly from the plurality of nodes or periodically selected from the plurality of nodes. The transaction sequencing node is mainly used for receiving a plurality of transactions submitted by the nodes in sequence, sequencing the transactions to obtain a transaction set, and distributing the transaction set to each node. In this way, each node obtains the same transaction set, and each node executes each transaction in turn according to the sequence of the transactions in the transaction set, so as to obtain a plurality of execution results with the same result and the same sequence relation.
For ease of understanding, it is exemplarily assumed that the transaction ranking node ranks the transaction a, the transaction b, and the transaction c in turn, resulting in a transaction set, which the transaction ranking node distributes to each node (including the transaction ranking node itself) within the blockchain network. After receiving the transaction set, the node X executes each transaction in turn according to the sequence of the transactions in the transaction set, thereby obtaining an execution result a, an execution result b and an execution result c in turn. Similarly, after receiving the transaction set, the node Y executes each transaction in turn according to the sequence of the transactions in the transaction set, and similarly obtains an execution result a, an execution result b, and an execution result c in turn.
Therefore, the transactions are sequenced through the transaction sequencing nodes, and each node sequentially executes each transaction according to the transaction sequencing, so that each node obtains a plurality of execution results with the same result and the same sequence relation, and the data consensus of the transaction results among the nodes is favorably realized.
In the above, the present invention provides a blockchain network through some embodiments, and the blockchain network introduces a group concept to solve the fairness problem of service consensus. In addition, the block chain network can also realize the dynamic joining of a new group. In the following, the present invention specifically describes how the above-mentioned blockchain network implements dynamic joining of a new group through other embodiments.
Referring to fig. 2, fig. 2 is a schematic diagram of a first stage of a group join method according to an embodiment of the present invention. As shown in fig. 2, when a new group needs to join the blockchain network, an administrator of the blockchain network inputs a group join transaction to one existing node (hereinafter, referred to as a first target node) of the blockchain network. Thus, the first target node receives the group join transaction. The group joining transaction carries a first group identifier and node number upper limit information, the first group identifier is an identifier of a new group to be joined, and the node number upper limit information is used for representing the maximum node number allowed to be contained in the new group. For example, if the upper limit of the number of nodes is equal to 10, after identifying that a new group joins the blockchain network, a maximum of 10 nodes can be joined in the new group.
As shown in fig. 2, the first target node responds to the group join transaction, and sends the group join transaction to the nodes of the first designated group (assumed to be group B and group C in fig. 2), so that the nodes of the first designated group perform consensus voting on the group join transaction. Each node of the first designated group may, after receiving the group join transaction, display the group join transaction to a user of the node and receive a first consensus vote input by the user, the first consensus vote being used to characterize whether the user agrees to perform the group join transaction. The nodes return the first consensus vote input by the user to the first target node, so that the first target node successively receives the first consensus vote returned by the nodes of each first designated group. Wherein each first consensus vote carries: a node identification of the respective node and/or a group identification of the respective group.
As shown in fig. 2, the first target node joins the group into the transaction and all the first consensus votes, and packages and submits them to the transaction ranking node. The transaction sorting node sorts the group joining transaction and other transactions received in the current time period to obtain a transaction set, wherein the transaction set comprises: a plurality of transactions having a sequential relationship, and a respective consensus vote for each transaction. The transaction ranking node distributes the set of transactions to each node within the blockchain network (including the transaction ranking node itself). To simplify the drawing, only a portion of the nodes receiving the transaction set is schematically shown in fig. 2.
As shown in fig. 2, after receiving the transaction set, any node in the blockchain network sequentially executes a plurality of transactions according to the sequential relationship of the plurality of transactions in the transaction set. When the node executes the group joining transaction, the node determines a first consensus result of the group joining transaction according to a preset first consensus strategy and a first consensus vote of the group joining transaction.
For ease of understanding, assume, by way of example, that the first common consensus policy is: (1) as long as one node in the first designated group casts the consensus vote of 'execution approval', the consensus votes of all nodes in the first designated group are collected into the consensus vote of 'execution approval', and the consensus vote is used as the consensus vote of the first designated group; (2) the consensus result of consensus passing can be obtained only if the consensus votes of all the first designated groups are "agree to perform". Thus, the node firstly collects the consensus votes of the nodes of each first designated group into the consensus votes of the first designated group according to the (1) th point of the first consensus strategy; and then according to the (2) th point of the first consensus strategy, determining a consensus result according to the consensus votes of each first designated group.
And if the first consensus result of the group joining transaction is that the consensus passes, the node executes the group joining transaction so as to correspondingly write the first group identification and the node quantity upper limit information carried by the group joining transaction into the block chain. Specifically, the node writes the first group identifier and the upper limit information of the node number carried in the group join transaction as the execution result of the group join transaction into the to-be-uplink block.
And if the first consensus result of the group joining transaction is that the consensus is not passed, the node refuses to execute the group joining transaction. In addition, the node can directly generate a record of execution failure for the group join transaction, and write the record into the pending uplink block as the execution result of the group join transaction. To simplify the drawing, the case where a node refuses to perform a group join transaction is not shown in fig. 2.
And when the node finishes executing all the transactions in the transaction set and the execution result of each transaction is written into the block to be uplink, the node and other nodes in the block chain network identify the block to be uplink respectively. If a node determines that its block to be uplink passes the consensus, it accesses its block to be uplink to the end of its stored block chain. When the to-be-uplink block is identified, for example, the node may send the hash value of the to-be-uplink block to all other nodes, and correspondingly, the node may also successively receive the hash values of the to-be-uplink blocks of other nodes sent by other nodes. And then the node compares each received hash value with the hash value of the block to be uplink, and if the hash values exceeding the preset number are equal to the hash values of the blocks to be uplink, the node determines that the blocks to be uplink pass the common identification.
For ease of understanding, assuming that the blockchain network comprises a total of 50 nodes, the predetermined number is equal to 80% of the total number of nodes, the predetermined number is equal to 40. Assuming that the node receives the hash values respectively transmitted by the other 49 nodes in total, 47 hash values are equal to the hash values of the blocks to be uplink of the node, and since 47 exceeds the preset number 40, the node determines that the blocks to be uplink pass the consensus.
In summary, in the present invention, after obtaining the group join transaction and the first consensus vote, any node in the blockchain network determines the first consensus result of the group join transaction according to the first consensus strategy and the first consensus vote, and executes the group join transaction to write the group identifier of the new group into the blockchain if the first consensus result is a consensus pass. This corresponds to a new group being registered in the blockchain network. As shown in fig. 2, the oval dotted box in fig. 2, which does not contain a node, represents a new group in which registration is completed.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a second stage of a group join method according to an embodiment of the invention. As shown in fig. 3, a new node to be joined sends a node join transaction to an existing node (hereinafter referred to as a second target node) in the blockchain network. Thus, the second target node receives the node join transaction. The node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is to be joined. In fig. 3, a small dotted circle represents a new node to be added, and an oval dotted frame where the new node is located represents a group to which the new node is to be added.
As shown in fig. 3, in response to the node joining transaction, the second target node first queries the second group identifier from the node joining transaction, and then queries the number of nodes currently corresponding to the second group identifier from the blockchain, so as to determine the number of nodes currently included in the group to which the new node is to join. And the second target node determines a corresponding second designated group for the node to join in the transaction from a plurality of groups of the block chain network according to the determined number of the nodes. And the second target node sends the node joining transaction to the determined nodes of the second appointed group, so that the nodes of the second appointed group join the transaction for consensus voting.
In order to enable the user to have the ability to control the new node to join the group after the user registers the group in the blockchain network, the group to which the new node is to join (i.e., the group corresponding to the second group identifier carried by the node joining transaction) may be determined as the second designated group. Thus, when a new node is ready to join a group, the group is required to consensus the corresponding node joining transaction. However, it is also contemplated that if the group to which the new node is ready to join temporarily does not already contain a node, then there is temporarily no node in the group that can consensus vote for the node to join the transaction.
Based on the above consideration, in the present invention, after determining the number of nodes currently included in the group to which the new node is ready to join, if the number of nodes is greater than 0, the second target node joins the node to the group corresponding to the second group identifier carried in the transaction, and determines the second target node as the second designated group. In other words, the group to which the new node is ready to join is determined as the second designated group. And if the number of the nodes is equal to 0, the second target node directly determines the first designated group as a second designated group. To simplify the drawing, fig. 3 only shows the case where the number of nodes is equal to 0, and thus the second target node determines the first designated group (i.e., group B and group C) as the second designated group.
And after receiving the node joining transaction, the nodes of the second designated group can display the node joining transaction to users of the nodes and receive a second consensus vote input by the users, wherein the second consensus vote is used for representing whether the users agree to execute the node joining transaction. The node returns a second consensus vote input by the user to the second target node, and thus, the second target node receives the second consensus vote returned by the nodes of the second designated group. Wherein each second consensus vote carries: a node identification of the respective node and/or a group identification of the respective group.
As shown in fig. 3, the second target node adds the node to the transaction and all second consensus votes, packaged and submitted to the transaction ranking node. The transaction sorting node sorts the node joining transactions and other transactions received in the current time period to obtain a transaction set, wherein the transaction set comprises: a plurality of transactions having a sequential relationship, and a respective consensus vote for each transaction. The transaction ranking node distributes the set of transactions to each node within the blockchain network (including the transaction ranking node itself). To simplify the drawing, only a portion of the nodes receiving the transaction set is schematically shown in fig. 3.
As shown in fig. 3, after receiving the transaction set, any node in the blockchain network sequentially executes a plurality of transactions according to the sequential relationship of the plurality of transactions in the transaction set. And when the node executes the node joining transaction, the node determines a second consensus result of the node joining transaction according to a preset second consensus strategy and a second consensus vote of the node joining transaction.
For ease of understanding, assume, by way of example, that the second consensus strategy is: (1) as long as one node in the second designated group casts the consensus vote of 'execution approval', the consensus votes of all nodes in the second designated group are collected into the consensus vote of 'execution approval', and the consensus vote is used as the consensus vote of the second designated group; (2) only when the consensus votes of all the second designated groups are "agree to do", the consensus result that the consensus passed can be obtained.
In addition, as shown in fig. 3, when the node executes the node join transaction, the node also queries the second group identifier from the node join transaction, and after querying the second group identifier, further determines whether the second group identifier is recorded in the blockchain.
In addition, as shown in fig. 3, when the node performs the node joining transaction, the node also queries the number of nodes currently corresponding to the second group identifier from the blockchain, so as to determine the number of nodes currently included in the group to which the new node is to join. And the node also inquires the upper limit information of the number of nodes corresponding to the second group identifier from the block chain, and then judges whether the number of nodes corresponding to the second group identifier reaches the upper limit of the number of nodes corresponding to the second group identifier. In other words, it is determined whether the number of nodes in the group to which the new node is to join reaches the upper limit of the number of nodes in the group.
And if the second consensus result is that the consensus passes and the block chain records a second group identifier, and the number of the nodes corresponding to the second group identifier does not reach the upper limit of the number of the nodes corresponding to the second group identifier, executing the node joining transaction. Otherwise, the execution node is refused to join the transaction. To simplify the drawing, the rejection of the node to perform the node join transaction is not shown in fig. 3.
When the node joining transaction is executed, correspondingly writing the node identification carried by the node joining transaction and the second group identification into the block chain, updating the number of nodes corresponding to the second group identification, and writing the updated number of nodes into the block chain. Specifically, a corresponding relation is established for node identification carried by a node joining exchange and a second group identification, and 1 is added to the number of nodes corresponding to the second group identification; and writing the established corresponding relation and the number of the nodes added with 1 into the block to be linked as an execution result of the node adding transaction.
If the node joining transaction is refused to be executed, a record of execution failure can be directly generated for the node joining transaction, and the record is used as an execution result of the node joining transaction and is written into the block to be uplink.
And when the node finishes executing all the transactions in the transaction set and the execution result of each transaction is written into the block to be uplink, the node and other nodes in the block chain network identify the block to be uplink respectively. If a node determines that the block to be uplink is identified by the common identification, the node accesses the block to be uplink to the end of the block chain stored by the node. When the to-be-uplink block is identified, for example, the node may send the hash value of the to-be-uplink block to all other nodes, and correspondingly, the node may also successively receive the hash values of the to-be-uplink blocks of other nodes sent by other nodes. And then the node compares each received hash value with the hash value of the block to be uplink, and if the hash values exceeding the preset number are equal to the hash values of the blocks to be uplink, the node determines that the blocks to be uplink pass the common identification.
In addition, any node in the blockchain network locally stores a node statistical table, and the node statistical table is used for recording respective node identifications and/or node addresses of all nodes included in the blockchain network. Each node may determine other nodes included in the blockchain network by querying its locally stored node statistics table so that information may be broadcast to the other nodes of the blockchain network. After any node of the block chain network completes the node joining transaction, the node identification and/or the node address of the new node are/is written into a node statistical table locally stored by the any node.
In summary, in the present invention, after any node in the blockchain network obtains the node joining transaction, it is determined whether the blockchain records the group identifier carried in the node joining transaction. And if so, executing node joining transaction so as to correspondingly write the node identification and the group identification carried by the node joining transaction into the block chain. This is equivalent to adding a new node to the already registered group. Dynamic joining of new groups in a blockchain network is achieved by the first stage shown in fig. 2 and the second stage shown in fig. 3.
For a new node, the new node may obtain an established block of the blockchain from an existing node in the blockchain network in advance. And when the node joining transaction is executed and the execution result is identified and written into the block chain, the new node obtains the execution result of the node joining transaction. Optionally, in some embodiments, the new node may send an execution result obtaining request to an existing node in the blockchain network periodically, and when the node completes adding the transaction to the node and the execution result passes through consensus and is written into the blockchain, the node returns the execution result to the new node. Or optionally, in other embodiments, after a certain existing node in the blockchain network completes the node joining transaction, and an execution result passes through consensus and is written into the blockchain, the node actively returns the execution result to the new node.
And after the new node obtains the execution result, the new node judges whether the node joining transaction is successfully executed or not according to the execution result. Optionally, in some specific embodiments, the new node determines whether the execution result includes: and if the corresponding relation between the node identification and the second group identification is included, the new node determines that the execution of the node adding transaction is successful, and if the corresponding relation is not included, the new node determines that the execution of the node adding transaction is not successful.
If the new node determines that the node joining transaction is successfully executed, the new node obtains a history block of the blockchain from one existing node in the blockchain network. Wherein, the history block includes: the block height is 2 to all blocks with the block height being the current height. The new node sequentially performs the following steps for each block according to the sequence of the block heights from low to high: (1) reading a plurality of transactions recorded in the block; (2) executing each transaction in sequence according to the sequence of the transactions in the block, thereby obtaining a plurality of execution results in sequence; (3) writing a plurality of execution results into a block to be uplink, and connecting the block to be uplink to the end of a block chain of a new node, so that the block height of the block chain is increased by 1.
And after the new node sequentially executes the steps aiming at each historical block, the new node is synchronized to the block chain of other existing nodes. It should be noted that during the time when the new node performs the above steps for each history block in turn, the new node may receive one or more transaction sets that the transaction sequencing node sequentially sends. The new node stores the transaction sets, and after the new node sequentially executes the steps for each history block, the new node sequentially processes the transaction sets. The specific process of processing the transaction set by the new node can refer to the foregoing contents, and is not described herein again to avoid repetition.
In the above, the present invention proposes a group joining method through a preferred embodiment. In the following, the present invention provides other group joining methods according to other embodiments. The following examples and the preferred embodiments above are referred to in some respects.
Referring to fig. 4, fig. 4 is a flowchart of a group joining method according to an embodiment of the present invention, where the group joining method is applied to any node in a blockchain network. As shown in fig. 4, the method includes:
step S41: the method comprises the steps of obtaining a group joining transaction and a first consensus vote, wherein the group joining transaction carries a first group identifier, the first group identifier is an identifier of a new group to be joined, and the first consensus vote is a consensus vote of a node of a first designated group in the block chain network to the group joining transaction.
Optionally, in some embodiments, the any node may receive a first transaction set sent by the transaction ranking node, where the first transaction set includes the group join transaction and a first consensus vote for the group join transaction. In this manner, the any node obtains a group join transaction and a first consensus vote.
Step S42: determining a first consensus result of the group joining transaction according to a first consensus policy and the first consensus vote.
Step S43: and if the first consensus result is that consensus passes, executing the group joining transaction to write the first group identifier into a block chain.
Step S44: and acquiring a node joining transaction, wherein the node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is ready to join.
Optionally, in some specific embodiments, the any node may receive a second transaction set sent by the transaction sorting node, where the second transaction set includes node joining transactions. In this manner, any of the nodes obtains a node join transaction.
Step S45: and judging whether the second group identifier is recorded in the block chain, and executing the node joining transaction under the condition that the second group identifier is recorded in the block chain so as to write the corresponding relation between the node identifier and the second group identifier into the block chain.
For the specific implementation of the above steps S41 to S45, reference may be made to the above preferred embodiment, and details are not repeated here to avoid repetition.
In the invention, after any node in the block chain network obtains the group joining transaction and the first consensus vote, the first consensus result of the group joining transaction is determined according to the first consensus strategy and the first consensus vote, and the group joining transaction is executed under the condition that the first consensus result is consensus pass so as to write the group identifier of a new group into the block chain. This corresponds to a new group being registered in the blockchain network. After any node in the block chain network acquires the node joining transaction, whether a group identifier carried by the node joining transaction is recorded in the block chain is judged. And if so, executing node joining transaction so as to correspondingly write the node identification and the group identification carried by the node joining transaction into the block chain. This is equivalent to adding a new node to the already registered group. Through the process, the new group is added in the block chain network.
In addition, before performing the group join transaction, the node needs to determine whether the first common result is a common pass, and only performs the group join transaction if the first common result is a common pass. Therefore, the supervision control of the first appointed group on the new group joining can be realized, and the safety of the block chain network is improved.
In addition, before the node performs the node joining transaction, it needs to determine whether the blockchain records the group identifier carried by the node joining transaction. In other words, it is necessary to determine whether the group to which the new node is about to join is a group that is already registered in the blockchain network. Therefore, illegal nodes (namely nodes not belonging to any group) are prevented from being mixed in the block chain network, and the safety of the block chain network is further improved.
Optionally, in some specific embodiments, when performing a node join transaction, in addition to writing the correspondence between the node identifier and the second group identifier into the block chain, the node number corresponding to the second group identifier may be updated, and the updated node number may be written into the block chain. Specifically, the any node determines the number of nodes corresponding to the second group identifier by querying the blockchain, that is, determines the number of nodes currently included in the group to which the new node is to join. After the number of the nodes is inquired by any node, the number of the nodes is added by 1, and then the number of the nodes added by 1 is written into the block chain.
In the invention, the number of the nodes of the group is updated, and the updated number of the nodes is written into the block chain. In this manner, any node within the blockchain network may determine the number of nodes per group by querying the blockchain.
In addition, considering that the overall performance (e.g., network performance) of the blockchain network may be affected by the number of nodes, the greater the network communication pressure within the blockchain network.
In order to ensure the overall performance of the blockchain network, optionally, in some embodiments, the group join transaction may further carry node number upper limit information, where the node number upper limit information is used to indicate a maximum node number that the new group is allowed to include.
When any node executes the group join transaction, specifically, the first group identifier and the node number upper limit information carried in the group join transaction are correspondingly written into the block chain.
Before any node executes the node joining transaction, besides the need of judging whether the block chain records the second group identifier, the node number corresponding to the second group identifier can be inquired, and whether the node number reaches the upper limit of the node number corresponding to the second group identifier is judged. In other words, besides determining whether the second group identifier is recorded in the blockchain, the above-mentioned any node may also determine whether the number of nodes in the group to which the new node is ready to join reaches the upper limit of the number of nodes in the group.
And only when the second group identifier is recorded in the block chain and the number of the nodes corresponding to the second group identifier does not reach the upper limit of the number of the nodes corresponding to the second group identifier, executing the node joining transaction. Otherwise, the executing node is refused to join the transaction.
In the invention, the upper limit of the number of nodes is set for each group, and the information such as the upper limit of the number of nodes, the number of nodes already owned by the group and the like is written into the block chain. In this way, each node may query the blockchain to determine whether the number of nodes currently included in the group to which the new node is ready to join reaches its upper node number limit before performing the node join transaction. And refusing to execute the node joining transaction under the condition that the number of the nodes reaches the upper limit of the number of the nodes. Therefore, the number of nodes in each group can be effectively limited, and the situation that a large number of new nodes are accessed to the block chain network by the group without restriction, so that the performance of the block chain network is reduced, and the execution efficiency of transactions is influenced is prevented.
Optionally, in some embodiments, the any node, while obtaining the node to join the transaction, also obtains a second consensus vote, the second consensus vote being a consensus vote for a second designated group of nodes within the blockchain network to join the transaction for the node.
Before any node executes the node joining transaction, whether the second group identifier is recorded in the blockchain or not needs to be judged, and a second consensus result of the node joining transaction can be determined according to a second consensus strategy and a second consensus vote. And executing the node joining transaction only when the second consensus result is that the consensus passes and the second group identifier is recorded in the blockchain. Otherwise, the executing node is refused to join the transaction.
In the invention, the node needs to judge whether the second consensus result is passed or not before executing the node joining transaction, and if the second consensus result is failed, the node refuses to execute the group joining transaction. Therefore, the supervision control of the new node addition can be realized, and the improvement of the safety of the block chain network is facilitated.
Optionally, in some embodiments, the process of consensus voting for node joining a transaction comprises: a target node receives the node joining transaction sent by the new node, wherein the target node is one node in the block chain network; the target node inquires the block chain to determine the number of nodes corresponding to a second group identifier carried by the node joining transaction; the target node determines a corresponding second designated group for the node to join in the transaction from a plurality of groups of the block chain network according to the determined number of the nodes; and the target node sends the node joining transaction to the determined nodes of the second appointed group, so that the node joins the transaction to carry out consensus voting.
When the target node determines the second designated group, specifically: and if the determined number of the nodes is more than 0, adding the nodes into a group corresponding to the second group identifier carried by the transaction, and determining the nodes as a second appointed group. In other words, if a new node is already included in the group to which it is ready to join, the group is determined to be a second designated group through which consensus voting is conducted for node joining transactions.
Determining the first designated group as a second designated group if the determined number of nodes is equal to 0. In other words, if no node exists in the group to which the new node is to join, the first designated group is determined as the second designated group, so as to perform consensus voting for the node joining transaction through the first designated group.
Optionally, in some specific embodiments, after the any node performs the node join transaction, the node identifier and/or the node address of the new node is further written into a local node statistics table, where the node statistics table is used to record the node identifiers and/or the node addresses of all nodes included in the blockchain network.
Specifically, any node in the blockchain network locally stores a node statistical table, and the node statistical table is used for recording respective node identifiers and/or node addresses of all nodes included in the blockchain network. Each node may determine other nodes included in the blockchain network by querying its locally stored node statistics table so that information may be broadcast to the other nodes of the blockchain network. After any node of the block chain network completes the node joining transaction, the node identification and/or the node address of the new node are/is written into a node statistical table locally stored by the any node.
Referring to fig. 5, fig. 5 is a flowchart of a group joining method according to another embodiment of the present invention. As shown in fig. 5, the method includes:
step S51: a first target node in a block chain network receives a group join transaction, and responds to the group join transaction, and sends the group join transaction to a node of an appointed group in the block chain network, wherein the group join transaction carries a first group identifier, and the first group identifier is an identifier of a new group to be joined.
Step S52: each designated group node performs consensus voting on the group join transaction in response to the group join transaction to generate consensus votes for the group join transaction, which the node returns to the first target node.
Step S53: and the first target node receives consensus votes returned by each node, packages and submits the group join transaction and the consensus votes to transaction sequencing nodes in the blockchain network, wherein the transaction sequencing nodes are used for receiving the transactions submitted by the nodes, sequencing the transactions to obtain a transaction set, and distributing the transaction set to each node.
Step S54: the transaction sequencing node arranges the group joining transactions into a first transaction set and distributes the first transaction set to each node.
Step S55: and after receiving the first transaction set, any node in the block chain network sequentially executes each transaction in the first transaction set, when the group joining transaction is executed, determining a consensus result of the group joining transaction according to a preset consensus strategy and consensus votes carried by the group joining transaction, and executing the group joining transaction to write the first group identifier into the block chain under the condition that the consensus result is consensus pass.
Step S56: a second target node in the block chain network receives a node joining transaction sent by a new node to be joined, wherein the node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of the new node, and the second group identifier is an identifier of a group to which the new node is ready to join.
Step S57: and the second target node adds the node into the transaction and submits the node into the transaction sequencing node.
Step S58: and the transaction sequencing node arranges the node adding transactions into a second transaction set and distributes the second transaction set to each node.
Step S59: after receiving the second transaction set, any node in the blockchain network sequentially executes each transaction in the second transaction set, when the node joins in the transaction, whether the blockchain records the second group identifier is judged, and under the condition that the blockchain records the second group identifier, the node joins in the transaction, so that the corresponding relation between the node identifier and the second group identifier is written into the blockchain.
The first target node is any one of a plurality of nodes of the blockchain network, and the second target node is also any one of a plurality of nodes of the blockchain network. The first target node and the second target node may be the same node or may be different nodes.
For the specific implementation of steps S51 to S59, reference may be made to the above preferred embodiment, and details are not repeated here to avoid repetition.
Based on the same inventive concept, the embodiment of the invention also provides a group adding device. Referring to fig. 6, fig. 6 is a schematic diagram of a group joining apparatus according to an embodiment of the present invention, which is applied to any node in a blockchain network.
As shown in fig. 6, the apparatus includes: a transaction obtaining module 61, a consensus result determining module 62, a group joining transaction executing module 63, and a node joining transaction executing module 64, wherein:
the transaction obtaining module 61 is configured to obtain a group join transaction and a first consensus vote, where the group join transaction carries a first group identifier, the first group identifier is an identifier of a new group to be joined, and the first consensus vote is a consensus vote of a node of a first designated group in the blockchain network to the group join transaction;
the consensus result determining module 62 is configured to determine a first consensus result of the group joining transaction according to a first consensus policy and the first consensus vote;
the group join transaction executing module 63 is configured to execute the group join transaction to write the first group identifier into the block chain if the first consensus result is that the consensus passes;
the transaction obtaining module 61 is further configured to obtain a node join transaction, where the node join transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is to join;
the node join transaction executing module 64 is configured to determine whether the second group identifier is recorded in the blockchain, and execute the node join transaction when the second group identifier is recorded in the blockchain, so as to write the correspondence between the node identifier and the second group identifier into the blockchain.
Optionally, in some specific embodiments, the node joins the transaction execution module, and is specifically configured to: and executing the node joining transaction to write the corresponding relation between the node identification and the second group identification into the block chain, updating the number of nodes corresponding to the second group identification, and writing the updated number of nodes into the block chain.
Optionally, in some specific embodiments, the group join transaction further carries node number upper limit information;
the group joining transaction execution module is specifically configured to: if the first consensus result is that consensus passes, executing the group join transaction to correspondingly write the first group identifier and the upper limit information of the number of nodes into the block chain;
the node joining transaction execution module is specifically configured to: judging whether the block chain records the second group identification, inquiring the number of nodes corresponding to the second group identification, judging whether the number of the nodes reaches the upper limit of the number of the nodes corresponding to the second group identification, and executing the node joining transaction under the condition that the block chain records the second group identification and the number of the nodes corresponding to the second group identification does not reach the upper limit of the number of the nodes corresponding to the second group identification.
Optionally, in some embodiments, the transaction obtaining module, while being configured to obtain the node joining the transaction, is further configured to obtain a second consensus vote, the second consensus vote being a consensus vote for a second designated group of nodes within the blockchain network to join the transaction with the node;
the node joining transaction execution module is specifically configured to: and determining a second consensus result of the node joining transaction according to a second consensus strategy and the second consensus vote, judging whether the block chain records the second group identifier, and executing the node joining transaction under the conditions that the second consensus result is that consensus passes and the block chain records the second group identifier.
Optionally, in some embodiments, the apparatus further comprises:
the transaction receiving module is used for receiving the node joining transaction sent by the new node;
the appointed group determining module is used for inquiring the block chain so as to determine the number of nodes corresponding to a second group identifier carried by the node joining transaction;
the appointed group determining module is used for determining a corresponding second appointed group for the nodes to join in the transaction from a plurality of groups of the block chain network according to the determined number of the nodes;
and the transaction sending module is used for sending the node joining transaction to the determined node of the second appointed group so as to enable the node to carry out consensus voting on the node joining transaction.
Optionally, in some specific embodiments, if the determined number of nodes is greater than 0, the designated group determining module determines that the node is added to a group corresponding to a second group identifier carried in a transaction, and the node is determined as the second designated group; the designated group determination module determines the first designated group as the second designated group if the determined number of nodes is equal to 0.
Optionally, in some embodiments, the apparatus further comprises:
and the node statistical table management module is used for writing the node identifier and/or the node address of the new node into a local node statistical table, and the node statistical table is used for recording the respective node identifiers and/or node addresses of all nodes included in the blockchain network.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Based on the same inventive concept, an embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702 and the memory 703 complete communication with each other through the communication bus 704.
The memory 703 is used for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
obtaining a group join transaction and a first consensus vote, wherein the group join transaction carries a first group identifier, the first group identifier is an identifier of a new group to be joined, and the first consensus vote is a consensus vote of a node of a first designated group in the blockchain network to the group join transaction;
determining a first consensus result of the group joining transaction according to a first consensus strategy and the first consensus vote;
if the first consensus result is that consensus passes, executing the group join transaction to write the first group identifier into a block chain;
obtaining a node joining transaction, wherein the node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is to be joined;
and judging whether the second group identifier is recorded in the block chain, and executing the node joining transaction under the condition that the second group identifier is recorded in the block chain so as to write the corresponding relation between the node identifier and the second group identifier into the block chain.
Alternatively, the processor 701 is configured to implement the group joining method steps provided by the above other method embodiments of the present invention when executing the program stored in the memory 703.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only a part of the embodiments of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A group joining method applied to any node in a blockchain network, the method comprising:
obtaining a group join transaction and a first consensus vote, wherein the group join transaction carries a first group identifier, the first group identifier is an identifier of a new group to be joined, and the first consensus vote is a consensus vote of a node of a first designated group in the blockchain network to the group join transaction;
determining a first consensus result of the group joining transaction according to a first consensus strategy and the first consensus vote;
if the first consensus result is that consensus passes, executing the group join transaction to write the first group identifier into a block chain;
obtaining a node joining transaction, wherein the node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is to be joined;
and judging whether the second group identifier is recorded in the block chain, and executing the node joining transaction under the condition that the second group identifier is recorded in the block chain so as to write the corresponding relation between the node identifier and the second group identifier into the block chain.
2. The method of claim 1, wherein performing the node join transaction to write the correspondence between the node identifier and the second group identifier into the blockchain comprises:
and executing the node joining transaction to write the corresponding relation between the node identification and the second group identification into the block chain, updating the number of nodes corresponding to the second group identification, and writing the updated number of nodes into the block chain.
3. The method of claim 2, wherein the group join transaction further carries node quantity cap information;
the executing the group join transaction to write the first group identifier into a blockchain if the first consensus result is a passing consensus comprises:
if the first consensus result is that consensus passes, executing the group join transaction to correspondingly write the first group identifier and the upper limit information of the number of nodes into the block chain;
the determining whether the second group identifier is recorded in the blockchain, and executing the node joining transaction under the condition that the second group identifier is recorded in the blockchain, includes:
judging whether the block chain records the second group identification, inquiring the number of nodes corresponding to the second group identification, judging whether the number of the nodes reaches the upper limit of the number of the nodes corresponding to the second group identification, and executing the node joining transaction under the condition that the block chain records the second group identification and the number of the nodes corresponding to the second group identification does not reach the upper limit of the number of the nodes corresponding to the second group identification.
4. The method of claim 2, wherein a second consensus vote is obtained concurrently with the node joining the transaction, the second consensus vote being a consensus vote for a second designated group of nodes within the blockchain network to join the transaction with the node;
the determining whether the second group identifier is recorded in the blockchain, and executing the node joining transaction under the condition that the second group identifier is recorded in the blockchain, includes:
and determining a second consensus result of the node joining transaction according to a second consensus strategy and the second consensus vote, judging whether the block chain records the second group identifier, and executing the node joining transaction under the conditions that the second consensus result is that consensus passes and the block chain records the second group identifier.
5. The method of claim 4, wherein the act of consensus voting for the node joining a transaction comprises:
a target node receives the node joining transaction sent by the new node, wherein the target node is one node in the block chain network;
the target node inquires the block chain to determine the number of nodes corresponding to a second group identifier carried by the node joining transaction;
the target node determines a corresponding second designated group for the node to join in the transaction from a plurality of groups of the block chain network according to the determined number of the nodes;
and the target node sends the node joining transaction to the determined nodes of the second appointed group, so that the node joins the transaction to carry out consensus voting.
6. The method according to claim 5, wherein if the determined number of nodes is greater than 0, the node is added to a group corresponding to a second group identifier carried by a transaction, and determined as the second designated group; determining the first designated group as the second designated group if the determined number of nodes is equal to 0.
7. The method of any of claims 1 to 6, wherein after performing the node join transaction, the method further comprises:
and writing the node identification and/or the node address of the new node into a local node statistical table, wherein the node statistical table is used for recording the respective node identification and/or node address of all nodes included in the blockchain network.
8. A group addition method, comprising:
a first target node in a block chain network receives a group join transaction, responds to the group join transaction, and sends the group join transaction to a node of an appointed group in the block chain network, wherein the group join transaction carries a first group identifier which is an identifier of a new group to be joined;
each designated group node responds to the group joining transaction, carries out consensus voting on the group joining transaction to generate consensus voting aiming at the group joining transaction, and the node returns the consensus voting to the first target node;
the first target node receives consensus votes returned by each node, packages and submits the group join transactions and the consensus votes to transaction sorting nodes in the block chain network, wherein the transaction sorting nodes are used for receiving transactions submitted by the nodes, sorting the transactions to obtain transaction sets, and distributing the transaction sets to each node;
the transaction sequencing node arranges the group joining transactions into a first transaction set and distributes the first transaction set to each node;
after receiving the first transaction set, any node in the block chain network sequentially executes each transaction in the first transaction set, when the group joining transaction is executed, determining a consensus result of the group joining transaction according to a preset consensus strategy and consensus votes carried by the group joining transaction, and executing the group joining transaction to write the first group identifier into a block chain under the condition that the consensus result is consensus pass;
a second target node in the block chain network receives a node joining transaction sent by a new node to be joined, wherein the node joining transaction carries a node identifier and a second group identifier, the node identifier is an identifier of the new node, and the second group identifier is an identifier of a group to which the new node is to be joined;
the second target node adds the node into a transaction and submits the node into the transaction sequencing node;
the transaction sequencing node arranges the node adding transactions into a second transaction set and distributes the second transaction set to each node;
after receiving the second transaction set, any node in the blockchain network sequentially executes each transaction in the second transaction set, when the node joins in the transaction, whether the blockchain records the second group identifier is judged, and under the condition that the blockchain records the second group identifier, the node joins in the transaction, so that the corresponding relation between the node identifier and the second group identifier is written into the blockchain.
9. A group joining apparatus, applied to any node in a blockchain network, the apparatus comprising: the device comprises a transaction obtaining module, a consensus result determining module, a group joining transaction executing module and a node joining transaction executing module, wherein:
the transaction obtaining module is configured to obtain a group join transaction and a first consensus vote, where the group join transaction carries a first group identifier, the first group identifier is an identifier of a new group to be joined, and the first consensus vote is a consensus vote of a node of a first designated group in the blockchain network to the group join transaction;
the consensus result determining module is used for determining a first consensus result of the group joining transaction according to a first consensus strategy and the first consensus vote;
the group join transaction execution module is configured to execute the group join transaction to write the first group identifier into a block chain when the first consensus result is that the consensus passes;
the transaction obtaining module is further configured to obtain a node join transaction, where the node join transaction carries a node identifier and a second group identifier, the node identifier is an identifier of a new node to be joined, and the second group identifier is an identifier of a group to which the new node is to join;
and the node joining transaction execution module is used for judging whether the second group identifier is recorded in the block chain or not, and executing the node joining transaction under the condition that the second group identifier is recorded in the block chain so as to write the corresponding relation between the node identifier and the second group identifier into the block chain.
10. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
the memory is used for storing a computer program;
the processor, when executing a program stored in the memory, is adapted to perform the method steps of any of claims 1-7.
CN202011013697.8A 2020-09-24 2020-09-24 Group joining method and device and electronic equipment Pending CN112202581A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011013697.8A CN112202581A (en) 2020-09-24 2020-09-24 Group joining method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011013697.8A CN112202581A (en) 2020-09-24 2020-09-24 Group joining method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN112202581A true CN112202581A (en) 2021-01-08

Family

ID=74014603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011013697.8A Pending CN112202581A (en) 2020-09-24 2020-09-24 Group joining method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112202581A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115334026A (en) * 2022-10-12 2022-11-11 北京百度网讯科技有限公司 Instant messaging processing method, device and equipment based on block chain and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908979A (en) * 2017-10-20 2018-04-13 上海点融信息科技有限责任公司 For the method and electronic equipment for being configured and being endorsed in block chain
CN109862135A (en) * 2019-03-19 2019-06-07 全链通有限公司 Group communication method, block chain node and medium based on domain name block chain
CN109981305A (en) * 2019-03-19 2019-07-05 全链通有限公司 Group communication method, equipment and computer readable storage medium
CN109995850A (en) * 2019-03-05 2019-07-09 深圳前海微众银行股份有限公司 A kind of transaction processing method of block catenary system and block catenary system
CN110445627A (en) * 2019-08-12 2019-11-12 腾讯科技(深圳)有限公司 Group updating method, apparatus, computer equipment and computer storage medium
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system
US20200186509A1 (en) * 2018-12-06 2020-06-11 Bank Of America Corporation System and method for hierarchical decisioning within a hybrid blockchain
CN111327564A (en) * 2018-12-13 2020-06-23 航天信息股份有限公司 Access method and device for alliance chain

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908979A (en) * 2017-10-20 2018-04-13 上海点融信息科技有限责任公司 For the method and electronic equipment for being configured and being endorsed in block chain
US20200186509A1 (en) * 2018-12-06 2020-06-11 Bank Of America Corporation System and method for hierarchical decisioning within a hybrid blockchain
CN111327564A (en) * 2018-12-13 2020-06-23 航天信息股份有限公司 Access method and device for alliance chain
CN109995850A (en) * 2019-03-05 2019-07-09 深圳前海微众银行股份有限公司 A kind of transaction processing method of block catenary system and block catenary system
CN109862135A (en) * 2019-03-19 2019-06-07 全链通有限公司 Group communication method, block chain node and medium based on domain name block chain
CN109981305A (en) * 2019-03-19 2019-07-05 全链通有限公司 Group communication method, equipment and computer readable storage medium
CN110445627A (en) * 2019-08-12 2019-11-12 腾讯科技(深圳)有限公司 Group updating method, apparatus, computer equipment and computer storage medium
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115334026A (en) * 2022-10-12 2022-11-11 北京百度网讯科技有限公司 Instant messaging processing method, device and equipment based on block chain and storage medium
CN115334026B (en) * 2022-10-12 2023-03-24 北京百度网讯科技有限公司 Instant messaging processing method, device and equipment based on block chain and storage medium

Similar Documents

Publication Publication Date Title
CN110166409A (en) Equipment cut-in method, related platform and computer storage medium
JP2021526751A (en) Secure consensus endorsement for self-monitoring blockchain
CN111400112B (en) Writing method and device of storage system of distributed cluster and readable storage medium
CN112087502B (en) Method, device and equipment for processing request and storage medium
CN112037057B (en) Correction method and device for block chain data
CN112671908A (en) Network management method and device, electronic equipment and readable storage medium
CN112822267B (en) Data processing method and device based on block chain
CN112488834B (en) Node management method, node management device, electronic equipment and readable storage medium
CN112037055B (en) Transaction processing method, device, electronic equipment and readable storage medium
CN112202581A (en) Group joining method and device and electronic equipment
CN108173711B (en) Data exchange monitoring method for internal system of enterprise
WO2019220251A1 (en) Automatic inter-bank reconciliation system
CN110784324B (en) Node admission method and device
CN111680282A (en) Node management method, device, equipment and medium based on block chain network
CN110991573A (en) Product management method, system, client node and storage medium
CN112039893B (en) Private transaction processing method and device, electronic equipment and readable storage medium
CN113327169B (en) Claims settlement method and device based on block chain and electronic equipment
CN112258184B (en) Method, apparatus, electronic device and readable storage medium for freezing blockchain network
CN114491662A (en) Block chain-based data asset auditing method, system and equipment
CN113886487B (en) Message transmission method, system, medium, equipment and mobile terminal
CN110049109A (en) Accounting method, system and the computer readable storage medium of the shared storage of block chain
CN112785302B (en) Message statistics method and device, electronic equipment and readable storage medium
CN112488836B (en) Transaction transmitting method, device, electronic equipment and readable storage medium
CN112258183B (en) Cross-chain private transaction method, blockchain network and electronic equipment
CN110956551B (en) Revenue distribution method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination