WO2025007540A1 - 一种基于区块链的数据处理方法、装置、设备及介质 - Google Patents

一种基于区块链的数据处理方法、装置、设备及介质 Download PDF

Info

Publication number
WO2025007540A1
WO2025007540A1 PCT/CN2024/072020 CN2024072020W WO2025007540A1 WO 2025007540 A1 WO2025007540 A1 WO 2025007540A1 CN 2024072020 W CN2024072020 W CN 2024072020W WO 2025007540 A1 WO2025007540 A1 WO 2025007540A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
consensus
weight
blockchain network
update instruction
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.)
Ceased
Application number
PCT/CN2024/072020
Other languages
English (en)
French (fr)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Publication of WO2025007540A1 publication Critical patent/WO2025007540A1/zh
Priority to US19/320,800 priority Critical patent/US20260005872A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/321Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • H04L9/3255Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures using group based signatures, e.g. ring or threshold signatures
    • 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/40Network security protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the present application relates to the field of blockchain network technology, and in particular to a blockchain-based data processing method, device, equipment and medium.
  • the embodiments of the present application provide a blockchain-based data processing method, device, equipment and medium, which can reduce the workload of deploying nodes without additionally increasing the resource consumption and node management difficulty of the blockchain network.
  • an embodiment of the present application provides a data processing method based on blockchain, including:
  • the update results are recorded in the database of the blockchain network.
  • an embodiment of the present application provides a data processing device based on blockchain, including:
  • An acquisition module used to acquire a node weight update instruction generated for a first consensus node in a blockchain network, where the node weight update instruction is used to instruct to update the node weight of voting information configured for the first consensus node in a consensus service;
  • An update processing module used to predict whether the node weight of the updated first consensus node meets the node update condition based on the node weight update instruction, and obtain a prediction result
  • the update processing module is further used to update the node weight of the first consensus node according to the node weight update instruction in response to the prediction result being positive, to obtain an update result;
  • the writing module is used to record the update results into the database of the blockchain network.
  • the first consensus node belongs to the N consensus nodes included in the blockchain network, and N is a positive integer;
  • the update processing module includes:
  • a quantity determination unit used to determine the maximum number F of illegal nodes allowed by the blockchain network based on the N node weights and the configuration weight carried by the node weight update instruction; the configuration weight is the predicted node weight of the updated first consensus node;
  • a comparison unit used for comparing the configuration weight and the maximum number F to obtain a comparison result
  • the first updating unit is used to determine that the prediction result is positive if the comparison result indicates that the configuration weight is less than or equal to the maximum number F; a positive prediction result indicates that the configuration weight satisfies the node update condition.
  • the update processing module is used to update the node weight of the first consensus node according to the node weight update instruction in response to the prediction result being positive, and when the update result is obtained, specifically to perform the following operations:
  • the node weight of the first consensus node is updated according to the configuration weight in the node weight update instruction to obtain an update result; the configuration weight of the first consensus node in the update result is used to update the node weight list.
  • the quantity determination unit comprises:
  • An acquisition subunit used to acquire (N-1) node weights other than the node weight of the first consensus node from the N node weights;
  • the summation subunit is used to sum the (N-1) node weights and the configuration weights carried by the node weight update instructions.
  • the sum is calculated to obtain the total node weight H corresponding to the blockchain network; H is a positive integer;
  • the determination subunit is used to determine the maximum number F of illegal nodes allowed by the blockchain network based on the total node weight H and the node configuration rules corresponding to the blockchain network.
  • the update processing module further includes:
  • a first acquisition unit is used to acquire a configuration weight carried by a node weight update instruction, and according to the node weight update instruction, the prediction result is determined to be positive by default; the configuration weight is the predicted node weight of the updated first consensus node; a positive prediction result indicates that the configuration weight satisfies the node update condition;
  • a second acquisition unit is used to acquire a node weight of the first consensus node from the blockchain network in response to the prediction result being positive;
  • the target consensus node is the master node with the proposal function in the blockchain network; the target consensus node belongs to the N consensus nodes included in the blockchain network; N is a positive integer equal to (3F+1); F is the maximum number of illegal nodes allowed by the blockchain network;
  • the writing module includes:
  • a packaging unit is used to package the update results to obtain a block to be verified to be written into the blockchain network
  • the broadcast unit is used to broadcast the block to be verified to (N-1) backup nodes in the blockchain network, so that the (N-1) backup nodes can reach a consensus on the block to be verified and obtain a consensus result;
  • the (N-1) backup nodes refer to the consensus nodes other than the target consensus node among the N consensus nodes;
  • a statistical unit used for counting consensus results that are consistent from the received consensus results, and determining the consensus results that are consistent with the statistical consensus as a consensus result set;
  • a consensus determination unit used to determine the sum of the node weights of the backup nodes corresponding to each consensus result in the consensus result set as the consensus quantity corresponding to the consensus result set;
  • the writing unit is used to determine that the consensus nodes in the blockchain network have reached a consensus if the ratio of the number of consensuses to the total weight of the nodes corresponding to the blockchain network reaches the consensus threshold, and write the block to be verified as the target block into the data in the blockchain network.
  • the total node weight refers to the sum of the node weights of N consensus nodes; the target block of the database written into the blockchain network is used to indicate that the updated node weight of the first consensus node can perform weighted processing on the voting information of the first consensus node in the consensus business.
  • a detection unit configured to detect a consensus node in an abnormal state in the blockchain network if the consensus nodes in the blockchain network fail to reach a consensus and the prediction result is determined to be positive by default through a node weight update instruction, and determine the detected consensus node as a second consensus node;
  • a third acquisition unit is used to acquire the node weight of the second consensus node
  • the consensus unit is used to re-reach consensus on the acquired block to be verified if the consensus state of the updated second consensus node is restored to a normal state.
  • the writing module further includes:
  • An information generation unit is used to generate alarm information associated with the second consensus node if the consensus state of the updated second consensus node is an abnormal state, and send the alarm information to a management terminal device associated with the blockchain network.
  • the device also includes:
  • the master node determination module is used to determine the target consensus node as a master node with a proposal function if the number of blocks produced by the target consensus node in the current round does not reach the total number of blocks produced, so that the target consensus node can chain the next block of the target block.
  • the first consensus node belongs to the N consensus nodes included in the blockchain network; N is a positive integer; one consensus node corresponds to one business organization; the business organization corresponding to the first consensus node is the first business organization; the node weight update instruction is generated by the first terminal device of the first business organization in response to the configuration operation of the first object on the node weight of the first consensus node;
  • the device also includes:
  • a legitimacy verification module used to verify the legitimacy of the node weight update instruction based on the first public key and the primary signature information of the first object, and obtain a legitimacy verification result
  • a multi-signature verification module configured to perform multi-signature verification on the multi-party signature information based on the second public keys respectively corresponding to the second objects associated with the M second business institutions to obtain a multi-signature verification result if the legitimacy verification result indicates that the node weight update instruction is legitimate;
  • the execution module is used to notify the update processing module to execute the node weight update instruction to predict whether the node weight of the updated first consensus node meets the node update condition when the multi-signature verification result indicates that the verification is successful, and obtain the prediction result.
  • the legality verification module includes:
  • a signature verification unit configured to verify the primary signature information based on the first public key of the first object to obtain a primary signature verification result
  • a verification unit used to verify the instruction format of the node weight update instruction based on the smart contract on the blockchain network to obtain a verification result
  • the second generating unit is used to generate a legitimacy verification result indicating that the node weight update instruction is not legitimate if the primary signature verification result indicates that the verification failed, or the verification result indicates that the verification failed.
  • the target consensus node is a master node with a proposal function in the blockchain network and is not the first consensus node
  • the node weight update instruction obtained by the target consensus node is submitted by the first consensus node when it determines that the multi-signature verification result indicates that the verification is successful
  • the multi-signature verification result is obtained by the first consensus node after performing multi-signature verification on the multi-party signature information carried in the node weight update instruction when it determines that the legitimacy verification result indicates that the node weight update instruction is legitimacy
  • the legitimacy verification result is generated by the first consensus node after performing legitimacy verification on the received node weight update instruction.
  • the present application embodiment provides a blockchain network, including:
  • N consensus nodes N is a positive integer; one consensus node corresponds to one node weight; the N consensus nodes include a first consensus node and a target consensus node; the target consensus node is used to obtain a node weight update instruction generated for the first consensus node in the blockchain network, and the node weight update instruction is used to instruct to update the node weight of the voting information configured for the first consensus node in the consensus business; the target consensus node is also used to predict whether the node weight of the updated first consensus node meets the node update condition based on the node weight update instruction, and obtain a prediction result; the target consensus node is also used to respond to the prediction The result is positive.
  • the node weight of the first consensus node is updated according to the node weight update instruction to obtain an updated result, which is then recorded in the database of the blockchain network.
  • the first consensus node is used to broadcast the node weight update instruction to the target consensus node when it is determined that the instruction verification result of the node weight update instruction indicates that the verification is successful; the instruction verification result is determined by the first consensus node based on the legitimacy verification result and the multi-signature verification result; the legitimacy verification result is generated after the first consensus node verifies the legitimacy of the node weight update instruction; the multi-signature verification result is obtained after the first consensus node performs multi-signature verification on the multi-party signature information carried in the node weight update instruction when it is determined that the legitimacy verification result indicates that the node weight update instruction is legitimacy.
  • the present application provides a computer device, including: a processor, a memory, and a network interface;
  • the processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method provided in the embodiment of the present application.
  • an embodiment of the present application provides a computer-readable storage medium, which stores a computer program.
  • the computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method provided by the embodiment of the present application.
  • an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium; a processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method in the embodiment of the present application.
  • the target consensus node can obtain a node weight update instruction generated for the first consensus node in the blockchain network, and the node weight update instruction is used to indicate the update of the node weight of the voting information configured for the first consensus node in the consensus business.
  • the target consensus node can predict whether the node weight of the updated first consensus node meets the node update condition based on the node weight update instruction, obtain the prediction result, and in response to the prediction result being positive, update the node weight of the first consensus node according to the node weight update instruction, obtain the update result, and record the update result to the database of the blockchain network.
  • This application changes the node weights in this way.
  • this deployment mode there is no need to add new consensus nodes, and there is no need to perform the above configuration operations, which can reduce the workload of deploying nodes.
  • the number of consensus nodes in the blockchain network has not increased, the resource consumption of the blockchain network will not be increased.
  • the number of consensus nodes maintained and managed has not increased, the difficulty of maintaining and managing consensus nodes will not increase.
  • FIG1 is a schematic diagram of a blockchain network structure provided in an embodiment of the present application.
  • FIG2 is a schematic diagram of a scenario for data interaction provided in an embodiment of the present application.
  • FIG3 is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application.
  • FIG4 is a schematic diagram of a scenario of a check node weight update instruction provided in an embodiment of the present application.
  • FIG5 is a schematic diagram of a consensus algorithm provided in an embodiment of the present application.
  • FIG6 is a schematic diagram of a scenario of updating the node weight of a first consensus node provided by an embodiment of the present application
  • FIG. 7 is a second schematic diagram of a scenario of updating the node weight of a first consensus node provided by an embodiment of the present application.
  • FIG8 is a third schematic diagram of a scenario of updating the node weight of a first consensus node provided by an embodiment of the present application.
  • FIG9 is a schematic diagram of a transaction on-chain scenario provided by an embodiment of the present application.
  • FIG10 is a schematic diagram of a scenario of a business consensus provided by an embodiment of the present application.
  • FIG11 is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application.
  • FIG12 is a schematic diagram of a scenario for rotating a master node provided in an embodiment of the present application.
  • FIG13 is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application.
  • FIG14 is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application.
  • FIG. 15 is a schematic diagram of a computer device provided in an embodiment of the present application.
  • the embodiment of the present application proposes a consensus voting processing scheme based on blockchain.
  • the blockchain network (blockchain or block chain) can be a series of text records (also known as blocks) that are connected and protected by cryptography, that is, it includes a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain network, it will not be removed.
  • each block can include the encrypted hash of the previous block (that is, the hash value of the parent block), the generation timestamp, and the transaction data (also known as business data, usually represented by the hash value calculated by the Merkle tree algorithm).
  • the transaction data also known as business data, usually represented by the hash value calculated by the Merkle tree algorithm.
  • the distributed database connected in series with blockchain network technology allows both parties to effectively record transactions and can permanently check the transaction (that is, business data).
  • smart contracts are applications or programs running on blockchain network nodes. Usually, they are a set of digital agreements with specific rules that can be enforced. These rules are pre-defined by computer source code, which is copied and executed by all network nodes.
  • consensus nodes refer to nodes running the blockchain network consensus protocol, which have block generation and voting rights. Consensus nodes can participate in the verification and broadcasting of transaction data and block information, and can discover and maintain connections with other consensus nodes. At the same time, the consensus node can also include a complete blockchain network database.
  • the N consensus nodes shown in Figure 1 will take turns as the main node with proposal function in the blockchain network based on the block generation rules associated with the blockchain network to participate in the generation, broadcasting and consensus of new blocks.
  • the consensus algorithm is one of the core technologies of the blockchain network.
  • the so-called consensus algorithm is the specification followed by the nodes of the blockchain network (i.e., consensus nodes).
  • the consensus algorithms commonly used in the industry include proof of work (i.e., PoW), proof of stake (i.e., PoS), Byzantine fault-tolerant algorithms (e.g., TBFT), etc.
  • TBFT is the TendermintBFT consensus algorithm, which is a Byzantine fault-tolerant consensus algorithm.
  • N represents the maximum number of malicious nodes (i.e., illegal nodes) allowed in the blockchain network.
  • the illegal nodes here may not transmit messages, or transmit inconsistent messages in an attempt to disrupt other consensus nodes.
  • the consensus algorithm can allow illegal nodes to delay network transmission between normal nodes, and can provide security and activity when there are less than 1/3 illegal nodes. For example, in the blockchain network system shown in Figure 1, when there are no less than (2F+1) legitimate consensus nodes working normally, the blockchain network Nodes can reach a consensus. For example, the maximum number of illegal nodes that can exist in a blockchain network system with 4 consensus nodes is 1.
  • the total number of nodes N in the blockchain network shown in Figure 1 can be 4 as an example.
  • These 4 consensus nodes can specifically include node 10a corresponding to business organization A, node 10b corresponding to business organization B, node 10c corresponding to business organization C, and node 10d corresponding to business organization D.
  • Each business organization can correspond to one or more business objects (i.e., organizational members).
  • the database corresponding to the node 10a is database 1; the database corresponding to the node 10b is database 2; the database corresponding to the node 10c is database 3; and the database corresponding to the node 10d is database 4.
  • each of the four consensus nodes in the blockchain network shown in Figure 1 can correspond to a node weight.
  • the node weight of node 10a is used to indicate the proportion of voting information initiated by node 10a in the process of participating in the consensus business in the blockchain network
  • the node weight of node 10b is used to indicate the proportion of voting information initiated by node 10b in the process of participating in the consensus business in the blockchain network
  • the node weight of node 10c is used to indicate the proportion of voting information initiated by node 10c in the process of participating in the consensus business in the blockchain network
  • the node weight of node 10d is used to indicate the proportion of voting information initiated by node 10d in the process of participating in the consensus business in the blockchain network.
  • the node weights of any two consensus nodes in the blockchain network can be the same or different, and will not be limited here.
  • the embodiment of the present application may refer to business organization A as the first business organization, and the node 10a corresponding to the business structure A as the consensus node for the weight to be configured.
  • the embodiment of the present application may refer to the consensus node for the weight to be configured in the blockchain network as the first consensus node, and refer to the other consensus nodes in the blockchain network except the first consensus node as the third consensus node. It should be noted that if a consensus node in an abnormal state is detected in the blockchain network, the embodiment of the present application may refer to the consensus node detected in an abnormal state as the second consensus node.
  • any business object belonging to the business organization A may be referred to as a first object
  • the terminal device corresponding to the first object may be referred to as a first terminal device.
  • the first terminal device can generate a node weight update instruction in response to the configuration operation of the first object on the node weight of the node 10a, wherein the node weight update instruction is used to indicate the update of the node weight of the voting information configured for the first consensus node in the consensus business, and the node weight update instruction can also be understood as a transaction in the blockchain business for requesting an update of the node weight of the first consensus node.
  • the target consensus node in the blockchain network can obtain the node weight update instruction for node 10a, and then can predict (specifically, can predict through the prediction rule) whether the node weight of the updated first consensus node meets the node update condition based on the node weight update instruction to obtain the prediction result.
  • the prediction rule here can be the first prediction rule (for example, strong rule) or the second prediction rule (for example, weak rule).
  • strong rule means that after a consensus node updates its weight, even if the consensus node subsequently has an abnormality, it cannot affect the normal consensus of the entire blockchain network.
  • the node update condition at this time can refer to the default condition that allows the node weight of the first consensus node to be updated, among which there will only be positive results in the prediction results.
  • a positive result can be expressed as the predicted updated node weight of the first consensus node meets the node update condition, and a positive result can also be expressed as allowing the node weight of the first consensus node to be updated.
  • the node weight of node 10a can be updated according to the configuration weight carried by the node weight update instruction to obtain an update result, and then the update result can be written into the database in the blockchain network.
  • the update result written into the database in the blockchain network can also be understood as the transaction execution result written into the blockchain account book (the update result can be written into the database in the form of a block, and the block can also include a node weight update instruction), that is, each consensus node in the blockchain network will recognize the update result written into the database in the blockchain network, that is, recognize the node weight of the updated first consensus node.
  • the node weight of node 10a in the update result is used to indicate the proportion of voting information initiated by node 10a in the process of participating in the consensus business. For example, if the node weight of node 10a is updated to 2, it means that the number of votes corresponding to the voting information generated by node 10a in the subsequent consensus stage is equivalent to 2.
  • the embodiment of the present application proposes a processing model in which the nodes in the blockchain network themselves support weights.
  • the node weight of the first consensus node is changed to change the proportion of voting information initiated by the first consensus node in the process of participating in the consensus business.
  • the present application uses this deployment method of changing the node weight to avoid adding new consensus nodes, and there is no need to perform various configuration operations required to create new consensus nodes, thereby reducing the workload of deploying nodes.
  • the number of consensus nodes in the blockchain network has not increased, the resource consumption of the blockchain network will not be increased.
  • the difficulty of maintaining and managing consensus nodes will not increase.
  • the terminal device cluster shown in Figure 2 may be a terminal device cluster corresponding to the business organization (for example, business organization A) corresponding to the node 20a, and the terminal device cluster may include terminal devices corresponding to X business objects (i.e., members belonging to the business organization A), specifically including terminal device 200Z1 corresponding to object A1 , terminal device 200Z2 corresponding to object A2 , terminal device 200Z3 corresponding to object A3 , ..., and terminal device 200Zx corresponding to object Ax .
  • X business objects i.e., members belonging to the business organization A
  • Each terminal device in the terminal device cluster may include: smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, vehicle terminals, smart TVs and other smart terminals with data processing functions.
  • each terminal device in the terminal device cluster shown in Figure 2 can be installed with a business application (i.e., an application client).
  • the application client runs in each terminal device, data can be exchanged with the node 20a shown in Figure 2 above.
  • the application client may include application clients such as social clients, multimedia clients (e.g., video clients), entertainment clients (e.g., game clients), information flow clients, education clients, and live broadcast clients.
  • the application client can be an independent client or an embedded sub-client integrated in a client (e.g., a social client, an education client, and a multimedia client, etc.), which is not limited here.
  • Each terminal device corresponding to a business object can be connected to the node 20a through a network connection, so as to exchange data with the node 20a through the network connection.
  • the network connection here does not limit the connection method, and can be directly or indirectly connected through a wired communication method, directly or indirectly connected through a wireless communication method, or through other methods, which are not limited in this application.
  • any business object belonging to business organization A can generate a node weight update instruction (for example, the node weight update instruction 2t shown in Figure 2) for node 20a through the terminal device used.
  • a node weight update instruction for example, the node weight update instruction 2t shown in Figure 2
  • object A1 i.e., the first object
  • object A1 can determine the configuration weight corresponding to node 20a on terminal device 200Z1 , and after the determination is completed, perform a configuration operation on the node weight of node 20a, so that the terminal device 200Z1 (i.e., the first terminal device) responds to the configuration operation and generates a node weight update instruction 2t for node 20a (the node weight update instruction 2t can carry the configuration weight).
  • the configuration operation here can include contact operations such as clicking and long pressing, and can also include non-contact operations such as voice and gestures, which will not be limited here.
  • the configuration weight here is determined based on the percentage of consensus nodes that business organization A wants to occupy in the entire blockchain environment and the total weight of nodes in the blockchain network.
  • the configuration weight can be directly input by object A 1 on the weight configuration interface of terminal device 200Z 1 (i.e., the terminal interface for weight configuration), or selected by object A 1 from multiple candidate weights provided on the weight configuration interface of terminal device 200Z 1 , or selected by terminal device 200Z 1.
  • 200Z 1 is automatically calculated based on the percentage input by object A 1 in the weight configuration interface of terminal device 200Z 1 and the total weight of nodes in the blockchain network.
  • the configuration weight can also include other determination methods, which will not be limited here.
  • the terminal device 200Z 1 can automatically determine that the configuration weight corresponding to node 20a is 2 (wherein, the total weight of the node after the predicted node weight is updated becomes 5, and the configuration weight is 2, so the percentage of the node weight of node 20a in the entire blockchain network is 40%), and then generate a node weight update instruction 2t for requesting to change the node weight of node 20a to the configuration weight.
  • the terminal device 200Z 1 can send the node weight update instruction 2t to the node 20a (i.e., the first consensus node) in the blockchain network, so that the node 20a verifies the acquired node weight update instruction 2t (including legitimacy verification and multi-signature verification) to obtain the transaction verification result.
  • the embodiment of the present application can refer to the verification result of the legitimacy verification (i.e., verification instruction format verification and primary signature information) of the node weight update instruction 2t as the legitimacy verification result, and the verification result of the node weight update instruction 2t multi-signature verification (i.e., verification of multi-party signature information) as the multi-signature verification result.
  • the legitimacy verification result indicates that the node weight update instruction 2t is legitimate, and the multi-signature verification result indicates that the verification is successful, it means that the transaction verification result here indicates that the verification is successful. If the legitimacy verification result indicates that the node weight update instruction 2t is legitimate, but the multi-signature verification result indicates that the verification fails, it means that the transaction verification result here indicates that the verification fails. If the legitimacy check result indicates that the node weight update instruction 2t is not legitimate, there is no need to perform multi-signature verification on the node weight update instruction 2t, and the transaction verification result can be directly determined to indicate that the verification failed. It is understandable that when the transaction verification result indicates that the verification failed, the node 20a can directly discard the node weight update instruction 2t.
  • the node 20a can broadcast the node weight update instruction 2t to other nodes (i.e., the third consensus node) in the blockchain network, that is, the node weight update instruction 2t can be broadcast to the nodes 20b, 20c, and 20d shown in Figure 2, respectively, to wait for the master node with the proposal function in the blockchain network (i.e., the target consensus node) to execute the node weight update instruction 2t, thereby obtaining the update result corresponding to the node weight update instruction 2t. Then, the master node can write the update result and the node weight update instruction 2t into the blockchain network when the consensus nodes in the blockchain network reach a consensus.
  • the master node can write the update result and the node weight update instruction 2t into the blockchain network when the consensus nodes in the blockchain network reach a consensus.
  • the node 20d can predict whether the node weight of the updated first consensus node meets the node update condition based on the node weight update instruction, and obtain the prediction result.
  • the node weight of node 20a can be updated based on the configuration weight carried by the node weight update instruction 2t to obtain the update result.
  • the consensus nodes in the blockchain network reach a consensus, the node 20d can write the update result and the node weight update instruction 2t into the blockchain network.
  • the node 20d can update the node weight of node 20a to the configuration weight based on the configuration weight carried by the node weight update instruction 2t.
  • the node weight of node 20a in the update result is used to indicate the proportion of voting information initiated by node 20a in the process of participating in the consensus business, that is, when the configuration weight is 2, it means that one voting information initiated by node 20a in the process of participating in the consensus business is equivalent to two.
  • the deployment method proposed in the embodiment of the present application does not need to increase the number of nodes corresponding to business organization A, but changes the node weight of node 10a to change the proportion of voting information initiated by node 10a in the process of participating in consensus business.
  • the deployment method of changing the node weight in the present application can avoid the need to add new consensus nodes, and there is no need to perform various configuration operations required to create new consensus nodes, thereby reducing the workload of deploying nodes.
  • the number of consensus nodes in the blockchain network has not increased, the resource consumption of the blockchain network will not be increased.
  • the number of consensus nodes maintained and managed has not increased, the difficulty of maintaining and managing consensus nodes will not increase.
  • the embodiments of the present application are based on the idea of weight, and the specific implementation method of deploying nodes in the blockchain network can be referred to the embodiments corresponding to the following Figures 3 to 13.
  • Figure 3 is a flow chart of a data processing method based on blockchain provided by an embodiment of the present application.
  • the method can be executed by a target consensus node, which can be a master node with a proposal function in the blockchain network shown in Figure 1 above, and the target consensus node can be a first consensus node (for example, node 10a shown in Figure 1 above), or a third consensus node (for example, any one of node 10b, node 10c or node 10d), and the target consensus node will not be limited here.
  • the method can at least include the following steps S101-step S103:
  • Step S101 obtaining a node weight update instruction generated for a first consensus node in a blockchain network, where the node weight update instruction is used to instruct to update the node weight of voting information configured for the first consensus node in a consensus service.
  • the first consensus node here belongs to the N consensus nodes included in the blockchain network; the N consensus nodes may include the first consensus node and the third consensus node; N is a positive integer, and one consensus node corresponds to one business organization.
  • the business organization corresponding to the first consensus node is the first business organization.
  • the first business organization refers to a business organization that hopes to change the decision-making power in the entire blockchain network.
  • the node weight update instruction here is generated by the first terminal device of the first business organization in response to the configuration operation of the node weight of the first consensus node by the first object. It can be understood that the node weight update instruction obtained by the target consensus node can be sent directly by the first terminal device, or it can be broadcast by other nodes in the blockchain network after successful verification, and it will not be limited here.
  • each of the N consensus nodes in the blockchain network can correspond to a node weight.
  • the node weight of each consensus node is 1, the total number of nodes in the blockchain network is the total number of nodes in the blockchain network.
  • the first object can determine the node weight to be configured of the first consensus node on the first terminal device based on the percentage that the first business organization wants to occupy in the blockchain network and the total node weight in the blockchain network.
  • the node weights of the three consensus nodes are all 1, the percentage that the first business organization wants to occupy in the blockchain network is 50%, and the total node weight in the blockchain network is 3, then the node weight to be configured of the first consensus node determined by the first object is 2.
  • the first object can perform a configuration operation on the first terminal device for the node weight of the first consensus node, so that when the first terminal device responds to the configuration operation, the node weight to be configured of the first consensus node determined by the first object is determined as the configuration weight, and then based on the configuration weight, a business transaction (i.e., a node weight update instruction) for requesting a change in the node weight of the first consensus node can be generated.
  • the first terminal device can sign the node weight update instruction based on the object private key of the first object (i.e., the first private key) to obtain the primary signature information corresponding to the node weight update instruction.
  • the blockchain network includes N consensus nodes, and one consensus node corresponds to one business organization, this means that the blockchain network is related to N business organizations.
  • the business organizations other than the first business organization among the N business organizations may be referred to as second business organizations.
  • the first terminal device can send the node weight update instruction containing the main signature information to the second terminal device corresponding to the second object belonging to the second business organization, so that the second terminal device that receives the node weight update instruction containing the main signature information returns the signature parameters for multi-party signature of the node weight update instruction based on the object private key of the second object (i.e., the second private key).
  • the first terminal device can count the number of signature agencies M of the received signature parameters. When the number of signature agencies M is greater than the signature threshold (for example, 2N/3), the first terminal device can aggregate the M signature parameters to obtain the multi-party signature information of the node weight update instruction, and then send the node weight update instruction containing the multi-party signature information and the main signature information to the blockchain network. This means that the multi-party signature information in the embodiment of the present application is obtained after multi-party signature of the node weight update instruction based on the second private key of the second object associated with the M second business institutions.
  • the signature threshold for example, 2N/3
  • the target consensus node here can be the first consensus node or the third consensus node (that is, another consensus node other than the first consensus node). If the target consensus node is the first consensus node, the target consensus node can directly receive the node weight update instruction sent by the first terminal device. The node weight update instruction carries the primary signature information and the multi-party signature information. Then, the target consensus node can verify the legitimacy of the node weight update instruction based on the first public key of the first object and the primary signature information to obtain a legitimacy verification result. Among them, when the target consensus node verifies the legitimacy of the node weight update instruction, it can verify the primary signature information based on the first public key of the first object to obtain the primary verification result.
  • the target consensus node also needs to verify the instruction format of the node weight update instruction based on the smart contract on the blockchain network to obtain a verification result. If the primary verification result indicates that the verification is successful, and the verification result indicates that the verification is successful, If the verification is successful, the target consensus node can generate a legitimacy verification result indicating that the node weight update instruction is legitimate. If the primary verification result indicates that the verification failed, or the verification result indicates that the verification failed, the target consensus node can generate a legitimacy verification result indicating that the node weight update instruction is not legitimate.
  • the target consensus node is the third consensus node (i.e. not the first consensus node)
  • the node weight update instruction obtained by the target consensus node is submitted by the first consensus node when it determines that the multi-signature verification result indicates that the verification is successful.
  • the multi-signature verification result here is obtained by the first consensus node after multi-signature verification of the multi-party signature information carried in the node weight update instruction when it determines that the legitimacy verification result indicates that the node weight update instruction is legitimate; the legitimacy verification result here is generated by the first consensus node after legitimacy verification of the received node weight update instruction.
  • Figure 4 is a scene diagram of a verification node weight update instruction provided in an embodiment of the present application.
  • the object A1 corresponding to the terminal device 400Z here belongs to a member of the business organization A (i.e., the first business organization).
  • the node corresponding to the business organization A in the blockchain network may be the node 40a shown in Figure 4.
  • the node 40a here may be the node 10a in the blockchain network in the embodiment corresponding to Figure 1 above.
  • the business organization associated with the blockchain network to which node 40a belongs may also include a second business organization, for example, business organization B, business organization C, and business organization D.
  • the embodiment of the present application can refer to the summary information of the node weight update instruction 4t determined by the terminal device 400Z as the first summary information. Further, the terminal device 400Z can sign the first summary information based on the object private key of the object A1 , so as to obtain the main signature information shown in Figure 4.
  • the terminal device 400Z can send the node weight update instruction 4t containing the primary signature information to the second terminal device corresponding to the second object belonging to the business organization B, the second terminal device corresponding to the second object belonging to the business organization C, and the second terminal device corresponding to the second object belonging to the business organization C.
  • the second terminal device and the second terminal device corresponding to the second object belonging to the business organization D are used to enable the second terminal device to return the signature parameters for multi-party signature of the node weight update instruction 4t based on the second private key of the second object corresponding to itself.
  • the signature parameters returned by multiple second terminal devices belonging to the same second business organization to the terminal device 400Z can all be regarded as signature parameters returned by the same signature agency.
  • the signature parameters received by the terminal device 400Z include signature parameter 1 of object B1 (for example, the signature parameter returned by the terminal device corresponding to object B1 ), signature parameter 2 of object B2 (for example, the signature parameter returned by the terminal device corresponding to object B2 ), signature parameter 3 of object C1 (for example, the signature parameter returned by the terminal device corresponding to object C1 ), and signature parameter 4 of object D1 (for example, the signature parameter returned by the terminal device corresponding to object D1 ), wherein object B1 and object B2 are both members of business organization B, object C1 is a member of business organization C, and object D1 is a member of business organization D, this means that the number M of signature organizations counted by the terminal device 400Z is 3, namely, business organization B, business organization C, and business organization D.
  • the terminal device 400Z can aggregate the three signature parameters to obtain the multi-party signature information of the node weight update instruction 4t. Then, the terminal device 400Z can send the node weight update instruction 4t containing the multi-party signature information and the main signature information to the consensus node corresponding to the business organization A (i.e., the first consensus node in the blockchain network, e.g., node 40a), so that node 40a verifies the node weight update instruction 4t.
  • the consensus node corresponding to the business organization A i.e., the first consensus node in the blockchain network, e.g., node 40a
  • node 40a when node 40a obtains node weight update instruction 4t, it can verify the legitimacy of node weight update instruction 4t according to the object public key (i.e., the first public key) of object A1 and the primary signature information to obtain a legitimacy verification result.
  • the legitimacy verification result here is jointly determined by the verification result and the primary signature result.
  • node 40a needs to first verify the main signature information based on the object public key of object A 1 to obtain the main verification result. That is, node 40a can obtain the object public key of object A 1 , and then can verify the main signature information based on the object public key of object A 1 to obtain the first summary information of node weight update instruction 4t. At the same time, the node 40a can also obtain the same hash calculation rule as terminal device 400Z, and perform hash calculation on node weight update instruction 4t, so as to obtain the summary information (for example, summary information H) of node weight update instruction 4t. Among them, the summary information of node weight update instruction 4t determined by node 40a in the embodiment of the present application can be referred to as second summary information.
  • the node 40a can discard the node weight update instruction 4t.
  • the node 40a needs to continue to perform multi-signature verification on the multi-party signature information based on the second public keys corresponding to the second objects associated with the M second business institutions, and obtain the multi-signature verification result.
  • the second public keys corresponding to the second objects associated with the M second business institutions can include the object public key of object B1 , the object public key of object B2 , the object public key of object C1 , and the object public key of object D1 .
  • the embodiment of the present application can adopt a non-interactive aggregate signature rule (e.g., Schnorr algorithm) to perform multi-party signature on the node weight update instruction 4t to obtain multi-party signature information, and the specific implementation method of node 40a performing multi-party verification on the multi-party signature information can refer to this non-interactive aggregate signature rule, which will not be repeated here.
  • a non-interactive aggregate signature rule e.g., Schnorr algorithm
  • the node 40a can discard the node weight update instruction 4t.
  • the node 40a can broadcast the node weight update instruction 4t to other nodes in the blockchain network to wait for the master node with the proposal function to chain it. For example, if the master node is node 40a, the node 40a can continue to execute the following S102 step. It can be seen that the legality verification and multi-signature verification can ensure that the node weight update instructions to be executed subsequently are legal and reliable.
  • the blockchain network of the present application can adopt the original consensus algorithm (for example, TBFT consensus).
  • TBFT consensus for example, TBFT consensus
  • the blockchain network in the embodiment of the present application may include N consensus nodes, and these N consensus nodes may specifically include a master node with a proposal function (for example, node a) and (N-1) backup nodes with a verification function, which may specifically include node b, node c, and node d.
  • N here can be a positive integer equal to (3F+1), and F can be the maximum number of illegal nodes allowed by the blockchain network.
  • the consensus process between nodes can include 5 stages, including the preparation stage (NewRound) of consensus voting, the proposal stage (Proposal), the pre-voting stage (Prevote), the pre-commit stage (Precommit), and the commit stage (Commit).
  • node a In the preparation stage, when node a receives a transaction sent by the client in the first terminal device (for example, a node weight update instruction generated for node a), it will initialize the consensus-related state.
  • a transaction sent by the client in the first terminal device for example, a node weight update instruction generated for node a
  • the master node can generate a proposal and broadcast it to other nodes.
  • node a will package the transactions to be uploaded to the chain and broadcast the generated blocks to nodes b, c, and d respectively.
  • the backup node can execute the transaction in the block and determine whether the block hash value of the block is correct, so as to generate prevote voting information (i.e., first voting information) in the pre-voting phase and broadcast the prevote voting information to other nodes. If the block hash value is correct, the backup node generates prevote voting information indicating a yes vote; otherwise, it generates prevote voting information indicating a no vote.
  • prevote voting information i.e., first voting information
  • any consensus node can collect the prevote voting information generated by other nodes in the pre-voting phase. If the number of votes in the collected prevote voting information reaches (2F+1), Precommit voting information (i.e., the second voting information) is generated based on the collected prevote voting information, and the Precommit voting information is broadcast to other nodes.
  • Precommit voting information i.e., the second voting information
  • any consensus node can collect the Precommit voting information generated by other nodes in the pre-submission phase. If the number of votes in the collected Precommit voting information reaches (2F+1), a submission message is generated based on the collected Precommit voting information. The submission message here is used to indicate whether the block in the proposal is submitted to the database.
  • Step S102 based on the node weight update instruction, predict whether the node weight of the updated first consensus node meets the node update condition, and obtain a prediction result; in response to the prediction result being positive, update the node weight of the first consensus node according to the node weight update instruction to obtain an update result.
  • the consensus algorithm mentioned above (for example, TBFT consensus) is a three-stage model. Since the embodiment of the present application is based on the idea of node weight to change the proportion of voting information initiated by the first consensus node in the process of participating in the consensus business, for security reasons, the embodiment of the present application does not modify its three-stage model and the entire fault-tolerant mechanism, but designs two prediction rules for the blockchain network. Both prediction rules can be used to indicate whether the node weight update for the first consensus node meets the node update condition.
  • the prediction rule may include a first prediction rule (for example, a strong rule) or a second prediction rule (for example, a weak rule).
  • the so-called strong rule refers to the requirement that after a consensus node updates its weight, even if the node subsequently has an abnormality, it cannot affect the normal consensus of the entire blockchain network, that is, the node update condition at this time may refer to the condition that the node weight of the updated first consensus node does not affect the normal consensus of the blockchain network, wherein the prediction results can be divided into positive and negative, and the positive can indicate that the predicted node weight of the updated first consensus node satisfies the node update condition.
  • a positive value can also be expressed as the node weight of the updated first consensus node does not affect the normal consensus of the blockchain network
  • a negative value can be expressed as the predicted node weight of the updated first consensus node does not meet the node update condition
  • a negative value can also be expressed as the node weight of the updated first consensus node will affect the normal consensus of the blockchain network.
  • the node update condition at this time can refer to the default condition that allows the node weight of the first consensus node to be updated, where there will only be positive results in the prediction results.
  • the positive result can be expressed as the predicted updated node weight of the first consensus node meets the node update condition, and the positive result can also be expressed as allowing the node weight of the first consensus node to be updated.
  • the prediction rule obtained by the target consensus node can be directly obtained from the database in the blockchain network (that is, the blockchain network database, or the blockchain ledger), or it can be read from the smart contract associated with the blockchain network, or it can be jointly agreed upon by N consensus nodes in the blockchain network (for example, read from the configuration file), which will not be limited here.
  • the configuration weight of the first consensus node in the update result is used to indicate the proportion of voting information initiated by the first consensus node in the process of participating in the consensus business. It should be understood that if the prediction rule is the first prediction rule, the target consensus node (i.e., the master node) needs to determine whether the first consensus node meets the node update condition based on the configuration weight in the node weight update instruction and the node weight list corresponding to the blockchain network to obtain the prediction result.
  • the node update condition here can also refer to the configuration weight of the first consensus node being less than or equal to the maximum number of illegal nodes allowed by the blockchain network to ensure that the node weight (i.e., the configuration weight) of the updated first consensus node does not affect the normal consensus of the blockchain network.
  • the prediction rule is the second prediction rule
  • the target consensus node can directly assume that the predicted updated node weight of the first consensus node meets the node update condition, that is, the node weight update instruction can be directly executed to update the node weight of the first consensus node to obtain the update result.
  • each consensus node in the blockchain network has a corresponding node identifier, and each consensus node can store the node identifiers of other consensus nodes in the blockchain network, so that the generated blocks can be broadcast to other consensus nodes according to the node identifiers of other consensus nodes.
  • the node identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address or any other information that can be used to identify the node.
  • each consensus node can maintain a node identification list. Since the embodiment of the present application proposes a processing model in which the nodes in the blockchain network themselves support weights, the embodiment of the present application can add a new field for indicating the node weight and a field for indicating the business organization corresponding to the consensus node on the basis of the node identification list to obtain the node weight list corresponding to the blockchain network.
  • the node weight list may include fields corresponding to the business organization, fields corresponding to the consensus node name, fields corresponding to the node identifier, and fields corresponding to the node weight.
  • the node weight list may also be other lists containing fields corresponding to the node weights, which will not be limited here.
  • the blockchain network corresponding to the node weight list may be the blockchain network in the embodiment corresponding to Figure 1 above.
  • the blockchain network may include 4 consensus nodes, specifically including node 10a corresponding to business organization A, node 10b corresponding to business organization B, node 10c corresponding to business organization C, and node 10d corresponding to business organization D. Among them, one consensus node corresponds to one consensus node weight. As shown in Table 1:
  • the target consensus node can obtain the node weight list corresponding to the blockchain network. Since the first consensus node here belongs to the N consensus nodes included in the blockchain network, the embodiment of the present application can refer to the node weight of each consensus node in the N consensus nodes in the node weight list as the node weight; N is a positive integer. Then, the target consensus node can determine the maximum number F of illegal nodes allowed by the blockchain network based on the N node weights and the configuration weights carried by the node weight update instruction, and then compare the configuration weight and the maximum number F to obtain a comparison result.
  • the target consensus node when determining the maximum number F, can obtain (N-1) node weights other than the node weight of the first consensus node from the N node weights, and then sum the (N-1) node weights and the configuration weights carried by the node weight update instruction to obtain the predicted total node weight H corresponding to the blockchain network.
  • H here is a positive integer.
  • the target consensus node can determine that the configuration weight meets the node update condition, that is, the prediction result can be determined to be positive, and then the node weight of the first consensus node can be updated based on the configuration weight in the node weight update instruction to obtain an update result.
  • the configuration weight of the first consensus node in the update result here can be used to update the node weight list of the blockchain network.
  • the target consensus node can determine that the prediction result is negative, with a negative prediction result. The test result indicates that the configuration weight does not meet the node update conditions, and the node weight update instruction is discarded.
  • this application can use strong rules to ensure that the configuration weight you want to change will not affect the normal consensus of the entire blockchain network, that is, even if the consensus node that has been changed to the configuration weight is abnormal or malicious, the blockchain network can still continue to complete the consensus process normally.
  • the configuration weight is greater than the maximum number F of illegal nodes allowed by the blockchain network
  • This can effectively increase the security of updating node weights and ensure that the blockchain network after the node weight is updated can still safely and normally execute the consensus process.
  • Figure 6 is a schematic diagram of a scenario for updating the node weight of the first consensus node provided in an embodiment of the present application.
  • the total number of nodes N in the blockchain network (i.e., the current blockchain network) in the embodiment of the present application can be 4 as an example, and can specifically include node 60a, node 60b, node 60c, and node 60d.
  • the target consensus node i.e., the master node
  • the target consensus node may obtain a node weight list corresponding to the blockchain network.
  • the node weight list may include the node weight of node 60a (e.g., 1), the node weight of node 60b (e.g., 1), the node weight of node 60c (e.g., 1), and the node weight of node 60d (e.g., 1).
  • the target consensus node Since the node weight update instruction is used to request that the node weight of node 60a be changed to the configuration weight (for example, 2), the target consensus node needs to obtain the three node weights other than node 60a from the four node weights, and then sum the three node weights and the configuration weight of node 60a to obtain the predicted total node weight H (for example, 5) corresponding to the updated blockchain network. Furthermore, the target consensus node can determine the maximum number F (for example, 1) of illegal nodes allowed by the blockchain network based on the node configuration rules corresponding to the blockchain network.
  • F for example, 1
  • the node update condition in the first prediction rule indicates that once the updated node exits, it is necessary to ensure that other nodes can continue to reach consensus. Therefore, after the node weight of node 60a is predicted and updated, it is predicted that the updated blockchain network needs 4 consensus results to reach a consensus. If node 60a is abnormal (for example, it is offline, malicious, etc.), then the remaining nodes 60b, 60c, and 60d will not be able to reach a consensus, which means that the first prediction rule does not allow node 60a to change the node weight. In other words, since the configuration weight of node 60a is greater than the maximum number F, the target consensus node can determine that the configuration weight of node 60a does not meet the node update condition, and the node weight update instruction can be directly discarded.
  • Figure 7 is a schematic diagram of a scenario 2 for updating the node weight of the first consensus node provided in an embodiment of the present application.
  • the total number of nodes N in the blockchain network (i.e., the current blockchain network) in the embodiment of the present application can be 6 as an example, and can specifically include node 70a, node 70b, node 70c, node 70d, node 70e, and node 70f.
  • the target consensus node i.e., the master node
  • the node weight list may include the node weight of node 70a (e.g., 1), the node weight of node 70b (e.g., 1), the node weight of node 70c (e.g., 1), the node weight of node 70d (e.g., 1), the node weight of node 70e (e.g., 1), and the node weight of node 70f (e.g., 1).
  • the target consensus node needs to obtain 5 node weights other than node 70a from the 6 node weights, and then sum these 5 node weights and the configuration weight of node 70a to obtain the predicted total node weight H (for example, 7) corresponding to the updated blockchain network. Furthermore, the target consensus node can determine the maximum number F (for example, 2) of illegal nodes allowed by the blockchain network based on the node configuration rules corresponding to the blockchain network.
  • node update condition in the first prediction rule indicates that once the updated node exits, it is necessary to ensure that other nodes can continue to reach a consensus. Therefore, after the node weight of node 70a is predicted and updated, it is predicted that the updated blockchain network needs 5 consensus results to reach a consensus. If node 70a is abnormal (for example, it is in an abnormal state such as disconnection, malicious behavior, etc.), then the remaining nodes 70b, 70c, 70d, 70e and 70f can still reach a consensus, which means that the first prediction rule allows node 70a to change the node weight.
  • the target consensus node can determine that the configuration weight of node 70a meets the node update condition, and then based on the configuration weight, the node weight of node 70a can be updated to obtain an update result.
  • the node weight of node 70a in the update result i.e., the configuration weight
  • the node weight list of the blockchain network By updating the node weight list of the blockchain network, it is possible to ensure that the correct node weight of each current consensus node is recorded in real time, so that when the node weight is updated next time, the accurate node weight can be obtained through the updated node weight list to ensure that the node weight update can continue to be completed safely and reliably.
  • Figure 8 is a schematic diagram of a scenario for updating the node weight of the first consensus node provided in an embodiment of the present application.
  • the total number of nodes N in the blockchain network (i.e., the current blockchain network) in the embodiment of the present application can be 7 as an example, and can specifically include node 80a, node 80b, node 80c, node 80d, node 80e, node 80f, and node 80g.
  • the target consensus node i.e., the master node
  • the node weight list may include the node weight of node 80a (e.g., 1), the node weight of node 80b (e.g., 1), the node weight of node 80c (e.g., 1), the node weight of node 80d (e.g., 1), the node weight of node 80e (e.g., 1), the node weight of node 80f (e.g., 1), and the node weight of node 80g (e.g., 1).
  • the node weight list may include the node weight of node 80a (e.g., 1), the node weight of node 80b (e.g., 1), the node weight of node 80c (e.g., 1), the node weight of node 80d (e.g., 1), the node weight of node 80e (e.g., 1), the node weight of node 80f (e.g., 1)
  • the target consensus node needs to obtain the weights of 6 nodes except node 80a from these 7 node weights, and then sum these 6 node weights and the configuration weight of node 80a to obtain the predicted total node weight H (for example, 8) corresponding to the updated blockchain network. Furthermore, the target consensus node can determine the maximum number F (for example, 2) of illegal nodes allowed by the blockchain network based on the node configuration rules corresponding to the blockchain network.
  • node update condition in the first prediction rule indicates that once the updated node exits, it is necessary to ensure that other nodes can continue to reach a consensus. Therefore, after the node weight of node 80a is predicted and updated, it is predicted that the updated blockchain network needs 6 consensus results to reach a consensus. If node 80a is abnormal (for example, it is in an abnormal state such as disconnection, evil, etc.), then the remaining nodes 80b, 80c, 80d, 80e, 80f and 80g can still reach a consensus, which means that the first prediction rule allows node 80a to change the node weight.
  • the target consensus node can directly obtain the configuration weight carried by the node weight update instruction, and determine the prediction result to be positive by default according to the node weight update instruction.
  • the positive prediction result indicates that the configuration weight satisfies the node update condition, and then the node weight of the first consensus node can be obtained from the blockchain network in response to the prediction result being positive, and the node weight of the first consensus node can be changed to the configuration weight to obtain the update result. It can be seen that by providing a weak rule node weight update mechanism, the present application can complete the node weight update more efficiently when the user has time requirements.
  • the total node weight refers to the sum of the node weights of N consensus nodes; the target block of the database written into the blockchain network is used to indicate that the updated node weight of the first consensus node can perform weighted processing on the voting information of the first consensus node in the consensus business.
  • the node weights of the consensus nodes in the embodiment of the present application can be stored in the latest block in the blockchain network (for example, the update results in the block or the status tree in the block), or in the node weight list maintained by itself, or in a configuration file associated with the consensus node.
  • the storage method of the current node weight here can also include other forms, which will not be exemplified one by one here.
  • the target consensus node can obtain the block with the maximum generation timestamp from the blockchain network, and then determine the information to be packaged based on the block hash value of the obtained block and the update result, and then package the information to be packaged, and use the block generated after the packaging process as the block to be verified to be written into the blockchain network. Then, the target consensus node can broadcast the block to be verified to the (N-1) backup nodes in the blockchain network, so that the (N-1) backup nodes can reach a consensus on the block to be verified and obtain a consensus result.
  • the block to be verified can be written into the blockchain network as the target block.
  • the generation timestamp of the target block here can be used to update the maximum generation timestamp of the blockchain network.
  • the target consensus node can obtain the block with the maximum generation timestamp from the blockchain network, and then use the obtained block as the parent block.
  • the state tree in the parent block stores the node weight of the first consensus node.
  • the target consensus node can obtain the leaf node for storing the node weight of the first consensus node from the state tree of the parent block based on the path indicated by the key information (e.g., node identifier) of the first consensus node, and then change the storage information of the obtained leaf node from the node weight of the first consensus node to the configuration weight carried by the node weight update instruction, thereby obtaining an updated state tree. Then, the target consensus node can determine the information to be packaged based on the block hash value of the parent block, the updated state tree, and the update result, and then can package the information to be packaged, and use the block generated after the packaging process as the block to be verified to be written into the blockchain network.
  • the key information e.g., node identifier
  • the target consensus node can broadcast the block to be verified to (N-1) backup nodes in the blockchain network, so that (N-1) backup nodes can reach a consensus on the block to be verified and obtain a consensus result.
  • the block to be verified can be written into the blockchain network as the target block.
  • the generation timestamp of the target block here can be used to update the maximum generation timestamp of the blockchain network, and the node weight of the first consensus node stored in the state tree in the target block is the configuration weight of the first consensus node.
  • the target consensus node may change the node weight of the first consensus node in the configuration file to the configuration weight after executing step S103, that is, after the target consensus node writes the target block into the blockchain network.
  • Figure 9 is a schematic diagram of a transaction chain scenario provided by an embodiment of the present application.
  • the total number of consensus nodes in the blockchain network in the embodiment of the present application can be 4 as an example, and can specifically include node 90a, node 90b, node 90c and node 90d.
  • node 90d can be a master node with a proposal function determined according to the block rules associated with the blockchain network, and node 90a, node 90b and node 90c can all be called backup nodes.
  • the node weight update instruction here can be used to request that the node weight of node 90a be changed to the configuration weight (for example, 2).
  • the blockchain network shown in FIG9 can be an identical blockchain network shared by each consensus node in the blockchain network, and each consensus node can obtain information stored in the blockchain network (for example, the current node weight of any consensus node) in the blockchain network.
  • the blockchain network includes blocks 9Q 1 , blocks 9Q 2 , ... and blocks 9Q n .
  • the node 90d i.e., the target consensus node
  • the node 90d updates the result on the chain
  • it needs to obtain the block with the maximum generation timestamp from the blockchain network e.g., block 9Q n shown in FIG9
  • the node 90d can package the parent block hash value and the update result, and use the block generated after the packaging process as the block to be written to the blockchain network to which the node 90d belongs to be verified.
  • the node 90d can broadcast the block to be verified to the three backup nodes in the blockchain network where the node 90d is located, so that the three backup nodes can respectively reach consensus on the obtained block to be verified, thereby obtaining a consensus result for returning to the node 90d.
  • the number of copies of the consensus result returned by each backup node is equal to the number of consensuses that match the node weight. For example, if the node weight of node 90a is 1, the node weight of node 90b is 1, and the node weight of node 90c is 3.
  • the node weight of node 90d is 2, so the total node weight of the blockchain network is 7.
  • the number of consensus results returned by node 90a is equivalent to one consensus result
  • the number of consensus results returned by node 90b is equivalent to one consensus result
  • the number of consensus results returned by node 90c is equivalent to three consensus results
  • the number of consensus results generated by node 90d itself is equivalent to two consensus results.
  • the generation timestamp of the target block is used to update the maximum generation timestamp of the blockchain network.
  • the target consensus node can detect the consensus node in an abnormal state in the blockchain network, and determine the detected consensus node as the second consensus node. Further, the target consensus node can obtain the node weight of the second consensus node. If the node weight of the second consensus node is greater than the maximum number F of illegal nodes allowed by the blockchain network, the second consensus node can be restarted and the consensus state of the second consensus node can be updated.
  • the consensus state of the updated second consensus node is restored to a normal state, the consensus can be re-obtained on the block to be verified. If the consensus state of the updated second consensus node is still an abnormal state, the target consensus node can generate an alarm message associated with the second consensus node, and send the alarm message to the management terminal device associated with the blockchain network, so that the management object corresponding to the management terminal device processes the second consensus node. It can be seen that in the scenario where node weight updates are implemented through weak rules, the present application not only considers the timeliness of updating node weights, but also further sets up an exception check mechanism in the consensus process after the node weights are updated.
  • Figure 10 is a schematic diagram of a scenario of a business consensus provided in an embodiment of the present application.
  • the prediction rule associated with the blockchain network in the embodiment of the present application as the second prediction rule and the total number of nodes in the blockchain network as 4 as an example it can specifically include node 100a, node 100b, node 100c and node 100d.
  • the node weight of node 100a can be 2, the node weight of node 100b can be 1, the node weight of node 100c can be 1, and the node weight of node 100d can be 1.
  • the total node weight of the blockchain network is is 5, and the maximum number of illegal nodes allowed by the blockchain network is 1.
  • the blockchain network can still reach a consensus because the node weight of node 100a is equal to the maximum number of illegal nodes allowed by the blockchain network.
  • the target consensus node when the target consensus node is chaining the block to be verified, if the consensus nodes in the blockchain network do not reach a consensus, the target consensus node needs to detect the consensus node in an abnormal state in the blockchain network, and determine the detected consensus node as the second consensus node (for example, node 100a). Since if the node weight of node 100a is greater than the maximum number F of illegal nodes allowed by the blockchain network, the embodiment of the present application can instruct node 100a to restart through the target consensus node, thereby updating the consensus state of node 100a. If the consensus state of node 100a after the update is restored to a normal state, the consensus can be re-obtained on the block to be verified.
  • the second consensus node for example, node 100a
  • the target consensus node can generate an alarm message associated with the node 100a, and send the alarm message to the management terminal device associated with the blockchain network, so that the management object corresponding to the management terminal device processes the node 100a.
  • the alarm message here can be a warning message of the type of voice, text, video, picture, etc., and the form of the alarm message will not be limited here.
  • the present application if the first business organization wants to have greater decision-making power in the entire blockchain network, there is no need to increase the number of nodes of the first business organization. Instead, based on the idea of node weight, by changing the node weight of the first consensus node, the proportion of voting information initiated by the first consensus node in the process of participating in the consensus business is changed.
  • the present application uses this deployment method of changing the node weight to avoid adding new consensus nodes, and there is no need to perform various configuration operations required to create new consensus nodes, thereby reducing the workload of deploying nodes.
  • the number of consensus nodes in the blockchain network has not increased, the resource consumption of the blockchain network will not be increased.
  • the difficulty of maintaining and managing consensus nodes will not increase.
  • FIG. 11 is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application.
  • the method involves a target consensus node (i.e., a master node with a proposal function) and a first consensus node in a blockchain network.
  • the target consensus node here is not the first consensus node, but other consensus nodes (e.g., a third consensus node) in the blockchain network except the first consensus node.
  • the method may at least include the following steps S201-S205:
  • Step S201 When the first consensus node obtains the node weight update instruction generated for the first consensus node, the first consensus node verifies the node weight update instruction to obtain a transaction verification result.
  • the transaction verification result is determined by the first consensus node based on the legitimacy verification result and the multi-signature verification result;
  • the legality verification result is generated by the first consensus node after verifying the legality of the node weight update instruction;
  • the multi-signature verification result is obtained by the first consensus node after performing multi-signature verification on the multi-party signature information carried in the node weight update instruction when it determines that the legality verification result indicates that the node weight update instruction is legal.
  • Step S202 when the transaction verification result indicates that the verification is successful, the first consensus node broadcasts the node weight update instruction to the blockchain network.
  • Step S203 The target consensus node obtains a node weight update instruction generated for the first consensus node.
  • the target consensus node can obtain the block rules associated with the blockchain network.
  • the block rules can be block rules associated with node weights (i.e., first block rules) or block rules that are unrelated to node weights (i.e., second block rules). If the block rules are block rules associated with node weights, the target consensus node can obtain the node weight of the target consensus node. Among them, the node weight of the target consensus node here is used to indicate the total number of blocks produced by the target consensus node in the current round.
  • the node weight of the present application can not only act on the process of consensus voting, but also determine the polling timing of the master node, that is, the consensus node with a higher node weight can have more opportunities to become a master node, further improving the influence of the node weight.
  • Figure 12 is a schematic diagram of a scenario for rotating the master node provided in an embodiment of the present application.
  • the total number of nodes in the blockchain network in the embodiment of the present application can be 4.
  • the node 120a, the node 120b, the node 120c and the node 120d may be specifically included.
  • the node weight of the node 120a may be 2
  • the node weight of the node 120b may be 1
  • the node weight of the node 120c may be 1
  • the node weight of the node 120d may be 3.
  • the block rule associated with the blockchain network is the first block rule (i.e., the block rule associated with the node weight)
  • the node weight of each consensus node is used to indicate the total number of blocks generated by the node in the current round.
  • the polling order of a certain round of the master node in the blockchain network can be node 120a, node 120a (i.e., node 120a can be a master node twice in a row, i.e., can chain two blocks continuously), node 120b, node 120c, node 120d, node 120d, and node 120d (i.e., node 120d can be a master node 3 times in a row, i.e., can chain 3 blocks continuously).
  • the first parameter included in the parameter 12R shown in Figure 12 is 1, which is used to indicate that the block height of the new block generated by the current master node (i.e., node 120a) is 1, and the second parameter in the parameter 12R is 0, which is used to indicate that the current round is the first round.
  • node 120d After node 120d links the 5th block, it generates blocks for the first time in the current round. Since the node weight of node 120d is 3, this means that the number of blocks generated by node 120d in the first round has not reached the total number of blocks generated. At this time, node 120d can continue to be the master node to link the next block of the 5th block (i.e., the 6th block). When the 7th block is successfully linked, the number of blocks generated by node 120d in the current round is the third time, which is equal to the corresponding total number of blocks generated. Therefore, another node will be replaced as the master node (such as node 120a) at this time.
  • the master node such as node 120a
  • the block generation rule associated with the blockchain network is the second block generation rule (i.e., a block generation rule that is independent of the node weight)
  • the number of blocks generated by each consensus node in the current round is 1.
  • the polling order of a master node in a certain round in the blockchain network may be node 120a, node 120b, node 120c, and node 120d.
  • the block generation rule in the embodiment of the present application can determine the next node of node 120b (for example, node 120c) as the master node according to the round order associated with the second block generation rule, so that node 120c continues to chain the sixth block.
  • the target consensus node when the target consensus node receives the node weight update instruction generated for the first consensus node, the target consensus node can perform a legitimacy verification on the node weight update instruction (i.e., verify the primary signature information and the instruction format carried by the node weight update instruction, respectively) to obtain a legitimacy verification result, and then execute step S131. To determine whether the legitimacy verification result indicates that the verification is successful. If the legitimacy verification result indicates that the verification fails (that is, the node weight update instruction is not legitimate), the target consensus node can jump to step S138 and discard the node weight update instruction.
  • a legitimacy verification on the node weight update instruction i.e., verify the primary signature information and the instruction format carried by the node weight update instruction, respectively
  • the target consensus node can continue to perform multi-signature verification on the multi-party signature information carried by the node weight update instruction to obtain the multi-signature verification result, and then execute step S132 to determine whether the multi-signature verification result indicates that the verification is successful. If the multi-signature verification result indicates that the verification failed, the target consensus node can jump to step S138 and discard the node weight update instruction.
  • the target consensus node can broadcast the node weight update instruction to other nodes in the blockchain network. Then, when the target consensus node is the master node in the blockchain network, the target consensus node can continue to execute step S133 to obtain the prediction rules associated with the blockchain network.
  • the target consensus node can execute step S134-step S136: that is, the target consensus node can execute step S134 to obtain the node weight list corresponding to the blockchain network, and then can execute step S135 based on the configuration weight of the first consensus node in the node weight update instruction and the node weight list to determine whether the configuration weight meets the node update condition. If the configuration weight does not meet the node update condition, the target consensus node can jump to execute step S138 and discard the node weight update instruction. If the configuration weight meets the node update condition, the target consensus node can continue to execute step S136, that is, based on the configuration weight, update the node weight of the first consensus node to obtain an update result.
  • the target consensus node can configure the weight by default to meet the node update condition, that is, it can directly jump to step S136 to update the node weight of the first consensus node based on the configuration weight to obtain an update result. Then, when the target consensus node can reach a consensus with the consensus nodes in the blockchain network, it writes the update result into the database in the blockchain network.
  • the target consensus node may also execute step S137 to update the node weight list based on the configuration weight of the first consensus node in the update result to obtain an updated node weight list.
  • the target consensus node may also update the maximum number of illegal nodes allowed in the blockchain network based on the configuration weight of the first consensus node in the update result to obtain an updated maximum number F.
  • a new node deployment method is proposed for the solution that the existing blockchain network nodes must implement weights by deploying multiple consensus nodes. That is, based on the idea of weights, a processing model in which the consensus nodes themselves support weights is proposed.
  • the model can support both strong and weak prediction rules, so that users can choose according to their actual business scenarios, thereby improving business adaptability.
  • it can still meet the 3F+1 rule, and the security is not reduced due to the node weight.
  • This application adopts this deployment method of changing the node weights, There is no need to add new consensus nodes, and there is no need to perform the various configuration operations required to create new consensus nodes, which can reduce the workload of deploying nodes. Moreover, since the number of consensus nodes in the blockchain network has not increased, the resource consumption of the blockchain network will not be increased. Moreover, since the number of consensus nodes maintained and managed has not increased, the difficulty of maintaining and managing consensus nodes will not increase.
  • Figure 14 is a schematic diagram of the structure of a data processing device based on blockchain provided in an embodiment of the present application.
  • the data processing device 1 based on the blockchain network can be a computer program (including program code) running in a computer device.
  • the data processing device 1 based on the blockchain network is an application software; the data processing device 1 based on the blockchain network can be used to execute the corresponding steps in the method provided in the embodiment of the present application.
  • the data processing device 1 based on the blockchain network can be run on the target consensus node, and the target consensus node can be any consensus node in the blockchain network in the embodiment corresponding to Figure 1 above.
  • the data processing device 1 based on the blockchain network may include: an acquisition module 11, an update processing module 12, a write module 13, a legitimacy verification module 15, a multi-signature verification module 16, an execution module 17, a block rule acquisition module 18, a target weight acquisition module 19, and a master node determination module 20.
  • the acquisition module 11 is used to acquire a node weight update instruction generated for a first consensus node in a blockchain network, where the node weight update instruction is used to instruct to update the node weight of the voting information configured for the first consensus node in a consensus service;
  • the update processing module 12 is used to predict whether the node weight of the updated first consensus node meets the node update condition based on the node weight update instruction, and obtain a prediction result;
  • the update processing module 12 is further used to update the node weight of the first consensus node according to the node weight update instruction in response to the prediction result being positive, to obtain an update result.
  • the first consensus node belongs to the N consensus nodes included in the blockchain network, and N is a positive integer;
  • the update processing module 12 includes: a list acquisition unit 121 , a quantity determination unit 122 , a comparison unit 123 , a first update unit 124 , a discard unit 125 , a first acquisition unit 126 , a second acquisition unit 127 and a second update unit 128 .
  • the list acquisition unit 121 is used to acquire a node weight list corresponding to the blockchain network based on the node weight update instruction; the node weight list includes the node weight corresponding to each consensus node in the N consensus nodes;
  • the quantity determination unit 122 is used to determine the maximum number F of illegal nodes allowed by the blockchain network based on N node weights and the configuration weight carried by the node weight update instruction; the configuration weight is the predicted node weight of the updated first consensus node.
  • the quantity determining unit 122 includes: an acquiring subunit 1221 , a summing subunit 1222 and a determining subunit 1223 .
  • the acquisition subunit 1221 is used to acquire (N-1) node weights other than the node weight of the first consensus node from the N node weights;
  • the summing subunit 1222 is used to sum the (N-1) node weights and the configuration weights carried by the node weight update instruction to obtain the total node weight H corresponding to the blockchain network; H is a positive integer;
  • the determination subunit 1223 is used to determine the maximum number F of illegal nodes allowed by the blockchain network based on the total node weight H and the node configuration rule corresponding to the blockchain network.
  • the specific implementation of the acquisition subunit 1221, the summation subunit 1222 and the determination subunit 1223 can refer to the description of the maximum number of illegal nodes in the embodiment corresponding to FIG. 3 above, and will not be further described here.
  • the comparison unit 123 is used to compare the configuration weight and the maximum number F to obtain a comparison result
  • the first updating unit 124 is used to determine that the prediction result is positive if the comparison result indicates that the configuration weight is less than or equal to the maximum number F; a positive prediction result indicates that the configuration weight satisfies the node update condition.
  • the update processing module 12 is used to update the node weight of the first consensus node according to the node weight update instruction in response to the prediction result being positive, and when the update result is obtained, specifically to perform the following operations:
  • the node weight of the first consensus node is updated according to the configuration weight in the node weight update instruction to obtain an update result; the configuration weight of the first consensus node in the update result is used to update the node weight list.
  • the discarding unit 125 is used to determine that the prediction result is negative and discard the node weight update instruction if the comparison result indicates that the configuration weight is greater than the maximum number F; a negative prediction result indicates that the configuration weight does not meet the node update condition.
  • the first acquisition unit 126 is used to acquire the configuration weight carried by the node weight update instruction, and the prediction result is determined to be positive by default according to the node weight update instruction; the configuration weight is the predicted node weight of the updated first consensus node; a positive prediction result indicates that the configuration weight meets the node update condition;
  • the second acquisition unit 127 is used to acquire the node weight of the first consensus node from the blockchain network in response to the prediction result being positive;
  • the second updating unit 128 is used to update the node weight of the first consensus node to the configuration weight in the node weight update instruction to obtain an update result.
  • step S102 the specific implementation methods of the list acquisition unit 121, the quantity determination unit 122, the comparison unit 123, the first update unit 124, the discarding unit 125, the first acquisition unit 126, the second acquisition unit 127 and the second update unit 128 can be referred to the description of step S102 in the embodiment corresponding to Figure 3 above, and will not be repeated here.
  • the writing module 13 is used to record the update result into the database of the blockchain network.
  • the writing module 13 includes: a packaging unit 1301, a broadcasting unit 1302, a statistics unit 1303, a consensus determination unit 1304, a writing unit 1305, a detection unit 1306, a third acquisition unit 1307, a restart unit 1308, a consensus unit 1309 and an information generation unit 1310.
  • the packaging unit 1301 is used to package the update results to obtain a block to be verified to be written into the blockchain network;
  • the counting unit 1303 is used to count the consensus results that are consistent from the received consensus results, and determine the consensus results that are consistent with the counted consensus as a consensus result set;
  • the consensus determination unit 1304 is used to determine the sum of the node weights of the backup nodes corresponding to each consensus result in the consensus result set as the consensus quantity corresponding to the consensus result set;
  • the writing unit 1305 is used to determine that the consensus nodes in the blockchain network have reached a consensus if the ratio between the number of consensuses and the total weight of the nodes corresponding to the blockchain network reaches a consensus threshold, and write the block to be verified as a target block into the database in the blockchain network;
  • the total node weight refers to the sum of the node weights of N consensus nodes;
  • the target block written into the database in the blockchain network is used to indicate that the updated node weight of the first consensus node can perform weighted processing on the voting information of the first consensus node in the consensus business.
  • the detection unit 1306 is used to detect a consensus node in an abnormal state in the blockchain network if the consensus nodes in the blockchain network have not reached a consensus and the prediction result is determined to be positive by default through the node weight update instruction, and determine the detected consensus node as a second consensus node;
  • the third acquisition unit 1307 is used to acquire the node weight of the second consensus node
  • the restart unit 1308 is used to restart the second consensus node and update the consensus state of the second consensus node if the node weight of the second consensus node is greater than the maximum number F of illegal nodes allowed by the blockchain network;
  • the consensus unit 1309 is used to re-consensus the acquired block to be verified if the consensus state of the updated second consensus node is restored to a normal state.
  • the information generating unit 1310 is used to generate alarm information associated with the second consensus node if the consensus state of the updated second consensus node is an abnormal state, and send the alarm information to a management terminal device associated with the blockchain network.
  • the specific implementation of the unit 1305, the detection unit 1306, the third acquisition unit 1307, the restart unit 1308, the consensus unit 1309 and the information generation unit 1310 can refer to the description of step S103 in the embodiment corresponding to FIG. 3 above, which will not be further described here.
  • the first consensus node belongs to the N consensus nodes included in the blockchain network; N is a positive integer; one consensus node corresponds to one business organization; the business organization corresponding to the first consensus node is the first business organization; the node weight update instruction is generated by the first terminal device of the first business organization in response to the configuration operation of the first object on the node weight of the first consensus node;
  • the acquisition module 11 is specifically used to receive a node weight update instruction sent by a first terminal device; the node weight update instruction carries a primary signature information and a multi-party signature information; the primary signature information is obtained after the first terminal device signs the node weight update instruction based on the first private key of the first object; the multi-party signature information is obtained after the node weight update instruction is multi-signed based on the second private key of the second object associated with M second business institutions; the second business institution is a business institution other than the first business institution among the N business institutions; M is a positive integer less than N and greater than the signature threshold;
  • the legitimacy verification module 15 is used to verify the legitimacy of the node weight update instruction based on the first public key and the primary signature information of the first object to obtain a legitimacy verification result.
  • the legitimacy verification module 15 includes: a signature verification unit 151 , a verification unit 152 , a first generation unit 153 and a second generation unit 154 .
  • the signature verification unit 151 is used to verify the primary signature information based on the first public key of the first object to obtain a primary signature verification result;
  • the verification unit 152 is used to verify the instruction format of the node weight update instruction based on the smart contract on the blockchain network to obtain a verification result;
  • the first generating unit 153 is used to generate a legitimacy verification result indicating that the node weight update instruction is legitimate if the primary signature verification result indicates that the verification is successful and the verification result indicates that the verification is successful;
  • the second generating unit 154 is used to generate a legitimacy verification result indicating that the node weight update instruction is not legitimate if the primary signature verification result indicates a verification failure or the verification result indicates a verification failure.
  • the specific implementation methods of the signature verification unit 151, the verification unit 152, the first generation unit 153 and the second generation unit 154 can refer to the description of the legitimacy verification of the node weight update instruction in the embodiment corresponding to Figure 3 above, and will not be further elaborated here.
  • the multi-signature verification module 16 is used to perform multi-signature verification on the multi-party signature information based on the second public keys corresponding to the second objects associated with the M second business institutions to obtain a multi-signature verification result if the legitimacy verification result indicates that the node weight update instruction is legitimate;
  • the execution module 17 is used to notify the update processing module 12 to execute the node weight update instruction to predict whether the node weight of the updated first consensus node meets the node update condition when the multi-signature verification result indicates that the verification is successful, and obtain the prediction result.
  • the target consensus node is a master node with a proposal function in the blockchain network and is not the first consensus node
  • the node weight update instruction obtained by the target consensus node is submitted by the first consensus node when it determines that the multi-signature verification result indicates that the verification is successful
  • the multi-signature verification result is obtained by the first consensus node after performing multi-signature verification on the multi-party signature information carried in the node weight update instruction when it determines that the legitimacy verification result indicates that the node weight update instruction is legitimacy
  • the legitimacy verification result is generated by the first consensus node after performing legitimacy verification on the received node weight update instruction.
  • the target consensus node is the master node with the proposal function in the blockchain network;
  • the block containing the update result in the blockchain network is the target block;
  • the block generation rule acquisition module 18 is used to obtain the block generation rule associated with the blockchain network
  • the target weight acquisition module 19 is used to acquire the node weight of the target consensus node if the block generation rule is a block generation rule associated with the node weight; the node weight of the target consensus node is used to indicate the total number of blocks generated by the target consensus node in the current round;
  • the master node determination module 20 is used to continue to determine the target consensus node as a master node with a proposal function if the number of blocks produced by the target consensus node in the current round does not reach the total number of blocks produced, so that the target consensus node can chain the next block of the target block.
  • the specific implementation of the acquisition module 11, the update processing module 12, the writing module 13, the legitimacy verification module 15, the multi-signature verification module 16, the execution module 17, the block rule acquisition module 18, the target weight acquisition module 19 and the master node determination module 20 can refer to the description of steps S101-S103 in the embodiment corresponding to FIG. 3 and steps S201-S205 in the embodiment corresponding to FIG. 11, and steps S131-S137 in the embodiment corresponding to FIG. 13, which will not be further described here.
  • the description of the beneficial effects of using the same method will not be repeated.
  • the computer device 1000 may include: at least one processor 1001, for example, a CPU, at least one network interface 1004, a memory 1005, and at least one communication bus 1002.
  • the communication bus 1002 is used to realize the connection and communication between these components.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage.
  • the memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001.
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
  • the computer device It may also include the user interface 1003 shown in FIG. 15 .
  • the computer device may also include the user interface 1003 , wherein the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the like.
  • the network interface 1004 is mainly used for network communication;
  • the user interface 1003 is mainly used for providing an input interface for the user; and
  • the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
  • the update results are recorded in the database of the blockchain network.
  • the computer device 1000 described in the embodiment of the present application can execute the description of the data processing method based on the blockchain network in the embodiments corresponding to Figures 3, 11 and 13 above, and can also execute the description of the data processing device 1 based on the blockchain network in the embodiment corresponding to Figure 14 above, which will not be repeated here.
  • the description of the beneficial effects of using the same method will not be repeated.
  • An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program.
  • the computer program includes program instructions.
  • the program instructions are executed by a processor, a data processing method based on a blockchain network provided in each step of FIG. 3, FIG. 11 and FIG. 13 is implemented.
  • a data processing method based on a blockchain network provided in each step of FIG. 3, FIG. 11 and FIG. 13 is implemented.
  • FIG. 11 and FIG. 13 For details, please refer to the implementation methods provided in each step of FIG. 3, FIG. 11 and FIG. 13, which will not be repeated here.
  • the computer-readable storage medium may be the data transmission device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device.
  • the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (Flash card), etc. equipped on the computer device.
  • the computer-readable storage medium may also include both the internal storage unit of the computer device and the external storage device.
  • the computer-readable storage medium is used to store the computer program and other programs and data required by the computer device.
  • the computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
  • the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium.
  • a processor of a computer device reads the computer program from the computer-readable storage medium.
  • the computer program is executed by the processor so that the computer device can execute the description of the data processing method or device based on the blockchain network in the above embodiments, which will not be repeated here.
  • the description of the beneficial effects of using the same method will not be repeated.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例公开了一种基于区块链的数据处理方法、装置、设备及介质,该方法包括:获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新;基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果;将更新结果记录至区块链网络的数据库。采用本申请实施例,可以降低节点部署的资源消耗以及节点管理的难度。

