Data processing method and device based on block chain network and storage medium

By introducing a switching mechanism between the target primary node and the target backup node in the blockchain system, the risks brought about by single-node failure are solved, the system availability and stability are improved, and block confirmation delay is reduced.

CN119996164APending Publication Date: 2025-05-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311510607.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-10
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

There is a risk of single point failure and downtime in a single node in a blockchain system, especially in a consortium chain or private chain. The number of nodes is small, and the impact of failure is more obvious. The block confirmation speed may slow down or fail during node downtime.

Method used

The node mechanism of the target master node and the target backup node is introduced, the target backup node detects the master node failure, calls the blockchain network system contract to generate transaction information, switches the master node to the backup node, and reaches a consensus in multiple node clusters to ensure the effectiveness of the switch.

Benefits of technology

It improves the availability and fault tolerance of single nodes of blockchain, reduces block confirmation latency, improves the stability and performance of the entire blockchain system, and provides stronger availability and stability in consortium chains or private chains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119996164A_ABST
    Figure CN119996164A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data processing method and device based on a block chain network and a storage medium. The method relates to the technical field of data processing in the technical field of block chains. According to the method, a target standby node calls a system contract of a block chain network to generate first transaction information when detecting that a target master node has a fault, and under the condition that a consensus result of a first proposal block corresponding to the first transaction information indicates that the main node of the target node cluster is sponsored to be switched from the target main node to the target standby node, switching the main node in the target node cluster from the target main node to the target standby node. And the first proposal block is added to the block chain of the target standby node, so that the availability and fault-tolerant capability of the single node of the block chain can be improved, and the block confirmation delay is reduced, thereby improving the stability and performance of the whole block chain system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data processing technology in the field of blockchain technology, and more specifically, to a data processing method, device, and storage medium based on a blockchain network. Background Art

[0002] The blockchain system is naturally distributed and decentralized. In the blockchain system, multiple nodes usually rely on the consensus mechanism to jointly maintain the blockchain data. Each node saves a copy of the entire blockchain data. To some extent, this is a mechanism for multiple nodes to back up each other, thus ensuring decentralization and data persistence.

[0003] However, although the blockchain system uses multiple nodes to achieve data backup, there is still a single point of failure and downtime risk for a single node. In particular, for alliance chains or private chains, the number of nodes is relatively small, and the impact of single point failure is more obvious. In addition, data synchronization between existing blockchain nodes depends on block broadcasting and consensus processes. Node downtime or failure may cause the latest block confirmation to be slightly slower or even fail. Summary of the invention

[0004] The present application provides a data processing method, device and storage medium based on a blockchain network, which not only improves the availability and fault tolerance of a single blockchain node, but also reduces the block confirmation delay, thereby improving the stability and performance of the entire blockchain system. In particular, it provides stronger availability and stability in a consortium chain or a private chain, avoiding a single node failure from having a significant impact on the entire system.

[0005] In a first aspect, an embodiment of the present application provides a data processing method based on a blockchain network, wherein the blockchain network includes multiple node clusters, the multiple node clusters include a target node cluster, the target node cluster includes a target master node and a target standby node, the method is executed by the target standby node, and the method includes:

[0006] Detect whether the target master node fails;

[0007] In the case where a failure of the target master node is detected, a system contract of the blockchain network is called to generate first transaction information; the first transaction information is used to instruct the master node of the target node cluster to be switched from the target master node to the target standby node;

[0008] Verifying the first transaction information, and if the first transaction information passes the verification, broadcasting the first transaction information to other node clusters among the multiple node clusters except the target node cluster;

[0009] Obtain a consensus result of a first proposal block corresponding to the first transaction information, and when the consensus result of the first proposal block indicates approval for switching the master node of the target node cluster from the target master node to the target standby node, switch the master node in the target node cluster from the target master node to the target standby node, and add the first proposal block to the blockchain of the target standby node.

[0010] In a second aspect, an embodiment of the present application provides a data processing device based on a blockchain network, for executing the method in the first aspect or its various implementations. Specifically, the data processing device includes a functional module for executing the method in the first aspect or its various implementations.

[0011] In one implementation, the data processing device may include a processing unit, which is used to perform functions related to information processing. For example, the processing unit may be a processor.

[0012] In one implementation, the data processing device may include a sending unit and / or a receiving unit. The sending unit is used to perform functions related to sending, and the receiving unit is used to perform functions related to receiving. For example, the sending unit may be a transmitter or a transmitter, and the receiving unit may be a receiver or a receiver. For another example, the data processing device is a communication chip, the sending unit may be an input circuit or an interface of the communication chip, and the sending unit may be an output circuit or an interface of the communication chip.

[0013] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the first aspect or its implementations.

[0014] In one implementation, the number of the processor is one or more, and the number of the memory is one or more.

[0015] In one implementation, the memory may be integrated with the processor, or the memory may be provided separately from the processor.

[0016] In one implementation, the electronic device further includes a transmitter (transmitter) and a receiver (receiver).

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, characterized in that it is used to store a computer program, which enables a computer to execute the method of the first aspect above.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, it implements the method of executing the above-mentioned first aspect.

[0019] In a sixth aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the method in any one of the first to second aspects above or in each of their implementations.

[0020] For the data processing method provided in the first aspect, when a failure of a target master node is detected, the target standby node calls the system contract of the blockchain network to generate first transaction information; the first transaction information is used to indicate that the master node of the target node cluster is switched from the target master node to the target standby node; then, the first transaction information is verified, and when the first transaction information passes the verification, the first transaction information is broadcast to other node clusters in the multiple node clusters except the target node cluster; the consensus result of the first proposal block corresponding to the first transaction information is obtained, and when the consensus result of the first proposal block indicates that it is in favor of switching the master node of the target node cluster from the target master node to the target standby node, the master node in the target node cluster is switched from the target master node to the target standby node, and the first proposal block is added to the blockchain of the target standby node.

[0021] In the embodiment of the present application, by introducing the node mechanism of the target master node and the target standby node to construct the node cluster in the blockchain network, the original multi-node mutual backup mechanism is further upgraded to the node cluster level, so that when the target standby node detects that the target master node fails, it can directly call the system contract of the blockchain network to generate the first transaction information, and when the consensus result of the first proposal block corresponding to the first transaction information indicates that the master node of the target node cluster is switched from the target master node to the target standby node, the master node in the target node cluster is switched from the target master node to the target standby node, and the first proposal block corresponding to the first transaction information is added to the blockchain of the target standby node, thereby, not only can the master node of the target node cluster be switched from the target master node to the target standby node, but also all the node clusters in the blockchain network can reach a consensus, reduce the risk brought by the failure of the target master node, improve the availability and fault tolerance of the single node of the blockchain, reduce the block confirmation delay, and thus improve the stability and performance of the entire blockchain system. In particular, it provides stronger availability and stability in the alliance chain or private chain to avoid the greater impact of single node failure on the entire system. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1aIt is a schematic diagram of a data sharing system 100 provided in an embodiment of the present application.

[0023] Figure 1b This is a schematic diagram of a blockchain provided in an embodiment of the present application.

[0024] Figure 1c It is a schematic diagram of a blockchain generation process provided in an embodiment of the present application.

[0025] Figure 2 It is a schematic diagram of a blockchain network 200 provided in an embodiment of the present application.

[0026] Figure 3 It is a structural diagram of a blockchain network applied to electronic bills provided in an embodiment of the present application.

[0027] Figure 4 It is a schematic flow chart of a data processing method based on a blockchain network provided in an embodiment of the present application.

[0028] Figure 5 This is an example of a connection relationship of a target node cluster provided in an embodiment of the present application.

[0029] Figure 6 This is an example of a fault recovery process provided in an embodiment of the present application.

[0030] Figure 7 This is an example of a master-slave switching process provided in an embodiment of the present application.

[0031] Figure 8 It is a schematic block diagram of a data processing device based on a blockchain network provided in an embodiment of the present application.

[0032] Fig. 9 It is a schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments provided by this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0034] To facilitate understanding of the technical solution provided by this application, the relevant terms are explained below.

[0035] Dual-Active: Dual-Active refers to a mode in which the primary and backup nodes run and provide services simultaneously in computer, network and data storage systems. In the dual-active mode, the primary and backup nodes have real-time data synchronization and status synchronization capabilities. When the primary node fails, the backup node can automatically take over the workload of the primary node to ensure high availability of the service.

[0036] Master Node: The master node is the main operating node in the active-active blockchain node implementation method, responsible for the main network services, transaction processing and consensus functions. In the event of a master node failure, the backup node will automatically take over the work of the master node.

[0037] Backup Node: The backup node is an auxiliary running node in the active-active blockchain node implementation method, which maintains real-time data synchronization and status synchronization with the primary node. When the primary node fails, the backup node can smoothly take over the workload of the primary node to ensure high availability of the service.

[0038] World State refers to a data set that records all the status information on the current chain. This data set includes all user accounts, smart contracts, on-chain assets, transaction records, and other information of the entire blockchain system.

[0039] System Contract: A system contract is a special type of smart contract that is mainly used to handle system-level operations. In the active-active blockchain implementation method, the system contract is responsible for storing, updating, and querying the active and standby node information and load distribution information on the blockchain ledger.

[0040] It should be noted that the terms used in the implementation method section of the present application are only used to explain the embodiments of the present application and are not intended to limit the present application.

[0041] For example, the term "and / or" in this article is only a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The term "at least one" is only a way to describe the combination relationship of listed objects, indicating that one or more items may exist. For example, at least one of the following: A, B, C can mean the following combinations: A exists alone, B exists alone, C exists alone, A and B exist at the same time, A and C exist at the same time, B and C exist at the same time, and A, B, and C exist at the same time. The term "multiple" means two or more. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0042] For another example, the term "corresponding" may indicate that there is a direct or indirect correspondence between the two, or that there is an association relationship between the two, or that there is an indication and being indicated, configuration and being configured, etc. The term "indication" may be a direct indication, an indirect indication, or an indication of an association relationship. For example, A indicates B, which may indicate that A directly indicates B, such as B can be obtained through A; it may also indicate that A indirectly indicates B, such as A indicates C, B can be obtained through C; it may also indicate that there is an association relationship between A and B. The term "predefined" or "preconfigured" may refer to the pre-storage of corresponding codes, tables or other relevant information that can be used for indication in the device, or it may refer to an agreement by protocol. "Protocol" may refer to a standard protocol in this field. The term "when..." may be interpreted as "if" or "if" or "when..." or "in response to" and other similar descriptions. Similarly, depending on the context, the phrase "if determined" or "if (stated condition or event) is detected" may be interpreted as "when determined" or "in response to determining" or "when (stated condition or event) is detected" or "in response to detecting (stated condition or event)" and similar descriptions. The terms "first", "second", "third", "fourth", "Ath", "Bth", etc. are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. Among them, digital video compression technology mainly compresses huge digital image video data for easy transmission and storage.

[0043] The application scenarios, technical problems to be solved and inventive concepts of the embodiments of the present application are described below.

[0044] The solution provided in this application can be applied to the field of blockchain technology, especially to blockchain reliability optimization, and can be used as a professional solution for reliability optimization.

[0045] Figure 1a It is a schematic diagram of a data sharing system 100 provided in an embodiment of the present application.

[0046] The data sharing system 100 is a system for sharing data between nodes. Figure 1aAs shown, the data sharing system 100 may include multiple nodes 101, and the multiple nodes 101 may refer to various clients in the data sharing system 100. Each node 101 can receive input information when performing normal work, and maintain the shared data in the data sharing system 100 based on the received input information. In order to ensure the information intercommunication in the data sharing system 100, there may be an information connection between each node in the data sharing system 100, and the nodes may transmit information through the above information connection. For example, when any node in the data sharing system 100 receives input information, other nodes in the data sharing system 100 obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all nodes in the data sharing system 100 are consistent.

[0047] Each node in the data sharing system 100 has a node identifier corresponding thereto, and each node in the data sharing system 100 can store the node identifiers of other nodes in the data sharing system 100, so that the generated blocks can be broadcast to other nodes in the data sharing system 100 according to the node identifiers of other nodes. A node identifier list as shown in the following table can be maintained in each node, and the node name and the node identifier are stored in the node identifier list accordingly. The node identifier can be an Internet Protocol (IP) address for interconnection between networks and any other information used to identify the node.

