Block chain network upgrading method and related device

By dividing service nodes and upgrade nodes based on node status and version in the blockchain network, and retaining the master node during the upgrade process, the problem of business service capabilities degradation during the blockchain network upgrade process is solved, and smooth upgrades and user experience improvements are achieved.

CN120066552APending Publication Date: 2025-05-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311614536.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

It is difficult for the existing technology to maintain business service capabilities during the blockchain network upgrade process, affecting user experience.

Method used

By determining the service node collection and upgrade node collection based on the node status and node version of the blockchain node, we ensure that the master node remains in the service node collection during the upgrade process, thereby continuing to provide business proposal service response.

Benefits of technology

It realizes the maintenance of business service capabilities during the blockchain network upgrade process to ensure that the user experience is not affected, and adopts a smooth upgrade method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066552A_ABST
    Figure CN120066552A_ABST
Patent Text Reader

Abstract

The invention discloses a block chain network upgrading method and a related device, and the method comprises the steps: determining a service node set and an upgrading node set based on the node states and node versions of block chain nodes, and upgrading the block chain nodes in the upgrading node set from a first version to a second version. In the upgrading process, the block chain nodes in the service node set are used for carrying out proposal service response on the business of the block chain network. And in response to completion of upgrading, re-determining the service node set and the upgrading node set so as to trigger the step of re-upgrading until the node versions of the block chain nodes are all the second versions. On the basis, part of the block chain nodes of the first version are upgraded, part of the block chain nodes of the first version are still used for proposal service response, and in the upgrading process, the main node used for proposal is reserved in the service node set, so that the business service capability in the upgrading process is guaranteed, and a smooth upgrading mode is provided; service use is not affected, and user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and particularly to a method for upgrading a blockchain network and related devices. Background Art

[0002] With the continuous development of blockchain technology, blockchain technology has been widely applied in various industries, such as government, banking and other industries, and the application scenarios cover different fields such as financial payment, supply chain management, electronic certificates, and medical and health.

[0003] After deploying a blockchain network, corresponding business services (such as providing financial payment business services) can be provided based on the blockchain nodes in the blockchain network. Among them, the blockchain nodes can refer to computer devices connected to the blockchain network, and corresponding business services can be provided based on the running application programs. After deployment, with the continuous development of blockchain technology, such as the launch of new functional services, etc., it is necessary to upgrade the blockchain network.

[0004] In the upgrade methods adopted in the related art, during the process of upgrading the blockchain network, it is difficult to provide business services well, which affects business use and the user experience is poor. Summary of the Invention

[0005] In order to solve the above technical problems, the present application provides a method for upgrading a blockchain network and related devices, which ensures the business service ability during the upgrade process, is a smooth upgrade method, does not affect business use, and is beneficial to improving the user experience.

[0006] The embodiments of the present application disclose the following technical solutions:

[0007] On the one hand, the embodiments of the present application provide a method for upgrading a blockchain network, and the method includes:

[0008] Based on the node status of the blockchain nodes in the blockchain network and the node versions of the blockchain nodes, determine a service node set and an upgrade node set. The blockchain nodes in the service node set include the primary nodes indicated by the node status and the blockchain nodes with the node version being the first version. The primary nodes are used to propose proposals for the business of the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version;

[0009] Upgrade the blockchain nodes in the upgrade node set from the first version to the second version, and during the upgrade process, the blockchain nodes in the service node set are used to provide proposal service responses for the business, and during the upgrade process, the primary nodes remain in the service node set;

[0010] In response to the completion of the upgrade, re-determine the service node set and the upgrade node set until the node versions of all the blockchain nodes are the second version.

[0011] In another aspect, an embodiment of the present application provides a blockchain network upgrade device, which is characterized in that the device includes a determination unit and an upgrade unit:

[0012] The determination unit is configured to determine a service node set and an upgrade node set based on the node status and node version of the blockchain nodes in the blockchain network. The blockchain nodes in the service node set include the primary nodes indicated by the node status and the blockchain nodes with the node version being the first version. The primary nodes are used to propose business for the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version;

[0013] The upgrade unit is configured to upgrade the blockchain nodes in the upgrade node set from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set are used to provide proposal service responses for the business. And during the upgrade process, the primary nodes remain in the service node set;

[0014] The determination unit is further configured to, in response to the completion of the upgrade, re-determine the service node set and the upgrade node set until the node versions of all the blockchain nodes are the second version.

[0015] In another aspect, an embodiment of the present application provides a computer device, which includes a processor and a memory:

[0016] The memory is used to store a computer program and transmit the computer program to the processor;

[0017] The processor is configured to execute the method described in any of the foregoing aspects according to the instructions in the computer program.

[0018] In another aspect, an embodiment of the present application provides a computer-readable storage medium, which is used to store a computer program. When the computer program is run on a computer device, the computer device is caused to execute the method described in any of the foregoing aspects.

[0019] In another aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When it runs on a computer device, the computer device is caused to execute the method described in any of the foregoing aspects.

[0020] As can be seen from the above technical solutions, the service node set and the upgrade node set can be determined based on the node status of the blockchain nodes in the blockchain network and the node versions of the blockchain nodes. Among them, the node status can indicate whether the blockchain node is a primary node, and the node version can indicate the version of the blockchain node. Based on these two, it can be determined which blockchain node is the primary node and which blockchain nodes need to be upgraded. Specifically, the blockchain nodes in the service node set include the primary node indicated by the node status and the blockchain nodes with the node version being the first version. Among them, the primary node can be used to propose business for the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version. Then, the blockchain nodes in the upgrade node set can be upgraded from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set can be used to provide proposal service responses for the business of the blockchain network. Since the primary node remains in the service node set during the upgrade process, it is ensured that the primary node will not switch to the node being upgraded during the upgrade process, so that proposals can continue to be made during the upgrade process, achieving the purpose of providing proposal service responses for the business and ensuring the business service capabilities during the upgrade process. Finally, in response to the completion of the upgrade, the service node set and the upgrade node set can be re-determined to trigger the steps of the next upgrade until the node versions of all blockchain nodes are the second version, indicating that all the blockchain nodes that need to be upgraded have been upgraded. Based on this, by upgrading some of the blockchain nodes with the first version, some of the blockchain nodes with the first version are still used for proposal service responses, and during the upgrade process, the primary node remains in the service node set, ensuring the business service capabilities during the upgrade process. This is a smooth upgrade method that will not affect business use and is beneficial to improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 FIG. is a schematic diagram of an application scenario of a blockchain network upgrade method provided by an embodiment of the present application;

[0023] Figure 2 FIG. is a flowchart of a blockchain network upgrade method provided by an embodiment of the present application;

[0024] Figure 3 FIG. is an interaction schematic diagram for detecting blockchain nodes provided by an embodiment of the present application;

[0025] Figure 4 An interaction schematic diagram for upgrading a blockchain node provided by an embodiment of the present application;

[0026] Figure 5 An interaction schematic diagram for upgrading a chain version provided by an embodiment of the present application;

[0027] Figure 6 An interaction schematic diagram for modifying a proposal strategy provided by an embodiment of the present application;

[0028] Figure 7 An architecture schematic diagram of an upgrade service provided by an embodiment of the present application;

[0029] Figure 8 A structural schematic diagram of a distributed system applied to a blockchain system provided by an embodiment of the present application;

[0030] Figure 9 A schematic diagram of a block structure provided by an embodiment of the present application;

[0031] Figure 10 A structural diagram of a blockchain network upgrade device provided by an embodiment of the present application;

[0032] Figure 11 A structural diagram of a terminal provided by an embodiment of the present application;

[0033] Figure 12 A structural diagram of a server provided by an embodiment of the present application. Detailed implementation manners

[0034] The embodiments of the present application will be described below with reference to the accompanying drawings.

[0035] In practical applications, a business application party (such as a banking institution, etc.) can deploy a blockchain network. After deploying the blockchain network, it can use the blockchain nodes in the blockchain network to provide corresponding business services (such as providing financial payment business services). Among them, a blockchain node can refer to a computer device connected to the blockchain network. With the continuous development of blockchain technology, for example, higher versions will introduce new functional services, which requires upgrading the blockchain network in order to provide better business services.