Description

一种基于区块链的数据处理方法、装置、设备及介质
本申请要求于2023年7月3日提交中国专利局、申请号为202310809879.3、申请名称为“一种基于区块链的数据处理方法、装置、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及区块链网络技术领域,尤其涉及一种基于区块链的数据处理方法、装置、设备及介质。
背景技术
在传统区块链网络的部署场景中,若某些业务机构(例如,组织1)希望在整个区块链网络中拥有更大的决策权,则需要在该区块链网络中,针对组织1部署更多的共识节点,即通过增加组织1的节点数量,来增加组织1的参与权重。但由于区块链网络中的每个共识节点会有独立的数据库,它们也可能在不同的服务器上,往往会需要消耗更多的计算和内存资源消耗,例如,在区块链网络中增加新的共识节点的时候,都是需要给新的共识节点配置共识算法、配置与已有的共识节点之间的网络连接关系以及配置所维护的数据库等一系列配置操作,这些配置操作是需要付出大量的工作量来实现的,而且通过增加共识节点的数量,必然会增加区块链网络的共识计算量、也会增加网络流量,导致区块链网络的资源消耗增加。而且区块链网络节点都是比较复杂的程序,这意味着节点管理也就会更加复杂。即传统部署方式不仅会增加节点部署的工作量,还会增加区块链网络的资源消耗和节点管理的难度。
发明内容
本申请实施例提供一种基于区块链的数据处理方法、装置、设备及介质,可以降低部署节点的工作量,且不会额外增加区块链网络的资源消耗和节点管理难度。
本申请实施例一方面提供一种基于区块链的数据处理方法,包括:
获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新;
基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;
响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果;
将更新结果记录至区块链网络的数据库。
本申请实施例一方面提供一种基于区块链的数据处理装置,包括:
获取模块,用于获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新;
更新处理模块,用于基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;
更新处理模块,还用于响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果;
写入模块,用于将更新结果记录至区块链网络的数据库。
其中,第一共识节点属于区块链网络所包括的N个共识节点,N为正整数;
该更新处理模块包括:
列表获取单元,用于基于节点权重更新指令获取区块链网络对应的节点权重列表;节点权重列表包括N个共识节点中的每个共识节点分别对应的节点权重;
数量确定单元,用于基于N个节点权重以及节点权重更新指令所携带的配置权重,确定区块链网络所允许的非法节点的最大数量F;配置权重为所预测的更新后的第一共识节点的节点权重;
比对单元,用于对配置权重和最大数量F进行比对,得到比对结果;
第一更新单元,用于若比对结果指示配置权重小于或者等于最大数量F,则确定预测结果为正面;具有正面的预测结果指示配置权重满足节点更新条件。
其中,该更新处理模块在用于响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果时,具体用于执行以下操作:
响应于预测结果为正面,按照节点权重更新指令中的配置权重,对第一共识节点的节点权重进行更新处理,得到更新结果;更新结果中的第一共识节点的配置权重用于更新节点权重列表。
其中,该数量确定单元包括:
获取子单元,用于从N个节点权重中,获取除第一共识节点的节点权重之外的(N-1)个节点权重;
求和子单元,用于对(N-1)个节点权重以及节点权重更新指令所携带的配置权重进行 求和处理,得到区块链网络对应的节点总权重H;H为正整数;
确定子单元,用于基于节点总权重H以及区块链网络对应的节点配置规则,确定区块链网络所允许的非法节点的最大数量F。
其中,节点配置规则为H=3F+1,H为节点总权重,F为区块链网络所允许的非法节点的最大数量。
其中,该更新处理模块还包括:
丢弃单元,用于若比对结果指示配置权重大于最大数量F,则确定预测结果为负面,将节点权重更新指令丢弃;具有负面的预测结果指示配置权重不满足节点更新条件。
其中,该更新处理模块包括:
第一获取单元,用于获取节点权重更新指令所携带的配置权重,根据节点权重更新指令默认确定预测结果为正面;配置权重为所预测的更新后的第一共识节点的节点权重;具有正面的预测结果指示配置权重满足节点更新条件;
第二获取单元,用于响应于预测结果为正面,从区块链网络中获取第一共识节点的节点权重;
第二更新单元,用于将第一共识节点的节点权重更新为节点权重更新指令中的配置权重,得到更新结果。
其中,目标共识节点为区块链网络中具有提案功能的主节点;目标共识节点属于区块链网络所包括的N个共识节点;N为等于(3F+1)的正整数;F为区块链网络所允许的非法节点的最大数量;
该写入模块包括:
打包单元,用于对更新结果进行打包处理,得到待写入区块链网络的待验证区块;
广播单元,用于将待验证区块广播至区块链网络中的(N-1)个备份节点,以使(N-1)个备份节点对获取到待验证区块进行共识,得到共识结果;(N-1)个备份节点是指N个共识节点中除了目标共识节点之外的共识节点;
统计单元,用于从接收到的共识结果中,统计共识一致的共识结果,将统计共识一致的共识结果确定为共识结果集合;
共识确定单元,用于将共识结果集合中的每个共识结果对应的备份节点的节点权重的总和,确定为共识结果集合对应的共识数量;
写入单元,用于若共识数量与区块链网络对应的节点总权重的比值达到共识阈值,则确定区块链网络中的共识节点达成共识,将待验证区块作为目标区块写入区块链网络中的数据 库;节点总权重是指N个共识节点的节点权重之和;已写入区块链网络中的数据库的目标区块,用于指示更新后的第一共识节点的节点权重能够对第一共识节点在共识业务中的投票信息进行加权处理。
其中,该写入模块还包括;
检测单元,用于若区块链网络中的共识节点未达成共识,且预测结果是通过节点权重更新指令默认确定为正面,则在区块链网络中检测处于异常状态的共识节点,将检测到的共识节点确定为第二共识节点;
第三获取单元,用于获取第二共识节点的节点权重;
重启单元,用于若第二共识节点的节点权重大于区块链网络所允许的非法节点的最大数量F,则对第二共识节点进行重启,更新第二共识节点的共识状态;
共识单元,用于若更新后的第二共识节点的共识状态恢复为正常状态,则重新对获取到待验证区块进行共识。
其中,该写入模块还包括:
信息生成单元,用于若更新后的第二共识节点的共识状态为异常状态,则生成与第二共识节点相关联的告警信息,将告警信息发送至与区块链网络相关联的管理终端设备。
其中,目标共识节点为区块链网络中具有提案功能的主节点;区块链网络中包含更新结果的区块为目标区块;
装置还包括:
出块规则获取模块,用于获取与区块链网络相关联的出块规则;
目标权重获取模块,用于若出块规则为与节点权重相关联的出块规则,则获取目标共识节点的节点权重;目标共识节点的节点权重用于指示目标共识节点在当前轮次的出块总次数;
主节点确定模块,用于若目标共识节点在当前轮次的出块次数未达到出块总次数,则将目标共识节点继续确定为具有提案功能的主节点,以使目标共识节点对目标区块的下一区块进行上链。
其中,第一共识节点属于区块链网络所包括的N个共识节点;N为正整数;一个共识节点对应一个业务机构;第一共识节点对应的业务机构为第一业务机构;节点权重更新指令是由第一业务机构的第一终端设备,在响应第一对象针对第一共识节点的节点权重的配置操作时所生成的;
获取模块,具体用于接收第一终端设备发送的节点权重更新指令;节点权重更新指令携带主签名信息以及多方签名信息;主签名信息是第一终端设备基于第一对象的第一私钥,对 节点权重更新指令进行签名后所得到的;多方签名信息是基于与M个第二业务机构相关联的第二对象的第二私钥,对节点权重更新指令进行多方签名后所得到的;第二业务机构为N个业务机构中除第一业务机构之外的业务机构;M为小于N,且大于签名阈值的正整数;
该装置还包括:
合法性验证模块,用于基于第一对象的第一公钥以及主签名信息,对节点权重更新指令进行合法性验证,得到合法性验证结果;
多签验证模块,用于若合法性验证结果指示节点权重更新指令具备合法性,则基于与M个第二业务机构相关联的第二对象分别对应的第二公钥,对多方签名信息进行多签验证,得到多签验证结果;
执行模块,用于在多签验证结果指示验证成功时,通知更新处理模块执行基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果。
其中,该合法性验证模块包括:
验签单元,用于基于第一对象的第一公钥,对主签名信息进行验签,得到主验签结果;
校验单元,用于基于区块链网络上的智能合约,对节点权重更新指令的指令格式进行校验,得到校验结果;
第一生成单元,用于若主验签结果指示验证成功,且校验结果指示校验成功,则生成用于指示节点权重更新指令具备合法性的合法性验证结果;
第二生成单元,用于若主验签结果指示验证失败,或校验结果指示校验失败,则生成用于指示节点权重更新指令不具备合法性的合法性验证结果。
其中,若目标共识节点为区块链网络中具有提案功能的主节点,且不为第一共识节点,则目标共识节点获取到的节点权重更新指令是第一共识节点在确定多签验证结果指示验证成功时所提交的;多签验证结果是第一共识节点在确定合法性验证结果指示节点权重更新指令具备合法性时,对节点权重更新指令中携带的多方签名信息进行多签验证后所得到的;合法性验证结果是第一共识节点对接收到的节点权重更新指令进行合法性验证后所生成的。
本申请实施例提供了一种区块链网络,包括:
N个共识节点;N为正整数;一个共识节点对应一个节点权重;N个共识节点包括第一共识节点和目标共识节点;目标共识节点用于获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新;目标共识节点还用于基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;目标共识节点还用于响应于预测 结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果,将更新结果记录至区块链网络的数据库。
其中,第一共识节点用于在确定节点权重更新指令的指令验证结果指示验证成功时,将节点权重更新指令广播至目标共识节点;指令验证结果是第一共识节点基于合法性验证结果和多签验证结果所确定的;合法性验证结果是第一共识节点对节点权重更新指令进行合法性验证后所生成的;多签验证结果是第一共识节点在确定合法性验证结果指示节点权重更新指令具备合法性时,对节点权重更新指令中携带的多方签名信息进行多签验证后所得到的。
本申请一方面提供了一种计算机设备,包括:处理器、存储器、网络接口;
处理器与存储器、网络接口相连,其中,网络接口用于提供数据通信功能,存储器用于存储计算机程序,处理器用于调用计算机程序,以使得计算机设备执行本申请实施例提供的方法。
本申请实施例一方面提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,该计算机程序适于由处理器加载并执行,以使得具有该处理器的计算机设备执行本申请实施例提供的方法。
本申请实施例一方面提供了一种计算机程序产品,该计算机程序产品包括计算机程序,该计算机程序存储在计算机可读存储介质中;计算机设备的处理器从计算机可读存储介质读取该计算机程序,处理器执行该计算机程序,使得该计算机设备执行本申请实施例中的方法。
在本申请实施例中,目标共识节点可以获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新。其中,若拥有第一共识节点的业务机构希望在整个区块链网络中变更决策权,则该目标共识节点可以基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果,且响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果,将更新结果记录至区块链网络的数据库。这意味着若该业务机构想要在整个区块链网络中拥有更大的决策权,无需增加该业务机构的节点数量,而是基于节点权重的思想,通过变更第一共识节点的节点权重,来变更第一共识节点在参与共识业务的过程中发起的投票信息所占的权重。由于在区块链网络中增加新的共识节点的时候,都是需要给新的共识节点配置共识算法、配置与已有的共识节点之间的网络连接关系以及配置所维护的数据库等一系列配置操作,这些配置操作是需要付出大量的工作量来实现的,而且通过增加共识节点的数量,必然会增加区块链网络的共识计算量、也会增加网络流量,导致区块链网络的资源消耗增加,而本申请通过变更节点权重的这种部 署方式,可以无需增加新的共识节点,也就不需要执行上述的配置操作,从而可以降低部署节点的工作量,而且由于区块链网络的共识节点数量没有增加,也就不会额外增加区块链网络的资源消耗,而且由于所维护管理的共识节点的数量没有增加,也就不会增加维护管理共识节点的难度。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的一种区块链网络结构的示意图;
图2是本申请实施例提供的一种进行数据交互的场景示意图;
图3是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图;
图4是本申请实施例提供的一种校验节点权重更新指令的场景示意图;
图5是本申请实施例提供的一种共识算法的流程示意图;
图6是本申请实施例提供的一种对第一共识节点的节点权重进行更新的场景示意图一;
图7是本申请实施例提供的一种对第一共识节点的节点权重进行更新的场景示意图二;
图8是本申请实施例提供的一种对第一共识节点的节点权重进行更新的场景示意图三;
图9是本申请实施例提供的一种交易上链的场景示意图;
图10是本申请实施例提供的一种业务共识的场景示意图;
图11是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图;
图12是本申请实施例提供的一种用于轮换主节点的场景示意图;
图13是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图;
图14是本申请实施例提供的一种基于区块链的数据处理装置的结构示意图;
图15是本申请实施例提供的一种计算机设备的示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应当理解,本申请实施例提出了一种基于区块链的共识投票处理方案。其中,区块链网络(blockchain或block chain)可以是借由密码学串接并保护内容的串连文字记录(又称区块),即包括一系列按照产生的先后时间顺序相互接续的区块,新区块一旦加入到该区块链网络中就不会再被移除,其中,每一个区块可以包括了前一个区块的加密散列(即父区块哈希值)、生成时间戳以及交易数据(也可以称之为业务数据,通常用默克尔树(Merkle tree)算法计算的散列值表示),这样的设计使得区块内容具有难以篡改的特性。用区块链网络技术所串接的分布式数据库能让两方有效纪录交易,且可永久查验此交易(即业务数据)。
其中,智能合约是一种运行在区块链网络节点上的应用或程序,通常情况下,它们为一组具有特定规则的数字化协议,且该协议能够被强制执行。这些规则由计算机源代码预先定义,所有网络节点会复制和执行这些计算机源码。
请参见图1,图1是本申请实施例提供的一种区块链网络结构的示意图。应当理解,区块链网络结构可以应用于区块链网络系统,该区块链网络系统可以包括由N个共识节点通过网络通信的形式连接形成的分布式系统,N为正整数。这里的共识节点可以为接入该区块链网络中的服务器,也可以为接入该区块链网络中的终端设备,这里对共识节点的具体形式不做限定。其中,一个共识节点可以对应一个业务机构,且每个共识节点均会有独立的数据库,该数据库也可以称之为区块链账本。
其中,共识节点是指运行有区块链网络共识协议的节点,具有出块和投票权限,共识节点可以参与校验、广播交易数据以及区块信息,且会发现和维持与其他共识节点的连接,与此同时,该共识节点还可以包括完整的区块链网络数据库,图1所示的N个共识节点会基于与区块链网络相关联的出块规则,轮流作为区块链网络中具有提案功能的主节点,以参与新区块的生成、广播与共识。
可以理解的是,共识算法是区块链网络的核心技术之一,所谓共识算法即区块链网络节点(即共识节点)都遵循的规范,目前业内常用的共识算法包括工作量证明(即PoW)、股权证明(即PoS)、拜占庭容错算法(例如,TBFT)等。其中,TBFT即TendermintBFT共识算法,它是一种拜占庭容错共识算法,其支持的节点需满足N等于3F+1的节点配置规则,其中F表示区块链网络中所允许的作恶节点(即非法节点)的最大数量,如果超过这个数量将会导致整个网络的安全性降低,甚至于不可用。这里的非法节点可能会不传输消息,或者传输不一致的消息以试图扰乱其他共识节点。该共识算法可以允许非法节点延迟正常节点间的网络传输,在少于1/3非法节点的情况下能够提供安全性和活动性。例如,在图1所示的区块链网络系统中,当有不少于(2F+1)个合法的共识节点正常工作时,该区块链网络中的 节点可以达成一致性。例如:4个共识节点的区块链网络系统中可以允许存在的非法节点的最大数量为1。
为便于阐述,如图1所示的区块链网络中的节点总数量N可以以4个为例,这4个共识节点具体可以包括业务机构A对应的节点10a、业务机构B对应的节点10b、业务机构C对应的节点10c以及业务机构D对应的节点10d。每个业务机构均可以对应一个或多个业务对象(即组织成员)。其中,该节点10a对应的数据库为数据库1;该节点10b对应的数据库为数据库2;该节点10c对应的数据库为数据库3;该节点10d对应的数据库为数据库4。
其中,图1所示的区块链网络中的4个共识节点的每个共识节点均可以对应一个节点权重,比如,节点10a的节点权重用于指示节点10a在区块链网络中参与共识业务过程中发起的投票信息所占的比重;节点10b的节点权重用于指示节点10b在区块链网络中参与共识业务过程中发起的投票信息所占的比重;节点10c的节点权重用于指示节点10c在区块链网络中参与共识业务过程中发起的投票信息所占的比重;节点10d的节点权重用于指示节点10d在区块链网络中参与共识业务过程中发起的投票信息所占的比重。区块链网络中的任意两个共识节点的节点权重可以相同,也可以不同,这里将不对其进行限定。
若这4个业务机构中的某个业务机构(例如,业务机构A)希望在整个区块链网络中变更决策权,则本申请实施例可以将业务机构A称之为第一业务机构,且将该业务结构A对应的节点10a作为待配置权重的共识节点。为便于区分,本申请实施例可以将区块链网络中的待配置权重的共识节点称之为第一共识节点,将区块链网络中的除第一共识节点之外的其他共识节点称之为第三共识节点。需要说明的是,若检测到区块链网络中存在处于异常状态的共识节点,则本申请实施例可以将检测到处于异常状态的共识节点称之为第二共识节点。
为便于阐述,本申请实施例可以将属于该业务机构A中的任意一个业务对象称之为第一对象,将该第一对象对应的终端设备称之为第一终端设备。该第一终端设备能够在响应第一对象针对节点10a的节点权重的配置操作时,生成节点权重更新指令,其中,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新,节点权重更新指令也可以理解为区块链业务中用于请求对第一共识节点的节点权重进行更新的一笔交易。
应当理解,区块链网络中的目标共识节点(例如,具有提案功能的主节点)能够获取到针对节点10a的节点权重更新指令,进而可以基于节点权重更新指令预测(具体可以通过预测规则进行预测)更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果。其中,这里的预测规则可以为第一预测规则(例如,强规则)或第二预测规则(例如,弱规 则)。所谓强规则是指要求一个共识节点在更新权重后,即使该共识节点后续发生异常,也不能影响整个区块链网络的正常共识,即此时的节点更新条件可以是指更新后的第一共识节点的节点权重不影响区块链网络的正常共识的条件,其中,预测结果可以分为正面和负面,正面可以表示所预测的更新后的第一共识节点的节点权重满足节点更新条件,正面也可以表示为更新后的第一共识节点的节点权重不影响区块链网络的正常共识,负面可以表示所预测的更新后的第一共识节点的节点权重不满足节点更新条件,负面也可以表示为更新后的第一共识节点的节点权重会影响区块链网络的正常共识。
而对于弱规则而言,在节点权重更新过程中是不进行控制的,即基于节点权重更新指令可以直接确定更新后的第一共识节点的节点权重满足节点更新条件,但在后续共识阶段会严格要求,此时的节点更新条件可以是指默认允许对第一共识节点的节点权重进行更新的条件,其中,预测结果只会存在正面的结果,正面可以表示为所预测的更新后的第一共识节点的节点权重满足节点更新条件,正面也可以表示为允许对第一共识节点的节点权重进行更新。
进一步地,响应于预测结果为正面,可以按照节点权重更新指令所携带的配置权重,对节点10a的节点权重进行更新处理,以得到更新结果,进而可以将该更新结果写入区块链网络中的数据库,写入区块链网络中的数据库的更新结果也可以理解为是写入区块链账本的交易执行结果(更新结果可以通过区块的形式被写入数据库,该区块还可以包括节点权重更新指令),即区块链网络中的每个共识节点都将会认可写入区块链网络中的数据库的更新结果,即认可更新后的第一共识节点的节点权重。其中,更新结果中的节点10a的节点权重用于指示节点10a在参与共识业务的过程中发起的投票信息所占的比重,例如,若节点10a的节点权重更新为2,则意味着该节点10a在后续共识阶段所生成的投票信息对应的投票数量相当于2。
由此可见,本申请实施例提出了一种区块链网络中的节点本身支持权重的处理模型,在第一业务机构需要拥有更大决策权时,无需增加第一业务机构对应的节点数量,而是通过变更第一共识节点的节点权重,来变更第一共识节点在参与共识业务的过程中发起的投票信息所占的比重,本申请通过变更节点权重的这种部署方式,可以无需增加新的共识节点,也就不需要执行创建新共识节点所需的各种配置操作,从而可以降低部署节点的工作量,而且由于区块链网络的共识节点数量没有增加,也就不会额外增加区块链网络的资源消耗,而且由于所维护管理的共识节点的数量没有增加,也就不会增加维护管理共识节点的难度。
为便于理解,进一步地,请参见图2,图2是本申请实施例提供的一种进行数据交互的场景示意图。如图2所示,本申请实施例中的区块链网络中的共识节点的节点总数量可以以 4个为例,具体可以包括节点20a、节点20b、节点20c以及节点20d。其中,一个共识节点可以对应一个业务机构,且每个业务机构均可以包括一个或多个业务对象。
其中,图2所示的终端设备集群可以为节点20a对应的业务机构(例如,业务机构A)对应的终端设备集群,该终端设备集群可以包括X个业务对象(即属于业务机构A的成员)对应的终端设备,具体可以包括对象A1对应的终端设备200Z1、对象A2对应的终端设备200Z2、对象A3对应的终端设备200Z3、…、以及对象Ax对应的终端设备200Zx
该终端设备集群中的每个终端设备均可以包括:智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表、车载终端、智能电视等具有数据处理功能的智能终端。应当理解,如图2所示的终端设备集群中的每个终端设备均可以安装有业务应用(即应用客户端),当该应用客户端运行于各终端设备中时,可以分别与上述图2所示的节点20a之间进行数据交互。其中,该应用客户端可以包括社交客户端、多媒体客户端(例如,视频客户端)、娱乐客户端(例如,游戏客户端)、信息流客户端、教育客户端、直播客户端等应用客户端。其中,该应用客户端可以为独立的客户端,也可以为集成在某客户端(例如,社交客户端、教育客户端以及多媒体客户端等)中的嵌入式子客户端,在此不做限定。
每个业务对象对应的终端设备均可以与节点20a进行网络连接,以便于通过该网络连接与节点20a进行数据交互。其中,这里的网络连接不限定连接方式,可以通过有线通信方式进行直接或间接地连接,也可以通过无线通信方式进行直接或间接地连接,还可以通过其他方式,本申请在此不做限制。
当业务机构A需要在整个区块链网络中变更决策权时,属于该业务机构A中的任意一个业务对象均可以通过所使用的终端设备,针对节点20a生成节点权重更新指令(例如,图2所示的节点权重更新指令2t)。
比如,对象A1(即第一对象)可以在终端设备200Z1上,确定节点20a对应的配置权重,并在确定完成后,针对节点20a的节点权重执行配置操作,以使该终端设备200Z1(即第一终端设备)响应该配置操作,生成针对节点20a的节点权重更新指令2t(节点权重更新指令2t可以携带配置权重)。其中,这里的配置操作可以包括点击、长按等接触性操作,也可以包括语音、手势等非接触性操作,这里将不对其进行限定。
其中,这里的配置权重是基于业务机构A希望自己的共识节点在整个区块链环境所占的百分比以及区块链网络中的节点总权重所确定的。该配置权重可以为对象A1在终端设备200Z1的权重配置界面(即用于进行权重配置的终端界面)上直接输入的,也可以为对象A1在终端设备200Z1的权重配置界面所提供的多个候选权重上所选择的,还可以为终端设备 200Z1基于对象A1在终端设备200Z1的权重配置界面输入的百分比、和区块链网络中的节点总权重所自动计算的,当然,该配置权重还可以包括其他确定方式,这里将不对其进行限定。例如,若对象A1在终端设备200Z1的权重配置界面输入的百分比为40%,且区块链网络中的每个共识节点的节点权重均为1,这意味着区块链网络中的节点总权重为4,那么,该终端设备200Z1可以自动确定节点20a对应的配置权重为2(其中,预测节点权重更新后的节点总权重变为5,而配置权重为2,因此可以满足节点20a的节点权重所占整个区块链网络的百分比为40%),然后生成用于请求将节点20a的节点权重变更为配置权重的节点权重更新指令2t。
进一步地,该终端设备200Z1可以将节点权重更新指令2t,发送至区块链网络中的节点20a(即第一共识节点),以使该节点20a对获取到的节点权重更新指令2t进行验证(包括合法性校验和多签验证),以得到交易验证结果。其中,本申请实施例可以将对节点权重更新指令2t进行合法性验证(即验证指令格式验证和主签名信息)的验证结果称之为合法性验证结果,将对节点权重更新指令2t进行多签验证(即验证多方签名信息)的验证结果称之为多签验证结果。可以理解的是,若合法性校验结果指示节点权重更新指令2t具备合法性,且多签验证结果指示验证成功时,则意味着这里的交易验证结果指示验证成功。若合法性校验结果指示节点权重更新指令2t具备合法性,但多签验证结果指示验证失败,则意味着这里的交易验证结果指示验证失败。若合法性校验结果指示节点权重更新指令2t不具备合法性,则无需对节点权重更新指令2t进行多签验证,可以直接对确定交易验证结果指示验证失败。可以理解的是,在交易验证结果指示验证失败时,该节点20a可以直接将节点权重更新指令2t进行丢弃。
在交易验证结果指示验证成功时,该节点20a可以向区块链网络中的其他节点(即第三共识节点)广播节点权重更新指令2t,即可以将节点权重更新指令2t分别广播至图2所示的节点20b、节点20c以及节点20d,以等待区块链网络中的具有提案功能的主节点(即目标共识节点)执行该节点权重更新指令2t,从而得到该节点权重更新指令2t对应的更新结果。然后,该主节点可以在该区块链网络中的共识节点达成共识时,将该更新结果以及节点权重更新指令2t一并写入区块链网络。
比如,若区块链网络中的具有提案功能的主节点为节点20d,该节点20d可以基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果,响应于预测结果为正面,可以基于节点权重更新指令2t所携带的配置权重,对节点20a的节点权重进行更新处理,得到更新结果。然后,该节点20d可以在该区块链网络中的共识节点达成共识时,将该更新结果以及节点权重更新指令2t一并写入区块链网络。
其中,若节点20a的节点权重为1,那么该节点20d可以基于节点权重更新指令2t所携带的配置权重,将节点20a的节点权重更新为配置权重。其中,更新结果中的节点20a的节点权重用于指示节点20a在参与共识业务的过程中发起的投票信息所占的比重,即在配置权重为2时,这意味着节点20a在参与共识业务的过程中发起的一张投票信息等同于两张。
由此可见,在业务机构A需要拥有更大决策权时,本申请实施例提出的这种部署方式无需增加业务机构A对应的节点数量,而是通过变更节点10a的节点权重,来变更节点10a在参与共识业务的过程中发起的投票信息所占的比重,本申请通过变更节点权重的这种部署方式,可以无需增加新的共识节点,也就不需要执行创建新共识节点所需的各种配置操作,从而可以降低部署节点的工作量,而且由于区块链网络的共识节点数量没有增加,也就不会额外增加区块链网络的资源消耗,而且由于所维护管理的共识节点的数量没有增加,也就不会增加维护管理共识节点的难度。
其中,本申请实施例基于权重的思想,对区块链网络中的节点进行部署的具体实现方式可以参见下述图3-图13所对应的实施例。
进一步地,请参见图3,图3是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图。如图3所示,该方法可以由目标共识节点执行,该目标共识节点可以为上述图1所示的区块链网络中的具有提案功能的主节点,该目标共识节点可以为第一共识节点(例如,上述图1所示的节点10a),也可以为第三共识节点(例如,节点10b、节点10c或节点10d中的任意一个共识节点),这里将不对目标共识节点进行限定。该方法至少可以包括以下步骤S101-步骤S103:
步骤S101,获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新。
其中,这里的第一共识节点属于区块链网络所包括的N个共识节点;N个共识节点可以包括第一共识节点和第三共识节点;N为正整数,一个共识节点对应一个业务机构。第一共识节点对应的业务机构为第一业务机构。该第一业务机构是指希望在整个区块链网络中变更决策权的业务机构。这里的节点权重更新指令是由第一业务机构的第一终端设备,在响应第一对象针对第一共识节点的节点权重的配置操作时所生成的。可以理解的是,该目标共识节点获取到的节点权重更新指令可以为第一终端设备所直接发送的,也可以为区块链网络中的其他节点在验证成功后所广播的,这里将不对其进行限定。
应当理解,区块链网络中的N个共识节点中的每个共识节点均可以对应一个节点权重,比如,当每个共识节点的节点权重均为1时,该区块链网络中的节点总数量即为区块链网络 中的节点总权重。当第一业务机构需要变更决策权时,第一对象可以在第一终端设备上,基于第一业务机构在区块链网络中所希望占据的百分比、以及区块链网络中的节点总权重,确定第一共识节点的待配置的节点权重。比如,若3个共识节点的节点权重均为1,第一业务机构在区块链网络中所希望占据的百分比为50%,且区块链网络中的节点总权重为3,那么,该第一对象所确定的第一共识节点的待配置的节点权重则为2。
然后,该第一对象可以在第一终端设备上针对第一共识节点的节点权重执行配置操作,以使第一终端设备在响应该配置操作时,将该第一对象所确定的第一共识节点的待配置的节点权重确定为配置权重,进而可以基于配置权重,生成用于请求对第一共识节点的节点权重进行变更的业务交易(即节点权重更新指令)。此时,该第一终端设备可以基于第一对象的对象私钥(即第一私钥),对该节点权重更新指令进行签名,得到该节点权重更新指令对应的主签名信息。
由于区块链网络中包括N个共识节点,且一个共识节点对应一个业务机构,这意味着该区块链网络与N个业务机构相关。本申请实施例可以将N个业务机构中除第一业务机构之外的业务机构称之为第二业务机构。基于此,该第一终端设备可以将包含主签名信息的节点权重更新指令分别发送至属于第二业务机构的第二对象对应的第二终端设备,以使接收到该包含主签名信息的节点权重更新指令的第二终端设备,基于第二对象的对象私钥(即第二私钥),返回用于对节点权重更新指令进行多方签名的签名参数。
第一终端设备可以统计接收到的签名参数的签名机构数量M,在签名机构数量M大于签名阈值(例如,2N/3)时,该第一终端设备可以对M个签名参数进行聚合,以得到节点权重更新指令的多方签名信息,进而可以将包含多方签名信息和主签名信息的节点权重更新指令发送至区块链网络。这意味着本申请实施例中的多方签名信息是基于与M个第二业务机构相关联的第二对象的第二私钥,对节点权重更新指令进行多方签名后所得到的。
可以理解的是,这里的目标共识节点可以为第一共识节点或第三共识节点(即除第一共识节点之外的另一共识节点)。若目标共识节点为第一共识节点,则该目标共识节点可以直接接收第一终端设备发送的节点权重更新指令。该节点权重更新指令携带主签名信息和多方签名信息。然后,该目标共识节点可以基于第一对象的第一公钥以及主签名信息,对节点权重更新指令进行合法性验证,以得到合法性验证结果。其中,目标共识节点在对节点权重更新指令进行合法性验证时,可以基于第一对象的第一公钥,对主签名信息进行验签,得到主验签结果。进一步地,该目标共识节点还需要基于区块链网络上的智能合约,对节点权重更新指令的指令格式进行校验,得到校验结果。若主验签结果指示验证成功,且校验结果指示校 验成功,则该目标共识节点可以生成用于指示节点权重更新指令具备合法性的合法性验证结果。若主验签结果指示验证失败,或校验结果指示校验失败,则该目标共识节点可以生成用于指示节点权重更新指令不具备合法性的合法性验证结果。
若合法性验证结果指示节点权重更新指令具备合法性,则该目标共识节点还需要继续基于与M个第二业务机构相关联的第二对象分别对应的第二公钥,对多方签名信息进行多签验证,得到多签验证结果,在多签验证结果指示验证成功时,该目标共识节点可以将节点权重更新指令广播至区块链网络中的其他节点(例如,第三共识节点)。在多签验证结果指示验证成功时,该目标共识节点就可以进一步执行下面S102的步骤。
可选的,若目标共识节点为第三共识节点(即不为第一共识节点),则该目标共识节点获取到的节点权重更新指令是由第一共识节点在确定多签验证结果指示验证成功时所提交的。其中,这里的多签验证结果是第一共识节点在确定合法性验证结果指示节点权重更新指令具备合法性时,对节点权重更新指令中携带的多方签名信息进行多签验证后所得到的;这里的合法性验证结果是第一共识节点对接收到的节点权重更新指令进行合法性验证后所生成的。
为便于理解,进一步地,请参见图4,图4是本申请实施例提供的一种校验节点权重更新指令的场景示意图。如图4所示,这里的终端设备400Z对应的对象A1属于业务机构A(即第一业务机构)中的成员。该业务机构A在区块链网络中对应的节点可以为图4所示的节点40a。这里的节点40a可以为上述图1所对应实施例中的区块链网络中的节点10a。与节点40a所属区块链网络相关联的业务机构除了业务机构A之外,还可以包括第二业务机构,例如,业务机构B、业务机构C以及业务机构D。
属于业务机构A的终端设备400Z在生成图4所示的节点权重更新指令4t时,可以基于该对象A1的对象私钥(即第一私钥),对该节点权重更新指令4t进行签名处理,得到该节点权重更新指令4t对应的主签名信息。其中,可以理解的是,该终端设备400Z可以获取哈希计算规则,该哈希计算规则可以为该终端设备400Z与区块链网络中的其他区块链网络节点提前约定好的摘要算法。该终端设备400Z可以基于该哈希计算规则,对该节点权重更新指令4t进行哈希计算,以得到节点权重更新指令4t的摘要信息(例如,摘要信息h)。其中,本申请实施例可以将终端设备400Z确定的节点权重更新指令4t的摘要信息称之为第一摘要信息。进一步地,该终端设备400Z可以基于该对象A1的对象私钥,对该第一摘要信息进行签名处理,从而可以得到图4所示的主签名信息。
然后,该终端设备400Z可以将包含主签名信息的节点权重更新指令4t分别发送给属于业务机构B的第二对象对应的第二终端设备、属于业务机构C的第二对象对应的第二终端设 备以及属于业务机构D的第二对象对应的第二终端设备,以使第二终端设备,基于自身对应的第二对象的第二私钥,返回用于对节点权重更新指令4t进行多方签名的签名参数。其中,属于同一第二业务机构的多个第二终端设备向终端设备400Z返回的签名参数均可以视作为同一种签名机构返回的签名参数。
比如,若终端设备400Z接收到的签名参数包括对象B1的签名参数1(例如,对象B1对应的终端设备返回的签名参数)、对象B2的签名参数2(例如,对象B2对应的终端设备返回的签名参数)、对象C1的签名参数3(例如,对象C1对应的终端设备返回的签名参数)以及对象D1的签名参数4(例如,对象D1对应的终端设备返回的签名参数),其中,对象B1与对象B2均属于业务机构B中的成员,对象C1属于业务机构C中的成员,对象D1属于业务机构D中的成员,这意味着终端设备400Z统计到的签名机构数量M为3,即业务机构B、业务机构C以及业务机构D。
由于签名机构数量3大于签名阈值(例如,2N/3),则该终端设备400Z可以对这3个签名参数进行聚合,以得到节点权重更新指令4t的多方签名信息。然后,该终端设备400Z可以将包含多方签名信息和主签名信息的节点权重更新指令4t发送至业务机构A对应的共识节点(即区块链网络中的第一共识节点,例如,节点40a),以使节点40a对该节点权重更新指令4t进行验证。
可以理解的是,节点40a在获取到节点权重更新指令4t时,可以根据对象A1的对象公钥(即第一公钥)以及主签名信息,对节点权重更新指令4t进行合法性验证,以得到合法性验证结果。其中,这里的合法性验证结果是由校验结果和主签名结果所共同确定的。
比如,节点40a需要先基于对象A1的对象公钥,对主签名信息进行验签,得到主验签结果。即节点40a可以获取对象A1的对象公钥,进而可以基于该对象A1的对象公钥对主签名信息进行验签,得到节点权重更新指令4t的第一摘要信息。与此同时,该节点40a还可以获取与终端设备400Z相同的哈希计算规则,对节点权重更新指令4t进行哈希计算,从而可以得到该节点权重更新指令4t的摘要信息(例如,摘要信息H)。其中,本申请实施例可以将节点40a确定的节点权重更新指令4t的摘要信息称之为第二摘要信息。然后,该节点40a可以将第一摘要信息与第二摘要信息进行比对,得到主验签结果,以确定该节点权重更新指令4t是否被篡改。可以理解的是,若第一摘要信息与第二摘要信息不相同,则该节点40a可以确定主验签结果指示验证失败。可选的,若第一摘要信息与第二摘要信息相同,则该节点40a可以确定主验签结果指示验证成功,这意味着节点权重更新指令4t未发生篡改,且该节点权重更新指令4t确实是由终端设备400Z发送的。
与此同时,该节点40a还需要基于区块链网络上的智能合约,对节点权重更新指令4t的指令格式进行校验,得到校验结果。若主验签结果指示验证成功,且校验结果指示校验成功,则该节点40a可以生成用于指示节点权重更新指令4t具备合法性的合法性验证结果。若主验签结果指示验证失败,或校验结果指示校验失败,则该节点40a可以生成用于指示节点权重更新指令4t不具备合法性的合法性验证结果。
在合法性验证结果指示节点权重更新指令4t不具备合法性(即验证失败)时,该节点40a可以将该节点权重更新指令4t进行丢弃。可选的,在合法性验证结果指示节点权重更新指令4t具备合法性时(即验证成功时),该节点40a需要继续基于与M个第二业务机构相关联的第二对象分别对应的第二公钥,对多方签名信息进行多签验证,得到多签验证结果。其中,这里的与M个第二业务机构相关联的第二对象分别对应的第二公钥可以包括对象B1的对象公钥、对象B2的对象公钥、对象C1的对象公钥以及对象D1的对象公钥。其中,本申请实施例可以采用一种非交互式聚合签名规则(例如,Schnorr算法),对节点权重更新指令4t进行多方签名,得到多方签名信息,而节点40a对多方签名信息进行多方验签的具体实施方式可以参见这种非交互式聚合签名规则,这里将不对其进行赘述。
可以理解的是,在多签验证结果指示验证失败时,该节点40a可以将该节点权重更新指令4t进行丢弃。可选的,若多签验证结果指示验证成功时,该节点40a可以将节点权重更新指令4t广播至区块链网络中的其他节点,以等待具有提案功能的主节点对其进行上链。比如,若该主节点为节点40a,则该节点40a可以继续执行下面S102步骤。可见通过合法性验证和多签验证可以保证后续所要执行的节点权重更新指令是合法可靠的,通过合法性验证和多签验证可以将一些异常或非法的节点权重更新指令丢弃,以避免造成错误的节点权重更新,即通过执行合法可靠的节点权重更新指令,可以保证所更新的节点权重也是合法可靠的。
其中,本申请的区块链网络可以采用原始的共识算法(例如,TBFT共识)。为便于理解,进一步地,请参见图5,图5是本申请实施例提供的一种共识算法的流程示意图。如图5所示,该本申请实施例中的区块链网络可以包括N个共识节点,这N个共识节点具体可以包括一个具有提案功能的主节点(例如,节点a)和(N-1)个具有验证功能的备份节点,具体可以包括节点b、节点c以及节点d。其中,这里的N可以为等于(3F+1)的正整数,F可以为区块链网络所允许的非法节点的最大数量。
其中,在TBFT共识算法下,节点之间的共识流程可以包括5个阶段,具体可以包括共识投票的准备阶段(NewRound)、提案阶段(Proposal)、预投票阶段(Prevote)、预提交阶段(Precommit)、以及提交阶段(Commit)。
其中,在准备阶段中,节点a在接收到第一终端设备中的客户端发送的交易(例如,针对节点a生成的节点权重更新指令)时,会初始化共识相关状态。
在提案阶段中,主节点可以生成提案,并将该提案广播至其他节点。比如,该节点a会对基于待上链的交易进行打包处理,以将打包处理后生成的区块分别广播至节点b、节点c以及节点d。
在预投票阶段中,对于节点b、节点c或节点d中任意一个备份节点而言,在接收到节点a发送的区块后,备份节点可以执行区块中的交易,并判断该区块的区块哈希值是否正确,以在预投票阶段生成prevote投票信息(即第一投票信息),并将prevote投票信息广播至其他节点。其中,若区块哈希值正确,则备份节点生成用于指示赞成票的prevote投票信息;否则,则生成用于指示反对票的prevote投票信息。
在预提交阶段中,任意一个共识节点均可以收集其他节点在预投票阶段所生成的prevote投票信息,若收集到的prevote投票信息的投票数量达到(2F+1)时,则根据收集到的prevote投票信息,生成Precommit投票信息(即第二投票信息),并将Precommit投票信息广播到其他节点。
在提交阶段中,任意一个共识节点均可以收集其他节点在预提交阶段所生成的Precommit投票信息,若收集到的Precommit投票信息的投票数量达到(2F+1)时,则根据收集到的Precommit投票信息,生成提交消息,其中,这里的提交消息用于指示是否将提案中的区块提交到数据库。
步骤S102,基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果。
其中,上述提到的共识算法(例如,TBFT共识)是一个三阶段模型,由于本申请实施例基于节点权重的思想,来变更第一共识节点在参与共识业务的过程中发起的投票信息所占的比重,因此为了安全性考虑,本申请实施例并未修改其三阶段的模型和整个容错机制,而是针对区块链网络设计了两种预测规则,两种预测规则均可以用于指示针对第一共识节点的节点权重更新是否满足节点更新条件。具体的,预测规则可以包括第一预测规则(例如,强规则)或第二预测规则(例如,弱规则)。所谓强规则是指要求一个共识节点在更新权重后,即使该节点后续发生异常,也不能影响整个区块链网络的正常共识,即此时的节点更新条件可以是指更新后的第一共识节点的节点权重不影响区块链网络的正常共识的条件,其中,预测结果可以分为正面和负面,正面可以表示所预测的更新后的第一共识节点的节点权重满足 节点更新条件,正面也可以表示为更新后的第一共识节点的节点权重不影响区块链网络的正常共识,负面可以表示所预测的更新后的第一共识节点的节点权重不满足节点更新条件,负面也可以表示为更新后的第一共识节点的节点权重会影响区块链网络的正常共识。
而对于弱规则而言,在节点权重更新过程中是不进行控制的,即基于节点权重更新指令可以直接确定更新后的第一共识节点的节点权重满足节点更新条件,但在后续共识阶段会严格要求,此时的节点更新条件可以是指默认允许对第一共识节点的节点权重进行更新的条件,其中,预测结果只会存在正面的结果,正面可以表示为所预测的更新后的第一共识节点的节点权重满足节点更新条件,正面也可以表示为允许对第一共识节点的节点权重进行更新。其中,目标共识节点获取到的预测规则可以是从区块链网络中的数据库(即区块链网络数据库,也可以是指区块链账本)上直接获取的,也可以是从与区块链网络相关联的智能合约中所读取的,还可以是区块链网络中的N个共识节点共同约定的(例如,从配置文件中读取),这里将不对其进行限定。
其中,这里的更新结果中的第一共识节点的配置权重用于指示第一共识节点在参与共识业务的过程中发起的投票信息所占的比重。应当理解,若预测规则为第一预测规则,则该目标共识节点(即主节点)需要基于节点权重更新指令中的配置权重以及区块链网络对应的节点权重列表,来确定第一共识节点是否满足节点更新条件,得到预测结果。其中,这里的节点更新条件还可以是指第一共识节点的配置权重小于或者等于区块链网络所允许的非法节点的最大数量,以保证更新后的第一共识节点的节点权重(即配置权重)不影响区块链网络的正常共识。若预测规则为第二预测规则,则该目标共识节点可以直接默认所预测的更新后的第一共识节点的节点权重满足节点更新条件,即可以直接执行节点权重更新指令,以对第一共识节点的节点权重进行更新处理,得到更新结果。
可以理解的是,对于区块链网络中的每个共识节点而言,均具有与其对应的节点标识,且每个共识节点均可以存储有区块链网络中的其他共识节点的节点标识,以便于后续根据其他共识节点的节点标识,将生成的区块广播至其他共识节点。其中,节点标识可为IP(Internet Protocol,网络之间互联的协议)地址以及其他任一种能够用于标识该节点的信息。
换言之,每个共识节点均可以维护一个节点标识列表,由于本申请实施例提出了一种区块链网络中的节点本身支持权重的处理模型,因此,本申请实施例可以在节点标识列表的基础上,新增添一个用于指示节点权重的字段以及一个用于指示共识节点对应的业务机构的字段,以得到区块链网络对应的节点权重列表。
为便于理解,进一步地,请参见表1,表1是本申请实施例提供的一种区块链网络对应 的节点权重列表。其中,该节点权重列表可以包括业务机构对应的字段、共识节点名称对应的字段、节点标识对应的字段以及节点权重对应的字段,当然,该节点权重列表还可以为其他包含有节点权重对应的字段的列表,这里将不对其进行限定。如表1所示,该节点权重列表对应的区块链网络可以为上述图1所对应实施例中的区块链网络,该区块链网络可以包括4个共识节点,具体可以包括业务机构A对应的节点10a、业务机构B对应的节点10b、业务机构C对应的节点10c以及业务机构D对应的节点10d。其中,一个共识节点对应一个共识节点权重。具体如表1所示:
表1
比如,若预测规则为第一预测规则,则该目标共识节点可以获取区块链网络对应的节点权重列表。由于这里的第一共识节点属于区块链网络所包括的N个共识节点,因此,本申请实施例可以将该节点权重列表中的N个共识节点中的每个共识节点的节点权重称之为节点权重;N为正整数。然后,该目标共识节点可以基于N个节点权重以及节点权重更新指令所携带的配置权重,确定区块链网络所允许的非法节点的最大数量F,进而可以对配置权重和最大数量F进行比对,得到比对结果。
其中,该目标共识节点在确定最大数量F时,可以从N个节点权重中,获取除第一共识节点的节点权重之外的(N-1)个节点权重,进而可以对(N-1)个节点权重以及节点权重更新指令所携带的配置权重进行求和处理,得到预测的区块链网络对应的节点总权重H。其中,这里的H为正整数。进一步地,该目标共识节点可以获取区块链网络对应的节点配置规则(即H=3F+1),并基于节点总权重H以及节点配置规则,确定区块链网络所允许的非法节点的最大数量F。
若比对结果指示配置权重小于或者等于最大数量F,则目标共识节点可以确定配置权重满足节点更新条件,即可以确定预测结果为正面,进而可以基于节点权重更新指令中的配置权重,对第一共识节点的节点权重进行更新处理,得到更新结果。其中,这里的更新结果中的第一共识节点的配置权重可以用于更新区块链网络的节点权重列表。可选的,若比对结果指示配置权重大于最大数量F,则该目标共识节点可以确定预测结果为负面,具有负面的预 测结果指示配置权重不满足节点更新条件,并将节点权重更新指令进行丢弃。可见,本申请在更新节点权重之前,可以通过强规则来保证所希望变更的配置权重不会影响整个区块链网络的正常共识,即即使已变更为配置权重的共识节点出现异常或作恶,区块链网络也依然可以继续正常完成共识过程,对于不符合节点更新条件的配置权重(即配置权重大于区块链网络所允许的非法节点的最大数量F的情况)就不会允许其进行变更,这样可以有效增加更新节点权重的安全性,保证节点权重更新后的区块链网络依然可以安全、正常执行共识流程。
为便于理解,进一步地,请参见图6,图6是本申请实施例提供的一种对第一共识节点的节点权重进行更新的场景示意图一。如图6所示,本申请实施例中的区块链网络(即当前区块链网络)中的节点总数量N可以以4个为例,具体可以包括节点60a、节点60b、节点60c以及节点60d。
若预测规则为第一预测规则,则目标共识节点(即主节点)可以获取区块链网络对应的节点权重列表。例如,该节点权重列表可以包括节点60a的节点权重(例如,1)、节点60b的节点权重(例如,1)、节点60c的节点权重(例如,1)以及节点60d的节点权重(例如,1)。
由于节点权重更新指令用于请求将节点60a的节点权重变更为配置权重(例如,2),则该目标共识节点需要从这4个节点权重中,获取除节点60a之外的3个节点权重,进而可以对这3个节点权重以及节点60a的配置权重进行求和处理,以得到预测更新后的区块链网络对应的节点总权重H(例如,5),进一步地,该目标共识节点可以基于区块链网络对应的节点配置规则,确定区块链网络所允许的非法节点的最大数量F(例如,1)。
由于第一预测规则中的节点更新条件指示更新后的节点一旦退出,需要保证其他节点可继续达成一致,因此在对节点60a的节点权重进行预测更新后,预测更新后的区块链网络需要4个共识一致的共识结果,才可达成共识,若节点60a出现异常(例如,处于掉线、作恶等异常状态),那么剩余的节点60b、节点60c以及节点60d将无法达成共识,这意味着该第一预测规则不允许节点60a变更节点权重。换言之,由于节点60a的配置权重大于最大数量F,因此,该目标共识节点可以确定针对节点60a的配置权重不满足节点更新条件,可以直接将节点权重更新指令进行丢弃。
为便于理解,进一步地,请参见图7,图7是本申请实施例提供的一种对第一共识节点的节点权重进行更新的场景示意图二。如图7所示,本申请实施例中的区块链网络(即当前区块链网络)中的节点总数量N可以以6个为例,具体可以包括节点70a、节点70b、节点70c、节点70d、节点70e以及节点70f。
若预测规则为第一预测规则,则目标共识节点(即主节点)可以获取区块链网络对应的节点权重列表。例如,该节点权重列表可以包括节点70a的节点权重(例如,1)、节点70b的节点权重(例如,1)、节点70c的节点权重(例如,1)、节点70d的节点权重(例如,1)、节点70e的节点权重(例如,1)以及节点70f的节点权重(例如,1)。
由于节点权重更新指令用于请求将节点70a的节点权重变更为配置权重(例如,2),则该目标共识节点需要从这6个节点权重中,获取除节点70a之外的5个节点权重,进而可以对这5个节点权重以及节点70a的配置权重进行求和处理,以得到预测更新后的区块链网络对应的节点总权重H(例如,7),进一步地,该目标共识节点可以基于区块链网络对应的节点配置规则,确定区块链网络所允许的非法节点的最大数量F(例如,2)。
由于第一预测规则中的节点更新条件指示更新后的节点一旦退出,需要保证其他节点可继续达成一致,因此在对节点70a的节点权重进行预测更新后,预测更新后的区块链网络需要5个共识一致的共识结果,才可达成共识,若节点70a出现异常(例如,处于掉线、作恶等异常状态),那么剩余的节点70b、节点70c、节点70d、节点70e以及节点70f仍然可以达成共识,这意味着该第一预测规则允许节点70a变更节点权重。换言之,由于节点70a的配置权重等于最大数量F,因此,该目标共识节点可以确定针对节点70a的配置权重满足节点更新条件,进而可以基于配置权重,对节点70a的节点权重进行更新处理,得到更新结果。其中,更新结果中的节点70a的节点权重(即配置权重)用于更新区块链网络的节点权重列表。通过更新区块链网络的节点权重列表可以保证实时记录当前每个共识节点正确的节点权重,使得在下一次进行节点权重更新时,可以通过更新后的节点权重列表获取准确的节点权重,以保证可以继续安全、可靠的完成节点权重更新。
为便于理解,进一步地,请参见图8,图8是本申请实施例提供的一种对第一共识节点的节点权重进行更新的场景示意图三。如图8所示,本申请实施例中的区块链网络(即当前区块链网络)中的节点总数量N可以以7个为例,具体可以包括节点80a、节点80b、节点80c、节点80d、节点80e、节点80f以及节点80g。
若预测规则为第一预测规则,则目标共识节点(即主节点)可以获取区块链网络对应的节点权重列表。例如,该节点权重列表可以包括节点80a的节点权重(例如,1)、节点80b的节点权重(例如,1)、节点80c的节点权重(例如,1)、节点80d的节点权重(例如,1)、节点80e的节点权重(例如,1)、节点80f的节点权重(例如,1)以及节点80g的节点权重(例如,1)。
由于节点权重更新指令用于请求将节点80a的节点权重变更为配置权重(例如,2),则 该目标共识节点需要从这7个节点权重中,获取除节点80a之外的6个节点权重,进而可以对这6个节点权重以及节点80a的配置权重进行求和处理,以得到预测更新后的区块链网络对应的节点总权重H(例如,8),进一步地,该目标共识节点可以基于区块链网络对应的节点配置规则,确定区块链网络所允许的非法节点的最大数量F(例如,2)。
由于第一预测规则中的节点更新条件指示更新后的节点一旦退出,需要保证其他节点可继续达成一致,因此在对节点80a的节点权重进行预测更新后,预测更新后的区块链网络需要6个共识一致的共识结果,才可达成共识,若节点80a出现异常(例如,处于掉线、作恶等异常状态),那么剩余的节点80b、节点80c、节点80d、节点80e、节点80f以及节点80g仍然可以达成共识,这意味着该第一预测规则允许节点80a变更节点权重。换言之,由于节点80a的配置权重等于最大数量F,因此,该目标共识节点可以确定针对节点80a的配置权重满足节点更新条件,进而可以基于配置权重,对节点80a的节点权重进行更新处理,得到更新结果。其中,更新结果中的节点80a的节点权重(即配置权重)用于更新区块链网络的节点权重列表。
又比如,若预测规则为第二预测规则,则该目标共识节点可以直接获取节点权重更新指令所携带的配置权重,根据节点权重更新指令默认确定预测结果为正面,具有正面的预测结果指示配置权重满足节点更新条件,进而可以响应于预测结果为正面,从区块链网络中获取第一共识节点的节点权重,将第一共识节点的节点权重变更为配置权重,得到更新结果。可见,本申请通过提供弱规则的节点权重更新机制,可以在用户有时效要求的情况下,更高效的完成节点权重更新。
步骤S103,将更新结果记录至区块链网络的数据库。
具体地,在目标共识节点为区块链网络中具有提案功能的主节点时,该区块链网络还包括(N-1)个备份节点,其中,该区块链网络包括N个共识节点,(N-1)个备份节点是指N个共识节点中除了目标共识节点之外的共识节点;N为区块链网络中的共识节点的节点总数量;N为等于(3F+1)正整数;F为区块链网络所允许的非法节点的最大数量。此时,该目标共识节点可以对更新结果(可选的,也可以将更新结果和节点权重更新指令一并打包)进行打包处理,得到待写入区块链网络的待验证区块。然后,该目标共识节点可以将待验证区块广播至区块链网络中的(N-1)个备份节点,以使(N-1)个备份节点对获取到待验证区块进行共识,得到共识结果。进一步地,该目标共识节点可以从接收到的共识结果中,统计共识一致的共识结果(可以将共识一致的共识结果理解为共识投票中投赞成票的共识结果),将统计共识一致的共识结果确定为共识结果集合,进而可以将共识结果集合中的每个共识结果对应 的备份节点的节点权重的总和,确定为共识结果集合对应的共识数量。若共识数量与区块链网络对应的节点总权重之间的比值达到共识阈值,则确定区块链网络中的共识节点达成共识,进而可以将待验证区块作为目标区块写入区块链网络。节点总权重是指N个共识节点的节点权重之和;已写入区块链网络中的数据库的目标区块,用于指示更新后的第一共识节点的节点权重能够对第一共识节点在共识业务中的投票信息进行加权处理。
由于本申请实施例提出了一种区块链网络中的节点本身支持权重的处理模型,因此,本申请实施例中的共识节点的节点权重可以存储于区块链网络中的最新区块(例如,区块中的更新结果或区块中的状态树)里,也可以存储于自身所维护的节点权重列表中,还可以存储于与共识节点相关联的配置文件中,当然,这里的当前节点权重的存储方式还可以包括其他形式,这里将不对其进行一一举例。
比如,若希望共识节点的节点权重存储于区块链网络中的最新区块的更新结果里,则该目标共识节点在执行步骤S102之后,可以从区块链网络中获取具有最大生成时间戳的区块,进而可以基于获取到的区块的区块哈希值以及更新结果,确定待打包信息,进而可以对待打包信息进行打包处理,将打包处理后所生成的区块作为待写入区块链网络的待验证区块。然后,该目标共识节点可以将待验证区块广播至区块链网络中的(N-1)个备份节点,以使(N-1)个备份节点对获取到待验证区块进行共识,得到共识结果。在确定区块链网络中的共识节点针对待验证区块达成共识时,可以将该待验证区块作为目标区块写入区块链网络。其中,这里的目标区块的生成时间戳可以用于更新区块链网络的最大生成时间戳。
又比如,若希望共识节点的节点权重存储于区块链网络中的最新区块的状态树里,这意味着区块链网络中的每个区块均可以存储与N个共识节点的节点权重相关联的状态树。因此,该目标共识节点在执行步骤S102之后,可以从区块链网络中获取具有最大生成时间戳的区块,进而可以将获取到的区块作为父区块。其中,该父区块中的状态树存储有第一共识节点的节点权重。进一步地,该目标共识节点可以基于第一共识节点的关键信息(例如,节点标识)所指示的路径,从父区块的状态树中,获取用于存储第一共识节点的节点权重的叶子节点,然后将该获取到的叶子节点的存储信息由第一共识节点的节点权重变更为节点权重更新指令所携带的配置权重,从而得到更新后的状态树。然后,该目标共识节点可以基于父区块的区块哈希值、更新后的状态树以及更新结果,确定待打包信息,进而可以对待打包信息进行打包处理,将打包处理后所生成的区块作为待写入区块链网络的待验证区块。然后,该目标共识节点可以将待验证区块广播至区块链网络中的(N-1)个备份节点,以使(N-1)个备份节点对获取到待验证区块进行共识,得到共识结果。在确定区块链网络中的共识节点针对待验 证区块达成共识时,可以将该待验证区块作为目标区块写入区块链网络。其中,这里的目标区块的生成时间戳可以用于更新区块链网络的最大生成时间戳,且该目标区块中的状态树所存储的第一共识节点的节点权重为该第一共识节点的配置权重。
又比如,若希望共识节点的节点权重存储于自身所维护的节点权重列表中,那么,该目标共识节点可以在执行步骤S103之后,即该目标共识节点将目标区块写入区块链网络之后,该目标共识节点还可以从区块链网络对应的节点权重列表(例如,上述表1所示的节点权重列表)中,查找第一共识节点的节点权重,进而可以在节点权重列表中将查找到的节点权重变更为配置权重。
又比如,若希望共识节点的节点权重存储于共识节点的配置文件,那么,该目标共识节点可以在执行步骤S103之后,即该目标共识节点将目标区块写入区块链网络之后,将配置文件中的第一共识节点的节点权重变更为配置权重。
为便于理解,进一步地,请参见图9,图9是本申请实施例提供的一种交易上链的场景示意图。如图9所示,本申请实施例中的区块链网络中共识节点的节点总数量可以以4个为例,具体可以包括节点90a、节点90b、节点90c以及节点90d。其中,节点90d可以为根据与区块链网络相关联的出块规则所确定的具有提案功能的主节点,节点90a、节点90b以及节点90c均可以为称之为备份节点。
这里的节点权重更新指令可以用于请求将节点90a的节点权重变更为配置权重(例如,2)。其中,图9所示的区块链网络可以为区块链网络中每个共识节点均共享的一条相同的区块链网络,每个共识节点均可以在区块链网络中获取该区块链网络所存储的信息(例如,任意一个共识节点的当前节点权重)。其中,在节点90d未上链更新结果之前,该区块链网络中包括区块9Q1、区块9Q2、…以及区块9Qn
可以理解的是,该节点90d(即目标共识节点)在上链更新结果时,需要从该区块链网络中获取具有最大生成时间戳的区块(例如,图9所示的区块9Qn),且将该区块9Qn的区块哈希值作为待生成的区块的父区块哈希值。进一步地,节点90d可以对父区块哈希值和更新结果进行打包处理,将打包处理后所生成的区块作为待写入节点90d所属的区块链网络的待验证区块。
此时,该节点90d可以将该待验证区块广播至节点90d所在区块链网络中的3个备份节点,以使该这3个备份节点分别对获取到的待验证区块进行共识,从而得到用于返回至节点90d的共识结果。其中,每个备份节点返回的共识结果的份数等于与节点权重相符合的共识数量。例如,若节点90a的节点权重为1,节点90b的节点权重为1,节点90c的节点权重为 3,节点90d的节点权重为2,那么,区块链网络的节点总权重为7,此时节点90a返回的共识结果的份数等同于一个共识结果,节点90b返回的共识结果份数等同于一个共识结果,节点90c返回的共识结果的份数等同于三个共识结果,节点90d自身生成的共识结果的份数等同于两个共识结果。
然后,该节点90d可以从接收到的共识结果中,统计共识一致的共识结果(共识一致的共识结果可以理解为共识投票中投赞成票的共识结果),将统计共识一致的共识结果称之为共识结果集合,进而可以将共识结果集合中的每个共识结果对应的备份节点的节点权重的总和,确定为共识结果集合对应的共识数量。若共识数量与区块链网络对应的节点总权重之间的比对达到共识阈值(例如,2/3),则确定区块链网络中的共识节点达成共识,进而可以将该待验证区块作为目标区块,以将其作为区块9Qn的下一区块,成功写入至区块链网络的数据库,从而有效确保更新结果在链上的数据安全性。其中,目标区块的生成时间戳用于更新区块链网络的最大生成时间戳。
进一步地,若区块链网络中的共识节点未达成共识,且与区块链网络相关联的预测规则为第二预测规则(即预测结果是通过节点权重更新指令默认确定为正面),则该目标共识节点可以在区块链网络中检测处于异常状态的共识节点,将检测到的共识节点确定为第二共识节点。进一步地,该目标共识节点可以获取第二共识节点的节点权重。若第二共识节点的节点权重大于区块链网络所允许的非法节点的最大数量F,则可以对第二共识节点进行重启,更新第二共识节点的共识状态。若更新后的第二共识节点的共识状态恢复为正常状态,则可以重新对获取到待验证区块进行共识。若更新后的第二共识节点的共识状态仍然为异常状态,则目标共识节点可以生成与第二共识节点相关联的告警信息,将告警信息发送至与区块链网络相关联的管理终端设备,以使管理终端设备对应的管理对象,对第二共识节点进行处理。可见,本申请在通过弱规则实现节点权重更新的场景下,不仅考虑了更新节点权重时的时效性,还进一步在节点权重更新后的共识过程中设置了异常检查机制,即通过重启节点权重大于区块链网络所允许的非法节点的最大数量F的共识节点,可以及时恢复或告警这些会对区块链网络的共识流程造成影响的共识节点,因此,可以提高实施弱规则的安全性。
为便于理解,进一步地,请参见图10,图10是本申请实施例提供的一种业务共识的场景示意图。如图10所示,以本申请实施例中与区块链网络相关联的预测规则为第二预测规则、该区块链网络中的节点总数量为4个为例,具体可以包括节点100a、节点100b、节点100c以及节点100d。例如,节点100a的节点权重可以为2,节点100b的节点权重可以为1,节点100c的节点权重可以为1,节点100d的节点权重可以为1,此时区块链网络的节点总权重 为5,区块链网络所允许的非法节点的最大数量为1。
若节点100a的节点处于异常状态,则会因为节点100a的节点权重大于区块链网络所允许的非法节点的最大数量,导致区块链网络中剩余的节点将无法达成共识。可选的,若只有节点100d处于异常状态,则会因为节点100a的节点权重等于区块链网络所允许的非法节点的最大数量,使得区块链网络仍然可以达成共识。
基于此,在目标共识节点对待验证区块进行上链时,若区块链网络中的共识节点未达成共识,则该目标共识节点需要在区块链网络中检测处于异常状态的共识节点,将检测到的共识节点确定为第二共识节点(例如,节点100a)。由于若节点100a的节点权重大于区块链网络所允许的非法节点的最大数量F,则本申请实施例可以通过目标共识节点指示节点100a进行重启,进而来更新节点100a的共识状态。若更新后的节点100a的共识状态恢复为正常状态,则可以重新对获取到待验证区块进行共识。
可选的,若更新后的节点100a的共识状态为异常状态,则目标共识节点可以生成与节点100a相关联的告警信息,将告警信息发送至与区块链网络相关联的管理终端设备,以使管理终端设备对应的管理对象,对节点100a进行处理。其中,这里的告警信息可以为语音、文本、视频、图片等类型的警示信息,这里将不对告警信息的形式进行限定。
在本申请实施例中,若第一业务机构想要在整个区块链网络中拥有更大的决策权,无需增加该第一业务机构的节点数量,而是基于节点权重的思想,通过变更第一共识节点的节点权重,来变更第一共识节点在参与共识业务的过程中发起的投票信息所占的比重,本申请通过变更节点权重的这种部署方式,可以无需增加新的共识节点,也就不需要执行创建新共识节点所需的各种配置操作,从而可以降低部署节点的工作量,而且由于区块链网络的共识节点数量没有增加,也就不会额外增加区块链网络的资源消耗,而且由于所维护管理的共识节点的数量没有增加,也就不会增加维护管理共识节点的难度。
进一步地,请参见图11,图11是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图。该方法涉及区块链网络中的目标共识节点(即具有提案功能的主节点)以及第一共识节点。其中,这里的目标共识节点不为第一共识节点,而是该区块链网络中除第一共识节点之外的其他共识节点(例如,第三共识节点)。该方法至少可以包括以下步骤S201-步骤S205:
步骤S201,第一共识节点在获取到针对第一共识节点生成的节点权重更新指令时,对节点权重更新指令进行验证,得到交易验证结果。
其中,交易验证结果是第一共识节点基于合法性验证结果和多签验证结果所确定的;合 法性验证结果是第一共识节点对节点权重更新指令进行合法性验证后所生成的;多签验证结果是第一共识节点在确定合法性验证结果指示节点权重更新指令具备合法性时,对节点权重更新指令中携带的多方签名信息进行多签验证后所得到的。
步骤S202,在交易验证结果指示验证成功时,第一共识节点将节点权重更新指令广播至区块链网络。
具体地,在交易验证结果指示验证成功时,该第一共识节点可以将节点权重更新指令分别广播至区块链网络中除第一共识节点之外的其他共识节点(例如,第三共识节点)。
步骤S203,目标共识节点获取针对第一共识节点生成的节点权重更新指令。
步骤S204,目标共识节点基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果。
步骤S205,目标共识节点将更新结果记录至区块链网络的数据库。
其中,该步骤S201-步骤S205的具体实施方式可参见上述图3所对应实施例中对步骤S101-步骤S103的描述,这里将不再赘述。
进一步地,在目标共识节点为区块链网络中具有提案功能的主节点,且更新结果在区块链网络中的区块为目标区块(例如,图9所示的目标区块)时,该目标共识节点可以获取与区块链网络相关联的出块规则。其中,这里的出块规则可以为与节点权重相关联的出块规则(即第一出块规则)或与节点权重无关的出块规则(即第二出块规则)。若出块规则为与节点权重相关联的出块规则,则该目标共识节点可以获取目标共识节点的节点权重。其中,这里的目标共识节点的节点权重用于指示目标共识节点在当前轮次的出块总次数。
若目标共识节点在当前轮次的出块次数未达到出块总次数,则目标共识节点可以将自己继续确定为具有提案功能的主节点,以使目标共识节点继续对目标区块的下一区块进行上链。其中,目标共识节点每上链一个区块,就累计一次出块次数。可选的,若目标共识节点在当前轮次的出块次数达到出块总次数,则本申请实施例可以将基于出块规则所确定的目标共识节点的下一节点确定为具有提案功能的主节点,以使新的主节点对目标区块的下一区块进行上链。可见,本申请的节点权重不仅仅可以作用于共识投票的过程,还可以决定主节点的轮询时机,即节点权重更高的共识节点可以拥有更多成为主节点的机会,进一步提高了节点权重的影响作用。
为便于理解,进一步地,请参见图12,图12是本申请实施例提供的一种用于轮换主节点的场景示意图。如图12所示,本申请实施例中的区块链网络中的节点总数量可以以4个为 例,具体可以包括节点120a、节点120b、节点120c以及节点120d。例如,节点120a的节点权重可以为2,节点120b的节点权重可以为1,节点120c的节点权重可以为1,节点120d的节点权重可以为3。
可以理解的是,若与区块链网络相关联的出块规则为第一出块规则(即与节点权重相关联的出块规则),那么,每个共识节点的节点权重均用于指示该节点在当前轮次的出块总次数。区块链网络中的主节点的某一轮次的轮询顺序可以为节点120a、节点120a(即节点120a可以连续做两次主节点,即可以连续上链两个区块)、节点120b、节点120c、节点120d、节点120d以及节点120d(即节点120d可以连续做3次主节点,即可以连续上链3个区块)。其中,图12所示的参数12R中所包括的第一参数为1,用于表示当前主节点(即节点120a)生成的新区块的区块高度为1,参数12R中的第二参数为0,用于表示当前轮次为第一轮。
以节点120d为例,节点120d在上链第5个区块后,在当前轮次的出块次数为第一次,由于该节点120d的节点权重为3,这意味着该节点120d在第一轮的出块次数还未达到出块总次数,此时,该节点120d可以继续成为主节点,以将第5个区块的下一区块(即第6个区块)进行上链,当成功上链第7个区块时,该节点120d在当前轮次的出块次数为第三次,与对应的出块总次数相等,因此,此时将会更换另一个节点作为主节点(如节点120a)。
如图12所示,节点120a在上链第8个区块时,处于异常状态,则本申请实施例中的出块规则可以按照与第一出块规则相关联的轮次顺序,将该节点120a的下一节点(例如,节点120b)确定为主节点,以使节点120b继续对第8个区块进行上链。
可以理解的是,若与区块链网络相关联的出块规则为第二出块规则(即与节点权重无关的出块规则),那么,每个共识节点在当前轮次的出块次数均为1。区块链网络中的主节点的某一轮次的轮询顺序可以为节点120a、节点120b、节点120c以及节点120d。
如图12所示,节点120b在上链第6个区块时,处于异常状态,则本申请实施例中的出块规则可以按照与第二出块规则相关联的轮次顺序,将该节点120b的下一节点(例如,节点120c)确定为主节点,以使节点120c继续对第6个区块进行上链。
进一步地,请参见图13,图13是本申请实施例提供的一种基于区块链的数据处理方法的流程示意图。该方法可以由区块链网络中的目标共识节点执行,这里的目标共识节点为待配置节点权重的第一共识节点,同时也是区块链网络中具有提案功能的主节点。
如图13所示,在目标共识节点接收到针对第一共识节点生成的节点权重更新指令时,该目标共识节点可以对节点权重更新指令进行合法性验证(即对节点权重更新指令携带的主签名信息以及指令格式分别进行验证),以得到合法性验证结果,进而可以执行步骤S131, 以确定该合法性验证结果是否指示验证成功。若该合法性验证结果指示验证失败(即节点权重更新指令不具备合法性),则该目标共识节点可以跳转执行步骤S138,将节点权重更新指令进行丢弃。
若该合法性验证结果指示验证成功(即节点权重更新指令具备合法性),则该目标共识节点可以继续对节点权重更新指令携带的多方签名信息进行多签验证,得到多签验证结果,进而可以执行步骤S132,以确定该多签验证结果是否指示验证成功。若该多签验证结果指示验证失败,则该目标共识节点可以跳转执行步骤S138,将节点权重更新指令进行丢弃。
若多签验证结果指示验证成功,该目标共识节点可以将节点权重更新指令广播至区块链网络中的其他节点。然后,在目标共识节点为区块链网络中的主节点时,该目标共识节点可以继续执行步骤S133,获取与区块链网络相关联的预测规则。
可以理解的是,若预测规则为第一预测规则,则该目标共识节点可以执行步骤S134-步骤S136:即该目标共识节点可以执行步骤S134,获取区块链网络对应的节点权重列表,进而可以基于节点权重更新指令中的第一共识节点的配置权重以及节点权重列表,来执行步骤S135,以确定配置权重是否满足节点更新条件。若配置权重不满足节点更新条件,则该目标共识节点可以跳转执行步骤S138,将节点权重更新指令进行丢弃。若配置权重满足节点更新条件,则该目标共识节点可以继续执行步骤S136,即基于配置权重,对第一共识节点的节点权重进行更新处理,得到更新结果。
可选的,若预测规则为第二预测规则,则该目标共识节点可以默认配置权重满足节点更新条件,即可以直接跳转执行步骤S136,以基于配置权重,对第一共识节点的节点权重进行更新处理,得到更新结果。然后,该目标共识节点在可以区块链网络中的共识节点达成共识时,将更新结果写入区块链网络中的数据库。
进一步地,该目标共识节点还可以执行步骤S137,基于更新结果中的第一共识节点的配置权重,对节点权重列表进行更新,以得到更新后的节点权重列表。与此同时,该目标共识节点还可以基于更新结果中的第一共识节点的配置权重,对区块链网络的所允许的非法节点的最大数量进行更新,以得到更新后的最大数量F。
在本申请实施例中,可以针对现有区块链网络节点必须要通过多部署共识节点来实现权重的方案,提出了一种新的节点部署方式,即基于权重的思想,提出了一种本身共识节点支持权重的处理模型。此外,该模型一方面可以支持强弱两种预测规则,以使用户可根据自己的实际业务场景进行选择,从而提升业务适配性,另一方面在安全性上仍然可以满足3F+1的规则,并未因为节点权重而引起安全性的降低。本申请通过变更节点权重的这种部署方式, 可以无需增加新的共识节点,也就不需要执行创建新共识节点所需的各种配置操作,从而可以降低部署节点的工作量,而且由于区块链网络的共识节点数量没有增加,也就不会额外增加区块链网络的资源消耗,而且由于所维护管理的共识节点的数量没有增加,也就不会增加维护管理共识节点的难度。
进一步地,请参见图14,图14是本申请实施例提供的一种基于区块链的数据处理装置的结构示意图。如图14所示,该基于区块链网络的数据处理装置1可以是运行于计算机设备中的一个计算机程序(包括程序代码),例如,该基于区块链网络的数据处理装置1为一个应用软件;该基于区块链网络的数据处理装置1可以用于执行本申请实施例提供的方法中的相应步骤。如图14所示,该基于区块链网络的数据处理装置1可以运行于目标共识节点,该目标共识节点可以为上述图1所对应实施例中的区块链网络中的任意一个共识节点。该基于区块链网络的数据处理装置1可以包括:获取模块11,更新处理模块12,写入模块13,合法性验证模块15,多签验证模块16,执行模块17,出块规则获取模块18,目标权重获取模块19以及主节点确定模块20。
该获取模块11,用于获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新;
该更新处理模块12,用于基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;
该更新处理模块12,还用于响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果。
其中,第一共识节点属于区块链网络所包括的N个共识节点,N为正整数;
该更新处理模块12包括:列表获取单元121,数量确定单元122,比对单元123,第一更新单元124,丢弃单元125,第一获取单元126,第二获取单元127以及第二更新单元128。
该列表获取单元121,用于基于节点权重更新指令获取区块链网络对应的节点权重列表;节点权重列表包括N个共识节点中的每个共识节点分别对应的节点权重;
该数量确定单元122,用于基于N个节点权重以及节点权重更新指令所携带的配置权重,确定区块链网络所允许的非法节点的最大数量F;配置权重为所预测的更新后的第一共识节点的节点权重。
其中,该数量确定单元122包括:获取子单元1221,求和子单元1222以及确定子单元1223。
该获取子单元1221,用于从N个节点权重中,获取除第一共识节点的节点权重之外的(N-1)个节点权重;
该求和子单元1222,用于对(N-1)个节点权重以及节点权重更新指令所携带的配置权重进行求和处理,得到区块链网络对应的节点总权重H;H为正整数;
该确定子单元1223,用于基于节点总权重H以及区块链网络对应的节点配置规则,确定区块链网络所允许的非法节点的最大数量F。其中,节点配置规则为H=3F+1,H为节点总权重,F为区块链网络所允许的非法节点的最大数量。
其中,该获取子单元1221,求和子单元1222以及确定子单元1223的具体实现方式可以参见上述图3所对应实施例中对非法节点的最大数量的描述,这里将不再继续进行赘述。
该比对单元123,用于对配置权重和最大数量F进行比对,得到比对结果;
该第一更新单元124,用于若比对结果指示配置权重小于或者等于最大数量F,则确定预测结果为正面;具有正面的预测结果指示配置权重满足节点更新条件。
其中,该更新处理模块12在用于响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果时,具体用于执行以下操作:
响应于预测结果为正面,按照节点权重更新指令中的配置权重,对第一共识节点的节点权重进行更新处理,得到更新结果;更新结果中的第一共识节点的配置权重用于更新节点权重列表。
该丢弃单元125,用于若比对结果指示配置权重大于最大数量F,则确定预测结果为负面,将节点权重更新指令丢弃;具有负面的预测结果指示配置权重不满足节点更新条件。
该第一获取单元126,用于获取节点权重更新指令所携带的配置权重,根据节点权重更新指令默认确定预测结果为正面;配置权重为所预测的更新后的第一共识节点的节点权重;具有正面的预测结果指示配置权重满足节点更新条件;
该第二获取单元127,用于响应于预测结果为正面,从区块链网络中获取第一共识节点的节点权重;
该第二更新单元128,用于将第一共识节点的节点权重更新为节点权重更新指令中的配置权重,得到更新结果。
其中,该列表获取单元121,数量确定单元122,比对单元123,第一更新单元124,丢弃单元125,第一获取单元126,第二获取单元127以及第二更新单元128的具体实现方式可以参见上述图3所对应实施例中对步骤S102的描述,这里将不再继续进行赘述。
该写入模块13,用于将更新结果记录至区块链网络的数据库。
其中,目标共识节点为区块链网络中具有提案功能的主节点;目标共识节点属于区块链网络所包括的N个共识节点;N为等于(3F+1)的正整数;F为区块链网络所允许的非法节点的最大数量;
该写入模块13包括:打包单元1301,广播单元1302,统计单元1303,共识确定单元1304,写入单元1305,检测单元1306,第三获取单元1307,重启单元1308,共识单元1309以及信息生成单元1310。
该打包单元1301,用于对更新结果进行打包处理,得到待写入区块链网络的待验证区块;
该广播单元1302,用于将待验证区块广播至区块链网络中的(N-1)个备份节点,以使(N-1)个备份节点对获取到待验证区块进行共识,得到共识结果;(N-1)个备份节点是指N个共识节点中除了目标共识节点之外的共识节点;
该统计单元1303,用于从接收到的共识结果中,统计共识一致的共识结果,将统计共识一致的共识结果确定为共识结果集合;
该共识确定单元1304,用于将共识结果集合中的每个共识结果对应的备份节点的节点权重的总和,确定为共识结果集合对应的共识数量;
该写入单元1305,用于若共识数量与区块链网络对应的节点总权重之间的比值达到共识阈值,则确定区块链网络中的共识节点达成共识,将待验证区块作为目标区块写入区块链网络中的数据库;节点总权重是指N个共识节点的节点权重之和;已写入区块链网络中的数据库的目标区块,用于指示更新后的第一共识节点的节点权重能够对第一共识节点在共识业务中的投票信息进行加权处理。
该检测单元1306,用于若区块链网络中的共识节点未达成共识,且预测结果是通过节点权重更新指令默认确定为正面,则在区块链网络中检测处于异常状态的共识节点,将检测到的共识节点确定为第二共识节点;
该第三获取单元1307,用于获取第二共识节点的节点权重;
该重启单元1308,用于若第二共识节点的节点权重大于区块链网络所允许的非法节点的最大数量F,则对第二共识节点进行重启,更新第二共识节点的共识状态;
该共识单元1309,用于若更新后的第二共识节点的共识状态恢复为正常状态,则重新对获取到待验证区块进行共识。
该信息生成单元1310,用于若更新后的第二共识节点的共识状态为异常状态,则生成与第二共识节点相关联的告警信息,将告警信息发送至与区块链网络相关联的管理终端设备。
其中,该打包单元1301,广播单元1302,统计单元1303,共识确定单元1304,写入单 元1305,检测单元1306,第三获取单元1307,重启单元1308,共识单元1309以及信息生成单元1310的具体实现方式可以参见上述图3所对应实施例中对步骤S103的描述,这里将不再继续进行赘述。
其中,第一共识节点属于区块链网络所包括的N个共识节点;N为正整数;一个共识节点对应一个业务机构;第一共识节点对应的业务机构为第一业务机构;节点权重更新指令是由第一业务机构的第一终端设备,在响应第一对象针对第一共识节点的节点权重的配置操作时所生成的;
该获取模块11,具体用于接收第一终端设备发送的节点权重更新指令;节点权重更新指令携带主签名信息以及多方签名信息;主签名信息是第一终端设备基于第一对象的第一私钥,对节点权重更新指令进行签名后所得到的;多方签名信息是基于与M个第二业务机构相关联的第二对象的第二私钥,对节点权重更新指令进行多方签名后所得到的;第二业务机构为N个业务机构中除第一业务机构之外的业务机构;M为小于N,且大于签名阈值的正整数;
该合法性验证模块15,用于基于第一对象的第一公钥以及主签名信息,对节点权重更新指令进行合法性验证,得到合法性验证结果。
其中,该合法性验证模块15包括:验签单元151,校验单元152,第一生成单元153以及第二生成单元154。
该验签单元151,用于基于第一对象的第一公钥,对主签名信息进行验签,得到主验签结果;
该校验单元152,用于基于区块链网络上的智能合约,对节点权重更新指令的指令格式进行校验,得到校验结果;
该第一生成单元153,用于若主验签结果指示验证成功,且校验结果指示校验成功,则生成用于指示节点权重更新指令具备合法性的合法性验证结果;
该第二生成单元154,用于若主验签结果指示验证失败,或校验结果指示校验失败,则生成用于指示节点权重更新指令不具备合法性的合法性验证结果。
其中,该验签单元151,校验单元152,第一生成单元153以及第二生成单元154的具体实现方式可以参见上述图3所对应实施例中对节点权重更新指令进行合法性验证的描述,这里将不再继续进行赘述。
该多签验证模块16,用于若合法性验证结果指示节点权重更新指令具备合法性,则基于与M个第二业务机构相关联的第二对象分别对应的第二公钥,对多方签名信息进行多签验证,得到多签验证结果;
该执行模块17,用于在多签验证结果指示验证成功时,通知更新处理模块12执行基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果。
其中,若目标共识节点为区块链网络中具有提案功能的主节点,且不为第一共识节点,则目标共识节点获取到的节点权重更新指令是第一共识节点在确定多签验证结果指示验证成功时所提交的;多签验证结果是第一共识节点在确定合法性验证结果指示节点权重更新指令具备合法性时,对节点权重更新指令中携带的多方签名信息进行多签验证后所得到的;合法性验证结果是第一共识节点对接收到的节点权重更新指令进行合法性验证后所生成的。
其中,目标共识节点为区块链网络中具有提案功能的主节点;区块链网络中包含更新结果的区块为目标区块;
该出块规则获取模块18,用于获取与区块链网络相关联的出块规则;
该目标权重获取模块19,用于若出块规则为与节点权重相关联的出块规则,则获取目标共识节点的节点权重;目标共识节点的节点权重用于指示目标共识节点在当前轮次的出块总次数;
该主节点确定模块20,用于若目标共识节点在当前轮次的出块次数未达到出块总次数,则将目标共识节点继续确定为具有提案功能的主节点,以使目标共识节点对目标区块的下一区块进行上链。
其中,该获取模块11,更新处理模块12,写入模块13,合法性验证模块15,多签验证模块16,执行模块17,出块规则获取模块18,目标权重获取模块19以及主节点确定模块20的具体实现方式可以参见上述图3所对应实施例中对步骤S101-步骤S103以及图11所对应实施例中对步骤S201-步骤S205、以及图13所对应实施例中对步骤S131-步骤S137的描述,这里将不再继续进行赘述。另外,对采用相同方法的有益效果描述,也不再进行赘述。
进一步地,请参见图15,图15是本申请实施例提供的一种计算机设备的示意图。如图15所示,该计算机设备1000可以包括:至少一个处理器1001,例如,CPU,至少一个网络接口1004,存储器1005,至少一个通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。网络接口1004可选地可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。存储器1005可选地还可以是至少一个位于远离前述处理器1001的存储装置。如图15所示,作为一种计算机存储介质的存储器1005可以包括操作系统、网络通信模块、用户接口模块以及设备控制应用程序。其中,在一些实施例中,该计算机设备 还可以包括图15所示的用户接口1003,比如,若该计算机设备为终端设备,则该计算机设备还可以包括该用户接口1003,其中,该用户接口1003可以包括显示屏(Display)、键盘(Keyboard)等。
在图15所示的计算机设备1000中,网络接口1004主要用于进行网络通信;而用户接口1003主要用于为用户提供输入的接口;而处理器1001可以用于调用存储器1005中存储的设备控制应用程序,以实现:
获取针对区块链网络中的第一共识节点生成的节点权重更新指令,节点权重更新指令用于指示对配置给第一共识节点在共识业务中的投票信息的节点权重进行更新;
基于节点权重更新指令预测更新后的第一共识节点的节点权重是否满足节点更新条件,得到预测结果;
响应于预测结果为正面,按照节点权重更新指令对第一共识节点的节点权重进行更新,得到更新结果;
将更新结果记录至区块链网络的数据库。
应当理解,本申请实施例中所描述的计算机设备1000可执行前文图3、图11和图13所对应实施例中对该基于区块链网络的数据处理方法的描述,也可执行前文图14所对应实施例中对该基于区块链网络的数据处理装置1的描述,在此不再赘述。另外,对采用相同方法的有益效果描述,也不再进行赘述。
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包括程序指令,该程序指令被处理器执行时实现图3、图11和图13中各个步骤所提供的基于区块链网络的数据处理方法,具体可参见图3、图11以及图13各个步骤所提供的实现方式,在此不再赘述。
计算机可读存储介质可以是前述任一实施例提供的数据传输装置或者计算机设备的内部存储单元,例如计算机设备的硬盘或内存。该计算机可读存储介质也可以是该计算机设备的外部存储设备,例如该计算机设备上配备的插接式硬盘,智能存储卡(smart media card,SMC),安全数字(secure digital,SD)卡,闪存卡(Flash card)等。进一步地,该计算机可读存储介质还可以既包括该计算机设备的内部存储单元也包括外部存储设备。该计算机可读存储介质用于存储该计算机程序以及该计算机设备所需的其他程序和数据。该计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。
本申请实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机程序,该计算机程序存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该 计算机程序,处理器执行该计算机程序,使得该计算机设备可执行前文各实施例中对基于区块链网络的数据处理方法或装置的描述,在此不再赘述。另外,对采用相同方法的有益效果描述,也不再进行赘述。
本申请实施例的说明书和权利要求书及附图中的术语“第一”、“第二”等是用于区别不同对象,而非用于描述特定顺序。此外,术语“包括”以及它们任何变形,意图在于覆盖不排他的包括。例如包括了一系列步骤或单元的过程、方法、装置、产品或设备没有限定于已列出的步骤或模块,而是可选地还包括没有列出的步骤或模块,或可选地还包括对于这些过程、方法、装置、产品或设备固有的其他步骤单元。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。