[0048] Node Name Node ID Node 1 117.114.151.174 Node 2 117.116.189.145 … … Node N 119.123.789.258

[0049] As shown in Table 1, different points are identified by different IP addresses.

[0050] Each node in the data sharing system 100 stores an identical blockchain.

[0051] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains information about network transactions in batches, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block.

[0052] Figure 1b This is a schematic diagram of a blockchain provided in an embodiment of the present application.

[0053] like Figure 1bAs shown, the blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The header stores input information feature values, version numbers, timestamps, and difficulty values, and the block body stores input information. The next block of the genesis block uses the genesis block as its parent block. The next block also includes a block header and a block body. The block header stores input information feature values ​​of the current block, feature values ​​of the block header of the parent block, version numbers, timestamps, and difficulty values, and so on. This ensures that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, thereby ensuring the security of the input information in the block.

[0054] Figure 1c It is a schematic diagram of a blockchain generation process provided in an embodiment of the present application.

[0055] like Figure 1c As shown in the figure, when generating each block in the blockchain, the node where the blockchain is located receives the input information and verifies the input information. After the verification is completed, the input information is stored in the memory pool and the hash tree used to record the input information is updated; then, the update timestamp is updated to the time when the input information is received, and different random numbers are tried, and the eigenvalue calculation is performed multiple times so that the calculated eigenvalue can satisfy the following formula:

[0056] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) <TARGET;

[0057] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which can be a fixed value within a period of time and will be determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.

[0058] In this way, when a random number that satisfies the above formula is calculated, the information can be stored accordingly, the block header and block body can be generated, and the current block can be obtained.

[0059] Subsequently, the node where the blockchain is located sends the newly generated blocks to other nodes in the data sharing system according to the node identifiers of other nodes in the data sharing system. Other nodes verify the newly generated blocks and add them to the blockchain they store after the verification is completed.

[0060] Blockchain can include the blockchain underlying platform, platform product service layer and application service layer.

[0061] Among them, the underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operational prosecution.

[0062] The user management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the corresponding relationship between the user's real identity and the blockchain address (authority management), etc., and under authorization, it detects and audits the transaction of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests and record them on the storage after completing the "consensus" for valid requests. For a new business request, the basic service first processes the interface adaptation parsing and permission verification (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management), and transmits it to the shared ledger completely and consistently after encryption (network communication), and records and stores it. The smart contract module is responsible for the registration and issuance of contracts, contract triggering and contract execution. Developers can define the contract logic in a certain programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, call the key or other events to trigger the execution and complete the contract logic. At the same time, it also provides the function of contract upgrade and cancellation. Among them, smart contracts can refer to computerized protocols that can execute the terms of a contract and are deployed on a shared ledger. Smart contracts are used to implement codes that are executed when certain conditions are met. According to actual business needs, the codes are used to complete automated transactions. The role of the operation and control module in the underlying blockchain platform is mainly to conduct real-time detection and control, audit and risk control of the platform's operating status, business transactions and contract execution.

[0063] The platform product service layer provides the basic capabilities and implementation framework for typical applications. Developers can build on these basic capabilities and overlay business features to complete the blockchain implementation of business logic.

[0064] The application service layer provides application services based on blockchain solutions for business participants to use.

[0065] Figure 2 It is a schematic diagram of a blockchain network 200 provided in an embodiment of the present application.

[0066] like Figure 2 As shown, the blockchain network 200 may include a business network 210, a core consensus network 220, and a routing proxy network 230 where the proxy node 230D is located.

[0067] Among them, the node system corresponding to the business network 210 (i.e., the witness network) may include one or more blockchain nodes, and the number of nodes in the node system corresponding to the business network 210 is not limited here. For example, the node system corresponding to the business network may specifically include node 210a, node 210b, node 210c, node 210d, node 210e, node 210f, node 210g, ..., node 210n. It should be understood that the embodiment of the present application may refer to the blockchain node in the business network 210 as a business node, which does not need to participate in the bookkeeping consensus and is mainly used to execute transaction business to obtain transaction data associated with the transaction business. Among them, the business node here can be a full node containing a complete blockchain database, or a lightweight node that stores part of the data in the blockchain database, which will not be limited here. In order to reduce the waste of storage space of business nodes, the business node in the embodiment of the present application can take a lightweight node (Simplified Payment Verification, SPV) as an example. The business node does not need to store complete transaction data, but obtains block header data and partially authorized visible block data (for example, transactions associated with the business node itself) through the proxy node 230D.

[0068] The node system corresponding to the core consensus network 220 may also include one or more blockchain nodes, and the number of nodes in the node system corresponding to the core consensus network 220 will not be limited here. For example, the node system corresponding to the core consensus network 220 may specifically include node 220a, node 220b, node 220c, node 220d, node 220e, node 220f, node 220g, ..., node 220m. It should be understood that the embodiment of the present application may refer to the nodes in the core consensus network 220 as consensus nodes (i.e., accounting nodes), and the consensus nodes may run a blockchain consensus protocol.

[0069] The number of nodes of the proxy node in the routing proxy network 230 can be one or more, which is not limited here. In the embodiment of the present application, the proxy node 230D is taken as an example. The proxy node 230D can be used to isolate the business network 201 and the core consensus network 220. The proxy node 230D can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic "cloud" computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, which are not limited here. The proxy node 230D can perform network stratification on the peer-to-peer network to form a hierarchical structure such as "business network-core consensus network", thereby improving the confidentiality and security of data on the blockchain.

[0070] It should be understood that in the embodiment of the present application, the proxy node, the service node and the consensus node can be collectively referred to as the blockchain node in the blockchain network 200. Among them, the blockchain node can be a server connected to the blockchain network 200, or a user terminal connected to the blockchain network 200. The specific form of the blockchain node is not limited here.

[0071] It is worth noting that Figure 2 The business network 210 and the core consensus network 220 shown can be in different network environments. For example, generally speaking, the business network 210 can be a public network, and the core consensus network 220 can be a private network, and the two can interact through the routing boundary. The business nodes in the business network 210 can be connected to the core consensus network 220 after meeting certain requirements, but because the core consensus network 220 is in a relatively secure private cloud, its mutual access has a consensus mechanism to ensure security, and the security is relatively high. The business nodes are in the public network and may be accessed by other uncertain network terminals. Therefore, the behavior of the business nodes and other possible nodes accessing the consensus network needs to be strictly controlled.

[0072] Figure 3 It is a structural diagram of a blockchain network applied to electronic bills provided in an embodiment of the present application.

[0073] like Figure 3 As shown, when Figure 2When the blockchain network in the example is applied to the scenario of electronic bills, the blockchain network can record the transaction data generated during the entire circulation process of the electronic bills. The blockchain network includes a business network 31a, a routing layer 32b, and a consensus network 33c. The circulation process of electronic bills can specifically include the application of electronic bills, the issuance of electronic bills, the reimbursement of electronic bills, and the tax declaration of electronic bills. The issuance of electronic bills is also called the generation of electronic bills.

[0074] Since the roles involved in the circulation process of the entire electronic invoice include management agencies, invoicing parties, reimbursement parties and tax payers, the business network 31a includes a management agency private network 311a that provides relevant services for the management agency, a public cloud 312a that provides relevant services for invoicing parties, reimbursement parties and tax payers, and a private cloud 313a that provides electronic invoice storage services for consumers. Among them, the management agency private network 311a includes computer equipment used by the management agency involved in the electronic invoice, including a management agency terminal 3111a, and the management terminal can access the management agency private network 311a. The public cloud 312a includes computer equipment used by the invoicing party, reimbursement fee and tax payer involved in the electronic invoice, including an invoicing party terminal 3121a, a reimbursement party terminal 3122a and a tax payer terminal 3123a, wherein the invoicing party can be an invoicing service provider, the reimbursement party can be a reimbursement service provider, and the enterprise terminal can access the public cloud 312a. The private cloud 313a includes computer devices used by users involved in electronic bills, including payment terminals 3131a for making payments, electronic bill circulation terminals 3132a for temporarily saving electronic bills for users, and some enterprise-specific terminals 3133a. Consumer terminals can access the private cloud 313a. The computer devices in the management agency's private network 311a, the public cloud 312a, and the private cloud 313a can all serve as business nodes to send data on-chain requests or data query requests for electronic bills to the consensus network 33c through the routing layer 32b.

[0075] Any routing node in the routing layer 32b includes functional modules that provide authentication services 321b, certificate cache 322b, routing services 323b, and peer-to-peer services 324b. The authentication service 321b is used to authenticate the business nodes in the business network 31a, the certificate cache 322b is used to cache the identity certificates of each node, the routing service 323b is used to achieve network isolation between the business network 31a and the consensus network 33c, and the peer-to-peer service 324b is used to allocate tasks between routing nodes, and the routing nodes form a peer-to-peer network. The peer-to-peer protocol is an application layer protocol running on the Transmission Control Protocol (TCP).

[0076] Among them, the consensus network 33c includes multiple consensus branch networks, such as consensus branch network 331c, consensus branch network 332c and consensus branch network 333c, etc. Each consensus branch network includes multiple consensus nodes (i.e., consensus node devices), and multiple consensus nodes in each consensus branch network maintain the blockchain corresponding to the consensus branch network, such as the multiple consensus nodes included in the consensus branch network 331c are used to maintain the blockchain corresponding to the consensus branch network 331c. Among them, the functions of different blockchains in the consensus network 33c are different. For example, some blockchains are used to record transaction information related to electronic bills belonging to a certain ticket number range, and some blockchains are used to record transaction information related to red electronic bills. When it is necessary to record data related to electronic bills, the blockchain to be recorded can be determined according to the authority of the business node, and then recorded by the consensus branch network that maintains the blockchain. Consensus nodes can usually be computer devices used by administrative agencies in various regions.

[0077] The consensus nodes in each consensus branch network include permission contracts, which store the circulation logic of the entire life cycle of electronic bills, such as the bill status, circulation process, data access rights, electronic bill application conditions, electronic bill issuance conditions, etc. In addition, the consensus nodes also include cache and data blocks, which can provide support for the chaining and query of transaction information.

[0078] It should be noted that all node devices in the blockchain network can be mobile phones, tablets, laptops, PDAs, mobile Internet devices (MID), vehicles, roadside equipment, aircraft, wearable devices, such as smart watches, smart bracelets, pedometers and other smart devices with data processing functions. The device type corresponding to each node device can be the same or different.

[0079] However, although the blockchain system uses multiple nodes to achieve data backup, there is still a single point of failure and downtime risk for a single node.

[0080] In particular, for consortium chains or private chains, the number of nodes is relatively small, and the impact of single point failures is more obvious. The main difference between consortium chains and private chains lies in the degree of openness and decentralization. Each node of a consortium chain usually has a corresponding entity organization, and can only join and exit the network after authorization. This enables the consortium chain to have higher transaction efficiency, privacy protection and control capabilities in specific scenarios. It is not completely decentralized, but partially decentralized, that is, it is only open to members within the consortium, so it is more open than a private chain. Relatively speaking, the write permission of a private chain is under internal control, and the read permission can be selectively opened to the outside world as needed. A private chain belongs to a certain organization or institution, and emphasizes security and privacy protection. Transaction data will not be open to the entire network, so its degree of decentralization is higher than that of a consortium chain.

[0081] In addition, data synchronization between existing blockchain nodes depends on block broadcasting and consensus processes. Node downtime or failure may cause the latest block confirmation to be slightly slower or even fail.

[0082] In view of this, the present application provides a data processing method, device and storage medium based on a blockchain network, which not only improves the availability and fault tolerance of a single blockchain node, but also reduces the block confirmation delay, thereby improving the stability and performance of the entire blockchain system. In particular, it provides stronger availability and stability in a consortium chain or a private chain, avoiding a single node failure from having a significant impact on the entire system.

[0083] Figure 4 A schematic flow chart of a data processing method 400 based on a blockchain network according to an embodiment of the present application is shown, the blockchain network includes multiple node clusters, the multiple node clusters include a target node cluster, the target node cluster includes a target master node and a target standby node, the method is executed by the target standby node, and the target standby node can be any electronic device with data processing capabilities. For example, the electronic device can be implemented as a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or an artificial intelligence platform or cloud server provided with cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data services. For another example, the electronic device can be implemented as a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile Internet device (MID, mobile internet device), a vehicle, a roadside device, an aircraft, a wearable device, such as a smart watch, a smart bracelet, a pedometer, and other smart devices with data processing functions. This application is not limited here. For ease of explanation, the data processing method 400 is described below taking the target standby node as an example.