[0036] In the upgrade methods adopted in the related art, it is difficult to provide business services well during the upgrade of the blockchain network. For example, in the stop-service upgrade method adopted in the related art, the blockchain network pauses providing business services when an upgrade is needed until the upgrade is completed and then the business services are restored. However, this results in the inability to provide business services during the upgrade process, affecting business use and resulting in a poor user experience. Another example is the manual upgrade method adopted in the related art. When an upgrade is needed, it requires operation and maintenance personnel to manually perform the upgrade. The upgrade process is cumbersome and not conducive to the upgrade. This manual upgrade method adds uncertainty to the upgrade process, causing instability in business services during the upgrade, and also affects business use, resulting in a poor user experience. It can be seen that the upgrade methods adopted in the related art are difficult to guarantee business services during the upgrade process, will affect business use, and result in a poor user experience.

[0037] Therefore, the embodiments of the present application provide a blockchain network upgrade method and related devices. When an upgrade is needed, the master node and the blockchain nodes to be upgraded can be determined based on the node status and node version of the blockchain nodes, so as to determine a service node set and an upgrade node set. During the upgrade, the blockchain nodes in the upgrade node set can be upgraded from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set can be used to respond to business proposal services. Specifically, the master node included in the service node set can be used to propose business proposals. Since the master node remains in the service node set during the upgrade process, the master node will not switch to the node being upgraded during the upgrade process. Therefore, proposals can continue to be made during the upgrade process to achieve proposal service responses, guaranteeing the business service capabilities during the upgrade process. In response to the completion of the upgrade, the service node set and the upgrade node set can be re-determined to trigger the steps of the next upgrade until the node versions of all blockchain nodes are the second version, completing the entire upgrade. It can be seen that for the blockchain nodes of the first version that need to be upgraded, some are used for upgrade and some are still used to provide proposal service responses. During the upgrade process, the master node remains in the service node set, guaranteeing the business service capabilities during the upgrade process. After some upgrades are completed, the two sets are re-determined to trigger the next round of upgrade until the entire upgrade is completed. This is a smooth upgrade method that will not affect business use and is conducive to improving the user experience.

[0038] The blockchain network upgrade method provided by the embodiments of the present application can be implemented by a computer device, which can be a terminal or a server. Among them, the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal includes but is not limited to smart phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, etc. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, which are not limited in this application. The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, intelligent transportation, audio and video, assisted driving, etc. The embodiments of the present application can be specifically applied to various blockchain network upgrade scenarios.

[0039] It should be noted that in the specific implementation of the present application, during the process of upgrading the blockchain network, it may involve relevant data such as user information. When the above embodiments of the present application are applied to specific products or technologies, the user's separate consent or separate permission needs to be obtained, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0040] Figure 1 shows a schematic diagram of the application scenario of the blockchain network upgrade method provided by the embodiments of the present application. In Figure 1 the shown scenario, the server 100 is taken as an example of the aforementioned computer device for illustration:

[0041] For the sake of easy understanding, in Figure 1 the shown scenario, taking the blockchain network including four blockchain nodes, namely blockchain node 1, blockchain node 2, blockchain node 3, and blockchain node 4, as an example for illustration, regarding the situation of the blockchain nodes included in the blockchain network, Figure 1 it is only an example and does not impose any limitations on the present application.

[0042] First, the server 100 can determine the service node set and the upgrade node set of the blockchain network based on the node status and the node version of the blockchain nodes in the blockchain network. Among them, the node status can indicate whether the blockchain node is a master node, and the node version can indicate the version of the blockchain node. Based on the two, it can be determined which blockchain node is the master node and which blockchain nodes need to be upgraded. Correspondingly, the blockchain nodes in the service node set can include the master node indicated by the node status and the blockchain nodes with the first version of the node version. Among them, the master node can be used to propose a proposal for the business of the blockchain network. In Figure 1In the example, the set of service nodes includes blockchain node 1, blockchain node 2, and blockchain node 3. Among them, the node status of blockchain node 1 indicates that blockchain node 1 is the primary node. The node versions of these three blockchain nodes are all the first version, indicating that all three blockchain nodes need to be upgraded. Also, the node versions of the blockchain nodes in the set of upgrade nodes are all the first version. In Figure 1 In the example, the set of upgrade nodes includes blockchain node 4, and its node version is the first version, indicating that it needs to be upgraded. It should be noted that in Figure 1 , the fact that all three blockchain nodes in the set of service nodes are the first version is only an example, and the number of blockchain nodes in the set of service nodes and the set of upgrade nodes is only an example. In this regard, no restrictions are imposed.

[0043] Next, the server 100 can upgrade blockchain node 4 in the set of upgrade nodes from the first version to the second version. During the upgrade process, the three blockchain nodes in the set of service nodes can be used to provide proposal service responses for the business of the blockchain network. During the upgrade process, the primary node remains in the set of service nodes. Figure 1 In the example, during the upgrade of blockchain node 4, the primary node can be one of blockchain node 1, blockchain node 2, and blockchain node 3. It is precisely because the primary node remains in the set of service nodes that during the upgrade process, the primary node will not switch to the node being upgraded, thus ensuring that proposals can continue to be made during the upgrade process, achieving the purpose of providing proposal service responses for the business, and ensuring the business service capabilities during the upgrade process.

[0044] Finally, in response to the completion of the upgrade, the server 100 can re-determine the set of service nodes and the set of upgrade nodes to trigger the steps of the next upgrade. For example, Figure 1 In the example, blockchain node 3, which originally belonged to the set of service nodes, can be included in the new set of upgrade nodes, and the upgraded blockchain node 4 can be added to the set of service nodes. In this way, a new set of service nodes and a new set of upgrade nodes are determined, triggering the steps of the next upgrade, and ensuring the ability to provide proposal service responses during the upgrade process. This cycle continues until the node versions of all blockchain nodes are the second version, indicating that all blockchain nodes that need to be upgraded have been upgraded.