Claims (20)

  1. 一种基于区块链的数据处理方法,其特征在于,所述方法由目标共识节点执行,包括:
    获取针对区块链网络中的第一共识节点生成的节点权重更新指令,所述节点权重更新指令用于指示对配置给所述第一共识节点在共识业务中的投票信息的节点权重进行更新;
    基于所述节点权重更新指令预测更新后的所述第一共识节点的节点权重是否满足节点更新条件,得到预测结果;
    响应于所述预测结果为正面,按照所述节点权重更新指令对所述第一共识节点的节点权重进行更新,得到更新结果;
    将所述更新结果记录至所述区块链网络的数据库。
  2. 根据权利要求1所述的方法,其特征在于,所述第一共识节点属于所述区块链网络所包括的N个共识节点,N为正整数;
    所述基于所述节点权重更新指令预测更新后的所述第一共识节点的节点权重是否满足节点更新条件,得到预测结果,包括:
    基于所述节点权重更新指令获取所述区块链网络对应的节点权重列表;所述节点权重列表包括所述N个共识节点中的每个共识节点分别对应的节点权重;
    基于N个节点权重以及所述节点权重更新指令所携带的配置权重,确定所述区块链网络所允许的非法节点的最大数量F;所述配置权重为所预测的更新后的所述第一共识节点的节点权重;
    对所述配置权重和所述最大数量F进行比对,得到比对结果;
    若所述比对结果指示所述配置权重小于或者等于所述最大数量F,则确定预测结果为正面;具有正面的所述预测结果指示所述配置权重满足节点更新条件。
  3. 根据权利要求2所述的方法,其特征在于,所述响应于所述预测结果为正面,按照所述节点权重更新指令对所述第一共识节点的节点权重进行更新,得到更新结果,包括:
    响应于所述预测结果为正面,按照所述节点权重更新指令中的所述配置权重,对所述第一共识节点的节点权重进行更新处理,得到更新结果;所述更新结果中的所述第一共识节点的配置权重用于更新所述节点权重列表。
  4. 根据权利要求2或3所述的方法,其特征在于,所述基于N个节点权重以及所述节点权重更新指令所携带的配置权重,确定所述区块链网络所允许的非法节点的最大数量F,包括:
    从N个节点权重中,获取除所述第一共识节点的节点权重之外的(N-1)个节点权重;
    对所述(N-1)个节点权重以及所述节点权重更新指令所携带的配置权重进行求和处理,得到所述区块链网络对应的节点总权重H;H为正整数;
    基于所述节点总权重H以及所述区块链网络对应的节点配置规则,确定所述区块链网络所允许的非法节点的最大数量F。
  5. 根据权利要求4所述的方法,其特征在于,所述节点配置规则为H=3F+1,H为所述节点总权重,F为所述区块链网络所允许的非法节点的最大数量。
  6. 根据权利要求2至5任一项所述的方法,其特征在于,所述方法还包括:
    若所述比对结果指示所述配置权重大于所述最大数量F,则确定预测结果为负面,将所述节点权重更新指令丢弃;具有负面的所述预测结果指示所述配置权重不满足所述节点更新条件。
  7. 根据权利要求1所述的方法,其特征在于,所述基于所述节点权重更新指令预测更新后的所述第一共识节点的节点权重是否满足节点更新条件,得到预测结果,包括:
    获取所述节点权重更新指令所携带的配置权重;所述配置权重为所预测的更新后的所述第一共识节点的节点权重;
    根据所述节点权重更新指令默认确定预测结果为正面;具有正面的所述预测结果指示所述配置权重满足节点更新条件;
    所述响应于所述预测结果为正面,按照所述节点权重更新指令对所述第一共识节点的节点权重进行更新,得到更新结果,包括:
    响应于所述预测结果为正面,从所述区块链网络中获取所述第一共识节点的节点权重;
    将所述第一共识节点的节点权重更新为所述节点权重更新指令中的所述配置权重,得到更新结果。
  8. 根据权利要求1至7任一项所述的方法,其特征在于,所述目标共识节点为所述区 块链网络中具有提案功能的主节点;所述目标共识节点属于所述区块链网络所包括的N个共识节点;N为等于(3F+1)的正整数;F为所述区块链网络所允许的非法节点的最大数量;
    所述将所述更新结果记录至所述区块链网络的数据库,包括:
    对所述更新结果进行打包处理,得到待写入所述区块链网络的待验证区块;
    将所述待验证区块广播至所述区块链网络中的(N-1)个备份节点,以使(N-1)个备份节点对获取到所述待验证区块进行共识,得到共识结果;(N-1)个备份节点是指所述N个共识节点中除了所述目标共识节点之外的共识节点;
    从接收到的共识结果中,统计共识一致的共识结果,将统计共识一致的共识结果确定为共识结果集合;
    将所述共识结果集合中的每个共识结果对应的备份节点的节点权重的总和,确定为所述共识结果集合对应的共识数量;
    若所述共识数量与所述区块链网络对应的节点总权重之间的比值达到共识阈值,则确定所述区块链网络中的共识节点达成共识,将所述待验证区块作为目标区块写入所述区块链网络中的数据库;所述节点总权重是指所述N个共识节点的节点权重之和;已写入所述区块链网络中的数据库的所述目标区块,用于指示更新后的所述第一共识节点的节点权重能够对所述第一共识节点在共识业务中的投票信息进行加权处理。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括;
    若所述区块链网络中的共识节点未达成共识,且所述预测结果是通过所述节点权重更新指令默认确定为正面,则在所述区块链网络中检测处于异常状态的共识节点,将检测到的共识节点确定为第二共识节点;
    获取所述第二共识节点的节点权重;
    若所述第二共识节点的节点权重大于所述区块链网络所允许的非法节点的最大数量F,则对所述第二共识节点进行重启,更新所述第二共识节点的共识状态;
    若更新后的第二共识节点的共识状态恢复为正常状态,则重新对获取到所述待验证区块进行共识。
  10. 根据权利要求9所述的方法,其特征在于,所述方法还包括:
    若更新后的第二共识节点的共识状态为异常状态,则生成与所述第二共识节点相关联的告警信息,将所述告警信息发送至与所述区块链网络相关联的管理终端设备。
  11. 根据权利要求1至10任一项所述的方法,其特征在于,所述目标共识节点为所述区块链网络中具有提案功能的主节点;所述区块链网络中包含所述更新结果的区块为目标区块;
    所述方法还包括:
    获取与所述区块链网络相关联的出块规则;
    若所述出块规则为与节点权重相关联的出块规则,则获取所述目标共识节点的节点权重;所述目标共识节点的节点权重用于指示所述目标共识节点在当前轮次的出块总次数;
    若所述目标共识节点在当前轮次的出块次数未达到所述出块总次数,则将所述目标共识节点继续确定为具有提案功能的主节点,对所述目标区块的下一区块进行上链。
  12. 根据权利要求1至11任一项所述的方法,其特征在于,所述第一共识节点属于所述区块链网络所包括的N个共识节点;N为正整数;一个共识节点对应一个业务机构;所述第一共识节点对应的业务机构为第一业务机构;所述节点权重更新指令是由所述第一业务机构的第一终端设备,在响应第一对象针对第一共识节点的节点权重的配置操作时所生成的;
    所述获取针对区块链网络中的第一共识节点生成的节点权重更新指令,包括:
    接收所述第一终端设备发送的节点权重更新指令;所述节点权重更新指令携带主签名信息以及多方签名信息;所述主签名信息是所述第一终端设备基于所述第一对象的第一私钥,对所述节点权重更新指令进行签名后所得到的;所述多方签名信息是基于与M个第二业务机构相关联的第二对象的第二私钥,对所述节点权重更新指令进行多方签名后所得到的;所述第二业务机构为N个业务机构中除所述第一业务机构之外的业务机构;M为小于N,且大于签名阈值的正整数;
    所述方法还包括:
    基于所述第一对象的第一公钥以及所述主签名信息,对所述节点权重更新指令进行合法性验证,得到合法性验证结果;
    若所述合法性验证结果指示所述节点权重更新指令具备合法性,则基于所述与M个第二业务机构相关联的第二对象分别对应的第二公钥,对所述多方签名信息进行多签验证,得到多签验证结果;
    在所述多签验证结果指示验证成功时,执行所述基于所述节点权重更新指令预测更新后的所述第一共识节点的节点权重是否满足节点更新条件,得到预测结果的步骤。
  13. 根据权利要求12所述的方法,其特征在于,所述基于所述第一对象的第一公钥以及所述主签名信息,对所述节点权重更新指令进行合法性验证,得到合法性验证结果,包括:
    基于所述第一对象的第一公钥,对所述主签名信息进行验签,得到主验签结果;
    基于所述区块链网络上的智能合约,对所述节点权重更新指令的指令格式进行校验,得到校验结果;
    若所述主验签结果指示验证成功,且所述校验结果指示校验成功,则生成用于指示所述节点权重更新指令具备合法性的合法性验证结果;
    若所述主验签结果指示验证失败,或所述校验结果指示校验失败,则生成用于指示所述节点权重更新指令不具备合法性的合法性验证结果。
  14. 根据权利要求1至13任一项所述的方法,其特征在于,若所述目标共识节点为所述区块链网络中具有提案功能的主节点,且不为所述第一共识节点,则所述目标共识节点获取到的所述节点权重更新指令是所述第一共识节点在确定多签验证结果指示验证成功时所提交的;所述多签验证结果是所述第一共识节点在确定合法性验证结果指示所述节点权重更新指令具备合法性时,对所述节点权重更新指令中携带的多方签名信息进行多签验证后所得到的;所述合法性验证结果是所述第一共识节点对接收到的所述节点权重更新指令进行合法性验证后所生成的。
  15. 一种区块链网络,其特征在于,包括:
    N个共识节点;N为正整数;一个共识节点对应一个节点权重;所述N个共识节点包括第一共识节点和目标共识节点;所述目标共识节点用于获取针对所述区块链网络中的第一共识节点生成的节点权重更新指令,所述节点权重更新指令用于指示对配置给所述第一共识节点在共识业务中的投票信息的节点权重进行更新;所述目标共识节点还用于基于所述节点权重更新指令预测更新后的所述第一共识节点的节点权重是否满足节点更新条件,得到预测结果;所述目标共识节点还用于响应于所述预测结果为正面,按照所述节点权重更新指令对所述第一共识节点的节点权重进行更新,得到更新结果,将所述更新结果记录至所述区块链网络的数据库。
  16. 根据权利要求15所述的区块链网络,其特征在于,所述第一共识节点用于在确定 所述节点权重更新指令的指令验证结果指示验证成功时,将所述节点权重更新指令广播至所述目标共识节点;所述指令验证结果是所述第一共识节点基于合法性验证结果和多签验证结果所确定的;所述合法性验证结果是所述第一共识节点对所述节点权重更新指令进行合法性验证后所生成的;所述多签验证结果是所述第一共识节点在确定合法性验证结果指示所述节点权重更新指令具备合法性时,对所述节点权重更新指令中携带的多方签名信息进行多签验证后所得到的。
  17. 一种基于区块链的数据处理装置,其特征在于,包括:
    获取模块,用于获取针对区块链网络中的第一共识节点生成的节点权重更新指令,所述节点权重更新指令用于指示对配置给所述第一共识节点在共识业务中的投票信息的节点权重进行更新;
    更新处理模块,用于基于所述节点权重更新指令预测更新后的所述第一共识节点的节点权重是否满足节点更新条件,得到预测结果;
    所述更新处理模块,还用于响应于所述预测结果为正面,按照所述节点权重更新指令对所述第一共识节点的节点权重进行更新,得到更新结果;
    写入模块,用于将所述更新结果记录至所述区块链网络的数据库。
  18. 一种计算机设备,其特征在于,包括:处理器和存储器以及网络接口;
    所述处理器与所述存储器、所述网络接口相连,其中,所述网络接口用于提供数据通信功能,所述存储器用于存储计算机程序,所述处理器用于调用所述计算机程序,以使得所述计算机设备执行权利要求1至14任一项所述的方法。
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,所述计算机程序适于由处理器加载并执行,以使得具有所述处理器的计算机设备执行权利要求1至14任一项所述的方法。
  20. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序,所述计算机程序存储在计算机可读存储介质中,所述计算机程序适于由处理器读取并执行,以使得具有所述处理器的计算机设备执行权利要求1至14任一项所述的方法。