[0084] Of course, in other alternative embodiments, the method 400 may also be executed by a data processing device, which may be a device integrated into the target standby node or a device independent of the target standby node. Specific limitations.

[0085] like Figure 4 As shown, the method 400 may include:

[0086] S410, the target standby node detects whether a failure occurs in the target master node.

[0087] Exemplarily, the target standby node can detect the status of the target master node in real time, including network connection, system status, application status, etc. Once the target standby node finds that the target master node has lost response or has an abnormal status, such as network disconnection, system crash, application crash, etc., it can be considered that the target master node may have failed. Furthermore, in order to ensure the accuracy of fault identification, the target standby node can also take some measures to confirm the fault. For example, for a fault in which the network connection is disconnected, the target standby node can confirm the fault by trying to reconnect to the target master node or waiting for a period of time to see whether the response is restored. If these measures are ineffective, it can be determined that the target master node has indeed failed.

[0088] For example, the target standby node can use methods such as heartbeat mechanism, resource detection, resource control, network connection detection and log analysis to regularly detect the status of the target master node, including network connection, system status, application status, etc.

[0089] Among them, heartbeat detection means: within a preset time interval, the target standby node sends a heartbeat request to the target master node to detect the survival status of the target master node. If no response is received from the target master node within the specified time, it is considered that the target master node may have failed. Resource detection means: regularly collecting and analyzing the resource usage of the target master node, including CPU usage, memory usage, disk space, etc. If abnormal resource usage is found, it is necessary to further check the node operation status. Network connection detection means: detecting the network connectivity and delay between the target master node and the target standby node to determine whether the target master node has failed. Log analysis means: determining whether the target master node has failed by analyzing the log for abnormal data. When performing log analysis, the analysis granularity can be in days or weeks, etc.

[0090] Of course, the target standby node may also detect the status of the target master node by periodically sending a status check request to the target master node, and this application does not make any specific limitation on this.

[0091] S420, when the target standby node detects that the target master node has failed, the target standby node calls the system contract of the blockchain network to generate first transaction information; the first transaction information is used to indicate that the master node of the target node cluster is switched from the target master node to the target standby node.

[0092] In other words, when the target standby node detects that the target master node has failed, it will trigger the system contract of the blockchain network and generate the first transaction information. In simple terms, when the target master node has a problem, the first transaction information can enable the target standby node to automatically take over the function of the target master node and become the new master node.

[0093] For example, a system contract is a special type of smart contract that is mainly used to handle system-level operations.

[0094] For example, when the target standby node detects that the target master node fails, it triggers the call of the blockchain network's system contract to generate the first transaction information. This system contract can be understood as a preset set of rules for handling events such as node failures and cluster switching. After the system contract is called, the first transaction information is generated. This first transaction information is used to indicate that the master node of the target node cluster is switched from the target master node to the target standby node. Specifically, the transaction information may include the identity information, authorization information, and other relevant parameters of the new master node.

[0095] Exemplarily, when the target standby node detects that the target master node has failed, it calls the system contract of the blockchain network to generate the first transaction information, and re-establishes the connection relationship between the target standby node and the node that has a connection relationship with the target master node to ensure the normal operation of the entire blockchain network. In other words, when the target master node fails, the target standby node can automatically switch the master node of the target node cluster from the target master node to the target standby node by calling the first transaction information generated by the system contract, or automatically switch the workload of the target master node to the target standby node, thereby ensuring the high availability and data consistency of the entire blockchain system, which helps to improve the availability and fault tolerance of the entire blockchain system when nodes fail or fail, thereby building a more stable and reliable blockchain system.

[0096] S430: The target standby node verifies the first transaction information, and if the first transaction information passes the verification, broadcasts the first transaction information to other node clusters in the multiple node clusters except the target node cluster.

[0097] Exemplarily, after receiving the first transaction information, the target standby node verifies the information. The verification process may include checking the format, signature, timeliness, etc. of the information to ensure the legitimacy and validity of the information. If the verification fails, the target standby node may reject the transaction information or mark it as invalid. If the first transaction information passes the verification, the target standby node broadcasts it to other node clusters in the multiple node clusters except the target node cluster. This can be achieved by sending a broadcast request to other nodes or using a specific network protocol.

[0098] Exemplarily, the target standby node verifies the first transaction information, and if the first transaction information passes the verification, adds the first transaction information to the transaction pool of the target standby node and broadcasts the first transaction information to other node clusters in the multiple node clusters except the target node cluster.

[0099] S440, the target standby node obtains the consensus result of the first proposal block corresponding to the first transaction information, and when the consensus result of the first proposal block indicates approval to switch the master node of the target node cluster from the target master node to the target standby node, the master node in the target node cluster is switched from the target master node to the target standby node, and the first proposal block is added to the blockchain of the target standby node.

[0100] Exemplarily, after the target standby node broadcasts the first transaction information to other node clusters other than the target node cluster in the multiple node clusters, after the other node clusters receive the broadcasted first transaction information, the master node in the other node cluster will verify it. The verification process is similar to the verification process of the target standby node on the first transaction information to ensure that the received transaction information is legal and valid. Once the other node clusters verify the first transaction information, the first transaction information can be added to the transaction pool of the master node in the other node cluster.

[0101] For example, when a proposal node cluster is elected in the blockchain network, the proposal node cluster will execute the transaction information in its own transaction pool.

[0102] For example, assuming that the transaction information in the transaction pool executed by the proposal node cluster includes the first transaction information, the proposal node can verify the first transaction information to ensure the legitimacy and validity of the information, which may include checking the format, signature, timeliness, etc. of the information, as well as confirming the source and purpose of the transaction. If the first transaction information passes the verification, the proposal node cluster will package the first transaction information into the first proposal block. Once the block is packaged, the proposal node cluster will broadcast it to the entire blockchain network, which can be achieved by sending a broadcast request to other nodes or using a specific network protocol. After receiving the broadcasted first proposal block, the node clusters other than the proposal node cluster in the blockchain network will verify it. If the verification passes, a voting result of approval will be generated. If the verification fails, a voting result of disapproval will be generated and the generated voting result will be broadcast. For example, after receiving the first proposal block broadcasted, node cluster 1 other than the proposal node cluster in the blockchain network will verify it. Specifically, node cluster 1 can package the first transaction information into proposal block 1, and determine the voting result of node cluster 1 on the first proposal block by comparing the first proposal block with the proposal block 1; for example, if the first proposal block and the proposal block 1 are the same, a voting result of approval will be generated, and if they are not the same, a voting result of disapproval will be generated. As a result, each node cluster in the blockchain network can receive the voting results of other node clusters on the first transaction information. Once the block is confirmed by most node clusters and consensus is reached, each node cluster will confirm the legitimacy of the first transaction information and perform related operations, which may include updating the node status, releasing locked assets, updating account balances, etc., that is, adding the first proposal block to their respective blockchains.

[0103] It should be understood that the embodiments of the present application do not specifically limit the proposal node cluster.

[0104] For example, when the proposal node cluster is the target node cluster, the target node cluster can verify the first transaction information to ensure the legitimacy and validity of the information, which may include checking the format, signature, timeliness, etc. of the information, as well as confirming the source and purpose of the transaction. If the first transaction information passes the verification, the target node cluster will package the first transaction information into a first proposal block, broadcast it to other node clusters, and generate a voting result in favor. Then, the target node cluster receives the voting results sent by other node clusters, and obtains the consensus result of the first proposal block based on the voting results generated by itself and the voting results sent by other node clusters. For example, once the block is approved by most node clusters, the consensus result of the first proposal block indicates approval to switch the master node of the target node cluster from the target master node to the target standby node, otherwise, the consensus result of the first proposal block indicates opposition to switching the master node of the target node cluster from the target master node to the target standby node.

[0105] For another example, the proposal node cluster can be a node cluster other than the target node cluster in the blockchain network. In this case, the target node cluster obtains the first proposal block from the proposal node cluster, verifies the first proposal block to generate the voting result of the target node cluster on the first proposal block, and broadcasts the voting result of the first proposal block to other node clusters. In addition, the target node cluster also needs to receive the voting results sent by other node clusters, and obtain the consensus result of the first proposal block based on the voting results generated by itself and the voting results sent by other node clusters. For example, once the block is approved by most of the node clusters, the consensus result of the first proposal block indicates approval to switch the master node of the target node cluster from the target master node to the target standby node, otherwise, the consensus result of the first proposal block indicates opposition to switching the master node of the target node cluster from the target master node to the target standby node.

[0106] It should be understood that the switching of the master node of the target node cluster is essentially a transaction initiated by the target standby node, and its transaction information (i.e., the first transaction information) includes the entry parameters. After the transaction information is generated, it is broadcast to other node clusters so that other node clusters can add it to the transaction pool, and after the proposal node cluster is selected, the proposal node cluster executes the transaction in the transaction pool. For the failed node (i.e., the target master node), after its performance is restored, it obtains the latest blockchain in a synchronous manner, and the entry parameters related to the system contract in its blockchain can be carried in the first proposal block corresponding to the first transaction information. Specifically, the first proposal block can include the information of the target master node and the information of the target standby node.

[0107] It is worth noting that regardless of whether the proposal node cluster is the target node cluster, when the target master node in the target node cluster fails, the target standby node generates the first transaction information by calling the system contract. For any node cluster in the blockchain network, when the consensus result of the first proposal block corresponding to the first transaction information indicates that the master node of the target node cluster is in favor of switching from the target master node to the target standby node, the any node cluster adds the first proposal block to its own blockchain. This is equivalent to ensuring that, in the event of a failure of the target master node, other node clusters other than the target node cluster in the blockchain network automatically switch the master node of the target node cluster to the target standby node, ensuring the high availability of the entire system. Specifically, when the target master node fails, since other node clusters will add the first proposal block to their own blockchain, it means that other node clusters have known that the master node of the target node cluster has switched, and other node clusters can quickly locate the target standby node in the target node cluster by querying the first proposal block, and automatically switch the relevant work to the target standby node. It can be seen that by calling the system contract of the blockchain network to generate the first transaction information, and when the consensus result of the first proposal block corresponding to the first transaction information indicates that it is in favor of switching the master node of the target node cluster from the target master node to the target standby node, the first proposal block corresponding to the first transaction information is added to the blockchain of the target standby node, which not only improves the efficiency of node fault switching, but also ensures the high availability of the system.

[0108] In the embodiment of the present application, by introducing the node mechanism of the target master node and the target standby node to construct the node cluster in the blockchain network, the original multi-node mutual backup mechanism is further upgraded to the node cluster level, so that when the target standby node detects that the target master node fails, it can directly call the system contract of the blockchain network to generate the first transaction information, and when the consensus result of the first proposal block corresponding to the first transaction information indicates that the master node of the target node cluster is switched from the target master node to the target standby node, the master node in the target node cluster is switched from the target master node to the target standby node, and the first proposal block corresponding to the first transaction information is added to the blockchain of the target standby node, thereby, not only can the master node of the target node cluster be switched from the target master node to the target standby node, but also all the node clusters in the blockchain network can reach a consensus, reduce the risk brought by the failure of the target master node, improve the availability and fault tolerance of the single node of the blockchain, reduce the block confirmation delay, and thus improve the stability and performance of the entire blockchain system. In particular, it provides stronger availability and stability in the alliance chain or private chain to avoid the greater impact of single node failure on the entire system.

[0109] Figure 5 This is an example of a connection relationship of a target node cluster provided in an embodiment of the present application.

[0110] like Figure 5 As shown, the target node cluster includes three nodes (consensus node 1, consensus node 2 and consensus node 3). Consensus node 1 is the master node (Master), responsible for processing the request of client 1, and is responsible for synchronization and communication with other backup nodes (consensus node 2 and consensus node 3) and other node clusters (Other Node). Consensus node 2 and consensus node 3 are respectively used as backup nodes (Backup), and consensus node 2 is responsible for processing the request of client 2. Consensus node 2 and consensus node 3 can synchronize data and status with the master node through information synchronization. The synchronized data and status include but are not limited to block data, transaction information, consensus status, etc.

[0111] When consensus node 1 (i.e., the master node) fails, a failover operation can be automatically triggered, that is, client 1's request is switched to an available standby node (such as consensus node 2). At this time, the workload and responsibilities of consensus node 1 (i.e., the master node) will be assumed by the available standby node (such as consensus node 2), thereby ensuring the continuous availability of blockchain services.