[0045] Based on this, by upgrading some blockchain nodes of the first version (such as Figure 1 blockchain node 4 in the example), some blockchain nodes of the first version (such as Figure 1In the example, Blockchain Node 1, Blockchain Node 2, and Blockchain Node 3 are still used for proposal service responses. During the upgrade process, the primary node remains in the set of service nodes, ensuring the business service capabilities during the upgrade process. After the upgrade is completed, a new set of service nodes and a new set of service nodes will be re-determined (for example, the new set of service nodes includes Blockchain Node 3) to trigger the upgrade of the first-version blockchain nodes originally used to provide proposal service responses until all are upgraded to the second version. For the business, this is a smooth upgrade method, that is, it can achieve the upgrade without affecting business use, which is beneficial to improving the user experience.

[0046] Figure 2 The figure is a flowchart of a blockchain network upgrade method provided by an embodiment of the present application. Taking the server as an example of the aforementioned computer device for illustration, the method includes S201 - S203:

[0047] S201: Determine a set of service nodes and a set of upgrade nodes based on the node status of the blockchain nodes in the blockchain network and the node versions of the blockchain nodes.

[0048] A blockchain node can refer to the core component in a blockchain network, specifically, it can refer to a computer device connected to the blockchain network. After deploying the blockchain network, corresponding business services can be provided based on the blockchain nodes. With the continuous development of blockchain technology, it may be necessary to upgrade the blockchain network to provide better business services. For example, an upgrade is required when new functional services are launched.

[0049] When an upgrade is needed, the server can first determine a set of service nodes and a set of upgrade nodes based on the node status of the blockchain nodes and the node versions of the blockchain nodes. Among them, the node status can indicate whether the blockchain node is the primary node, and the node version can indicate the version of the blockchain node. Based on these two, it can be determined which blockchain node is the primary node and which blockchain nodes need to be upgraded. In the blockchain network, the primary node can refer to the blockchain node responsible for proposing business for the blockchain network. To ensure the ability to provide proposal service responses to the business during the upgrade process, the blockchain nodes in the set of service nodes determined by the present application can include the primary node indicated by the node status and the blockchain nodes with the first version of the node version. The primary node can be used to propose business for the blockchain network. Moreover, the node versions of the blockchain nodes in the set of upgrade nodes are all the first version, where the first version indicates that an upgrade is required. Based on this, some of the first-version blockchain nodes are divided into the set of service nodes for proposal service responses, and some of the first-version blockchain nodes are divided into the set of upgrade nodes for upgrade.

[0050] It should be noted that this application does not make any restrictions on how to determine the node state and node version. For example, in a possible implementation, the server can determine the node state and node version of the blockchain node based on the interaction method of sending a request and receiving the response corresponding to the request. Specifically, when implementing, the server can send a Node State Request to each blockchain node in the blockchain network. After receiving the node state request, the blockchain node will respond with its current state, which can specifically include, for example, the identity document (ID) of the blockchain node, the node state of whether it is the main node, and the node version and other node state meta-information. Correspondingly, each blockchain node will return the corresponding node state meta-information to the server in the form of a Node State Response. Based on this, the server can determine the node state and node version of the blockchain node. In practical applications, in addition to the node state and node version, the Node State Request can also be used to determine whether the blockchain node is running normally online (i.e., whether it is alive) and the block height of the blockchain node and other information. These information can be used to more comprehensively describe the situation of each blockchain node. It can be understood that only when the blockchain node is in a live state, that is, running normally online, will the subsequent upgrade steps be continued.

[0051] For the sake of easy understanding, still taking the example of the above-mentioned blockchain network including four blockchain nodes, namely blockchain node 1, blockchain node 2, blockchain node 3, and blockchain node 4, for illustration. Specifically, reference can be made to Figure 3 As shown, based on this method of sending Node State Request and receiving Node State Response, the server can determine the node state and node version of these four blockchain nodes. See Figure 3 The main node and the first version marked in the example. Based on this, it can be determined that the main node is blockchain node 1 and all these four blockchain nodes need to be upgraded, which is convenient for executing the steps of determining the service node set and the upgrade node set in S201 and performing subsequent upgrades. It should be noted that in Figure 3 the example, for the sake of easy distinction, a solid arrow is used to exemplify sending the Node State Request, and a dashed arrow is used to exemplify receiving the Node State Response. This is only an example for easy distinction and does not make any restrictions.

[0052] It should also be noted that this application does not make any restrictions on the number of blockchain nodes in the service node set and the upgrade node set, etc. For the sake of easy understanding, the following method is provided as an example in the embodiments of this application:

[0053] In a blockchain network, a certain number of blockchain nodes usually need to participate together in the proposal service response for a business to improve credibility. Therefore, in a possible implementation, the number of blockchain nodes in the service node set meets the quantity threshold condition, where the quantity threshold condition can be used to represent the minimum number of blockchain nodes required for the proposal service response for a business. Based on this, for the service node set, the number of blockchain nodes in it meets the lower limit of the number required for the proposal service response, thus ensuring the ability to respond to the business. In this way, if the number of blockchain nodes in the service node set is set to the minimum value, the first-version blockchain nodes that are not classified in the service node set can form an upgrade node set. In this way, in one round of upgrade, multiple blockchain nodes can be upgraded, which is conducive to improving the upgrade efficiency.

[0054] Among them, regarding the setting of the quantity threshold condition, this application does not make any restrictions. For the convenience of understanding, this application provides the following method as an example:

[0055] In practical applications, blockchain nodes in a blockchain network can have different roles, and different roles can be enabled at different stages. The proposal service response for a business mainly refers to the process of proposing, reaching consensus, voting, etc. for the business. In practical applications, the blockchain nodes participating in the proposal service response are mainly consensus nodes, and the consensus nodes are the key to maintaining data consistency in the entire blockchain network. Therefore, in a possible implementation, to ensure the ability to respond to the proposal service, if the blockchain nodes include consensus nodes, the aforementioned quantity threshold condition can be used to represent the minimum number of consensus nodes required for the proposal service response for a business. Correspondingly, the number of consensus nodes in the service node set meets the quantity threshold condition, and the primary node belongs to the consensus nodes. Based on this, by measuring that the number of consensus nodes in the service node set meets the lower limit of the required consensus nodes, the ability to respond to the proposal service is ensured. In this implementation, the number of blockchain nodes that are not consensus nodes can be unrestricted and can be flexibly set according to the actual situation. For example, when the computer resources for upgrade are relatively sufficient, only the number of consensus nodes in the service node set needs to be ensured, and other blockchain nodes can all be used as blockchain nodes in the upgrade node set, which is conducive to improving the upgrade efficiency.

[0056] In a blockchain network, consensus nodes can include two roles: primary nodes and secondary nodes. Among them, as a role of consensus nodes, the main responsibility of the primary node is to package transactions (such as transaction services) to construct a block in a round of consensus and broadcast the block to other secondary nodes. Therefore, the primary node plays a key role in a round of consensus. If the primary node acts maliciously or crashes, packages invalid transactions or has an incorrect block structure, no consensus will be reached on any block in this round of consensus. In addition, as a role of consensus nodes, the main function of the secondary node is to verify the validity of the block after receiving the block broadcast by the primary node and execute the transactions. When the block is verified to be invalid or the transaction execution results are inconsistent, the secondary node will not vote or vote against the block. When the block is verified to be valid and the transaction execution results are consistent, it will vote for the block. Among them, the process of the primary node constructing a block and broadcasting it to the secondary nodes is the aforementioned proposal process. This way of the primary node proposing and the secondary node verifying is the consensus mechanism of the blockchain network to ensure credibility. In practical applications, the consensus mechanism of the blockchain network can be implemented based on the core engine module. Specifically, the core engine module can refer to the core scheduling module in the consensus node. This module mainly plays a central scheduling role. When the primary node makes a proposal, the consensus engine module of the primary node will notify the core engine module to construct a block and execute the transactions, and finally send the constructed block to the consensus engine module. Subsequently, the consensus engine module will construct a proposal based on the block and broadcast the proposal to other secondary nodes for verification. After receiving the proposal and verifying it to be valid, the secondary node will let its own core engine module verify the validity of the block and execute the transactions. If the transaction execution result of the secondary node is the same as that of the primary node, the block is considered valid, and then voting can be carried out.

[0057] It can be understood that the consensus algorithms adopted by different blockchain networks may vary, and different consensus algorithms may correspond to different applicable scenarios, specifically for example, for providing proposal service responses for different services. Correspondingly, the lower limit of the number of consensus nodes that different consensus algorithms can tolerate may be different. Therefore, in one possible implementation, a quantity threshold condition can be set based on the consensus algorithm adopted by the blockchain network, that is, the quantity threshold condition can be adapted to the specific consensus algorithm adopted. In this way, it can be flexibly applied to scenarios using different consensus algorithms, improving generality. In a blockchain network, the consensus algorithm can be deployed based on a consensus engine, and the consensus engine can be a module in a consensus node. This module mainly includes a consensus algorithm module and a peer-to-peer network module. Among them, the consensus algorithm module can include various specific consensus algorithms, such as the fault-tolerant Raft consensus algorithm, and consensus algorithms such as Practical Byzantine Fault Tolerance (PBFT), Tendermint, and HotStuff. The peer-to-peer network module, also known as peer-to-peer technology, is responsible for the broadcast and reception of proposal and voting messages in a peer-to-peer network communication manner. Peer-to-peer network communication is a communication technology that does not rely on a centralized server but relies on the user group to exchange information. In practical applications, the peer-to-peer network module can be used to broadcast the proposals of the master node to the slave nodes and send the voting messages of the slave nodes from the master node.

[0058] S202: Upgrade the blockchain nodes in the upgrade node set from the first version to the second version.

[0059] After determining the service node set and the upgrade node set, the server can upgrade the blockchain nodes in the upgrade node set from the first version to the second version. The second version can refer to the target version corresponding to this upgrade, such as the version corresponding to the new function. Upgrading from the first version to the second version can achieve the purpose of the upgrade.

[0060] During the upgrade process, the blockchain nodes in the service node set can be used to provide proposal service responses for services. And during the upgrade process, the master node remains in the service node set. Exactly because the master node remains in the service node set, during the upgrade process, the master node will not switch to the node being upgraded, thus ensuring that proposals can continue during the upgrade process, achieving the purpose of providing proposal service responses for services, and ensuring the service capacity during the upgrade process. Based on this, the upgrade can be achieved while ensuring the service capacity of the service, without affecting the use of the service. For the service, it is a solution for the smooth upgrade of blockchain nodes, which can achieve the upgrade of blockchain nodes without stopping the service, ensuring the security and robustness of the blockchain network during the upgrade process, and at the same time being able to continue to provide service externally.

[0061] For ease of understanding, still taking the example of the four blockchain nodes including blockchain node 1, blockchain node 2, blockchain node 3, and blockchain node 4 in the aforementioned blockchain network as an illustration. Specifically, reference can be made to Figure 4 As shown, among them, the service node set may include blockchain node 1, blockchain node 2, and blockchain node 3. Among them, blockchain node 1 is the master node, and the upgrade node set includes blockchain node 4. Correspondingly, the server can send a node upgrade request (Update Node Request) to blockchain node 4 to modify blockchain node 4 from the first version to the second version. It should be noted that Figure 4 Only the process of the server sending an Update Node Request to blockchain node 4 is exemplified. In actual applications, after completing the upgrade of blockchain node 4, a new upgrade node set can be re-determined. For example, the new upgrade node set includes blockchain node 3. Correspondingly, the server can send an Update Node Request to blockchain node 3 to implement the upgrade of blockchain node 3, and so on in a cycle until all four blockchain nodes are in the second version. Taking Figure 4 as an example, one round of upgrade completes the upgrade of one blockchain node. Correspondingly, it can be considered that only one slave node is upgraded each time, so that the other three blockchain nodes are still used for proposal service response, which can guarantee business services. However, it should be noted that Figure 4 This is only an example. In actual applications, when multiple blockchain nodes are included in the determined service node set, the purpose of upgrading multiple blockchain nodes at one time can also be achieved.

[0062] In order to improve the upgrade efficiency, in a possible implementation manner, during the upgrade process, node status detection can also be performed on the blockchain nodes of the first version, and based on this, the current situation of the blockchain nodes can be determined. Specifically, it can refer to whether there is an upgrade error. Correspondingly, in response to the node status detection indicating that the blockchain nodes of the first version have an upgrade error, it means that the upgrade has not been successful. At this time, the steps of upgrading the blockchain nodes with upgrade errors from the first version to the second version can be re-executed. Based on this, an upgrade mechanism based on state adaptation is provided. By detecting the node status during the upgrade process, the step of restarting the upgrade can be adaptively started when an upgrade error occurs, without manual detection of the upgrade situation, which is beneficial to improving the upgrade efficiency. Based on this, the node status can be sensed, and the processing method to be executed can be determined based on the situation indicated by the sensed node status to achieve adaptive upgrade, which is also more friendly to operation and maintenance personnel.

[0063] It should be noted that this application does not make any limitations on how to perform the upgrade. For ease of understanding, the following method is provided as an example in the embodiments of this application:

[0064] In a blockchain network, a blockchain node can refer to a computer device connected to the blockchain network. When providing business services, it can provide corresponding business services by running application programs. Therefore, upgrading a blockchain node can be considered as upgrading the application program of the blockchain node. In practical applications, the application program can be deployed through the node image of the blockchain node. Correspondingly, the node version of the aforementioned blockchain node can be used to indicate the version of the node image of the blockchain node, that is, the version of the application program. Different versions of node images correspond to different versions of application programs, and after being run by the blockchain node, they can provide business services with different functions.

[0065] For the blockchain node of the first version, it can be configured with a node image of the first version. Among them, the node image of the first version can indicate the first version of the business processing logic when the blockchain node responds to a business proposal service, and can also correspond to the application program of the first version. Based on this configuration method, in a possible implementation manner, in the specific implementation of the aforementioned S202, a node image of the second version can be configured for the blockchain nodes in the upgrade node set. Correspondingly, the node image of the second version can indicate the second version of the business processing logic when the blockchain node responds to a business proposal service. Based on this, the purpose of upgrading can be achieved by configuring the node image.

[0066] After completing the configuration of the node image, this application does not make any restrictions on how to respond to a business proposal service. For the convenience of understanding, the embodiments of this application provide the following method as an example:

[0067] It can be understood that before completing the upgrade of all blockchain nodes, the service node set may include both blockchain nodes of the second version and blockchain nodes of the first version. In this scenario, the upgrade is not yet complete. To ensure the stability of business services, in a possible implementation manner, when responding to a proposal service, the blockchain nodes of the second version in the service node set can be used to respond to the business proposal service through the business processing logic of the first version. In this way, by responding to the business proposal service through the business processing logic of the first version, both the business service can be ensured and it can be unaffected by the differences between different versions, which is conducive to ensuring the stability of the business service. In practical applications, some blockchain networks cannot achieve message compatibility between different versions. For this incompatible scenario, after adopting the method that the blockchain nodes of the second version in the service node set can be used to respond to the proposal service through the business processing logic of the first version, the upgrade can be carried out and the business service can be ensured, realizing a smooth upgrade in the incompatible scenario.

[0068] It should be noted that the ways of configuring the node image of the second version are different, and after configuring the node image of the second version, the manifestation forms of the business processing logic of the first version may also vary. For example, if the node image of the first version is retained and the node image of the second version is configured separately, in this configuration method, the business processing logic of the first version can still be reflected by the node image of the first version. Correspondingly, when responding to a business proposal service based on the business processing logic of the first version, the node image of the first version can be directly executed, which is more rapid and convenient. Another example is that the node image of the second version is configured by modifying the node image of the first version. Although the node image of the first version is modified, the business processing logic of the first version is retained during this process. Therefore, in this configuration method, the business processing logic of the first version can be reflected by the node image of the second version.

[0069] It can be understood that in actual applications, some blockchain networks can achieve message compatibility between different versions. For such a compatible scenario, in one way, the blockchain nodes of the second version can respond to business proposal services through the business processing logic of the first version, which is beneficial to improving the stability of business services. In another way, the blockchain nodes of the second version can also respond to business proposal services through the business processing logic of the second version, which is beneficial to more quickly adopting the new functions provided by the high version. Different ways are more flexible.

[0070] S203: In response to the completion of the upgrade, re-determine the service node set and the upgrade node set until the node versions of all blockchain nodes are the second version.

[0071] In response to the completion of the upgrade, the server can re-determine the service node set and the upgrade node set to trigger the steps of the next upgrade, so as to upgrade those blockchain nodes that need to be upgraded and are originally in the service node set for proposal service response until the node versions of all blockchain nodes are the second version, indicating that all the blockchain nodes that need to be upgraded have been upgraded.

[0072] It should be noted that this application does not make any restrictions on how to re-determine the service node set and the upgrade node set. For the convenience of understanding, the embodiments of this application provide the following methods as examples:

[0073] In practical applications, in order to achieve an upgrade and ensure business services, in a possible implementation, the blockchain nodes that have completed the upgrade can be added to the set of service nodes providing business services, and then the blockchain nodes that need to be upgraded in the set of service nodes can be added to the set of upgrade nodes for upgrading. In this way, a cycle is constructed to achieve the upgrade and ensure business services. During specific implementation, in response to the completion of the upgrade, the blockchain nodes of the second version in the set of upgrade nodes can be added to the set of service nodes, and a new set of upgrade nodes can be determined based on the blockchain nodes of the first version in the set of service nodes. Based on this, the blockchain nodes that have completed the upgrade can be reused to provide business services, and the blockchain nodes that were originally used to provide business services but need to be upgraded can suspend providing services for upgrading. By cycling in this way, the upgrade can be achieved and business services can be ensured, realizing a smooth upgrade. For the sake of easy understanding, in Figure 1 the example, after the upgrade of blockchain node 4 is completed, blockchain node 4 can be added to the set of service nodes, and one of the two non-primary blockchain nodes in the set of service nodes (such as blockchain node 3) can be selected and added to the set of upgrade nodes to trigger the upgrade of blockchain node 3. By cycling in this way, until all four blockchain nodes are of the second version.

[0074] It can be understood that the purpose of the upgrade is to provide better business services. Specifically, for example, it can be achieved by executing the updated version. If the aforementioned method of providing a proposal service response to the business through the business processing logic of the first version is adopted, then in order to be able to execute the updated second version to provide better services, in a possible implementation, after all the node versions of the blockchain nodes are of the second version, the business processing logic can be switched so that the business processing logic of the second version can be executed to provide a proposal service response to the business and provide better business services.

[0075] In specific implementation, after the node versions of all blockchain nodes reach the second version, that is, after all blockchain nodes of the first version are successfully upgraded, the blockchain network can be upgraded in terms of the chain version. After the chain version upgrade is completed, the blockchain nodes of the second version can be used to respond to business proposal services through the business processing logic of the second version, so as to provide updated and better business services. Among them, the chain version of the blockchain network can be used to indicate the version of the blockchain network. The chain version before the upgrade can be regarded as the first version. For the case where the chain version is the first version, that is, the first version of the business processing logic is executed to respond to business proposal services. The chain version after the upgrade can be regarded as the second version. For the case where the chain version is the second version, that is, the second version of the business processing logic is executed to respond to business proposal services. Correspondingly, it can also be considered that the chain version specifically refers to the version of the business processing logic executed by the blockchain network in the service node set when responding to business proposal services. Based on this, before all blockchain nodes of the first version are successfully upgraded, that is, during the upgrade process, the first version of the business processing logic is executed to ensure the stability of business services. After all blockchain nodes of the first version are successfully upgraded, the chain version can be upgraded to trigger the execution of the second version of the business processing logic to provide updated and better business services.

[0076] For ease of understanding, still taking the example of the blockchain network including four blockchain nodes, namely blockchain node 1, blockchain node 2, blockchain node 3, and blockchain node 4, as described above, specific reference can be made to Figure 5 As shown. Among them, all four blockchain nodes have been upgraded. At this time, the server can send a chain version update request (Update Version Request) to the blockchain network to achieve the purpose of upgrading the chain version of the blockchain network. Correspondingly, the blockchain network can return a chain version update response (Update Version Response) to the server so that the server can determine whether the chain version upgrade has been successfully completed.

[0077] In actual applications, when configuring the second version of the node image, the first version of the node image can be temporarily unchanged. In this configuration mode with the first version of the node image retained, the blockchain node can be configured with the first version of the node image and the second version of the node image. In this way, when providing business services, the corresponding version of the node image can be executed according to the actual situation to achieve the purpose of executing the business processing logic of the corresponding version, which is more flexible. In this way, it can be considered that after the chain version upgrade is completed, the blockchain node executes the second version of the node image. Therefore, when the chain version is upgraded, the node image of the first version can be replaced by the second version of the node image. In this way, after all upgrades are completed, the first version of the node image is no longer maintained, which is conducive to reducing resource consumption. When the node images of each blockchain node have been completely replaced, the chain version upgrade can be considered to be completed. At this time, the chain version can be modified from the first version to the second version (for example, the version number of the chain can be modified). When the proposal service response is made later, the execution logic will be carried out according to the second version of the node image. At this point, it can be considered that the upgrade of the blockchain network is completed.

[0078] Through the above embodiments, the relevant technologies of how to upgrade and how to respond to proposal services in the blockchain upgrade method provided by this application are explained. In this application, in order to ensure the business service capabilities during the upgrade process, the master node needs to be retained in the service node set during the upgrade process. This application does not make any restrictions on how to determine the master node to achieve the master node remaining in the service node set. For ease of understanding, the embodiments of this application provide the following methods as examples:

[0079] In a blockchain network, in order to achieve the purpose of decentralization, each blockchain node can take turns to be the master node responsible for making proposals, that is, the proposal strategy of the blockchain network is a strategy in which blockchain nodes take turns to make proposals. Therefore, when an upgrade is required, there will be a blockchain node in the blockchain network that is the master node. Therefore, in a possible implementation method, the master node at this time can be set to remain unchanged. In specific implementation, the master node can be the first node, and the first node can refer to the blockchain node that is proposing as the master node in the blockchain network when an upgrade is required. Correspondingly, during the upgrade process, the master node can remain unchanged as the first node. Based on this, the purpose of fixing the master node is achieved, so that during the upgrade process, the first node can continue to make proposals for the business as the master node to ensure the stability of the business service.

[0080] It can be understood that the primary node may also be a blockchain node that needs to be upgraded, that is, the node version of the primary node can be the first version. Correspondingly, in the implementation manner where the primary node remains unchanged as the first node, the present application also provides a method for upgrading the primary node. Specifically, after all the blockchain nodes of the first version except the primary node are upgraded, the primary node can be switched from the first node to the second node, and the first node can be determined as the new upgrade node set, where the second node is a blockchain node of the second version in the service node set. Based on this, after all the other blockchain nodes except the primary node are upgraded, the primary node can be switched, and the first node that was originally the primary node can be determined as the new upgrade node set, thereby triggering an upgrade loop to achieve the upgrade of the first node. It can be seen that on the basis of keeping the primary node unchanged to improve the stability of business services, the switching time of the primary node is correspondingly provided to achieve the upgrade of the first node (the original primary node), so as to complete the upgrade of all blockchain nodes.

[0081] Among them, the present application does not make any restrictions on how to keep the primary node unchanged as the first node. For the sake of understanding, the following method is provided as an example in the embodiments of the present application:

[0082] In the strategy of blockchain nodes in the blockchain network taking turns to propose proposals, the number of times each blockchain node proposes a proposal as the primary node can be equal. To achieve the purpose of keeping the primary node unchanged as the first node during the upgrade process, in a possible implementation manner, the proposal strategy of the blockchain network can be modified to achieve the purpose of keeping the primary node unchanged as the first node. Since the first node refers to the blockchain node that is currently proposing a proposal as the primary node in the blockchain network when an upgrade is needed, the proposal strategy of the blockchain network can be modified before the aforementioned S202. Specifically, when implementing, before upgrading the blockchain nodes in the upgrade node set from the first version to the second version, the proposal strategy of the blockchain network can be modified so that the primary node proposes a proposal continuously for the first preset number of times, where the cumulative proposal duration corresponding to the primary node proposing a proposal continuously for the first preset number of times is greater than the upgrade duration required to upgrade all the blockchain nodes of the first version except the primary node. Based on this, during the upgrade of the blockchain nodes of the first version except the first node, the primary node has always been the first node, achieving the purpose of keeping the primary node unchanged as the first node. By modifying it to the primary node proposing a proposal continuously for the first preset number of times, the duration of the first node as the primary node is extended, and during this period when the first node is the primary node, other blockchain nodes of the first version can be upgraded.

[0083] For the sake of understanding, still taking the example of the aforementioned blockchain network including four blockchain nodes, namely blockchain node 1, blockchain node 2, blockchain node 3, and blockchain node 4, for illustration, specifically, reference can be made toFigure 6 As shown in Figure 6 , the service node set may include blockchain node 1, blockchain node 2, and blockchain node 3, where blockchain node 1 is the primary node, and the upgrade node set includes blockchain node 4. Before sending an Update Node Request to blockchain node 4, that is, before the aforementioned S202, the server may first send a Continuous Block Request to the blockchain network to modify the proposal policy of the blockchain network to the primary node (i.e., blockchain node 1) proposing continuously for a first preset number of times. Correspondingly, the blockchain network may return a Continuous Block Response to the server so that the server can determine whether the proposal policy is modified successfully.

[0084] It should be noted that the present application does not make any limitation on the setting of the first preset number of times. For example, the first preset number of times may be determined according to the number of blockchain nodes that can be upgraded in one upgrade and the upgrade duration required for one upgrade. This proposal policy of the primary node proposing continuously for a certain number of times can also be referred to as the primary node continuous block generation policy in the blockchain network. For example, the first preset number of times may be 1000, which means that the primary node continuously generates 1000 blocks (such as the first node generates 1000 blocks continuously as the primary node).

[0085] In practical applications, the primary node only needs to remain in the service node set. During the upgrade process, the service node set may also include blockchain nodes of the second version that have completed the upgrade. For example, in the aforementioned compatible scenario, the service node set already includes blockchain nodes of the second version. Another example is that after completing one round of upgrade and adding blockchain nodes of the second version to the service node set, the service node set can also include blockchain nodes of the second version. The blockchain nodes of the second version in the service node set do not need to be upgraded. Therefore, in another possible implementation, if the primary node needs to be upgraded, the primary node can be directly switched to a blockchain node that does not need to be upgraded. Specifically, during implementation, if the node version of the blockchain node serving as the primary node is the first version, during the upgrade process, the primary node can be switched to a blockchain node of the second version in the service node set. Based on this, the primary node can be directly switched to a blockchain node in the service node set that does not need to be upgraded, enabling the primary node to remain in the service node set, ensuring business services while no longer requiring separate attention to the timing of primary node upgrade, which is beneficial to simplifying the upgrade process.

[0086] In some scenarios, there may be one blockchain node of the second version in the service node set. In this case, it is only necessary to switch the master node to the blockchain node of the second version. In some other scenarios, there may be multiple blockchain nodes of the second version in the service node set. In this case, when switching, in a possible implementation, the master node can be switched to one of the multiple blockchain nodes of the second version to ensure the stability of the business service. In another possible implementation, after the master node is switched to the blockchain node of the second version in the service node set, the multiple blockchain nodes of the second version in the service node set can also be determined as the master node in turn. Based on this, a mechanism is provided for multiple blockchain nodes that do not need to be upgraded to take turns as the master node. In this way, the master node can be retained in the service node set, and the master node can be rotated. The master node is a blockchain node that does not need to be upgraded, so the rotation of the master node will not affect the upgrade of business services and blockchain nodes, and the rotation method is conducive to balancing proposals.

[0087] In some scenarios (such as the aforementioned compatible scenarios), the blockchain network may already include blockchain nodes that do not need to be upgraded, that is, before the upgrade, there are already blockchain nodes of the second version. Therefore, in another possible implementation method, before the aforementioned S201, a blockchain node with a node version of the second version can also be determined as a master node, and the proposal strategy of the blockchain network can be modified to the second preset number of consecutive proposals by the master node, and the cumulative proposal duration corresponding to the second preset number of consecutive proposals by the master node is greater than the upgrade duration required for upgrading all blockchain nodes of the first version. Based on this, before the upgrade is required and has not been performed, a method of directly specifying a blockchain node that does not need to be upgraded as the master node is provided, so that the master node does not need to be upgraded directly, and the proposal strategy is modified to the strategy of continuous proposals of this master node. In this way, after the upgrade begins, there is no need to pay attention to the situation of the master node, which can not only guarantee business services, but also help simplify the upgrade process. Accordingly, after all blockchain nodes have the second version, the proposal strategy of the blockchain network can be modified to blockchain nodes taking turns to propose. In this way, after all blockchain nodes have been upgraded, proposal services can continue to be responded to with the proposal-taking-turn strategy, which is conducive to balanced proposals. It can be understood that the process of modifying the proposal strategy to take turns to propose is the same as the aforementioned Figure 6 The process of the example is similar, please refer to the above introduction for details.

[0088] For better understanding, an upgrade service is constructed in the embodiment of the present application. For details, please refer to Figure 7 , Figure 7The figure shows a schematic architecture diagram of an upgrade service. The upgrade service can include a basic module, a chain management module, an identity management module, and a chain request management module. Specifically:

[0089] The basic module can be used to provide various basic services. Specifically, it can include general components such as network components, storage components, log components, key service components, and other tool components, and can verify nodes to provide basic services (such as providing network services, data uploading and storing services, etc.).

[0090] The chain management module can be used to manage the blockchain resources of the blockchain network connected by the upgrade service. Specifically, it can include a chain configuration management component and a chain access identity component. Among them, the chain configuration management component can be used to manage the basic network configuration information of the blockchain network, and the chain access identity component can be used to implement the identity management function when accessing the blockchain, such as recording the identity of accessing the blockchain network for traceability.

[0091] The identity management module can be used to manage the identity of the upgrade service itself, mainly including two core identity management components: an identity authentication component and a security identity component. Among them, the identity authentication component can be used to sign when querying information about the upgrade service externally to ensure the authenticity and credibility of the upgrade service-related information, and the security identity component can be used for identity security when the upgrade service and the blockchain network conduct message transmission. Based on this, the security of the upgrade can be improved.

[0092] The chain request management module can be used to manage requests and handle responses between the upgrade service, the blockchain network, and blockchain nodes. It is also a key module in the upgrade service and can specifically include a blockchain software development kit (SDK), a liveness detection component, a node status detection component, a block production strategy management component, and a chain version change component. Among them, the blockchain SDK is responsible for communicating with the blockchain network and blockchain nodes and can send relevant commands to the blockchain network and blockchain nodes. The liveness detection component is responsible for detecting the status of each blockchain node in the blockchain network, specifically including whether the blockchain node is alive and whether its running status is normal. The specific information it can contain includes the node ID of the blockchain node, the current block height, the version of the current blockchain, etc. The node status detection component can be used to obtain the status information of the blockchain node, specifically including meta-information about the node status such as the node ID of the blockchain node and whether the blockchain node is the primary node. The block production strategy management component can be used to modify the proposal strategy (i.e., the block production strategy) of the blockchain network by initiating a chain configuration type transaction, thereby achieving the purpose of modifying the continuous proposal of the primary node. The chain version change component can be used to manage the chain version of the blockchain network. In practical applications, each version of the blockchain network has a corresponding version number. After all blockchain nodes are upgraded, that is, when the node versions of the blockchain nodes are all the second version, the chain version can be upgraded to modify the version number to a new version number.

[0093] In practical applications, the aforementioned server can call Figure 7For the example of the upgrade service, in the specific implementation process, a corresponding upgrade interface can be configured in the blockchain network. This upgrade interface can be used for the interaction between the blockchain network and the server to achieve the upgrade. Based on this, in this application, by constructing the upgrade service, relevant instructions and requests are sent to the blockchain network by calling the upgrade service, so as to achieve the adaptive upgrade of the blockchain network. The specific upgrade process can be to first probe the liveness of the blockchain nodes in the blockchain network, detect that the blockchain nodes are alive and running normally, then set the proposal strategy to continuous proposal by the master node, and then send node upgrade requests to each slave node in turn. Specifically, it can be to stop the slave node being upgraded and configure the node image of this slave node. After the upgrade is completed, this node can be restarted to provide business services. Until all the blockchain nodes are upgraded, the continuous proposal strategy can be deleted and modified to round-robin proposal, and the version number of the blockchain can also be upgraded. Based on this, by constructing the upgrade service to interact with the blockchain network, not only can the upgrade of the blockchain network be realized, but also this implementation method only needs to configure an upgrade interface in the blockchain network, and will not affect the underlying implementation logic of the blockchain network. That is, it can achieve non-invasive automatic upgrade of the blockchain network, and there is no need for operation and maintenance personnel to manually determine the node status and node version based on the blockchain network logs for manual upgrade, which is more automated and intelligent, and the upgrade efficiency is higher.

[0094] For ease of understanding, taking the foregoing Figure 3 as an example, the server can call the liveness detection component and the node status detection component in the upgrade service to send the Node State Request and receive the Node State Response, so as to determine the node status and node version of the blockchain node. Taking the foregoing Figure 5 as an example, the server can call the chain version change component in the upgrade network to upgrade the chain version of the blockchain network. Taking the foregoing Figure 6 as an example, the server can call the block production strategy management component in the upgrade service to modify the proposal strategy of the blockchain network. It can be understood that no matter which component in the upgrade service the server calls, the corresponding specific implementation process can refer to the introduction in the foregoing method embodiment part, and will not be elaborated here.

[0095] As can be seen from the above technical solution, the service node set and the upgrade node set can be determined based on the node status and node version of the blockchain nodes in the blockchain network. Among them, the node status can indicate whether the blockchain node is a primary node, and the node version can indicate the version of the blockchain node. Based on these two, it can be determined which blockchain node is the primary node and which blockchain nodes need to be upgraded. Specifically, the blockchain nodes in the service node set include the primary node indicated by the node status and the blockchain nodes with the node version being the first version. Among them, the primary node can be used to propose a proposal for the business of the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version. Then, the blockchain nodes in the upgrade node set can be upgraded from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set can be used to provide a proposal service response for the business of the blockchain network. Since the primary node remains in the service node set during the upgrade process, it is ensured that the primary node will not switch to the node being upgraded during the upgrade process, so that proposals can continue to be made during the upgrade process, achieving the purpose of providing a proposal service response for the business and ensuring the business service ability during the upgrade process. Finally, in response to the completion of the upgrade, the service node set and the upgrade node set can be re-determined to trigger the steps of the next upgrade until the node versions of all blockchain nodes are the second version, indicating that all the blockchain nodes that need to be upgraded have been upgraded. Based on this, by upgrading some of the blockchain nodes with the first version, some of the blockchain nodes with the first version are still used for the proposal service response, and during the upgrade process, the primary node remains in the service node set, ensuring the business service ability during the upgrade process. This is a smooth upgrade method that will not affect the business use and is beneficial to improving the user experience.

[0096] For better understanding, the embodiment of the present application also provides an upgrade system. The upgrade system involved in the embodiment of the present application can be a distributed system formed by connecting a client and multiple blockchain nodes (referring to any form of computing device connected to the network, such as a server, a user terminal) through network communication. Taking the blockchain system formed by the distributed system as the blockchain network as an example, specific reference can be made to Figure 8 , Figure 8FIG. 0 is an alternative structural diagram of the distributed system 800 provided by an embodiment of the present application when applied to a blockchain system, which is composed of multiple blockchain nodes 801 (any form of computing device connected to the network, such as a server or a user terminal) and a client 802. A peer-to-peer (Peer To Peer) network is formed among the multiple blockchain nodes. The peer-to-peer protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In a distributed system, any computing device (such as a server or a terminal) can join and become a blockchain node. A blockchain node can include a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0097] See Figure 8 An exemplary blockchain system, and the functions involved in each blockchain node can include: a routing function, which is a basic function of a blockchain node and is used to support communication among blockchain nodes. In addition to the routing function, it can also have an application function, which is used to be deployed in the blockchain and can implement specific services according to actual business requirements, record the data related to the implemented functions to form record data, carry a digital signature in the record data to indicate the source of the business data, and send the record data to other blockchain nodes in the blockchain system. When other blockchain nodes successfully verify the source and integrity of the record data, they add the record data to a temporary block. In blockchain systems deployed in different application scenarios, the corresponding implemented services may vary. For example, in a blockchain network deployed in a financial scenario, the implemented service may be, for example, the transaction of electronic currency.