PCT/CN2024/072020 2023-07-03 2024-01-12 一种基于区块链的数据处理方法、装置、设备及介质 Ceased WO2025007540A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US19/320,800 US20260005872A1 (en) 2023-07-03 2025-09-05 Data processing method and apparatus based on blockchain

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310809879.3 2023-07-03
CN202310809879.3A CN119254781A (zh) 2023-07-03 2023-07-03 一种基于区块链的数据处理方法、装置、设备及介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US19/320,800 Continuation US20260005872A1 (en) 2023-07-03 2025-09-05 Data processing method and apparatus based on blockchain

Publications (1)

Publication Number Publication Date
WO2025007540A1 true WO2025007540A1 (zh) 2025-01-09

Family

ID=94033502

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/072020 Ceased WO2025007540A1 (zh) 2023-07-03 2024-01-12 一种基于区块链的数据处理方法、装置、设备及介质

Country Status (3)

Country Link
US (1) US20260005872A1 (zh)
CN (1) CN119254781A (zh)
WO (1) WO2025007540A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120074801A (zh) * 2025-04-28 2025-05-30 霖久智慧(广东)科技有限公司 基于区块链的物业安全数据存证方法、装置、设备、介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200192770A1 (en) * 2018-12-14 2020-06-18 Nokia Technologies Oy Hierarchical weighted consensus for permissioned blockchains
CN113132126A (zh) * 2019-12-30 2021-07-16 百度在线网络技术(北京)有限公司 投票权重确定方法及相关设备
CN114710507A (zh) * 2022-03-30 2022-07-05 蚂蚁区块链科技(上海)有限公司 一种共识方法和区块链节点
CN115280722A (zh) * 2020-03-16 2022-11-01 贝宝公司 调整用于区块链的加权共识算法的权重

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200192770A1 (en) * 2018-12-14 2020-06-18 Nokia Technologies Oy Hierarchical weighted consensus for permissioned blockchains
CN113132126A (zh) * 2019-12-30 2021-07-16 百度在线网络技术(北京)有限公司 投票权重确定方法及相关设备
CN115280722A (zh) * 2020-03-16 2022-11-01 贝宝公司 调整用于区块链的加权共识算法的权重
CN114710507A (zh) * 2022-03-30 2022-07-05 蚂蚁区块链科技(上海)有限公司 一种共识方法和区块链节点

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHEN, XIAOJIN: "Blockchain Consensus Method Based on Weighted Excitation", GUANGDONG COMMUNICATION TECHNOLOGY, GUANGDONG SHENG DIANXIN YOUXIAN GONGSI YANJIUYUAN, CN, vol. 43, no. 3, 15 March 2023 (2023-03-15), CN , pages 41 - 46, XP093258833, ISSN: 1006-6403, DOI: 10.3969/j.issn.1006-6403.2023.03.009 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120074801A (zh) * 2025-04-28 2025-05-30 霖久智慧(广东)科技有限公司 基于区块链的物业安全数据存证方法、装置、设备、介质