[0112] It should be understood that for the target node cluster, a master node and a standby node can be provided for the target node cluster, and the two nodes run in a master and standby relationship. This architecture can be called a dual-active node architecture, or in other words, a node cluster provided with a master node and a slave node can be called a dual-active node. This dual-active node architecture can improve the availability of the node while retaining the distributed and decentralized characteristics of the blockchain system itself. A master node, a standby node and related network connection information can be configured for a dual-active node. That is, by configuring dual-active nodes, the master and standby nodes ensure system availability and data consistency, and reduce the risk of single point failures. Of course, in other alternative embodiments, the target node cluster may include multiple standby nodes, and the target standby node may be any one of the multiple standby nodes.

[0113] The following is an exemplary description of a solution for data synchronization and status synchronization between the primary and standby nodes.

[0114] Data and status synchronization can be performed between the master and backup nodes through real-time synchronization and periodic synchronization. The synchronized data and status include but are not limited to block data, transaction information, consensus status, etc. Real-time synchronization means: when the master node generates a new block or processes a transaction, the relevant information will be synchronized to the backup node immediately. Scheduled synchronization means: through full or incremental synchronization strategies, the master node and the backup node synchronize data regularly to further ensure data consistency.

[0115] Transaction information records information related to the transaction, including the sender, receiver, transaction amount, transaction time, etc. Transaction information is important data in the blockchain network, which can be used to record and confirm the transaction history in the network.

[0116] Block data is used to generate blocks. Blocks are the basic units in the blockchain network. Each block contains a certain amount of transaction information and information associated with the previous and next blocks. This information together constitutes the data structure on the blockchain. Each block is mainly composed of a block header and a transaction list. The block header contains information such as the version number, the hash value of the previous block, the timestamp, the difficulty value, the random number, etc., while the transaction list contains all confirmed transaction information in the block. The block in the blockchain is a data structure composed of a series of block data. Each block contains a certain amount of transaction information, and is associated by recording the hash value of the previous block to form the data structure of the blockchain. In other words, block data is the basic component of the blockchain, and the block in the blockchain is a data structure composed of a series of block data.

[0117] The consensus state of a node is the consensus reached by the node on the state of the entire blockchain network. The state of the entire blockchain network is a state that is commonly recognized by all nodes (such as the master node in all node clusters) after reaching a consensus, and is an important guarantee for the normal operation and data security of the blockchain network. For example, the consensus state can refer to the state information of the node during the consensus process, such as the consensus height, consensus round, step, validator set, received voting information, and consensus step execution event stamp that have been reached in the current system.

[0118] Through real-time synchronization and scheduled synchronization, the data between the master node and the backup node can be ensured to be completely consistent, reducing the risk of data loss. In addition, through real-time synchronization and scheduled synchronization, the data synchronization delay between nodes can be reduced, so that the faulty node can be restored to the latest state more quickly, thereby reducing the block confirmation time of the entire system. Moreover, through real-time synchronization and scheduled synchronization, when the master node fails or fails, the backup node can immediately continue to process new transactions and consensus processes to maintain the continuity and consistency of blockchain data.

[0119] For real-time synchronization, when the master node generates a new block or processes a transaction, the relevant information is synchronized to the backup node in real time. Specifically, it includes but is not limited to the following:

[0120] Block information synchronization: When the master node generates a new block, the block's hash, timestamp, transaction information, previous block hash and other information are transmitted to the standby node in real time and the standby node's blockchain data is updated.

[0121] Transaction information synchronization: When the master node receives and broadcasts a new transaction, the signature, input, output and other information of the transaction are transmitted to the backup node in real time.

[0122] Consensus status synchronization: When the master node completes the execution of the consensus algorithm or changes its status, it transmits the current consensus status, consensus round and other information to the standby node in real time to keep the consensus status between the master and standby nodes consistent.

[0123] For scheduled synchronization, you can use full or incremental synchronization strategies to periodically synchronize data between the primary node and the backup node. This includes but is not limited to the following:

[0124] Full data synchronization: At a preset time interval or when triggered by the system, the backup node obtains a copy of the entire blockchain data from the primary node to ensure that the primary and backup nodes are completely consistent. Full synchronization is usually performed when the system starts, the node is restarted, or the data of the primary and backup nodes are inconsistent.

[0125] Incremental data synchronization: At preset intervals, the standby node obtains the incremental part of the blockchain data from the master node (usually new blocks and transaction information generated since the last synchronization) and updates the blockchain data of the standby node. Incremental synchronization is more efficient than full synchronization, reducing bandwidth and storage resource consumption during the synchronization process.

[0126] During the information synchronization process, the synchronized data needs to be verified to ensure that the data is transmitted and received accurately. Data verification includes the following aspects:

[0127] Hash verification: By calculating the hash value of the received block and transaction data and comparing it with the transmitted hash value, the integrity and correctness of the data can be verified.

[0128] Signature verification: Verify the digital signature of the transaction to ensure the legitimacy and validity of the transaction.

[0129] The transaction information is sent by the client, and the block is sent by other nodes. The node can verify the transaction information, generate a block and add it to its own blockchain after verification, or verify the blocks sent by other nodes and add them to its own blockchain after verification. For transaction information, the node verifies its legitimacy and validity. For example, the node verifies whether the transaction meets certain conditions, such as whether the account balance is sufficient, whether the transaction is double-spent, etc. If the transaction information is verified, the node will add the transaction information to its own transaction pool. For blocks, the node verifies its legitimacy and validity. For example, the node verifies whether the new block meets the preset rules and standards, such as size limits, whether the hash value meets the requirements, etc. If the new block is verified, the node will add the new block to its own copy of the blockchain. It should be noted that the node's verification process for transaction information and blocks is asynchronous. That is, the node will process the verification of multiple transaction information and blocks at the same time, rather than one by one in sequence. This can improve the processing efficiency of the node and ensure that the verification speed of transactions and blocks can keep up with the needs of the network.

[0130] Consensus status verification: Check whether the block data, transaction information, and consensus status between the primary and backup nodes are consistent. If there is any inconsistency, the synchronization mechanism is triggered for repair.

[0131] Through real-time synchronization, scheduled synchronization and data verification, the consistency of blockchain data, transaction information and consensus status is achieved between the master node and the backup node. This helps to improve the availability, fault tolerance and data consistency of the entire blockchain system when a single node (such as the master node) fails or fails.

[0132] In some embodiments, S440 may include:

[0133] Synchronize the blockchain of the target master node; wherein the blockchain of the target master node includes a first block, the first block is a block obtained by the execution result of the first configuration transaction information, the first configuration transaction information is generated by calling the system contract and is used to indicate the node configuration information for configuring the target node cluster, the node configuration information includes at least one of the following: information for indicating the master node in the target node cluster, information for indicating the standby node in the target node cluster, information for indicating the master node in the target node cluster, information for indicating the standby node in the target node cluster, information of the node associated with the master node in the target node cluster, and information of the node associated with the standby node in the target node cluster; based on the information of the node associated with the master node in the target node cluster, establish a connection relationship between the target standby node and the node associated with the master node in the target node cluster.

[0134] In other words, the target standby node can synchronize the blockchain of the target master node, which includes a first block, and this first block is obtained by executing the first configuration transaction information. This first configuration transaction information is generated by calling the system contract and is used to indicate the node configuration information of the target node cluster, and these node configuration information include at least one of the following: information indicating the master node in the target node cluster, information indicating the standby node in the target node cluster, information about the node associated with the master node in the target node cluster, and information about the node associated with the standby node in the target node cluster. In other words, the first configuration transaction information is to configure the nodes of the target node cluster, including the master node and the standby node, and the connection relationship between these nodes in multiple node clusters. By executing this first configuration transaction information, a first block can be obtained, which is included in the blockchain of the target master node, and then the target standby node needs to synchronize this blockchain. Further, after the target standby node needs to synchronize this blockchain, it is also necessary to establish a connection relationship based on and with the relevant nodes in the target node cluster, so as to switch the master node of the target node cluster from the target master node to the target standby node.

[0135] Exemplarily, the system contract may have the function of storing, updating and querying the information of the master node and the standby node. That is, through the introduced system contract, the information of the master node and the standby node of each node cluster can be saved in the blockchain of each node cluster. This information may include necessary information such as the node identifier, network address, and public key. Secondly, when the master node fails, the system contract can be modified so that other nodes can quickly locate the corresponding standby node through the modified system contract, and automatically switch the relevant work to the standby node, thereby not only improving the efficiency of node failure switching, but also ensuring the high availability of the system. For example, when the target node cluster joins the blockchain network, the information of the master node (that is, the target master node) and the standby node (including the target standby node) of the target node cluster is written into the system contract (that is, the first block is added to the blockchain of each node cluster). When the target node fails, the system contract can be modified (that is, the first proposal block mentioned above is added to the blockchain of each node cluster) so that other nodes can quickly locate the corresponding standby node through the modified system contract, and automatically switch the relevant work to the standby node.

[0136] For example, this system contract can be used to:

[0137] Store the information of the master and backup nodes: record the necessary information such as the identifier, network address, and public key of the master and backup nodes.

[0138] Storage load distribution information: records the load distribution ratio between the primary and backup nodes, such as querying load distribution.

[0139] Update node information and load distribution information.

[0140] Query node information and load distribution information.

[0141] When the target master node and the target standby node join the system as dual-active nodes or need to update information, the system contract can be used to store their information on the blockchain of the target master node. The stored information can include the node's identifier, network address, public key, etc. The update of node information can be achieved by calling the update method in the system contract. This may be crucial for the master-standby node switching process. For example, when receiving a fault notification sent by other node clusters, the target master node can query the system contract to obtain the information of the relevant standby nodes of other node clusters.

[0142] In this embodiment, by synchronizing the blockchain of the target master node and introducing the first block into the blockchain of the target master node, since the first block is obtained by executing the first configuration transaction information, and the first configuration transaction information is generated by calling the system contract and is used to indicate the node configuration information of the target node cluster, the nodes in the blockchain network can be better managed, and the scalability and fault tolerance of the blockchain network can be improved, which helps to increase the maintainability and scalability of the blockchain, so that it can support the addition and management of more nodes. In addition, after the target master node fails or the network is interrupted, even if the master node of the target node cluster is switched from the target master node to the target standby node, other node clusters can quickly identify the new master node of the target node cluster by querying the blockchain, so that the target standby node can quickly take over and continue to maintain the security and availability of the blockchain. In addition, by synchronizing the blockchain of the target master node, a connection relationship can be established between the target standby node and the node associated with the master node in the target node cluster based on the information of the node associated with the master node in the target node cluster configured in the first block, and then the master node of the target node cluster can be switched from the target master node to the target standby node, thereby ensuring that the availability of the target node cluster is not affected after the master node is switched.

[0143] In some embodiments, the blockchain of the target master node includes a second block, the second block is a block obtained by executing the second configuration transaction information, the second configuration transaction information is generated by calling the system contract and is used to indicate the load distribution information for configuring the target node cluster, and the load distribution information includes at least one of the following:

[0144] The performance indicators of the target master node, the performance indicators of the target standby node, and the load distribution strategy adopted by the target node cluster.

[0145] In other words, the target standby node can synchronize the blockchain of the target master node, which includes a second block, and this second block is obtained by executing the second configuration transaction information. This second configuration transaction information is generated by calling the system contract and is used to indicate the load distribution information for configuring the target node cluster. These load distribution information include at least one of: the performance indicators of the target master node, the performance indicators of the target standby node, and the load distribution strategy adopted by the target node cluster. In other words, the second configuration transaction information is to configure the load distribution of the target node cluster, including the performance indicators and load distribution strategy of each node. By executing this second configuration transaction information, a second block can be obtained. This second block is included in the blockchain of the target master node, and then the target standby node needs to synchronize this blockchain. This process helps to ensure the rationality and fairness of the load distribution of the target node cluster and maintain the efficiency and stability of the entire blockchain network.

[0146] Exemplarily, the system contract is a special smart contract that is mainly used to process system-level operations. The system contract may have a load distribution ratio for storing, updating, and querying master and slave nodes. For example, 80% of the load can be set to be distributed to the master node, and 20% of the load can be distributed to the standby node. Secondly, when the master node of the node cluster finds that the load between the nodes (such as the master node and the standby node) is unbalanced, dynamic adjustment can be achieved by modifying the load distribution ratio in the system contract. For example, if the master node bears a large amount of query load, and the standby node is idle, the query load distribution ratio of the standby node can be appropriately increased to balance the resource utilization of the entire system. For example, when the target node cluster joins the blockchain network, the load distribution ratio of the master node (that is, the target master node) and the standby node (including the target standby node) of the target node cluster is written into the system contract (that is, the second block is added to the blockchain of each node cluster). In addition, when the target master node finds that the load between the nodes (such as the master node and the standby node) is unbalanced, dynamic adjustment can be achieved by modifying the load distribution ratio in the system contract (that is, the block corresponding to the transaction used to modify the load distribution ratio in the system contract is added to the blockchain of each node cluster). Using system contracts in the blockchain ledger to save load distribution information between master and slave nodes, such as querying the load distribution ratio, makes the entire system more flexible and controllable in load distribution. In addition, this method can dynamically adjust the load distribution ratio between master and slave nodes according to actual needs, thereby optimizing system performance.

[0147] For example, by introducing this system contract, the load distribution information between the primary and backup nodes can be stored on the blockchain of each node cluster. This information can include the weight ratio of the load distribution, etc. If the load distribution strategy needs to be adjusted, the stored load distribution information can be modified by calling the update method in the system contract. After the system contract is introduced, other nodes or clients can also query the node load distribution information in the target node cluster through the system contract, which helps to optimize the load distribution and resource utilization of the entire system.

[0148] Exemplarily, the performance indicators of the target master node generally include but are not limited to the computing power, storage capacity, network bandwidth, response time, etc. of the node. These performance indicators measure the processing and response capabilities of the master node, and whether it can meet the system requirements. By evaluating these indicators, it can be understood whether the target master node has sufficient performance to process and respond to transaction requests and other tasks in the blockchain network. The performance indicators of the target standby node are similar to those of the target master node, and are also used to measure the processing and response capabilities of the standby node. They usually include the computing power, storage capacity, network bandwidth, response time, etc. of the standby node. These indicators can evaluate whether the standby node has sufficient performance to process and respond to transaction requests and other tasks in the blockchain network, and whether it can serve as a backup node for the master node to ensure the availability and stability of the system.

[0149] For example, the performance indicators of the target master node or the target standby node include but are not limited to: processing capacity (e.g., number of transactions processed per second), CPU utilization, number of connections, memory usage (e.g., memory occupancy), I / O load, network latency, etc. These performance indicators can be used to understand the working capacity and resource usage of the node for load distribution. CPU utilization can reflect the current busyness of the node's CPU and help understand the efficiency of the node in processing computing tasks. The number of connections can reflect the network load of the node and can show how many network connections the node is processing. Memory usage can reflect the load of the node's memory and help understand the efficiency of the node in processing storage tasks. I / O load can reflect the input / output load of the node and help understand the busyness of the node when reading and writing disks or network transmission. Network latency can reflect the latency of the node's network transmission and help understand the efficiency and quality of network transmission. It is worth noting that in the actual process, other indicators such as the node's hash rate, transaction processing speed, etc. can also be combined according to actual needs to comprehensively evaluate the performance and load of the node. The specific values ​​of these load indicators will vary depending on factors such as the node's hardware configuration, operating environment, and the type of tasks being processed.

[0150] Exemplarily, the load distribution strategy adopted by the target node cluster is used to distribute the load of the target node cluster to different nodes in the target node cluster to ensure the efficient operation of the target node cluster. The load distribution strategy can be determined according to the specific needs and scenarios of the target node cluster. For example, the following factors can be considered: performance indicators of each node, node availability, transaction priority, type of workload, etc. Through a reasonable load distribution strategy, the load of each node can be balanced, the processing capacity and response speed of the entire cluster can be improved, and node overload or resource waste can be avoided.

[0151] For example, the load distribution strategies adopted by the standard node cluster include but are not limited to:

[0152] Weight distribution method:

[0153] According to the performance indicators of the master node and the standby node, the weight factor of the master node and the weight factor of the standby node are determined, and the workload of the master node and the standby node are allocated according to the weight factor of the master node and the weight factor of the standby node. Nodes with higher weights bear more workload.

[0154] Specifically, first obtain the performance indicators of the primary node and the standby node. These indicators may include CPU usage, memory usage, disk IO speed, network throughput, etc. These indicators can help us evaluate the computing power and communication capabilities of the nodes. Then, determine the weight factors of the two nodes based on these indicators. The weight factor can reflect the performance of the node. Generally speaking, nodes with better performance should have higher weight factors. The specific calculation method of the weight factor can be designed according to the actual situation. For example, the difference between the performance indicators of the two nodes can be compared, and the weight factor can be set based on this. Next, the load will be distributed to the primary node and the standby node based on the weight factor of each node. For example, 70% of the load can be allocated to the primary node and the remaining 30% to the standby node.

[0155] Polling method:

[0156] The tasks are assigned to the master node and the backup node in the preset order. When all nodes have been traversed, the tasks are assigned again starting from the master node.

[0157] Specifically, all tasks can be arranged in a certain order. This order can be random or regular, for example, sorted by task priority or creation time. Then, starting from the first task, assign it to the primary node, and assign the next task to the current standby node. After a task is assigned to each node, the task is assigned again from the primary node in a loop. Of course, in each task assignment, it can also be checked whether the current node is idle. If so, the next task is assigned to the current node.

[0158] Minimum connection method:

[0159] Assign tasks to the node with the least number of current connections to achieve load balancing.

[0160] Specifically, first obtain the number of connections of all nodes, which can be achieved by counting the number of tasks received by each node. Then find the node with the least number of connections. If there are multiple nodes with the same number of connections, you can choose one of them. Assign the task to the found node. If the found node is already full, you can wait for a while until it has enough free resources to receive new tasks. Repeat the above steps until all tasks are assigned.

[0161] In short, the load distribution information of the nodes in the target node cluster can be stored in the blockchain of the target node cluster through the second block. The stored information can be the performance indicators of the nodes in the target node cluster and the load distribution strategy, and the load distribution strategy includes weight factors, polling order and other strategies. Specifically, the target standby node can regularly collect the performance and load indicators of the target master node and the target standby node; then, the target standby node can determine and implement the corresponding load distribution strategy based on the collected performance indicators.

[0162] In this embodiment, by synchronizing the blockchain of the target master node and introducing the second block into the blockchain of the target master node, since the second block is obtained by executing the first configuration transaction information, and the second configuration transaction information is generated by calling the system contract and is used to indicate the load distribution information for configuring the target node cluster, the workload and resources of the entire blockchain network can be more reasonably distributed to avoid node overload or resource waste, which helps to improve the performance of the entire blockchain network, such as stability and availability, and at the same time can give full play to the performance differences between nodes and improve the performance and resource utilization of the entire blockchain system.

[0163] It should be understood that the target standby node can also query load distribution related information according to actual needs and detect the load status of the nodes in the target node cluster and the execution effect of related policies in real time.

[0164] In addition, the target standby node can also perform load balancing and optimization on blockchain nodes that support active-active (such as a target node cluster).

[0165] For example, from the perspective of the second configuration transaction information, the second configuration transaction information is generated by calling the system contract and is used to indicate the load distribution information for configuring the target node cluster. The load distribution information of the target node cluster can be the load distribution information obtained by the target node after load balancing and optimizing the target node cluster.

[0166] For example, the target standby node can automatically distribute and adjust the workload of the target node cluster according to the performance and load of the target master node and the performance and load of the target standby node. As an implementation method, the target standby node can evaluate whether the current load distribution strategy is appropriate by regularly checking the load status of the target master node and the load status of the target standby node. If it is found that the load distribution is unbalanced or the resource utilization is not ideal, the load or load distribution strategy of the target node cluster can be dynamically adjusted and optimized according to the actual situation. Through performance indicator collection, load distribution strategy, dynamic adjustment and optimization, and node load distribution information storage and query, an effective load scheduling mechanism is provided for the implementation method of blockchain nodes that support dual-active. This mechanism can give full play to the performance of each node, improve the performance and resource utilization of the entire system, and provide key support for building an efficient and stable blockchain system.

[0167] In some embodiments, after S440, the method 400 may further include:

[0168] In the case where the function of the target master node is restored, the data of the target standby node is synchronized to the target master node, and it is determined whether the master node of the target node cluster is restored to the target master node; in the case where it is determined that the master node of the target node cluster is restored to the target master node, the system contract is called to generate second transaction information; the second transaction information is used to indicate that the master node of the target node cluster is restored from the target standby node to the target master node; the second transaction information is verified, and if the second transaction information passes the verification, the second transaction information is broadcast to the other node clusters; the consensus result of the second proposal block corresponding to the second transaction information is obtained, and if the consensus result of the second proposal block indicates that it is in favor of restoring the master node of the target node cluster to the target master node, the second proposal block is added to the blockchain of the target standby node; the blockchain of the target standby node is synchronized to the target master node, and the target master node is triggered to establish a connection relationship with the associated node of the target master node; the associated node includes a node that has a connection relationship with the target master node before the failure of the target master node.

[0169] In other words, when the function of the target master node is restored, the data of the target standby node can be synchronized to the target master node, and it is determined whether to restore the master node of the target node cluster to the original target master node. If it is decided to do so, the system contract can be called to generate a second transaction information. This second transaction information indicates that the master node of the target node cluster is restored from the target standby node to the original target master node. The target standby node verifies the second transaction information, and if it passes the verification, it broadcasts this transaction information to other node clusters. The target standby node obtains the consensus result of the second proposal block corresponding to the second transaction information. If this consensus result shows that everyone agrees to restore the master node of the target node cluster to the original target master node, the target standby node will add this second proposal block to the blockchain of the target standby node. Then, the target standby node synchronizes the blockchain of the target standby node to the target master node, and triggers the target master node to establish a connection relationship with its related nodes. These related nodes include those nodes that have been connected to the target master node before the failure of the target master node.

[0170] Exemplarily, the functional recovery of the target master node may refer to the state of the target master node being restored to the latest state, which is approximately equal to the normal working state. The failure of the target master node (downtime, data loss) will cause data to settle, and only after the state is synchronized to the latest state can it participate in the consensus again (enter the normal state).

[0171] Exemplarily, the target standby node can determine whether the function of the target master node has been restored to normal operation by detecting the status of the target master node, including network connection status, node status, system operation status, etc. If it is found that the target master node has been restored to normal operation, the target standby node can take corresponding measures.

[0172] Exemplarily, after the target master node resumes normal operation, it may send a notification to the target standby node to inform it that its function has been restored. After receiving the notification, the target standby node may confirm that the function of the target master node has been restored.

[0173] Exemplarily, the target standby node can determine whether to restore the master node of the target node cluster to the target master node by judging whether its own status is good, including hardware and software status, network connection status, and system operation status, etc. If its own status is good, the target standby node may consider not restoring the master node of the target node cluster to the target master node, otherwise, consider restoring the master node of the target node cluster to the target master node.

[0174] Exemplarily, the target standby node can determine whether to restore the master node of the target node cluster to the target master node by judging the state of the target node cluster, including the state of the nodes other than the target master node in the target node cluster, the network connection status, and the performance and load of the entire cluster. If the state of the nodes other than the target master node in the target node cluster is good, and the performance and load of the entire cluster are relatively balanced, the target standby node may consider not restoring the master node of the target node cluster to the target master node, otherwise, consider restoring the master node of the target node cluster to the target master node.

[0175] Exemplarily, when the function of the target master node is restored, the target master node is triggered to establish a connection relationship with the associated node of the target master node; the associated node includes a node that had a connection relationship with the target master node before the target master node failed. The associated node includes a node that had a connection relationship with the target master node before the target master node failed, which means that these nodes had established a connection relationship with the target master node before the target master node failed. These associated nodes may be other important nodes, or nodes that have a specific business relationship or data interaction with the target master node. When the function of the target master node is restored, the target master node is triggered to establish a connection relationship with the associated node, which can ensure the connectivity and availability of the entire blockchain network, and also meet specific business needs and data interaction needs.

[0176] In this embodiment, when the function of the target master node is restored, the data of the target standby node is synchronized to the target master node, and a decision is made based on the consensus result whether to restore the master node of the target node cluster to the original target master node. When it is decided to restore the master node of the target node cluster to the original target master node, the blockchain of the target standby node is synchronized to the target master node again, and the target master node is triggered to establish a connection relationship with the associated node of the target master node. Specifically, by introducing the second transaction information, not only can the master node of the target node cluster be restored to the original target master node, but also all node clusters in the blockchain network can reach a consensus, thereby improving the availability and fault tolerance of a single node of the blockchain, reducing block confirmation delays, and thus improving the stability and performance of the entire blockchain system.

[0177] It should be understood that the method for obtaining the consensus result of the second transaction information is similar to the method for obtaining the consensus result of the first transaction information mentioned above. It usually includes packaging the second transaction information into the second proposal block by the proposal node cluster and broadcasting it, so that other node clusters except the proposal node cluster can verify the second proposal block and generate voting results for the second proposal block, thereby, each node cluster can determine the consensus result of the second proposal block based on the voting results of the second proposal block generated by itself and the voting results of the second proposal block received.

[0178] In some embodiments, the method 400 may further include:

[0179] When it is determined that the master node of the target node cluster will not be restored as the target master node, the master node of the target node cluster is maintained as the target standby node.

[0180] In other words, after the target master node fails, the master node before the target node can be switched from the target master node to the target backup node, but even if the function of the target master node is restored, the master node of the target node cluster is maintained as the target backup node.

[0181] In this embodiment, even if the function of the target master node is restored, the master node of the target node cluster is maintained as the target backup node, avoiding network fluctuations and instability caused by restoring the master node of the target node cluster as the target master node.

[0182] In some embodiments, the method 400 may further include:

[0183] In the case of determining that the master node of the target node cluster will not be restored to the target master node, based on the performance indicators of the nodes in the multiple node clusters, the system contract is called to generate third transaction information; wherein the third transaction information is used to indicate at least one of the following information for configuring the target node cluster: node reconfiguration information, load redistribution information; the node reconfiguration information includes at least one of the following: information for indicating the master node in the target node cluster, information for indicating the backup node in the target node cluster, information for indicating the connection relationship of the master node in the target node cluster in the multiple node clusters, information for indicating the The load redistribution information includes at least one of the following: the performance index of the target master node, the performance index of the target standby node, and the load distribution strategy adopted by the target node cluster; then, the third transaction information is verified, and if the third transaction information passes the verification, the third transaction information is broadcast to the other node clusters; the consensus result of the third proposal block corresponding to the third transaction information is obtained, and if the consensus result of the third proposal block indicates that the target node cluster is in favor of reconfiguring, the third proposal block is added to the blockchain of the master node in the target node cluster.

[0184] In other words, the target standby node is also responsible for rebuilding and optimizing the entire node network as needed after the target master node resumes normal working status. Specifically, the fault repair status of the original master node (i.e., the target master node) can be regularly detected, which can be achieved through methods such as heartbeat detection, resource detection, and network connection detection. After confirming that the original master node (i.e., the target master node) has resumed normal working status, the network reorganization process is triggered. Before network reorganization, it is necessary to ensure the data consistency between the original master node (i.e., the target master node) and the current master node (i.e., the target standby node). Full or incremental synchronization can be performed through regular synchronization strategies to ensure that the blockchain data, transaction information, and consensus status of the two nodes are consistent. According to actual needs, the roles between the original master node (i.e., the target master node) and the current master node (i.e., the target standby node) can be dynamically switched. For example, factors such as node performance, load conditions, and fault history can be used to decide whether to restore the original master-slave relationship or to continue to use the original master node (i.e., the target master node) as a standby node.

[0185] In addition, the master-slave node relationship, node performance and network topology of the target node cluster can also be optimized through the execution of the third transaction information. The master-slave node relationship optimization is to redetermine the master node and the backup node. Performance optimization includes master-slave node optimization and load optimization. The master-slave node optimization usually sets the node with high configuration as the master node and the node with low configuration as the backup node; load optimization sends the received block to different nodes in the node cluster to execute transactions and verify; network topology optimization refers to the optimization of node clusters in the blockchain network and the connection relationship between node clusters. For example, the connection relationship between nodes can be adjusted according to factors such as link delay, data transmission speed, and node reliability to improve the performance and stability of the entire blockchain system. For example, the following connection relationships can be adjusted according to delay and transmission speed:

[0186] The connection between the master node and the external node is used for the master node to directly synchronize data from the external node.

[0187] The connection between standby nodes is used to synchronize data between standby nodes.

[0188] The connection between the standby node and the external node is used for the standby node to directly synchronize data from the external node.

[0189] Exemplarily, the nodes in the multiple node clusters may include a master node in each node cluster.

[0190] Exemplarily, the nodes in the multiple node clusters may include a master node and a standby node in each node cluster.

[0191] For example, the performance indicators of the nodes in the multiple node clusters are similar to the performance indicators of the target standby nodes or the target master nodes mentioned above, and are also used to measure the processing and response capabilities of the standby nodes. They usually include the computing power, storage capacity, network bandwidth, response time, etc. of the standby nodes. These indicators can evaluate whether the standby nodes have sufficient performance to process and respond to transaction requests and other tasks in the blockchain network, and whether they can serve as backup nodes for the master nodes to ensure the availability and stability of the system.

[0192] Exemplarily, when it is determined that the master node of the target node cluster is not to be restored as the target master node, detect whether the data of the target master node is consistent with the data of the target standby node; when the data of the target master node is consistent with the data of the target standby node, call the system contract to generate third transaction information based on the performance indicators of the nodes in the multiple node clusters; when the data of the target master node is inconsistent with the data of the target standby node, synchronize the data of the target master node to the target standby node, and call the system contract to generate third transaction information based on the performance indicators of the nodes in the multiple node clusters. This is equivalent to, if the function of the target master node is restored, the target node cluster can be rebuilt on the premise of ensuring that the data of the target master node is consistent with the data of the target standby node, so that the nodes in the rebuilt target node cluster can still maintain data and status consistency.

[0193] It should be understood that the method for obtaining the consensus result of the third transaction information is similar to the method for obtaining the consensus result of the first transaction information or the second transaction information mentioned above. It usually includes packaging the third transaction information into the third proposal block by the proposal node cluster and broadcasting it, so that other node clusters except the proposal node cluster can verify the third proposal block and generate voting results for the third proposal block, thereby, each node cluster can determine the consensus result of the third proposal block based on the voting results of the third proposal block generated by itself and the voting results of the third proposal block received.

[0194] In this embodiment, the node reconfiguration information configured by the third transaction information can be used to adjust and optimize the target node cluster by reconstructing the network structure of the target node cluster without affecting the operation of the entire blockchain network, which helps to improve the maintainability of the target node cluster and reduce the risks and complexity brought by the adjustment of the network topology. Specifically, the roles of the master and standby nodes can be adjusted based on the information used to indicate the master node in the target node cluster and the information used to indicate the standby node in the target node cluster in the node reconfiguration information, and the connection relationship of the nodes in the target node cluster in the multiple node clusters can be adjusted based on the information used to indicate the connection relationship of the standby node in the target node cluster in the multiple node clusters in the node reconfiguration information; in addition, the load redistribution information configured by the third transaction information can be used to reconfigure the load of the reconstructed target node cluster. Moreover, the master node and standby node and load information in the target node cluster are reconfigured, which is equivalent to the dynamic reconstruction and optimization of the network after the original master node (i.e., the target master node) is repaired and restored to normal working state, which helps to improve the maintainability, fault tolerance and performance of the entire blockchain system and support the construction of an efficient and stable blockchain system. For example, it can adapt to changes in business needs, such as adding or reducing servers, adjusting network architecture, etc., which helps to improve the flexibility and scalability of the network and meet changing business needs and technical requirements.

[0195] It should be understood that after the target standby node completes the network reorganization, the client requests and other network nodes related to the active standby node can re-establish the connection with the master node in the target node cluster. In addition, the relevant operators or system components can be notified to ensure that they understand the results of the network reorganization and take corresponding measures.

[0196] Figure 6 This is an example of a fault recovery process 500 provided in an embodiment of the present application.

[0197] like Figure 6 As shown, when the target master node is repaired and restored to normal working state, the system needs to perform a fault recovery operation to optimize the network structure and improve system stability. Specifically, the fault recovery process 500 may include:

[0198] S510, fault repair detection.

[0199] Regularly check the fault repair status of the original master node (i.e. the target master node), which can be achieved through heartbeat detection, resource detection, network connection detection, etc. Once it is confirmed that the original master node has resumed normal working status, the fault recovery process is triggered.

[0200] S520, data consistency confirmation.

[0201] Before performing fault recovery, you need to ensure the data consistency between the original master node (i.e. the target master node) and the current master node (i.e. the target backup node). You can use a regular synchronization strategy to perform full or incremental synchronization to ensure that the blockchain data, transaction information, and consensus status of the two nodes are consistent.

[0202] S530, role switching and network reorganization.

[0203] After confirming data consistency, you can choose to implement one of the following two strategies:

[0204] Role switching: Restore the original master node (i.e., the target master node) as the master node, and restore the current master node (i.e., the target standby node) as the standby node to restore the original master-standby node relationship.

[0205] Network reorganization: Keep the current active and standby node roles unchanged and optimize the network topology. For example, optimize the connection relationship between nodes in the target node cluster through factors such as link latency, data transmission speed, and node reliability.

[0206] It should be understood that the selection of a specific strategy should be evaluated based on factors such as node performance, load conditions, and failure history.

[0207] S540, service switching and notification.

[0208] After completing the role switch or network reorganization, it is necessary to modify the network configuration related to the primary and backup nodes, and decide to switch some or all client requests and communications with other nodes back to the original primary node (i.e., the target primary node) according to the needs. At the same time, notify the relevant operators or system components to ensure that they understand the results of the failure recovery and take corresponding measures.

[0209] S550, system control and optimization.

[0210] After fault recovery, the node status and system performance are continuously monitored and controlled, and the load distribution strategy is dynamically adjusted and the fault response mechanism is optimized according to actual needs, which helps to improve the stability, resilience and performance of the entire blockchain system.

[0211] In this embodiment, through the above-mentioned fault recovery process, after the master node resumes normal working state, the system can choose to execute role switching or network reorganization strategy, and perform service switching and notification operations, continuously optimize system performance and stability, thereby ensuring the high availability and maintainability of the entire blockchain system.

[0212] In some embodiments, S420 may include:

[0213] When it is detected that the target master node has a failure, detect whether the data of the target master node is consistent with the data of the target standby node; when the data of the target master node is consistent with the data of the target standby node, call the system contract to generate the first transaction information; when the data of the target master node is inconsistent with the data of the target standby node, synchronize the data of the target master node to the target standby node, and call the system contract to generate the first transaction information.

[0214] In other words, before officially starting the switching process of the master-slave node, it is necessary to check the data consistency of the target standby node and the target master node to ensure that the data between the target standby node and the target master node should be consistent. If the data is found to be inconsistent, it is necessary to synchronize first (for example, full data synchronization or incremental data synchronization can be used) to ensure that the data status is correct. Under the premise of ensuring data consistency, execute the switching process of the master-slave node. For example, the target standby node can automatically switch the master node of the target node cluster from the target master node to the target standby node by calling the first transaction information generated by the system contract.

[0215] Exemplarily, when the target standby node detects whether the data of the target master node is consistent with the data of the target standby node, the information that needs to be detected includes but is not limited to data value, data type, and data integrity.

[0216] In this embodiment, when the data of the target master node is consistent with the data of the target backup node, the system contract is called to generate the first transaction information; when the data of the target master node is inconsistent with the data of the target backup node, the data of the target master node is synchronized to the target backup node, and the system contract is called to generate the first transaction information, which can ensure the accuracy and completeness of the first transaction information.

[0217] It should be understood that after the state detection submodule of the target standby node detects the failure of the target master node, the target standby node can send a failure notification to other node clusters to trigger a failover in addition to calling the first transaction information generated by the system contract. After the failover is completed, the target standby node can also record the cause, time and measures taken of the failure, and notify the relevant operator or system component.

[0218] Figure 7 This is an example of a master-slave switching process 600 provided in an embodiment of the present application.

[0219] like Figure 7 As shown, when an abnormality occurs in the primary node, the system needs to automatically switch the workload to the backup node to ensure the continuous availability of the service. Specifically, the primary-backup switching process 600 includes:

[0220] S610, fault detection.

[0221] The target master node is regularly tested for heartbeats, resources, and network connections. Once a target master node is detected to have a fault (such as no response, resource exhaustion, network interruption, etc.), the failover process will be triggered.

[0222] S620, data consistency check.

[0223] Before starting the switching process for failover, you first need to ensure the data consistency between the target primary node and the target standby node. You can use regular synchronization strategies (such as full or incremental synchronization) to ensure that the blockchain data, transaction information, and consensus status of the two nodes remain consistent.

[0224] S630, triggering a failover.

[0225] After fault detection and data consistency confirmation, the failover mechanism is triggered to switch all client requests and communications with other blockchain network nodes to the target standby node.

[0226] S640, service switching and redirection.

[0227] Modify the network configuration related to the target primary and backup nodes to redirect requests from clients and other nodes to the target backup nodes. This can be achieved by modifying DNS resolution settings, adjusting load balancing policies, or updating routing information between nodes. At the same time, update the consensus status, network connection, etc. in the target backup node to the status of the primary node in the target node cluster, that is, the target backup node begins to assume the role and workload of the primary node.

[0228] S650, fault logging and notification.

[0229] After the failover is completed, the cause, time and measures taken of the failure are recorded, and the relevant operators or system components are notified. This helps to analyze the cause of the failure and further optimize the system architecture and failure response strategy.

[0230] In short, when an abnormality occurs in the target master node, the system will automatically trigger the failover process, from fault detection, data consistency check, triggering failover, service switching and redirection to fault recording and notification, to ensure that the target standby node can smoothly take over the workload of the target master node and maintain the high availability of the entire blockchain system.

[0231] In some embodiments, when the target standby node detects that the target master node fails, detecting whether the data of the target master node is consistent with the data of the target standby node can be specifically implemented as follows:

[0232] When it is detected that the target master node has a failure, the operating status of the target standby node and the connection status between the target standby node and the target master node are detected; when the operating status of the target standby node is a normal operating status and the connection status is a normal connection status, it is detected whether the data of the target master node is consistent with the data of the target standby node.

[0233] Exemplarily, when the target standby node detects that the target master node has failed, the corresponding fault handling mechanism will be triggered. This can be achieved by detecting the status of the target master node, the network connection status or other relevant indicators. Once the target master node failure is confirmed, the target standby node needs to detect its own operating status. This can be achieved by checking the hardware and software status, system processes, network connection status, etc. of the target standby node. If the target standby node is running normally, the target standby node needs to detect the connection status with the target master node. This can be achieved by checking the network connection status, communication protocol or related network diagnostic tools. If the connection status is normal, the target standby node needs to detect whether its own data is consistent with the target master node data. This can be achieved by comparing the data records of the two nodes, performing the same database operation, or using data synchronization tools.

[0234] In this embodiment, by first detecting the operating status of the target standby node and the connection status between the target standby node and the target master node, and when the operating status of the target standby node is a normal operating status and the connection status is a normal connection status, detecting whether the data of the target master node is consistent with the data of the target standby node, it is possible to avoid waste of resources due to the target standby node being unable to use the data after obtaining the detection result of whether the data is consistent.

[0235] In some embodiments, the target standby node obtains the consensus result of the first proposal block corresponding to the first transaction information, which can be specifically implemented as follows:

[0236] In a case where the proposal node cluster of the first proposal block is the target node cluster, the first transaction information is executed and a transaction result of the first transaction information is obtained; the first proposal block is determined based on the transaction result of the first transaction information; the first proposal block is broadcast to the other node clusters, and the voting results of the other node clusters on the first proposal block are obtained; based on the voting results of the other node clusters on the first proposal block, the consensus result of the first proposal is determined.

[0237] Exemplarily, the target node cluster can verify the first transaction information to ensure the legitimacy and validity of the information, which may include checking the format, signature, timeliness, etc. of the information, as well as confirming the source and purpose of the transaction. If the first transaction information passes the verification, the target node cluster will package the first transaction information into a first proposal block, broadcast it to other node clusters, and generate a voting result in favor. Then, the target node cluster receives the voting results sent by other node clusters, and obtains the consensus result of the first proposal block based on the voting results generated by itself and the voting results sent by other node clusters. For example, once the block is approved by most node clusters, the consensus result of the first proposal block indicates approval to switch the master node of the target node cluster from the target master node to the target standby node, otherwise, the consensus result of the first proposal block indicates opposition to switching the master node of the target node cluster from the target master node to the target standby node.

[0238] Of course, in other alternative embodiments, the proposed node cluster may be a node cluster other than the target node cluster in the blockchain network, and this application does not specifically limit this.

[0239] For example, the proposal node cluster can be a node cluster other than the target node cluster in the blockchain network. In this case, the target node cluster obtains the first proposal block from the proposal node cluster, verifies the first proposal block to generate the voting result of the target node cluster on the first proposal block, and broadcasts the voting result of the first proposal block to other node clusters. In addition, the target node cluster also needs to receive the voting results sent by other node clusters, and obtain the consensus result of the first proposal block based on the voting results generated by itself and the voting results sent by other node clusters. For example, once the block is approved by most node clusters, the consensus result of the first proposal block indicates approval to switch the master node of the target node cluster from the target master node to the target standby node, otherwise, the consensus result of the first proposal block indicates opposition to switching the master node of the target node cluster from the target master node to the target standby node.

[0240] The preferred embodiments of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the embodiments mentioned above. Within the technical concept of the present application, the technical solution of the present application can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the present application. For example, the various specific technical features described in the specific embodiments mentioned above can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present application will not further explain various possible combinations. For another example, the various different embodiments of the present application can also be arbitrarily combined, as long as they do not violate the ideas of the present application, they should also be regarded as the contents disclosed in the present application.

[0241] It should also be understood that in the various method embodiments of the present application, the size of the serial numbers of the processes involved above does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0242] The method provided in the embodiment of the present application is described above, and the device provided in the embodiment of the present application is described below.

[0243] Figure 5 1 is a schematic block diagram of a data processing device 700 based on a blockchain network provided in an embodiment of the present application. The blockchain network includes multiple node clusters, the multiple node clusters include a target node cluster, and the target node cluster includes a target master node and a target standby node.

[0244] like Figure 5 As shown, the data processing device 700 may include:

[0245] A detection unit 710 is used to detect whether the target master node fails;

[0246] A generating unit 720 is configured to call a system contract of the blockchain network to generate first transaction information when a failure of the target master node is detected; the first transaction information is used to indicate that the master node of the target node cluster is switched from the target master node to the target standby node;

[0247] A verification unit 730 is configured to verify the first transaction information, and if the first transaction information passes the verification, broadcast the first transaction information to other node clusters among the multiple node clusters except the target node cluster;

[0248] The switching unit 740 is used to obtain the consensus result of the first proposal block corresponding to the first transaction information, and when the consensus result of the first proposal block indicates that it is in favor of switching the master node of the target node cluster from the target master node to the target standby node, switch the master node in the target node cluster from the target master node to the target standby node, and add the first proposal block to the blockchain of the target standby node.

[0249] In some embodiments, the detection unit 710 is specifically used to:

[0250] Synchronize the blockchain of the target master node;

[0251] The blockchain of the target master node includes a first block, which is a block obtained by executing the first configuration transaction information. The first configuration transaction information is generated by calling the system contract and is used to indicate the node configuration information for configuring the target node cluster. The node configuration information includes at least one of the following:

[0252] Information used to indicate the master node in the target node cluster, information used to indicate the standby node in the target node cluster, information used to indicate the master node in the target node cluster, information used to indicate the standby node in the target node cluster, information of nodes associated with the master node in the target node cluster, and information of nodes associated with the standby node in the target node cluster;

[0253] Based on the information of the node associated with the master node in the target node cluster, a connection relationship is established between the target standby node and the node associated with the master node in the target node cluster.

[0254] In some embodiments, the blockchain of the target master node includes a second block, the second block is a block obtained by executing the second configuration transaction information, the second configuration transaction information is generated by calling the system contract and is used to indicate the load distribution information for configuring the target node cluster, and the load distribution information includes at least one of the following:

[0255] The performance indicators of the target master node, the performance indicators of the target standby node, and the load distribution strategy adopted by the target node cluster.

[0256] In some embodiments, after the switching unit 740 switches the master node in the target node cluster from the target master node to the target standby node and adds the first proposal block to the blockchain of the target standby node, it is further configured to:

[0257] When the function of the target master node is restored, synchronize the data of the target standby node to the target master node, and determine whether to restore the master node of the target node cluster to the target master node;

[0258] In the case of determining that the master node of the target node cluster is restored to the target master node, calling the system contract to generate second transaction information; the second transaction information is used to indicate that the master node of the target node cluster is restored from the target standby node to the target master node;

[0259] Verifying the second transaction information, and broadcasting the second transaction information to the other node cluster if the second transaction information passes the verification;

[0260] Obtaining a consensus result of a second proposal block corresponding to the second transaction information, and if the consensus result of the second proposal block indicates that the master node of the target node cluster is in favor of being restored as the target master node, adding the second proposal block to the blockchain of the target standby node;

[0261] The blockchain of the target standby node is synchronized to the target master node, and the target master node is triggered to establish a connection relationship with an associated node of the target master node; the associated node includes a node that has a connection relationship with the target master node before the target master node fails.

[0262] In some embodiments, the switching unit 740 is further configured to:

[0263] When it is determined that the master node of the target node cluster will not be restored as the target master node, the master node of the target node cluster is maintained as the target standby node.

[0264] In some embodiments, the switching unit 740 is further configured to:

[0265] In a case where it is determined that the master node of the target node cluster is not restored as the target master node, based on the performance indicators of the nodes in the multiple node clusters, calling the system contract to generate third transaction information;

[0266] The third transaction information is used to indicate at least one of the following information for configuring the target node cluster: node reconfiguration information, load redistribution information;

[0267] The node reconfiguration information includes at least one of the following: information indicating a master node in the target node cluster, information indicating a standby node in the target node cluster, information indicating a connection relationship between the master node in the target node cluster and the multiple node clusters, and information indicating a connection relationship between the standby nodes in the target node cluster and the multiple node clusters;

[0268] The load redistribution information includes at least one of the following: a performance indicator of the target master node, a performance indicator of the target standby node, and a load distribution strategy adopted by the target node cluster;

[0269] Verifying the third transaction information, and broadcasting the third transaction information to the other node cluster if the third transaction information passes the verification;

[0270] Obtain a consensus result of a third proposal block corresponding to the third transaction information, and when the consensus result of the third proposal block indicates approval for reconfiguring the target node cluster, add the third proposal block to the blockchain of the master node in the target node cluster.

[0271] In some embodiments, the generating unit 720 is specifically used to:

[0272] In the case where it is detected that the target master node fails, detecting whether the data of the target master node is consistent with the data of the target standby node;

[0273] When the data of the target primary node is consistent with the data of the target backup node, calling the system contract to generate the first transaction information;

[0274] When the data of the target master node is inconsistent with the data of the target standby node, the data of the target master node is synchronized to the target standby node, and the system contract is called to generate the first transaction information.

[0275] In some embodiments, the generating unit 720 is specifically used to:

[0276] In the case where it is detected that the target primary node fails, detecting the operating state of the target standby node and detecting the connection state between the target standby node and the target primary node;

[0277] When the running state of the target standby node is a normal running state and the connection state is a normal connection state, it is detected whether the data of the target master node is consistent with the data of the target standby node.

[0278] In some embodiments, the switching unit 740 is specifically used to:

[0279] When the proposal node cluster of the first proposal block is the target node cluster, executing the first transaction information and obtaining a transaction result of the first transaction information;

[0280] Determine the first proposal block based on the transaction result of the first transaction information;

[0281] Broadcast the first proposal block to the other node clusters, and obtain the voting results of the other node clusters on the first proposal block;

[0282] Based on the voting results of the other node clusters on the first proposal block, the consensus result of the first proposal is determined.

[0283] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, the data processing device 700 may correspond to the corresponding subject in the method 400 to 600 of the embodiment of the present application, and the various units in the data processing device 700 are respectively for implementing the corresponding processes in the method 400 to 600, and for the sake of brevity, no further description is given here.

[0284] It should also be understood that the various units in the data processing device 700 involved in the embodiment of the present application are divided based on logical functions. In practical applications, the function of a unit can also be implemented by multiple units, or the functions of multiple units are implemented by one unit, and even these functions can also be implemented by one or more other units. For example, part or all of the data processing device 700 is merged into one or more other units. For another example, a certain (some) unit in the data processing device 700 can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. For another example, the data processing device 700 can also include other units. In practical applications, these functions can also be implemented by other units, and can be implemented by the collaboration of multiple units.

[0285] It should also be understood that the term "module" or "unit" involved in the embodiments of the present application refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0286] According to another embodiment of the present application, the data processing device 700 involved in the embodiment of the present application can be constructed by running a computer program (including program code) capable of executing each step involved in the corresponding method on a general computing device of a general-purpose computer including processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM), and the method of the embodiment of the present application can be implemented. The computer program can be recorded on, for example, a computer-readable storage medium, and loaded into an electronic device through a computer-readable storage medium, and run therein to implement the corresponding method of the embodiment of the present application. In other words, the units involved above can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented in the form of a combination of software and hardware. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form of the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or a combination of hardware and software in the decoding processor to execute. Optionally, the software can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, and a register. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the method embodiment mentioned above in combination with its hardware.

[0287] Fig. 9 It is a schematic structural diagram of an electronic device 800 provided in an embodiment of the present application.

[0288] like Fig. 9 As shown, the electronic device 800 at least includes a processor 810 and a computer-readable storage medium 820. The processor 810 and the computer-readable storage medium 820 may be connected via a bus or other means. The computer-readable storage medium 820 is used to store a computer program 821, which includes computer instructions, and the processor 810 is used to execute the computer instructions stored in the computer-readable storage medium 820. The processor 810 is the computing core and control core of the electronic device 800, which is suitable for implementing one or more computer instructions, and is specifically suitable for loading and executing one or more computer instructions to implement the corresponding method flow or corresponding function.

[0289] As an example, the processor 810 may also be referred to as a central processing unit (CPU). The processor 810 may include, but is not limited to, a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete component gates or transistor logic devices, discrete hardware components, and the like.

[0290] As an example, the computer-readable storage medium 820 may be a high-speed RAM memory, or a non-volatile memory (Non-Volatile Memory), such as at least one disk memory; optionally, it may also be at least one computer-readable storage medium located away from the aforementioned processor 810. Specifically, the computer-readable storage medium 820 includes, but is not limited to: a volatile memory and / or a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).

[0291] like Fig. 9 As shown, the electronic device 800 may further include a transceiver 830 .

[0292] The processor 810 may control the transceiver 830 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 830 may include a transmitter and a receiver. The transceiver 830 may further include an antenna, and the number of antennas may be one or more.

[0293] It should be understood that the various components in the electronic device 800 are connected via a bus system, wherein the bus system includes a power bus, a control bus, and a status signal bus in addition to a data bus. It is worth noting that the electronic device 800 can be any electronic device with data processing capabilities; the computer-readable storage medium 820 stores a first computer instruction; the processor 810 loads and executes the first computer instruction stored in the computer-readable storage medium 820 to implement the corresponding steps in the method embodiment shown in Figure 1; in a specific implementation, the first computer instruction in the computer-readable storage medium 820 is loaded by the processor 810 and the corresponding steps are executed. To avoid repetition, it will not be repeated here.

[0294] According to another aspect of the present application, an embodiment of the present application provides a chip. The chip may be an integrated circuit chip having signal processing capabilities, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The chip may also be referred to as a system-on-chip, a system-on-chip, a chip system, or a system-on-chip chip, etc. The chip may be applied to various electronic devices capable of installing the chip, so that the device equipped with the chip may execute the corresponding steps in the methods or logic block diagrams disclosed in the embodiments of the present application. For example, the chip may be suitable for implementing one or more computer instructions, specifically suitable for loading and executing one or more computer instructions to implement the corresponding method flow or corresponding function.

[0295] According to another aspect of the present application, an embodiment of the present application provides a computer-readable storage medium (Memory). The computer-readable storage medium is a memory device of a computer for storing programs and data. It is understandable that the computer-readable storage medium herein may include both a built-in storage medium in a computer and, of course, an extended storage medium supported by a computer. The computer-readable storage medium provides a storage space, which stores an operating system of an electronic device. The storage space stores computer instructions suitable for being loaded and executed by a processor, and when the computer instructions are read and executed by a processor of a computer device, the computer device executes the corresponding steps in each method or logic block diagram disclosed in the embodiment of the present application.

[0296] According to another aspect of the present application, an embodiment of the present application provides a computer program product or a computer program. The computer program product or computer program includes a computer instruction, which is stored in a computer-readable storage medium. The processor of a computer device reads the computer instruction from a computer-readable storage medium, and the processor executes the computer instruction so that the computer device executes the corresponding steps in each method disclosed in the embodiment of the present application or the logic block diagram. In other words, when the solution provided by the present application is implemented using software, it can be implemented in whole or in part in the form of a computer program product or a computer program. The computer program product or computer program includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, the process of the embodiment of the present application is run in whole or in part or the function of the embodiment of the present application is implemented.

[0297] It is worth noting that the computer involved in the present application can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions involved in the present application can be stored in a computer-readable storage medium, or can be transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0298] Those of ordinary skill in the art will appreciate that the units and process steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. In other words, professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of protection of this application.

[0299] Finally, it should be noted that the above content is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims. For example, the various specific technical features described in the above specific implementation methods can be combined in any suitable manner without contradiction. For another example, the various implementation methods of the present application can also be arbitrarily combined, as long as they do not violate the basic idea of ​​the present application, they should also be regarded as the content disclosed in the present application.

Claims

1. A data processing method based on a blockchain network, characterized in that: The blockchain network includes multiple node clusters, the multiple node clusters include a target node cluster, the target node cluster includes a target master node and a target standby node, the method is performed by the target standby node, and the method includes: Detecting whether the target master node fails; In the case where a failure of the target master node is detected, a system contract of the blockchain network is called to generate first transaction information; the first transaction information is used to indicate that the master node of the target node cluster is switched from the target master node to the target standby node; Verifying the first transaction information, and broadcasting the first transaction information to other node clusters among the multiple node clusters except the target node cluster if the first transaction information passes the verification; Obtain a consensus result of a first proposal block corresponding to the first transaction information, and when the consensus result of the first proposal block indicates approval for switching the master node of the target node cluster from the target master node to the target standby node, switch the master node in the target node cluster from the target master node to the target standby node, and add the first proposal block to the blockchain of the target standby node.

2. The method according to claim 1, characterized in that: The switching the master node in the target node cluster from the target master node to the target standby node includes: Synchronize the blockchain of the target master node; The blockchain of the target master node includes a first block, the first block is a block obtained by executing the first configuration transaction information, the first configuration transaction information is generated by calling the system contract and is used to indicate the node configuration information for configuring the target node cluster, and the node configuration information includes at least one of the following: Information used to indicate the master node in the target node cluster, information used to indicate the standby node in the target node cluster, information of nodes associated with the master node in the target node cluster, and information of nodes associated with the standby node in the target node cluster; Based on the information of the node associated with the master node in the target node cluster, a connection relationship is established between the target standby node and the node associated with the master node in the target node cluster.

3. The method according to claim 2, characterized in that The blockchain of the target master node includes a second block, which is a block obtained through the execution result of the second configuration transaction information, and the second configuration transaction information is generated by calling the system contract and is used to indicate the load distribution information for configuring the target node cluster, and the load distribution information includes at least one of the following: The performance index of the target master node, the performance index of the target standby node, and the load distribution strategy adopted by the target node cluster.

4. The method according to any one of claims 1 to 3, characterized in that After adding the first proposal block to the blockchain of the target standby node, the method further includes: When the function of the target master node is restored, synchronizing the data of the target standby node to the target master node, and determining whether to restore the master node of the target node cluster to the target master node; In the case where it is determined that the master node of the target node cluster is restored as the target master node, the system contract is called to generate second transaction information; the second transaction information is used to indicate that the master node of the target node cluster is restored from the target standby node to the target master node; Verifying the second transaction information, and broadcasting the second transaction information to the other node clusters if the second transaction information passes the verification; Obtaining a consensus result of a second proposal block corresponding to the second transaction information, and if the consensus result of the second proposal block indicates that it is in favor of restoring the master node of the target node cluster as the target master node, adding the second proposal block to the blockchain of the target standby node; The blockchain of the target standby node is synchronized to the target master node, and the target master node is triggered to establish a connection relationship with an associated node of the target master node; the associated node includes a node that has a connection relationship with the target master node before the target master node fails.

5. The method according to claim 4, characterized in that The method further comprises: When it is determined that the master node of the target node cluster is not to be restored as the target master node, the master node of the target node cluster is maintained as the target standby node.

6. The method according to claim 4, characterized in that The method further comprises: In a case where it is determined that the master node of the target node cluster is not to be restored as the target master node, based on performance indicators of nodes in the plurality of node clusters, calling the system contract to generate third transaction information; The third transaction information is used to indicate at least one of the following information for configuring the target node cluster: node reconfiguration information, load redistribution information; The node reconfiguration information includes at least one of the following: information indicating a master node in the target node cluster, information indicating a standby node in the target node cluster, information indicating a connection relationship between the master node in the target node cluster and the multiple node clusters, and information indicating a connection relationship between the standby node in the target node cluster and the multiple node clusters; The load redistribution information includes at least one of the following: a performance indicator of the target master node, a performance indicator of the target standby node, and a load distribution strategy adopted by the target node cluster; Verifying the third transaction information, and broadcasting the third transaction information to the other node clusters if the third transaction information passes the verification; Obtain a consensus result of a third proposal block corresponding to the third transaction information, and when the consensus result of the third proposal block indicates approval for reconfiguring the target node cluster, add the third proposal block to the blockchain of the master node in the target node cluster.

7. The method according to any one of claims 1 to 3, characterized in that In the case where the target master node is detected to have failed, calling the system contract of the blockchain network to generate the first transaction information includes: In the case where it is detected that the target master node fails, detecting whether the data of the target master node is consistent with the data of the target standby node; When the data of the target master node is consistent with the data of the target standby node, calling the system contract to generate the first transaction information; When the data of the target master node is inconsistent with the data of the target standby node, the data of the target master node is synchronized to the target standby node, and the system contract is called to generate the first transaction information.

8. The method according to claim 7, characterized in that When it is detected that the target master node fails, detecting whether data of the target master node is consistent with data of the target standby node includes: In the case where it is detected that the target master node fails, detecting the operating state of the target standby node and detecting the connection state between the target standby node and the target master node; When the running state of the target standby node is a normal running state and the connection state is a normal connection state, it is detected whether the data of the target master node is consistent with the data of the target standby node.

9. The method according to any one of claims 1 to 3, characterized in that The obtaining a consensus result of the first proposal block corresponding to the first transaction information includes: When the proposal node cluster of the first proposal block is the target node cluster, executing the first transaction information and obtaining a transaction result of the first transaction information; Determine the first proposal block based on the transaction result of the first transaction information; Broadcasting the first proposal block to the other node clusters, and obtaining voting results of the other node clusters on the first proposal block; Based on the voting results of the other node clusters on the first proposal block, a consensus result of the first proposal is determined.

10. A data processing device based on a blockchain network, characterized in that: The blockchain network includes multiple node clusters, the multiple node clusters include a target node cluster, the target node cluster includes a target master node and a target standby node, and the data processing device includes: A detection unit, used to detect whether the target master node fails; A generating unit, configured to, when detecting that a failure of the target master node occurs, call a system contract of the blockchain network to generate first transaction information; the first transaction information is used to indicate that the master node of the target node cluster is switched from the target master node to the target standby node; a verification unit, configured to verify the first transaction information, and, if the first transaction information passes the verification, broadcast the first transaction information to other node clusters among the multiple node clusters except the target node cluster; A switching unit is used to obtain a consensus result of a first proposal block corresponding to the first transaction information, and when the consensus result of the first proposal block indicates that it is in favor of switching the master node of the target node cluster from the target master node to the target standby node, switch the master node in the target node cluster from the target master node to the target standby node, and add the first proposal block to the blockchain of the target standby node.

11. An electronic device, characterized in that: include: a processor adapted to execute a computer program; A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by the processor, the method according to any one of claims 1 to 9 is implemented.

12. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program causes a computer to execute the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Internet of Things gateway cluster self-healing method and system based on smart contract

    CN121125397A

  • Node switching method, device and system and computer readable storage medium

    CN121125455A