[0098] Moreover, it can also have a blockchain, which can include a series of blocks (Blocks) that are sequentially connected in the order of generation. Once a new block (for example, the block constructed by the aforementioned master node when proposing a business) is added to the blockchain, it will not be removed again. The block records the record data (such as the business data corresponding to the aforementioned business) submitted by the blockchain nodes in the blockchain system. For a better understanding, see Figure 9 as shown in Figure 9 FIG. 12 is an alternative diagram of the block structure (Block Structure) provided by an embodiment of the present application. Each block can include the hash value of the transaction records stored in this block (the hash value of this block), the hash value of the previous block, and business data. The blocks are connected through hash values to form a blockchain. In addition, the block can also include information such as the timestamp when the block is generated. A blockchain, in essence, is a decentralized database, which is a string of data blocks generated by using cryptographic methods. Each data block contains relevant information for verifying the validity (anti-counterfeiting) of the information and generating the next block.

[0099] It should be noted that, based on the implementation manners provided in the above aspects of the present application, further combinations can be made to provide more implementation manners.

[0100] Based on Figure 2 Corresponding to the blockchain network upgrade method provided by the embodiment, the embodiment of the present application further provides a blockchain network upgrade device 1000, and the blockchain network upgrade device 1000 includes a determination unit 1001 and an upgrade unit 1002:

[0101] The determination unit 1001 is configured to determine a service node set and an upgrade node set based on the node status of the blockchain nodes in the blockchain network and the node versions of the blockchain nodes. The blockchain nodes in the service node set include the master nodes indicated by the node status and the blockchain nodes with the node version being the first version. The master nodes are used to propose business for the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version;

[0102] The upgrade unit 1002 is configured to upgrade the blockchain nodes in the upgrade node set from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set are used to provide proposal service responses for the business, and during the upgrade process, the master nodes remain in the service node set;

[0103] The determination unit 1001 is further configured to, in response to the completion of the upgrade, re-determine the service node set and the upgrade node set until the node versions of all the blockchain nodes are the second version.

[0104] In a possible implementation manner, the determination unit is further configured to:

[0105] In response to the completion of the upgrade, add the blockchain nodes with the second version in the upgrade node set to the service node set, and determine a new upgrade node set based on the blockchain nodes with the first version in the service node set.

[0106] In a possible implementation manner, during the upgrade process, the master node remains the first node unchanged. If the node version of the master node is the first version, the determination unit is further configured to:

[0107] Switch the master node from the first node to the second node, and determine the first node as the new upgrade node set. The second node is the blockchain node with the second version in the service node set.

[0108] In a possible implementation manner, the device further includes a modification unit:

[0109] The modification unit is used to modify the proposal strategy of the blockchain network to the master node continuously proposing a first preset number of times, and the cumulative proposal duration corresponding to the first preset number of consecutive proposals by the master node is greater than the upgrade duration required to complete the upgrade of all blockchain nodes of the first version except the master node.

[0110] In a possible implementation, if the node version of the blockchain node serving as the master node is the first version, during the upgrade process, the determining unit is further configured to:

[0111] Switch the master node to the blockchain node of the second version in the service node set.

[0112] In a possible implementation manner, if there are multiple blockchain nodes of the second version in the service node set, the determining unit is further used to:

[0113] Multiple blockchain nodes of the second version in the service node set are determined as the master nodes in turn.

[0114] In a possible implementation manner, the determining unit is further configured to:

[0115] Determine a blockchain node whose node version is the second version as the master node, and modify the proposal strategy of the blockchain network to allow the master node to propose continuously for a second preset number of times, and the cumulative proposal duration corresponding to the second preset number of consecutive proposals by the master node is greater than the upgrade duration required to upgrade all blockchain nodes of the first version;

[0116] The modification unit is further used to modify the proposal strategy of the blockchain network to allow the blockchain nodes to propose in turns.

[0117] In one possible implementation, the number of blockchain nodes in the service node set satisfies a quantity threshold condition, where the quantity threshold condition is used to represent the minimum number of blockchain nodes required to perform a proposal service response to the business.

[0118] In one possible implementation, the blockchain node includes a consensus node, the quantity threshold condition is used to represent the minimum number of consensus nodes required to respond to the proposal service of the business, the number of consensus nodes in the service node set satisfies the quantity threshold condition, and the master node belongs to the consensus node.

[0119] In a possible implementation, the device further includes a detection unit:

[0120] The detection unit is configured to detect the node status of the blockchain node of the first version during the upgrade process;

[0121] The upgrade unit is further configured to, in response to the node status detection indicating that the upgrade of the blockchain node of the first version reports an error, re-execute the step of upgrading the blockchain node with the upgrade error from the first version to the second version.

[0122] In a possible implementation manner, the blockchain node of the first version is configured with the node image of the first version, and the upgrade unit is further configured to:

[0123] Configure the node image of the second version for the blockchain nodes in the upgrade node set.

[0124] In a possible implementation manner, if the service node set includes the blockchain node of the second version, the blockchain node of the second version in the service node set is configured to perform a proposal service response to the service through the business processing logic of the first version.

[0125] In a possible implementation manner, the upgrade unit is further configured to:

[0126] Perform a chain version upgrade on the blockchain network. After the chain version upgrade is completed, the blockchain node of the second version is configured to perform a proposal service response to the service through the business processing logic of the second version.

[0127] As can be seen from the above technical solutions, the service node set and the upgrade node set can be determined based on the node status and node version of the blockchain nodes in the blockchain network. Among them, the node status can indicate whether the blockchain node is a primary node, and the node version can indicate the version of the blockchain node. Based on these two, it can be determined which blockchain node is the primary node and which blockchain nodes need to be upgraded. Specifically, the blockchain nodes in the service node set include the primary node indicated by the node status and the blockchain nodes with the node version being the first version. Among them, the primary node can be used to propose business for the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version. Then, the blockchain nodes in the upgrade node set can be upgraded from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set can be used to provide proposal service responses for the business of the blockchain network. Since the primary node remains in the service node set during the upgrade process, it is ensured that during the upgrade process, the primary node will not switch to the node being upgraded, thus ensuring that proposals can continue during the upgrade process, achieving the purpose of providing proposal service responses for the business, and ensuring the business service capabilities during the upgrade process. Finally, in response to the completion of the upgrade, the service node set and the upgrade node set can be re-determined to trigger the steps of the next upgrade until the node versions of all blockchain nodes are the second version, indicating that all the blockchain nodes that need to be upgraded have been upgraded. Based on this, by upgrading some of the blockchain nodes with the first version, some of the blockchain nodes with the first version are still used for proposal service responses, and during the upgrade process, the primary node remains in the service node set, ensuring the business service capabilities during the upgrade process. This is a smooth upgrade method that will not affect business use and is beneficial to improving the user experience.

[0128] An embodiment of the present application further provides a computer device, which may be a terminal. Taking the terminal as a smart phone as an example:

[0129] Figure 11 The following shows a block diagram of a part of the structure of the smart phone provided by the embodiment of the present application. Refer to Figure 11 , the smart phone includes: a Radio Frequency (RF) circuit 1110, a memory 1120, an input unit 1130, a display unit 1140, a sensor 1150, an audio circuit 1160, a Wireless Fidelity (WiFi) module 1170, a processor 1180, and a power supply 1190, etc. The input unit 1130 may include a touch panel 1131 and other input devices 1132. The display unit 1140 may include a display panel 1141. The audio circuit 1160 may include a speaker 1161 and a microphone 1162. Those skilled in the art can understand, Figure 11The smartphone structure shown does not constitute a limitation on smartphones and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0130] The memory 1120 can be used to store software programs and modules. The processor 1180 executes various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 1120. The memory 1120 may mainly include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, the image playback function, etc.); the data storage area can store data created according to the use of the smartphone (such as audio data, phone book, etc.). In addition, the memory 1120 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0131] The processor 1180 is the control center of the smartphone, connecting various parts of the entire smartphone using various interfaces and lines. By running or executing the software programs and / or modules stored in the memory 1120, and by calling the data stored in the memory 1120, it executes various functions of the smartphone and processes data. Optionally, the processor 1180 may include one or more processing units; preferably, the processor 1180 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 1180.

[0132] In this embodiment, the steps executed by the processor 1180 in the smartphone can be implemented based on Figure 11 the structure shown.

[0133] The computer device provided by the embodiments of the present application may also be a server. Please refer to Figure 12 as shown, Figure 12This is the structural diagram of the server 1200 provided by the embodiments of the present application. The server 1200 may vary greatly due to different configurations or performances. It may include one or more processors, such as a central processing unit (CPU) 1222, and a memory 1232, and one or more storage media 1230 (such as one or more mass storage devices) for storing application programs 1242 or data 1244. Among them, the memory 1232 and the storage media 1230 may be transient storage or persistent storage. The program stored in the storage media 1230 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Further, the central processing unit 1222 may be configured to communicate with the storage media 1230 and execute a series of instruction operations in the storage media 1230 on the server 1200.

[0134] The server 1200 may further include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input / output interfaces 1258, and / or one or more operating systems 1241, such as Windows Server TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM and so on.

[0135] In this embodiment, the central processing unit 1222 in the server 1200 may perform the following steps:

[0136] Based on the node status and node version of the blockchain nodes in the blockchain network, determine the service node set and the upgrade node set. The blockchain nodes in the service node set include the primary nodes indicated by the node status and the blockchain nodes with the node version being the first version. The primary nodes are used to propose business for the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version;

[0137] Upgrade the blockchain nodes in the upgrade node set from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set are used to provide proposal service responses for the business, and during the upgrade process, the primary nodes remain in the service node set;

[0138] In response to the completion of the upgrade, re-determine the service node set and the upgrade node set until the node versions of all blockchain nodes are the second version.

[0139] According to one aspect of the present application, there is provided a computer-readable storage medium for storing a computer program, which, when run on a computer device, causes the computer device to execute the blockchain network upgrade method described in each of the foregoing embodiments.

[0140] According to one aspect of the present application, there is provided a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, causing the computer device to execute the methods provided in various alternative implementations of the foregoing embodiments.

[0141] The descriptions of the processes or structures corresponding to the foregoing various drawings each have their own focuses. For parts not detailed in a certain process or structure, reference may be made to the relevant descriptions of other processes or structures.

[0142] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the foregoing drawings are used to distinguish similar objects and do not necessarily need to be used to describe a specific order or sequence. It should be understood that the data used in this way may be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0143] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.

[0144] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0145] In addition, each functional unit in various embodiments of the present application may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0146] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the related technology, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0147] As described above, the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of various embodiments of the present application.

Claims

1. A method for upgrading a blockchain network, characterized in that, the method includes: Based on the node status of blockchain nodes in the blockchain network and the node versions of the blockchain nodes, determining a service node set and an upgrade node set. The blockchain nodes in the service node set include the primary nodes indicated by the node status and the blockchain nodes with the node version being the first version. The primary nodes are used to propose business for the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version; Upgrading the blockchain nodes in the upgrade node set from the first version to the second version, and during the upgrade process, the blockchain nodes in the service node set are used to provide proposal service responses for the business, and during the upgrade process, the primary nodes remain in the service node set; In response to the completion of the upgrade, re-determining the service node set and the upgrade node set until the node versions of all blockchain nodes are the second version.

2. The method according to claim 1, characterized in that, the step of in response to the completion of the upgrade, re-determining the service node set and the upgrade node set includes: In response to the completion of the upgrade, adding the blockchain nodes with the second version in the upgrade node set to the service node set, and determining a new upgrade node set based on the blockchain nodes with the first version in the service node set.

3. The method according to claim 2, characterized in that, During the upgrade process, the primary node remains the first node unchanged. If the node version of the primary node is the first version, after all the blockchain nodes with the first version except the primary node are completely upgraded, the method further includes: Switching the primary node from the first node to the second node, and determining the first node as the new upgrade node set, where the second node is the blockchain node with the second version in the service node set.

4. The method according to claim 3, characterized in that, Before upgrading the blockchain nodes in the upgrade node set from the first version to the second version, the method further includes: Modifying the proposal strategy of the blockchain network so that the primary node proposes continuously for a first preset number of times, and the cumulative proposal duration corresponding to the primary node proposing continuously for the first preset number of times is greater than the upgrade duration required to completely upgrade all the blockchain nodes with the first version except the primary node.

5. The method according to claim 1, characterized in that, If the node version of the blockchain node serving as the primary node is the first version, during the upgrade process, the method further includes: Switching the primary node to the blockchain node with the second version in the service node set.

6. The method according to claim 5, characterized in that, If there are multiple blockchain nodes with the second version in the service node set, after switching the primary node to the blockchain node with the second version in the service node set, it includes: Multiple blockchain nodes of the second version in the service node set are determined as the master nodes in turn.

7. The method according to claim 1, It is characterized in that Before determining the service node set and the upgrade node set, the method further includes: Determine a blockchain node whose node version is the second version as the master node, and modify the proposal strategy of the blockchain network to allow the master node to propose continuously for a second preset number of times, and the cumulative proposal duration corresponding to the second preset number of consecutive proposals by the master node is greater than the upgrade duration required to upgrade all blockchain nodes of the first version; After the node versions of the blockchain nodes are all the second version, the method further includes: The proposal strategy of the blockchain network is modified so that the blockchain nodes make proposals in turns.

8. The method according to claim 1, It is characterized in that The number of blockchain nodes in the service node set satisfies a quantity threshold condition, and the quantity threshold condition is used to represent the minimum number of blockchain nodes required to provide a proposal service response to the business.

9. The method according to claim 8, It is characterized in that The blockchain nodes include consensus nodes, the quantity threshold condition is used to represent the minimum number of consensus nodes required to respond to the proposal service of the business, the number of consensus nodes in the service node set satisfies the quantity threshold condition, and the master node belongs to the consensus node.

10. The method according to claim 1, It is characterized in that The method further comprises: During the upgrade process, performing node status detection on the blockchain nodes of the first version; In response to the node status detection indicating that the first version of the blockchain node has an upgrade error, the step of upgrading the blockchain node that has an upgrade error from the first version to the second version is re-executed.

11. The method according to any one of claims 1 to 10, It is characterized in that The blockchain node of the first version is configured with a node image of the first version, and upgrading the blockchain nodes in the upgraded node set from the first version to the second version includes: The node image of the second version is configured for the blockchain nodes in the upgraded node set.

12. The method according to claim 11, It is characterized in that If the service node set includes the blockchain node of the second version, the blockchain node of the second version in the service node set is used to make a proposal service response to the business through the business processing logic of the first version.

13. The method according to claim 12, It is characterized in that After the node versions of the blockchain nodes are all the second version, the method further includes: The blockchain network is subjected to a chain version upgrade. After the chain version upgrade is completed, the blockchain node of the second version is used to provide a proposal service response to the business through the business processing logic of the second version.

14. A blockchain network upgrade device, It is characterized in that The device comprises a determination unit and an upgrade unit: The determining unit is configured to determine a service node set and an upgrade node set based on the node status of blockchain nodes in a blockchain network and the node versions of the blockchain nodes. The blockchain nodes in the service node set include the primary nodes indicated by the node status and the blockchain nodes with the node version being the first version. The primary nodes are used to propose business for the blockchain network. The node versions of the blockchain nodes in the upgrade node set are all the first version; The upgrade unit is configured to upgrade the blockchain nodes in the upgrade node set from the first version to the second version. During the upgrade process, the blockchain nodes in the service node set are used to provide proposal service responses for the business. And during the upgrade process, the primary nodes remain in the service node set; The determining unit is further configured to, in response to the completion of the upgrade, re-determine the service node set and the upgrade node set until the node versions of all the blockchain nodes are the second version.

15. A computer device, characterized in that, the computer device includes a processor and a memory: the memory is used to store a computer program and transmit the computer program to the processor; the processor is configured to execute the method according to any one of claims 1-13 based on the instructions in the computer program.

16. A computer-readable storage medium, characterized in that, the computer-readable storage medium is used to store a computer program. When the computer program is run on a computer device, the computer device is caused to execute the method according to any one of claims 1-13.

17. A computer program product, including a computer program, characterized in that, when it runs on a computer device, the computer device is caused to execute the method according to any one of claims 1-13.