Also Published As

Publication number Publication date
CN119254781A (zh) 2025-01-03
US20260005872A1 (en) 2026-01-01

Similar Documents

Publication Publication Date Title
CN115210741B (zh) 部分有序的区块链
US12505254B2 (en) Data processing method and apparatus based on blockchain network, and computer device
JP7228322B2 (ja) ブロックチェーン・ネットワークにおける自動コミット・トランザクション管理
US20210194759A1 (en) Changing a master node in a blockchain system
US11769156B2 (en) Automated data projection for smart contract groups on a blockchain
JP7672499B2 (ja) クロスチェーントランザクション処理方法と装置、電子機器及びコンピュータプログラム
US11689616B2 (en) Optimization of delivery of blocks
CN112822267B (zh) 基于区块链的数据处理方法和装置
CN112291372A (zh) 区块链的异步落账方法、装置、介质及电子设备
CN111368008B (zh) 基于区块链的数据处理方法、装置、设备及可读存储介质
US11044104B2 (en) Data certification as a service powered by permissioned blockchain network
WO2021233109A1 (zh) 基于区块链的消息处理方法、装置、设备以及存储介质
JP2022518960A (ja) 複数のノードに基づくネットワークトランザクション検証方法及びそのシステム並びに記憶媒体
US20200374340A1 (en) Optimization of delivery of blocks
US20260005872A1 (en) Data processing method and apparatus based on blockchain
JP2020204898A (ja) 分散台帳システムの運用管理方法、分散台帳システムの運用管理システム、および分散台帳システムの運用管理プログラム
CN111222885B (zh) 数据处理请求背书方法、装置、计算机设备及存储介质
CN111162970B (zh) 在区块链系统中测试去中心化应用服务器的方法及装置
CN116107801A (zh) 交易处理方法及相关产品
CN116074027A (zh) 一种基于区块链的数据处理方法、设备以及可读存储介质
CN116614311B (zh) 镜像签名方法、装置、服务节点、终端及可读存储介质
WO2024066974A1 (zh) 基于区块链的数据处理方法、设备以及可读存储介质
CN116074327A (zh) 区块链的共识方法、装置、计算机可读介质及电子设备
HK40027980B (zh) 基於区块链的数据处理方法、装置、存储介质及设备
HK40029934A (zh) 在区块链系统中测试去中心化应用服务器的方法及装置

Legal Events

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

Ref document number: 24835029

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE