Grayscale upgrade method and device for blockchain service platform, and electronic equipment

By adding operating environment tags to blockchain transactions, the stability of transaction processing logic in blockchain grayscale upgrades is solved, and stable transaction processing without perceived environmental changes is achieved.

CN114816493BActive Publication Date: 2025-08-26ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210473950.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2025-08-26
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

In blockchain technology, it is difficult to effectively identify the software operating environment of the transaction initiator during the grayscale upgrade process, resulting in the switching of new and old business smart contracts that may affect the stability and business execution of the blockchain.

Method used

By adding a running environment tag to blockchain transactions, the node devices of the blockchain service platform can determine whether the transaction is a test transaction related to grayscale upgrade based on the tag, and forward it to the node devices that support the transaction processing logic of the new or old versions for processing.

Benefits of technology

It realizes that there is no need to perceive environmental changes during the blockchain grayscale upgrade process, ensures the stability and reliability of transaction processing, and reduces risks and problem discoveries caused by environmental switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114816493B_ABST
    Figure CN114816493B_ABST
Patent Text Reader

Abstract

This specification provides a method, apparatus, and electronic device for grayscale upgrade of a blockchain service platform. The method includes: receiving a blockchain transaction initiated by a transaction initiator; in response to the blockchain transaction, adding an operating environment tag indicating the type of the software operating environment of the transaction initiator to the blockchain transaction; sending the blockchain transaction with the operating environment tag to the blockchain, so that the blockchain responds to the blockchain transaction and determines whether the blockchain transaction is a test transaction related to the grayscale upgrade based on the operating environment tag. If the blockchain transaction is determined to be a test transaction related to the grayscale upgrade, the test transaction is forwarded to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of this specification relate to the field of blockchain technology, and in particular, to a grayscale upgrade method and device, and electronic equipment for a blockchain service platform. Background Art

[0002] Blockchain technology, also known as distributed ledger technology, is an emerging technology that enables multiple computing devices to jointly maintain a complete distributed database. Due to its decentralized, transparent nature, the ability of each computing device to participate in database records, and the rapid synchronization of data between computing devices, blockchain technology has been widely applied in numerous fields. Summary of the Invention

[0003] The embodiments of this specification provide a method, device, and electronic device for improving information security.

[0004] According to a first aspect of an embodiment of this specification, a method for grayscale upgrading of a blockchain service platform is provided, wherein transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; the method includes:

[0005] Receive blockchain transactions initiated by the transaction initiator;

[0006] In response to the blockchain transaction, adding an operating environment tag indicating the type of the software operating environment of the transaction initiator to the blockchain transaction;

[0007] The blockchain transaction with the operating environment tag added is sent to the blockchain, so that the blockchain responds to the blockchain transaction, determines whether the blockchain transaction is a test transaction related to the grayscale upgrade based on the operating environment tag, and when it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, forwards the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwards the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing.

[0008] Optionally, the grayscale upgrade for the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0009] The adding of an operating environment tag indicating the type of the software operating environment to the blockchain transaction initiated by the transaction initiator includes:

[0010] Determining the software operating environment of the transaction initiator;

[0011] If the software operating environment is determined to be a pre-release environment, adding a pre-release environment tag indicating that the software operating environment is a pre-release environment to the blockchain transaction initiated by the transaction initiator;

[0012] If the software operating environment is determined to be a grayscale release environment, adding a grayscale environment tag indicating that the software operating environment is a grayscale release environment to the blockchain transaction initiated by the transaction initiator;

[0013] If the software operating environment determined to be a production environment is a production environment, a production environment tag indicating that the software operating environment is a production environment is added to the blockchain transaction initiated by the transaction initiator.

[0014] Optionally, the method further includes:

[0015] In response to a notification message issued by the blockchain service platform that the transaction processing logic supported by at least some node devices in the blockchain is replaced with a new version of the transaction processing logic after the grayscale upgrade, the current software operating environment is switched to the pre-release environment.

[0016] Optionally, if the software operating environment is a pre-release environment, the method further includes:

[0017] In response to the notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the pre-release test, the current software operating environment is switched from the pre-release environment to the grayscale environment.

[0018] Optionally, if the software operating environment is a grayscale environment, the method further includes:

[0019] In response to the notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the grayscale release test, the current software running environment is switched from the grayscale release environment to the production environment.

[0020] According to a second aspect of an embodiment of this specification, a method for grayscale upgrade of a blockchain service platform is provided, wherein transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade, the method comprising:

[0021] Receiving a blockchain transaction initiated by a transaction initiator; wherein the blockchain transaction includes an operating environment tag indicating the type of the software operating environment of the transaction initiator;

[0022] In response to the blockchain transaction, determining, based on the operating environment tag, whether the blockchain transaction is a test transaction related to the grayscale upgrade;

[0023] If it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, the test transaction is forwarded to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing.

[0024] Optionally, the grayscale upgrade for the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0025] The determining, based on the operating environment tag, whether the blockchain transaction is a test transaction related to the grayscale upgrade includes:

[0026] Determining the type of the operating environment tag carried by the blockchain transaction;

[0027] If the operating environment tag carried by the blockchain transaction is a pre-release environment tag, determining that the blockchain transaction is a pre-release test transaction related to the pre-release stage;

[0028] If the operating environment tag carried by the blockchain transaction is a grayscale environment tag, determining that the blockchain transaction is a grayscale release test transaction related to the grayscale release stage;

[0029] If the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry an operating environment tag, it is determined that the blockchain transaction is not a test transaction related to the grayscale upgrade.

[0030] Optionally, the blockchain service platform maintains a traffic diversion strategy for the blockchain transaction;

[0031] In the pre-release phase for the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase, forwarding the test transaction to a node device supporting the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device supporting the old version of the transaction processing logic for transaction processing;

[0032] If it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, further cross-contract calling the new version of the business smart contract to execute the blockchain transaction; otherwise, further cross-contract calling the old version of the business smart contract to execute the blockchain transaction, including:

[0033] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0034] Optionally, during the phased release of the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase; or a phased release test transaction related to the phased release phase, forwarding the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing;

[0035] If it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, further cross-contract calling the new version of the business smart contract to execute the blockchain transaction; otherwise, further cross-contract calling the old version of the business smart contract to execute the blockchain transaction, including:

[0036] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage; or, a grayscale release test transaction related to the grayscale release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0037] Optionally, the method further includes:

[0038] Based on the preset grayscale upgrade progress, the grayscale upgrade range of the node devices in the blockchain is gradually increased, and the binary codes corresponding to the transaction processing logic supported by the node devices within the grayscale upgrade range are replaced with the binary codes corresponding to the new version of the transaction processing logic.

[0039] Optionally, the method further includes:

[0040] Obtaining the execution result of the blockchain transaction from the node device;

[0041] Determining, based on the execution result, whether the new version of the transaction processing logic has passed the pre-release test corresponding to the pre-release stage; if so, sending a notification message to the transaction initiator indicating that the new version of the transaction processing logic has passed the pre-release test; and

[0042] Based on the execution result, determine whether the new version of the transaction processing logic has passed the grayscale release test corresponding to the grayscale release stage; if so, send a notification message to the transaction initiator that the new version of the transaction processing logic has passed the grayscale release test.

[0043] Optionally, the method further includes:

[0044] In response to the new version of the transaction processing logic passing the pre-release test, switching the traffic diversion strategy from the pre-release stage traffic diversion strategy to the phased release stage traffic diversion strategy; and

[0045] In response to the new version of the transaction processing logic passing the phased release test, switching the traffic diversion strategy from the phased release phase traffic diversion strategy to the post-phased release traffic diversion strategy;

[0046] Among them, the traffic diversion strategy after the grayscale upgrade is completed includes: forwarding the blockchain transaction to the node device that supports the new version of the transaction processing logic for transaction processing by default.

[0047] Optionally, the method further includes:

[0048] In response to the new version of the transaction execution logic failing the pre-release test or the phased release test, switching the traffic diversion strategy to a default traffic diversion strategy;

[0049] The default traffic diversion strategy includes forwarding the blockchain transaction to a node device that supports the old version of the transaction processing logic for transaction processing by default.

[0050] According to a third aspect of the embodiments of this specification, a device for grayscale upgrading of a blockchain service platform is provided, wherein the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; the device includes:

[0051] Transaction receiving unit, receiving blockchain transactions initiated by the transaction initiator;

[0052] a label adding unit, in response to the blockchain transaction, adding an operating environment label indicating a type of the software operating environment of the transaction initiator to the blockchain transaction;

[0053] The grayscale upgrade unit sends the blockchain transaction with the operating environment tag added to the blockchain, so that the blockchain responds to the blockchain transaction, determines whether the blockchain transaction is a test transaction related to the grayscale upgrade based on the operating environment tag, and when it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, forwards the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwards the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing.

[0054] Optionally, the grayscale upgrade for the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0055] The label adding unit includes:

[0056] Determine a subunit to determine the software operating environment of the transaction initiator;

[0057] A first adding subunit, if the software operating environment is determined to be a pre-release environment, adds a pre-release environment tag to the blockchain transaction initiated by the transaction initiator, indicating that the software operating environment is a pre-release environment;

[0058] A second adding subunit, if the software operating environment is determined to be a grayscale release environment, adds a grayscale environment tag to the blockchain transaction initiated by the transaction initiator, indicating that the software operating environment is a grayscale release environment;

[0059] The third adding subunit adds a production environment tag indicating that the software operating environment is a production environment to the blockchain transaction initiated by the transaction initiator if the determined software operating environment is a production environment.

[0060] Optionally, the device further includes:

[0061] The replacement unit switches the current software running environment to the pre-release environment in response to a notification message issued by the blockchain service platform to replace the transaction processing logic supported by at least some node devices in the blockchain with a new version of the transaction processing logic after the grayscale upgrade.

[0062] Optionally, if the software operating environment is a pre-release environment, the device further includes:

[0063] The environment switching unit switches the current software running environment from the pre-release environment to the grayscale environment in response to a notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the pre-release test.

[0064] Optionally, if the software operating environment is a grayscale environment, the device further includes:

[0065] The environment switching unit switches the current software running environment from the grayscale release environment to the production environment in response to a notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the grayscale release test.

[0066] According to a fourth aspect of the embodiments of this specification, a device for grayscale upgrading of a blockchain service platform is provided, wherein the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; the device includes:

[0067] A receiving unit, configured to receive a blockchain transaction initiated by a transaction initiator; wherein the blockchain transaction includes an operating environment tag indicating a type of a software operating environment of the transaction initiator;

[0068] a determining unit, in response to the blockchain transaction, determining, based on the operating environment tag, whether the blockchain transaction is a test transaction related to the grayscale upgrade;

[0069] The processing unit forwards the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing if it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade; otherwise, the processing unit forwards the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing.

[0070] Optionally, the grayscale upgrade for the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0071] The determining unit includes:

[0072] A determination subunit determines the type of the operating environment tag carried by the blockchain transaction; if the operating environment tag carried by the blockchain transaction is a pre-release environment tag, the blockchain transaction is determined to be a pre-release test transaction related to the pre-release stage; if the operating environment tag carried by the blockchain transaction is a grayscale environment tag, the blockchain transaction is determined to be a grayscale release test transaction related to the grayscale release stage; if the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry an operating environment tag, the blockchain transaction is determined not to be a test transaction related to the grayscale upgrade.

[0073] Optionally, the blockchain service platform maintains a traffic diversion strategy for the blockchain transaction;

[0074] In the pre-release phase for the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase, forwarding the test transaction to a node device supporting the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device supporting the old version of the transaction processing logic for transaction processing;

[0075] The processing unit includes:

[0076] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0077] Optionally, during the phased release of the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase; or a phased release test transaction related to the phased release phase, forwarding the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing;

[0078] The processing unit includes:

[0079] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage; or, a grayscale release test transaction related to the grayscale release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0080] Optionally, the device further includes:

[0081] The grayscale upgrade subunit, based on a preset grayscale upgrade progress, sequentially increases the grayscale upgrade range of the node devices in the blockchain, and sequentially replaces the binary codes corresponding to the transaction processing logic supported by the node devices within the grayscale upgrade range with the binary codes corresponding to the new version of the transaction processing logic.

[0082] Optionally, the device further includes:

[0083] An acquisition subunit, which acquires the execution result of the blockchain transaction from the node device;

[0084] The feedback sub-unit determines, based on the execution result, whether the new version of the transaction processing logic has passed the pre-release test corresponding to the pre-release stage; if so, sends a notification message to the transaction initiator stating that the new version of the transaction processing logic has passed the pre-release test; and determines, based on the execution result, whether the new version of the transaction processing logic has passed the grayscale release test corresponding to the grayscale release stage; if so, sends a notification message to the transaction initiator stating that the new version of the transaction processing logic has passed the grayscale release test.

[0085] Optionally, the device further includes:

[0086] a first strategy switching unit, in response to the new version of the transaction processing logic passing the pre-release test, switching the traffic diversion strategy from the traffic diversion strategy of the pre-release stage to the traffic diversion strategy of the phased release stage;

[0087] A second strategy switching unit, in response to the new version of the transaction processing logic passing the grayscale release test, switches the traffic diversion strategy from the traffic diversion strategy in the grayscale release stage to the traffic diversion strategy after the grayscale upgrade is completed; wherein the traffic diversion strategy after the grayscale upgrade is completed includes: by default forwarding the blockchain transaction to a node device that supports the new version of the transaction processing logic for transaction processing.

[0088] Optionally, the device further includes:

[0089] The third strategy switching unit switches the traffic diversion strategy to a default traffic diversion strategy in response to the new version of the transaction execution logic failing the pre-release test or the grayscale release test; wherein the default traffic diversion strategy includes: forwarding the blockchain transaction to a node device that supports the old version of the transaction processing logic for transaction processing by default.

[0090] According to a fifth aspect of the embodiments of this specification, an electronic device is provided, including:

[0091] processor;

[0092] a memory for storing processor-executable instructions;

[0093] In which, the processor is configured as a grayscale upgrade method for any of the above-mentioned blockchain service platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0094] Figure 1 This is a flowchart of a blockchain transaction execution method provided in an embodiment of this specification;

[0095] Figure 2 This is a flowchart of a grayscale upgrade method for smart contracts in a blockchain provided in an embodiment of this specification;

[0096] Figure 3 This is a flowchart of a grayscale upgrade method for smart contracts in a blockchain provided in an embodiment of this specification;

[0097] Figure 4 This is a flowchart of a grayscale upgrade method for a blockchain service platform provided in an embodiment of this specification;

[0098] Figure 5 This is a flowchart of a grayscale upgrade method for a blockchain service platform provided in an embodiment of this specification;

[0099] Figure 6 This is a hardware structure diagram of a device provided in an embodiment of this specification;

[0100] Figure 7 This is a module diagram of a blockchain transaction execution device provided in one embodiment of this specification;

[0101] Figure 8 This is a module diagram of a grayscale upgrade device for smart contracts in a blockchain provided by an embodiment of this specification;

[0102] Figure 9 This is a module diagram of a grayscale upgrade device for smart contracts in a blockchain provided by an embodiment of this specification;

[0103] Figure 10 This is a module diagram of a grayscale upgrade device for a blockchain service platform provided in an embodiment of this specification;

[0104] Figure 11 This is a module diagram of a grayscale upgrade device for a blockchain service platform provided in one embodiment of this specification. DETAILED DESCRIPTION

[0105] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of this specification, as detailed in the appended claims.

[0106] The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a," "the," and "the" used in this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items. A plurality herein may refer to two or more instances.

[0107] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information without departing from the scope of this specification. Depending on the context, the term "if" as used herein may be interpreted as "when," "when," or "in response to determining."

[0108] In related technologies, grayscale upgrades refer to a smooth transition upgrade method. During a blockchain grayscale upgrade, A / B testing is first used. This involves having some users continue to use the old version of the blockchain while others start using the new version. If users have no objections to the new version, the new version is gradually expanded to all users, and all users are gradually migrated to the new version.

[0109] The grayscale upgrade method can ensure the stability of the entire blockchain. Problems can be discovered and handled in a timely manner in the initial grayscale stage. Since the user group in the initial grayscale stage is small, even if problems occur, the impact range is limited.

[0110] In practical applications, the blockchain needs to perceive the grayscale changes of the blockchain for blockchain transactions initiated by the transaction initiator, so as to use the new and old versions of the grayscale changes to execute blockchain transactions initiated by different users.

[0111] This specification aims to provide a method for adding corresponding operating environment tags to blockchain transactions based on the software operating environment of the transaction initiator without the need to perceive the grayscale changes of the blockchain, so that the node devices of the blockchain can execute blockchain transactions based on the software operating environment determined by the operating environment tags.

[0112] Please refer to the following Figure 1 , Figure 1 This specification provides a blockchain transaction execution method, which can be applied to an access program corresponding to a blockchain; the method may include the following steps:

[0113] Step 110: In response to the blockchain transaction initiated by the transaction initiator, determine the software operating environment of the transaction initiator.

[0114] Step 120: Based on the determined software operating environment, add an operating environment tag indicating the type of the software operating environment of the transaction initiator to the blockchain transaction;

[0115] Step 130: Send the blockchain transaction with the operating environment tag added to the node device in the blockchain, so that the node device responds to the blockchain transaction, determines the software operating environment of the transaction initiator based on the operating environment tag, and executes the blockchain transaction based on the determined software operating environment.

[0116] In this specification, the access program may include an SDK access program integrated into a blockchain service platform. The blockchain service platform may include a BaaS platform (also referred to as a BaaS cloud) for providing Blockchain as a Service (BaaS). The BaaS platform can provide pre-written software for activities occurring on the blockchain (such as subscriptions and notifications, user authentication, database management, and remote updates). This provides easy-to-use, one-click deployment, fast verification, and flexible customization of blockchain services for user client-side computing devices coupled to the BaaS platform. This can accelerate the development, testing, and rollout of blockchain business applications, facilitating the implementation of blockchain business application scenarios across various industries.

[0117] During implementation, the transaction initiator can initiate a blockchain transaction to the blockchain service platform through a user client, add an operating environment tag to the blockchain transaction through an access program on the blockchain service platform, and send the blockchain transaction with the added operating environment tag to the node device in the blockchain.

[0118] In one embodiment, the software operating environment of the transaction initiator maintains operating parameters corresponding to the software operating environment;

[0119] Determining the software operating environment of the transaction initiator includes:

[0120] The operating parameters maintained in the software operating environment are read, and the type of the software operating environment of the transaction initiator is determined based on the read operating parameters.

[0121] In this specification, the operating parameters can be sent to the access program together with the blockchain transaction, so that the access line can read the operating parameters maintained in the software operating environment, and then determine the type of the software operating environment of the transaction initiator based on the read operating parameters.

[0122] In addition, the operating parameters may also be the operating parameters that the access program requests from the transaction initiator after receiving the blockchain transaction.

[0123] In this specification, the access program may determine the software operating environment of the transaction initiator by utilizing the operating parameters corresponding to the software operating environment maintained in the software operating environment of the transaction initiator.

[0124] In one embodiment, the value of the operating parameter is used to indicate the type of the software operating environment; wherein the value of the operating parameter is synchronously updated when the software operating environment is switched;

[0125] The determining the type of the software operating environment of the transaction initiator based on the read operating parameters includes:

[0126] The type of the software operating environment of the transaction initiator is determined based on the read value of the operating parameter.

[0127] In this specification, different values ​​of the operating parameters may correspond to different types of software operating environments, which may include pre-release environments, phased release environments, and production environments.

[0128] In this specification, the operating parameters include environment variables for indicating the type of the software operating environment.

[0129] In one embodiment, a smart contract for identifying the software running environment is deployed on the blockchain;

[0130] The determining the type of the software operating environment of the transaction initiator based on the read operating parameters includes:

[0131] Submitting the read operating parameters as call parameters to the smart contract to call the identification logic contained in the smart contract to identify the type of the software operating environment of the transaction initiator based on the operating parameters;

[0132] Obtain an identification result of the smart contract for the type of the software operating environment, and determine the type of the software operating environment of the transaction initiator based on the identification result.

[0133] In this specification, the identification of the type of the software operating environment of the transaction initiator based on the operating parameters may include analyzing the operating parameters and identifying the type based on the rules satisfied by the operating parameters; or maintaining a list or array in the smart contract to record the correspondence between the operating parameters and the types of software operating environments, and then identifying the type of the software operating environment corresponding to the operating parameters based on this correspondence.

[0134] In one embodiment, the blockchain transaction includes a test transaction related to a grayscale upgrade. For example, the blockchain transaction includes a test transaction related to a grayscale upgrade for a business smart contract deployed on the blockchain; or the blockchain transaction includes a test transaction related to a grayscale upgrade for transaction processing logic supported by each node device on the blockchain.

[0135] Take the test transaction related to the grayscale upgrade of the business smart contract deployed on the blockchain as an example.

[0136] Blockchains generally offer the functionality of smart contracts. Smart contracts on blockchains are contracts whose execution can be triggered by blockchain transactions. Smart contracts can be defined in code. By coding specific business logic into business smart contracts and publishing them to the blockchain, complex business logic can be implemented on the blockchain.

[0137] Since business execution logic constantly changes with business development, business smart contracts also need to be upgraded. However, due to the immutable nature of blockchain, business smart contracts that have already been published on the blockchain cannot be modified. Therefore, upgrading a business smart contract is not a simple modification of the contract code. Instead, a new version of the business smart contract (including the upgraded business logic) must be released. The business smart contract that is currently in effect on the blockchain must then be switched to this new version, thereby invalidating the previous version of the business smart contract.

[0138] In practice, due to the potential for incompatibility issues during business smart contract upgrades, if all business smart contracts on a blockchain are upgraded to a new version, incompatibility with the old version could disrupt normal business operations. This is why grayscale upgrades for business smart contracts have emerged. Grayscale upgrades ensure the stability of the blockchain where business smart contracts are deployed, allowing issues to be identified and addressed promptly during the initial grayscale phase. Due to the smaller user base during this initial grayscale phase, any issues that arise are likely to have a limited impact.

[0139] Since the blockchain deploys both old and new versions of business smart contracts, it is necessary to detect whether the blockchain transaction initiated by the transaction initiator is a test transaction related to the grayscale upgrade, and call the corresponding business smart contract to execute the blockchain transaction.

[0140] Specifically, in this specification, the blockchain deploys an old version of the business smart contract before the grayscale upgrade, a new version of the business smart contract after the grayscale upgrade; and a management smart contract for grayscale upgrade management of the business smart contract;

[0141] Accordingly, in response to the blockchain transaction, step 130 determines the software operating environment of the transaction initiator based on the operating environment tag, and executes the blockchain transaction based on the determined software operating environment, including:

[0142] In response to the blockchain transaction, the management smart contract deployed on the blockchain is called, and based on the operating environment tag, it is determined whether the blockchain transaction is a test transaction related to the grayscale upgrade of the business smart contract deployed on the blockchain. If so, the new version of the business smart contract is further called across contracts to execute the blockchain transaction; if not, the old version of the business smart contract is further called across contracts to execute the blockchain transaction.

[0143] In this specification, a management smart contract is deployed on the blockchain to manage the calls of new and old versions of business smart contracts, so that grayscale testing of business smart contracts can be completed under the management of the management smart contract.

[0144] To better illustrate the implementation of test transactions related to grayscale upgrades of business smart contracts deployed on the blockchain, please refer to the following example: Figure 2 As shown, this specification provides a method for grayscale upgrade of smart contracts in a blockchain, wherein the blockchain deploys an old version of a business smart contract before the grayscale upgrade and a new version of the business smart contract after the grayscale upgrade; and a management smart contract for grayscale upgrade management of the business smart contract; the method includes:

[0145] Step 210: Receive a smart contract call transaction initiated by a call initiator for the business smart contract.

[0146] In this embodiment, the call initiator corresponds to the aforementioned Figure 1 The transaction initiator in the smart contract call transaction corresponds to the aforementioned Figure 1 In addition, with the blockchain transactions Figure 1 Same, Figure 2 The illustrated embodiment is applied to an access procedure corresponding to a blockchain.

[0147] In addition, the access program may also enable an SDK access program on a user client that directly interfaces with the blockchain.

[0148] Step 220: In response to the smart contract call transaction, add an operating environment tag indicating the type of the software operating environment of the call initiator to the smart contract call transaction.

[0149] In this specification, the grayscale upgrade of the business smart contract includes a pre-release phase for the new version of the business smart contract; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0150] Accordingly, in step 220, adding an operating environment tag indicating the type of the software operating environment of the call initiator to the smart contract call transaction includes:

[0151] Determining the software operating environment of the call initiator;

[0152] If the software operating environment is determined to be a pre-release environment, adding a pre-release environment tag indicating that the software operating environment is a pre-release environment to the smart contract call transaction initiated by the call initiator;

[0153] If the software operating environment is determined to be a grayscale release environment, adding a grayscale environment tag indicating that the software operating environment is a grayscale release environment to the smart contract call transaction initiated by the call initiator;

[0154] If the determined software running environment is a production environment; or, the production environment tag indicating that the software running environment is a production environment is not added for the smart contract call transaction initiated by the call initiator in the software running environment, then the production environment tag indicating that the software running environment is a production environment is added for the smart contract call transaction initiated by the call initiator.

[0155] In this specification, determining the software operating environment of the call initiator may be the same as determining the software operating environment of the transaction initiator in the aforementioned step 110, and will not be repeated here.

[0156] In this manual, the process of grayscale upgrade can be to first perform pre-release (corresponding to the pre-release environment), complete the pre-release test, and switch to the grayscale release environment; then perform grayscale release (corresponding to the grayscale release environment), complete the grayscale release test, and then switch to the production environment.

[0157] Step 230: Send the smart contract call transaction with the operating environment tag added to the node device in the blockchain, so that the node device responds to the smart contract call transaction, calls the management smart contract deployed on the blockchain, and determines whether the smart contract call transaction is a test transaction related to the grayscale upgrade based on the operating environment tag. When it is determined that the smart contract call transaction is a test transaction related to the grayscale upgrade, further cross-contract call the new version of the business smart contract to execute the smart contract call transaction; otherwise, further cross-contract call the old version of the business smart contract to execute the smart contract call transaction.

[0158] In this specification, test transactions related to the grayscale upgrade may include pre-release test transactions and grayscale test transactions. Accordingly, in the pre-release phase, smart contract call transactions carrying the pre-release tag are test transactions; in the grayscale release phase, smart contract call transactions carrying both the pre-release tag and the grayscale release tag are test transactions. For test transactions, the new version of the business smart contract can be called across contracts to execute the smart contract call transaction; if it is not a test transaction, the old version of the business smart contract can be called across contracts to execute the smart contract call transaction.

[0159] During implementation, the blockchain can expose the contract address of the management smart contract to users, making them unaware of the existence of the business smart contract. In this way, although the smart contract call transaction initiated by the user carries the contract address of the management smart contract, it is actually used to call the business smart contract.

[0160] This is also the reason why, in this manual, although the access program receives a smart contract call transaction for the business smart contract, it calls the management smart contract by default; and after the node device responds to the smart contract call transaction, it first calls the management smart contract based on the contract address of the management smart contract, and then further calls the new or old version of the business smart contract through cross-contract call.

[0161] In one embodiment, before step 210, the method further includes:

[0162] Obtaining the contract code of the new version of the business smart contract;

[0163] Construct a smart contract creation transaction containing the contract code, and send the smart contract creation transaction to a node device in the blockchain, so that the node device executes the smart contract creation, creates the new version of the business smart contract in the blockchain based on the contract code, and completes the deployment of the new version of the business smart contract.

[0164] This example provides a way to deploy a new version of a business smart contract in the blockchain, thereby starting a grayscale upgrade for the business smart contract in the blockchain.

[0165] In one embodiment, the access program may switch the current software running environment to the pre-release environment in response to the completion of deployment of the new version of the business smart contract on the blockchain.

[0166] In this specification, after a new version of a business smart contract is deployed, the access program triggers a software runtime environment switch request to switch the current software runtime environment to a pre-release environment. This switch can be implemented by directly switching the database.

[0167] In this manual, the process of grayscale upgrade can be to first perform pre-release (corresponding to the pre-release environment), complete the pre-release test, and switch to the grayscale release environment; then perform grayscale release (corresponding to the grayscale release environment), complete the grayscale release test, and then switch to the production environment.

[0168] In one embodiment, if the software operating environment is a pre-release environment, the method further includes:

[0169] Obtaining the execution result of the smart contract call transaction from the node device;

[0170] Based on the execution result, determine whether the new version of the business smart contract passes the pre-release test corresponding to the pre-release stage; if so, switch the current software running environment from the pre-release environment to the grayscale release environment.

[0171] In this specification, the access program can analyze the execution results of the pre-release test transactions to determine whether the execution results meet the test expectations; if they do, it is determined that the new version of the business smart contract has passed the pre-release test corresponding to the pre-release stage, which means that the pre-release test is completed. At this time, the current software running environment can be switched from the pre-release environment to the gray release environment, so as to carry out the next stage of gray release.

[0172] In one embodiment, if the software operating environment is a phased release environment, the method further includes:

[0173] Obtaining the execution result of the smart contract call transaction from the node device;

[0174] Based on the execution result, determine whether the new version of the business smart contract passes the grayscale release test corresponding to the grayscale release stage; if so, switch the current software running environment from the grayscale release environment to the production environment.

[0175] In this specification, the access program can analyze the execution results of the grayscale release test transactions to determine whether the execution results meet the test expectations; if they do, it is determined that the new version of the business smart contract has passed the grayscale release test corresponding to the grayscale release stage, which means that the grayscale release test is completed. At this time, the current software running environment can be switched from the grayscale release environment to the production environment to enter the production stage.

[0176] Through the above embodiments, this specification aims to define a standard process for grayscale testing of business smart contracts for grayscale upgrades.

[0177] By deploying a management smart contract on the blockchain, the calls of new and old versions of business smart contracts can be managed, so that grayscale testing of business smart contracts can be completed under the management of the management smart contract.

[0178] This manual also provides the corresponding Figure 2 In an embodiment of a method in which a node device of a blockchain is used as an execution subject, the blockchain deploys an old version of a business smart contract before a grayscale upgrade and a new version of a business smart contract after a grayscale upgrade; and a management smart contract for grayscale upgrade management of the business smart contract; the embodiment, for example Figure 3 Shown include:

[0179] Step 310: Receive a smart contract call transaction initiated by a call initiator for the business smart contract; wherein the smart contract call transaction includes an operating environment tag indicating the type of the software operating environment of the call initiator.

[0180] Step 320: In response to the smart contract call transaction, call the management smart contract deployed on the blockchain, and determine whether the smart contract call transaction is a test transaction related to the grayscale upgrade based on the operating environment tag.

[0181] In one embodiment, the grayscale upgrade of the business smart contract includes a pre-release phase for the new version of the business smart contract; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0182] Accordingly, determining whether the smart contract call transaction is a test transaction related to the grayscale upgrade based on the operating environment tag in 320 includes:

[0183] Determining the type of the runtime environment tag carried by the smart contract call transaction;

[0184] If the running environment tag carried by the smart contract call transaction is a pre-release environment tag, determining that the smart contract call transaction is a pre-release test transaction related to the pre-release stage;

[0185] If the running environment tag carried by the smart contract call transaction is a grayscale environment tag, then the smart contract call transaction is determined to be a grayscale release test transaction related to the grayscale release stage;

[0186] If the operating environment tag carried by the smart contract call transaction is a production environment tag, or the smart contract call transaction does not carry the operating environment tag, it is determined that the smart contract call transaction is not a test transaction related to the grayscale upgrade.

[0187] This example is similar to the above Figure 2 The examples in are similar, and the specific details can be referred to the previous examples, which will not be repeated here.

[0188] In step 330, if it is determined that the smart contract call transaction is a test transaction related to the grayscale upgrade, the new version of the business smart contract is further called across contracts to execute the smart contract call transaction; otherwise, the old version of the business smart contract is further called across contracts to execute the smart contract call transaction.

[0189] In this specification, the management smart contract maintains a traffic diversion strategy for the smart contract call transaction.

[0190] In the pre-release phase for the business smart contract, the traffic diversion strategy includes: if the smart contract call transaction is a pre-release test transaction related to the pre-release phase, calling the new version of the business smart contract to execute the smart contract call transaction; otherwise, calling the old version of the business smart contract to execute the smart contract call transaction;

[0191] The corresponding step 330 includes:

[0192] If it is determined that the smart contract call transaction is a pre-release test transaction related to the pre-release stage, based on the traffic diversion strategy of the pre-release stage, the new version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the new version of the business smart contract is further called across contracts to execute the smart contract call transaction; otherwise, the old version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the old version of the business smart contract is further called across contracts to execute the smart contract call transaction.

[0193] In addition, during the phase of grayscale release of the business smart contract, the traffic diversion strategy includes: if the smart contract call transaction is a pre-release test transaction related to the pre-release phase; or a grayscale release test transaction related to the grayscale release phase, calling the new version of the business smart contract to execute the smart contract call transaction; otherwise, calling the old version of the business smart contract to execute the smart contract call transaction;

[0194] The corresponding step 330 includes:

[0195] If it is determined that the smart contract call transaction is a pre-release test transaction related to the pre-release stage; or, a grayscale release test transaction related to the grayscale release stage, based on the traffic diversion strategy of the pre-release stage, the new version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the new version of the business smart contract is further called across contracts to execute the smart contract call transaction; otherwise, the old version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the old version of the business smart contract is further called across contracts to execute the smart contract call transaction.

[0196] In one embodiment, the node device may further receive an upgrade request for the business smart contract initiated by a call initiator when the business smart contract passes the pre-release test corresponding to the pre-release stage; wherein the upgrade request may include a call parameter for instructing the traffic diversion strategy maintained by the management smart contract to switch from the traffic diversion strategy of the pre-release stage to the traffic diversion strategy of the phased release stage;

[0197] In response to the upgrade request, the strategy switching logic contained in the management smart contract is called, and based on the call parameters, the traffic diversion strategy is switched from the traffic diversion strategy of the pre-release stage to the traffic diversion strategy of the grayscale release stage.

[0198] In this specification, an upgrade request can be a request data or a smart contract call transaction for the above-mentioned management smart contract.

[0199] In one embodiment, the node device may receive an upgrade request for the business smart contract initiated by a call initiator when the business smart contract passes the grayscale release test corresponding to the grayscale release stage; wherein the upgrade request includes a call parameter for instructing the traffic diversion strategy maintained by the management smart contract to switch from the traffic diversion strategy in the grayscale release stage to the traffic diversion strategy after the grayscale upgrade is completed;

[0200] In response to the upgrade request, calling the strategy switching logic included in the management smart contract, and switching the traffic diversion strategy from the traffic diversion strategy in the grayscale release phase to the traffic diversion strategy after the grayscale upgrade is completed based on the call parameters, so as to complete the grayscale upgrade for the business smart contract;

[0201] In this specification, the traffic diversion strategy after the grayscale upgrade is completed includes: calling the new version of the business smart contract by default to execute the smart contract call transaction.

[0202] The diversion strategy is a mapping relationship between the type of the operating environment tag and the new version or old version of the business smart contract.

[0203] In one embodiment, the node device receives a rollback request for the business smart contract initiated by a call initiator when the business smart contract fails the pre-release test or the phased release test; wherein the rollback request includes a call parameter for instructing to switch the traffic diversion strategy maintained by the management smart contract to a default traffic diversion strategy;

[0204] In response to the rollback request, calling the policy switching logic included in the management smart contract, and switching the traffic diversion policy to the default traffic diversion policy based on the calling parameters;

[0205] In this specification, the default traffic diversion strategy includes: calling the old version of the business smart contract by default to execute the smart contract call transaction.

[0206] Through the above embodiments, this specification aims to define a standard process for grayscale testing of business smart contracts for grayscale upgrades.

[0207] By deploying a management smart contract on the blockchain, the calls of new and old versions of business smart contracts can be directed and managed, so that grayscale testing of business smart contracts can be completed under the management of the management smart contract.

[0208] After introducing the above implementation example of a test transaction related to the grayscale upgrade of a business smart contract deployed on the blockchain, let us return to Figure 1 The embodiment shown further introduces an embodiment of test transactions related to the grayscale upgrade of the transaction processing logic supported by each node device on the blockchain.

[0209] In this specification, the transaction processing logic supported by at least some node devices in the blockchain is replaced with the new version of the transaction processing logic after the grayscale upgrade;

[0210] Accordingly, in response to the blockchain transaction, step 130 determines the software operating environment of the transaction initiator based on the operating environment tag, and executes the blockchain transaction based on the determined software operating environment, including:

[0211] In response to the blockchain transaction, it is determined based on the operating environment tag whether the blockchain transaction is a test transaction related to the grayscale upgrade of the transaction processing logic supported by each node device on the blockchain. If so, the test transaction is forwarded to the node device supporting the new version of the transaction processing logic for transaction processing; if not, the test transaction is forwarded to the node device supporting the old version of the transaction processing logic for transaction processing.

[0212] This specification provides a solution for grayscale upgrades of the transaction processing logic of node devices. By testing the transaction processing logic of node devices to ensure that the new version of the transaction processing logic is executed correctly, grayscale upgrades of node devices in the blockchain can be achieved.

[0213] To better illustrate the implementation of test transactions related to the grayscale upgrade of transaction processing logic supported by each node device on the blockchain, please refer to the following example. Figure 4 As shown, this specification provides a method for grayscale upgrade of a blockchain service platform, in which the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with the new version of the transaction processing logic after the grayscale upgrade; the method includes:

[0214] Step 410: Receive a blockchain transaction initiated by a transaction initiator.

[0215] In this embodiment, the call initiator corresponds to the aforementioned Figure 1 In addition, Figure 1 akin, Figure 4 The illustrated embodiment is applied to an access program for connecting to a blockchain, and the access program is integrated into a blockchain service platform.

[0216] Step 420: In response to the blockchain transaction, add an operating environment tag indicating the type of the software operating environment of the transaction initiator to the blockchain transaction.

[0217] In this specification, the transaction initiator may send a request carrying an operating environment tag to the blockchain service platform, which is then packaged into a blockchain transaction by the blockchain service platform.

[0218] Of course, the transaction initiator may also send to the blockchain service platform a packaged blockchain transaction carrying an operating environment tag.

[0219] In this specification, the grayscale upgrade of the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0220] Accordingly, in step 420, adding an operating environment tag indicating the type of the software operating environment to the blockchain transaction initiated by the transaction initiator includes:

[0221] Determining the software operating environment of the transaction initiator;

[0222] If the software operating environment is determined to be a pre-release environment, adding a pre-release environment tag indicating that the software operating environment is a pre-release environment to the blockchain transaction initiated by the transaction initiator;

[0223] If the software operating environment is determined to be a grayscale release environment, adding a grayscale environment tag indicating that the software operating environment is a grayscale release environment to the blockchain transaction initiated by the transaction initiator;

[0224] If the software operating environment is determined to be a production environment, a production environment tag indicating that the software operating environment is a production environment is added to the blockchain transaction initiated by the transaction initiator; or, the production environment tag is not added to the blockchain transaction initiated by the transaction initiator in the software operating environment.

[0225] In this specification, determining the software operating environment of the transaction initiator may be the same as determining the software operating environment of the transaction initiator in the aforementioned step 110, and will not be repeated here.

[0226] In this manual, the process of grayscale upgrade can be to first perform pre-release (corresponding to the pre-release environment), complete the pre-release test, and switch to the grayscale release environment; then perform grayscale release (corresponding to the grayscale release environment), complete the grayscale release test, and then switch to the production environment.

[0227] In one embodiment, before step 410, the method further includes:

[0228] In response to a notification message issued by the blockchain service platform that the transaction processing logic supported by at least some node devices in the blockchain is replaced with a new version of the transaction processing logic after the grayscale upgrade, the current software operating environment is switched to the pre-release environment.

[0229] This example provides a pre-release process for grayscale upgrades of some node devices in the blockchain.

[0230] In one embodiment, if the software operating environment is a pre-release environment, the method further includes:

[0231] In response to the notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the pre-release test, the current software operating environment is switched from the pre-release environment to the grayscale environment.

[0232] In one embodiment, if the software operating environment is a grayscale environment, the method further includes:

[0233] In response to the notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the grayscale release test, the current software running environment is switched from the grayscale release environment to the production environment.

[0234] It should be noted that Figure 2 The difference between the grayscale upgrade for smart contracts shown in the example is that during the grayscale upgrade of smart contracts, the action of determining whether the test has passed is performed by the access program, while during the grayscale upgrade of the transaction processing logic supported by the node device in this example, the action of determining whether the test has passed is performed by the blockchain; the access program only needs to complete the switch of the software running environment based on the notification message feedback from the blockchain.

[0235] Step 430: Send the blockchain transaction with the operating environment tag added to the blockchain, so that the blockchain responds to the blockchain transaction, determines whether the blockchain transaction is a test transaction related to the grayscale upgrade based on the operating environment tag, and when it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, forwards the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwards the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing.

[0236] Through the above embodiments, this specification aims to define a standard process for grayscale testing of transaction processing logic supported by blockchain node devices.

[0237] By adding an environment tag to blockchain transactions, indicating the type of software environment used by the transaction initiator, the blockchain can determine whether the transaction is a test transaction based on the environment tag. If so, the transaction is processed by a node device supporting the new version of the transaction processing logic; otherwise, the transaction is processed by a node device supporting the old version of the transaction processing logic. This allows for grayscale upgrades of node devices in the blockchain.

[0238] This manual also provides the corresponding Figure 4In an embodiment of the method in which a node device of a blockchain is used as the execution subject, the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with the new version of the transaction processing logic after the grayscale upgrade; for example, Figure 5 Shown include:

[0239] Step 510: Receive a blockchain transaction initiated by a transaction initiator; wherein the blockchain transaction includes an operating environment tag indicating the type of the software operating environment of the transaction initiator.

[0240] Step 520: In response to the blockchain transaction, determine whether the blockchain transaction is a test transaction related to the grayscale upgrade based on the operating environment tag.

[0241] In one embodiment, the grayscale upgrade of the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0242] Accordingly, determining whether the blockchain transaction is a test transaction related to the grayscale upgrade based on the operating environment tag in step 520 includes:

[0243] Determining the type of the operating environment tag carried by the blockchain transaction;

[0244] If the operating environment tag carried by the blockchain transaction is a pre-release environment tag, determining that the blockchain transaction is a pre-release test transaction related to the pre-release stage;

[0245] If the operating environment tag carried by the blockchain transaction is a grayscale environment tag, determining that the blockchain transaction is a grayscale release test transaction related to the grayscale release stage;

[0246] If the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry an operating environment tag, it is determined that the blockchain transaction is not a test transaction related to the grayscale upgrade.

[0247] This example is similar to the above Figure 2 The examples in are similar, and the specific details can be referred to the previous examples, which will not be repeated here.

[0248] Step 530: If it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, the test transaction is forwarded to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing.

[0249] In this specification, the blockchain service platform maintains a traffic diversion strategy for the blockchain transactions.

[0250] During the pre-release phase of the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase, forwarding the test transaction to a node device supporting the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device supporting the old version of the transaction processing logic for transaction processing;

[0251] The corresponding step 530 includes:

[0252] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0253] In addition, during the phased release of the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase; or a phased release test transaction related to the phased release phase, forwarding the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing;

[0254] The corresponding step 530 includes:

[0255] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage; or, a grayscale release test transaction related to the grayscale release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0256] In this specification, the diversion strategy is a mapping relationship between the type of the operating environment tag and the transaction processing execution of the new version or the old version.

[0257] In one embodiment, the node devices may also, based on a preset grayscale upgrade progress, sequentially increase the grayscale upgrade range of the node devices in the blockchain, and sequentially replace the binary codes corresponding to the transaction processing logic supported by the node devices within the grayscale upgrade range with the binary codes corresponding to the new version of the transaction processing logic.

[0258] In this specification, grayscale upgrades of node devices generally involve adding new processing logic while ensuring that the basic blockchain processing logic (such as consensus logic) supported by the node device remains unchanged; for example, a new transaction type is added to the blockchain.

[0259] In one embodiment, the method may further include:

[0260] Obtaining the execution result of the blockchain transaction from the node device;

[0261] Determining, based on the execution result, whether the new version of the transaction processing logic has passed the pre-release test corresponding to the pre-release stage; if so, sending a notification message to the transaction initiator indicating that the new version of the transaction processing logic has passed the pre-release test; and

[0262] Based on the execution result, determine whether the new version of the transaction processing logic has passed the grayscale release test corresponding to the grayscale release stage; if so, send a notification message to the transaction initiator that the new version of the transaction processing logic has passed the grayscale release test.

[0263] In this specification, the execution results of pre-release or grayscale release test transactions are analyzed to determine whether the execution results meet test expectations. If so, the new version of the transaction processing logic is determined to have passed the pre-release test or grayscale release test, and a notification message indicating that the new version of the transaction processing logic has passed the pre-release test or grayscale release test can be sent to the transaction initiator, prompting the transaction initiator to switch its software operating environment. For example, if the pre-release test passes, the transaction initiator switches the software operating environment from the pre-release environment to the grayscale release environment; or, if the grayscale release test passes, the transaction initiator switches the software operating environment from the grayscale release environment to the production environment.

[0264] In one embodiment, the method may further include:

[0265] In response to the new version of the transaction processing logic passing the pre-release test, switching the traffic diversion strategy from the pre-release stage traffic diversion strategy to the phased release stage traffic diversion strategy; and

[0266] In response to the new version of the transaction processing logic passing the phased release test, switching the traffic diversion strategy from the phased release phase traffic diversion strategy to the post-phased release traffic diversion strategy;

[0267] Among them, the traffic diversion strategy after the grayscale upgrade is completed includes: forwarding the blockchain transaction to the node device that supports the new version of the transaction processing logic for transaction processing by default.

[0268] In addition, if the new version of the transaction execution logic fails the pre-release test or the grayscale release test, it may also include:

[0269] In response to the new version of the transaction execution logic failing the pre-release test or the phased release test, switching the traffic diversion strategy to a default traffic diversion strategy;

[0270] The default traffic diversion strategy includes forwarding the blockchain transaction to a node device that supports the old version of the transaction processing logic for transaction processing by default.

[0271] Through the above-mentioned embodiments, this specification aims to define a standard process for grayscale testing of transaction processing logic supported by blockchain node devices. Furthermore, through the traffic diversion strategy maintained by the blockchain service platform, traffic is diverted to blockchain transactions, thereby completing grayscale testing of the transaction processing logic supported by blockchain node devices.

[0272] Corresponding to the aforementioned method embodiments, this specification also provides corresponding device embodiments. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the device in which it is located reading the corresponding computer business program instructions in the non-volatile memory into the memory for execution. From the hardware level, such as Figure 6 The diagram shown is a hardware structure diagram of the device provided in this manual, except Figure 6 In addition to the processor, network interface, memory and non-volatile memory shown, the device in which the apparatus in the embodiment is located may also include other hardware according to actual functions, which will not be described in detail.

[0273] See Figure 7 , is a module diagram of a blockchain transaction execution device provided in an embodiment of this specification, and the device corresponds to Figure 1 The embodiment shown is applied to an access program corresponding to a blockchain, and the apparatus includes:

[0274] A determining unit 710, in response to a blockchain transaction initiated by a transaction initiator, determines a software operating environment of the transaction initiator;

[0275] An adding unit 720 adds an operating environment tag indicating the type of the software operating environment of the transaction initiator to the blockchain transaction based on the determined software operating environment;

[0276] The execution unit 730 sends the blockchain transaction with the operating environment tag added to the node device in the blockchain, so that the node device responds to the blockchain transaction, determines the software operating environment of the transaction initiator based on the operating environment tag, and executes the blockchain transaction based on the determined software operating environment.

[0277] Optionally, the software operating environment of the transaction initiator maintains operating parameters corresponding to the software operating environment;

[0278] The determining unit 710 includes:

[0279] The reading subunit reads the operating parameters maintained in the software operating environment, and determines the type of the software operating environment of the transaction initiator based on the read operating parameters.

[0280] Optionally, the value of the operating parameter is used to indicate the type of the software operating environment; wherein the value of the operating parameter is synchronously updated when the software operating environment is switched;

[0281] The reading subunit comprises:

[0282] The type of the software operating environment of the transaction initiator is determined based on the read value of the operating parameter.

[0283] Optionally, the operating parameters include environment variables for indicating the type of the software operating environment.

[0284] Optionally, a smart contract for identifying the software operating environment is deployed on the blockchain;

[0285] The reading subunit comprises:

[0286] The calling sub-unit submits the read operating parameters as calling parameters to the smart contract to call the identification logic contained in the smart contract and identify the type of the software operating environment of the transaction initiator based on the operating parameters;

[0287] An acquisition subunit obtains an identification result of the smart contract for the type of the software operating environment, and determines the type of the software operating environment of the transaction initiator based on the identification result.

[0288] Optionally, the blockchain transaction includes a test transaction related to the grayscale upgrade.

[0289] Optionally, the blockchain transaction includes a test transaction related to the grayscale upgrade of the business smart contract deployed on the blockchain; or, the blockchain transaction includes a test transaction related to the grayscale upgrade of the transaction processing logic supported by each node device on the blockchain.

[0290] Optionally, the blockchain deploys an old version of the business smart contract before the grayscale upgrade and a new version of the business smart contract after the grayscale upgrade; and a management smart contract for grayscale upgrade management of the business smart contract;

[0291] The execution unit 730 is further used to call the management smart contract deployed on the blockchain in response to the blockchain transaction, and determine based on the operating environment tag whether the blockchain transaction is a test transaction related to the grayscale upgrade of the business smart contract deployed on the blockchain; if so, further call the new version of the business smart contract across contracts to execute the blockchain transaction; if not, further call the old version of the business smart contract across contracts to execute the blockchain transaction.

[0292] Optionally, the transaction processing logic supported by at least some node devices in the blockchain is replaced with a new version of the transaction processing logic after the grayscale upgrade;

[0293] The execution unit 730 is further used to determine, in response to the blockchain transaction, whether the blockchain transaction is a test transaction related to the grayscale upgrade of the transaction processing logic supported by each node device on the blockchain based on the operating environment tag; if so, forward the test transaction to the node device supporting the new version of the transaction processing logic for transaction processing; if not, forward the test transaction to the node device supporting the old version of the transaction processing logic for transaction processing.

[0294] See Figure 8 , is a module diagram of a grayscale upgrade device for smart contracts in a blockchain provided in an embodiment of this specification, and the device corresponds to Figure 2 In the embodiment shown, the blockchain deploys an old version of a business smart contract before the grayscale upgrade and a new version of the business smart contract after the grayscale upgrade; and a management smart contract for grayscale upgrade management of the business smart contract; the apparatus includes:

[0295] The transaction receiving unit 810 receives a smart contract call transaction initiated by a call initiator for the business smart contract;

[0296] a tag adding unit 820, in response to the smart contract call transaction, adding an operating environment tag indicating the type of the software operating environment of the call initiator to the smart contract call transaction;

[0297] The grayscale upgrade unit 830 sends the smart contract call transaction with the operating environment tag added to the node device in the blockchain, so that the node device responds to the smart contract call transaction, calls the management smart contract deployed on the blockchain, determines whether the smart contract call transaction is a test transaction related to the grayscale upgrade based on the operating environment tag, and when it is determined that the smart contract call transaction is a test transaction related to the grayscale upgrade, further calls the new version of the business smart contract across contracts to execute the smart contract call transaction; otherwise, further calls the old version of the business smart contract across contracts to execute the smart contract call transaction.

[0298] Optionally, the grayscale upgrade for the business smart contract includes a pre-release phase for the new version of the business smart contract; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0299] The label adding unit 820 includes:

[0300] Determine a subunit to determine the software operating environment of the call initiator;

[0301] A first adding subunit, if the determined software operating environment is a pre-release environment, adds a pre-release environment tag to the smart contract call transaction initiated by the call initiator, indicating that the software operating environment is a pre-release environment;

[0302] A second adding subunit, if the software operating environment is determined to be a grayscale release environment, adds a grayscale environment tag to the smart contract call transaction initiated by the call initiator, indicating that the software operating environment is a grayscale release environment;

[0303] The third adding subunit adds a production environment tag indicating that the software operating environment is a production environment to the smart contract call transaction initiated by the call initiator if the determined software operating environment is a production environment.

[0304] Optionally, before the transaction receiving unit 810, the following is further included:

[0305] The contract deployment unit obtains the contract code of the new version of the business smart contract; constructs a smart contract creation transaction containing the contract code, and sends the smart contract creation transaction to the node device in the blockchain, so that the node device executes the smart contract creation, creates the new version of the business smart contract in the blockchain based on the contract code, and completes the deployment of the new version of the business smart contract.

[0306] Optionally, the device further includes:

[0307] The environment switching unit switches the current software running environment to the pre-release environment in response to the completion of deployment of the new version of the business smart contract on the blockchain.

[0308] Optionally, if the software operating environment is a pre-release environment, the device further includes:

[0309] A result judgment unit obtains the execution result of the smart contract call transaction from the node device; determines whether the new version of the business smart contract passes the pre-release test corresponding to the pre-release stage based on the execution result; if so, switches the current software running environment from the pre-release environment to the grayscale release environment.

[0310] Optionally, if the software operating environment is a grayscale release environment, the device further includes:

[0311] A result judgment unit obtains the execution result of the smart contract call transaction from the node device; determines whether the new version of the business smart contract passes the grayscale release test corresponding to the grayscale release stage based on the execution result; if so, switches the current software running environment from the grayscale release environment to the production environment.

[0312] See Figure 9 , is a module diagram of a grayscale upgrade device for smart contracts in a blockchain provided in an embodiment of this specification, and the device corresponds to Figure 3 In the embodiment shown, the blockchain deploys an old version of a business smart contract before the grayscale upgrade and a new version of the business smart contract after the grayscale upgrade; and a management smart contract for grayscale upgrade management of the business smart contract; the apparatus includes:

[0313] The transaction receiving unit 910 receives a smart contract call transaction initiated by a call initiator for the business smart contract; wherein the smart contract call transaction includes an operating environment tag indicating the type of the software operating environment of the call initiator;

[0314] A contract calling unit 920, in response to the smart contract calling transaction, calls a management smart contract deployed on the blockchain, and determines whether the smart contract calling transaction is a test transaction related to the grayscale upgrade based on the runtime environment tag;

[0315] The grayscale upgrade unit 930 further calls the new version of the business smart contract across contracts to execute the smart contract call transaction if it is determined that the smart contract call transaction is a test transaction related to the grayscale upgrade; otherwise, it further calls the old version of the business smart contract across contracts to execute the smart contract call transaction.

[0316] Optionally, the grayscale upgrade for the business smart contract includes a pre-release phase for the new version of the business smart contract; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0317] The contract calling unit 920 includes:

[0318] A determination subunit determines the type of the operating environment tag carried by the smart contract call transaction; if the operating environment tag carried by the smart contract call transaction is a pre-release environment tag, the smart contract call transaction is determined to be a pre-release test transaction related to the pre-release stage; if the operating environment tag carried by the smart contract call transaction is a grayscale environment tag, the smart contract call transaction is determined to be a grayscale release test transaction related to the grayscale release stage; if the operating environment tag carried by the smart contract call transaction is a production environment tag, or the smart contract call transaction does not carry the operating environment tag, the smart contract call transaction is determined not to be a test transaction related to the grayscale upgrade.

[0319] Optionally, the management smart contract maintains a traffic diversion strategy for the smart contract call transaction;

[0320] In the pre-release phase for the business smart contract, the traffic diversion strategy includes: if the smart contract call transaction is a pre-release test transaction related to the pre-release phase, calling the new version of the business smart contract to execute the smart contract call transaction; otherwise, calling the old version of the business smart contract to execute the smart contract call transaction;

[0321] The grayscale upgrading unit 930 includes:

[0322] If it is determined that the smart contract call transaction is a pre-release test transaction related to the pre-release stage, based on the traffic diversion strategy of the pre-release stage, the new version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the new version of the business smart contract is further called across contracts to execute the smart contract call transaction; otherwise, the old version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the old version of the business smart contract is further called across contracts to execute the smart contract call transaction.

[0323] Optionally, during the phase of grayscale release of the business smart contract, the traffic diversion strategy includes: if the smart contract call transaction is a pre-release test transaction related to the pre-release phase; or a grayscale release test transaction related to the grayscale release phase, calling the new version of the business smart contract to execute the smart contract call transaction; otherwise, calling the old version of the business smart contract to execute the smart contract call transaction;

[0324] The grayscale upgrading unit 930 includes:

[0325] If it is determined that the smart contract call transaction is a pre-release test transaction related to the pre-release stage; or, a grayscale release test transaction related to the grayscale release stage, based on the traffic diversion strategy of the pre-release stage, the new version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the new version of the business smart contract is further called across contracts to execute the smart contract call transaction; otherwise, the old version of the business smart contract is determined as the business smart contract used to execute the smart contract call transaction, and the old version of the business smart contract is further called across contracts to execute the smart contract call transaction.

[0326] Optionally, the device further includes:

[0327] A first strategy switching unit receives an upgrade request for the business smart contract initiated by a calling initiator when the business smart contract passes the pre-release test corresponding to the pre-release stage; wherein the upgrade request includes a call parameter for instructing the traffic diversion strategy maintained by the management smart contract to be switched from the traffic diversion strategy of the pre-release stage to the traffic diversion strategy of the gray release stage; in response to the upgrade request, the strategy switching logic contained in the management smart contract is called, and the traffic diversion strategy is switched from the traffic diversion strategy of the pre-release stage to the traffic diversion strategy of the gray release stage based on the call parameter.

[0328] Optionally, the device further includes:

[0329] The second strategy switching unit receives an upgrade request for the business smart contract initiated by the call initiator when the business smart contract passes the grayscale release test corresponding to the grayscale release stage; wherein the upgrade request includes a call parameter for instructing the traffic diversion strategy maintained by the management smart contract to be switched from the traffic diversion strategy in the grayscale release stage to the traffic diversion strategy after the grayscale upgrade is completed; in response to the upgrade request, the strategy switching logic contained in the management smart contract is called, and based on the call parameter, the traffic diversion strategy is switched from the traffic diversion strategy in the grayscale release stage to the traffic diversion strategy after the grayscale upgrade is completed, so as to complete the grayscale upgrade for the business smart contract; wherein the traffic diversion strategy after the grayscale upgrade is completed includes: calling the new version of the business smart contract by default to execute the smart contract call transaction.

[0330] Optionally, the device further includes:

[0331] The third strategy switching unit receives a rollback request for the business smart contract initiated by the call initiator when the business smart contract fails the pre-release test or the grayscale release test; wherein the rollback request includes a call parameter for indicating that the traffic diversion strategy maintained by the management smart contract is switched to the default traffic diversion strategy; in response to the rollback request, the strategy switching logic contained in the management smart contract is called, and the traffic diversion strategy is switched to the default traffic diversion strategy based on the call parameter; wherein the default traffic diversion strategy includes: calling the old version of the business smart contract by default to execute the smart contract call transaction.

[0332] See Figure 10 , is a module diagram of a grayscale upgrade device for a blockchain service platform provided in an embodiment of this specification, and the device corresponds to Figure 4 In the illustrated embodiment, the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; the apparatus includes:

[0333] The transaction receiving unit 1010 receives a blockchain transaction initiated by a transaction initiator;

[0334] a tag adding unit 1020, in response to the blockchain transaction, adding an operating environment tag indicating a type of the software operating environment of the transaction initiator to the blockchain transaction;

[0335] The grayscale upgrade unit 1030 sends the blockchain transaction with the operating environment tag added to the blockchain, so that the blockchain responds to the blockchain transaction, determines whether the blockchain transaction is a test transaction related to the grayscale upgrade based on the operating environment tag, and when it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, forwards the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwards the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing.

[0336] Optionally, the grayscale upgrade for the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0337] The label adding unit 1020 includes:

[0338] Determine a subunit to determine the software operating environment of the transaction initiator;

[0339] A first adding subunit, if the software operating environment is determined to be a pre-release environment, adds a pre-release environment tag to the blockchain transaction initiated by the transaction initiator, indicating that the software operating environment is a pre-release environment;

[0340] A second adding subunit, if the software operating environment is determined to be a grayscale release environment, adds a grayscale environment tag to the blockchain transaction initiated by the transaction initiator, indicating that the software operating environment is a grayscale release environment;

[0341] The third adding subunit adds a production environment tag indicating that the software operating environment is a production environment to the blockchain transaction initiated by the transaction initiator if the determined software operating environment is a production environment.

[0342] Optionally, the device further includes:

[0343] The replacement unit switches the current software running environment to the pre-release environment in response to a notification message issued by the blockchain service platform to replace the transaction processing logic supported by at least some node devices in the blockchain with a new version of the transaction processing logic after the grayscale upgrade.

[0344] Optionally, if the software operating environment is a pre-release environment, the device further includes:

[0345] The environment switching unit switches the current software running environment from the pre-release environment to the grayscale environment in response to a notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the pre-release test.

[0346] Optionally, if the software operating environment is a grayscale environment, the device further includes:

[0347] The environment switching unit switches the current software running environment from the grayscale release environment to the production environment in response to a notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the grayscale release test.

[0348] See Figure 11 , is a module diagram of a grayscale upgrade device for a blockchain service platform provided in an embodiment of this specification, and the device corresponds to Figure 5 In the illustrated embodiment, the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; the apparatus includes:

[0349] The receiving unit 1110 receives a blockchain transaction initiated by a transaction initiator, wherein the blockchain transaction includes an operating environment tag indicating a type of a software operating environment of the transaction initiator;

[0350] A determining unit 1120, in response to the blockchain transaction, determines, based on the operating environment tag, whether the blockchain transaction is a test transaction related to the grayscale upgrade;

[0351] Processing unit 1130, if it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, forwards the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwards the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing.

[0352] Optionally, the grayscale upgrade for the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release phase, and a grayscale release environment corresponding to the grayscale release phase;

[0353] The determining unit 1120 includes:

[0354] A determination subunit determines the type of the operating environment tag carried by the blockchain transaction; if the operating environment tag carried by the blockchain transaction is a pre-release environment tag, the blockchain transaction is determined to be a pre-release test transaction related to the pre-release stage; if the operating environment tag carried by the blockchain transaction is a grayscale environment tag, the blockchain transaction is determined to be a grayscale release test transaction related to the grayscale release stage; if the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry an operating environment tag, the blockchain transaction is determined not to be a test transaction related to the grayscale upgrade.

[0355] Optionally, the blockchain service platform maintains a traffic diversion strategy for the blockchain transaction;

[0356] In the pre-release phase for the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase, forwarding the test transaction to a node device supporting the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device supporting the old version of the transaction processing logic for transaction processing;

[0357] The processing unit 1130 includes:

[0358] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0359] Optionally, during the phased release of the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase; or a phased release test transaction related to the phased release phase, forwarding the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing;

[0360] The processing unit 1130 includes:

[0361] If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage; or, a grayscale release test transaction related to the grayscale release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

[0362] Optionally, the device further includes:

[0363] The grayscale upgrade subunit, based on a preset grayscale upgrade progress, sequentially increases the grayscale upgrade range of the node devices in the blockchain, and sequentially replaces the binary codes corresponding to the transaction processing logic supported by the node devices within the grayscale upgrade range with the binary codes corresponding to the new version of the transaction processing logic.

[0364] Optionally, the device further includes:

[0365] An acquisition subunit, which acquires the execution result of the blockchain transaction from the node device;

[0366] The feedback sub-unit determines, based on the execution result, whether the new version of the transaction processing logic has passed the pre-release test corresponding to the pre-release stage; if so, sends a notification message to the transaction initiator stating that the new version of the transaction processing logic has passed the pre-release test; and determines, based on the execution result, whether the new version of the transaction processing logic has passed the grayscale release test corresponding to the grayscale release stage; if so, sends a notification message to the transaction initiator stating that the new version of the transaction processing logic has passed the grayscale release test.

[0367] Optionally, the device further includes:

[0368] a first strategy switching unit, in response to the new version of the transaction processing logic passing the pre-release test, switching the traffic diversion strategy from the traffic diversion strategy of the pre-release stage to the traffic diversion strategy of the phased release stage;

[0369] A second strategy switching unit, in response to the new version of the transaction processing logic passing the grayscale release test, switches the traffic diversion strategy from the traffic diversion strategy in the grayscale release stage to the traffic diversion strategy after the grayscale upgrade is completed; wherein the traffic diversion strategy after the grayscale upgrade is completed includes: by default forwarding the blockchain transaction to a node device that supports the new version of the transaction processing logic for transaction processing.

[0370] Optionally, the device further includes:

[0371] The third strategy switching unit switches the traffic diversion strategy to a default traffic diversion strategy in response to the new version of the transaction execution logic failing the pre-release test or the grayscale release test; wherein the default traffic diversion strategy includes: forwarding the blockchain transaction to a node device that supports the old version of the transaction processing logic for transaction processing by default.

[0372] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.

[0373] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0374] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0375] In the embodiments of the electronic devices described above, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor may be a microprocessor or any conventional processor, and the aforementioned memory may be a read-only memory (ROM), random access memory (RAM), flash memory, a hard disk, or a solid-state drive. The steps of the methods disclosed in the embodiments of this specification may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0376] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the electronic device embodiment is generally similar to the method embodiment, so the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment.

[0377] Other embodiments of the present invention will readily occur to those skilled in the art after considering the specification and practicing the embodiments disclosed herein. This specification is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of this specification and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present invention being indicated by the appended claims.

[0378] It should be understood that the present description is not limited to the exact structure that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.

Claims

1. A method for grayscale upgrade of a blockchain service platform, wherein the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; The grayscale upgrade of the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed. The method includes: Receive blockchain transactions initiated by the transaction initiator; In response to the blockchain transaction, adding an operating environment tag indicating the type of the software operating environment of the transaction initiator to the blockchain transaction; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release stage, and a grayscale release environment corresponding to the grayscale release stage; The blockchain transaction with the operating environment tag added is sent to the blockchain, so that the blockchain responds to the blockchain transaction and determines the type of the operating environment tag carried by the blockchain transaction; if the operating environment tag carried by the blockchain transaction is a pre-release environment tag, the blockchain transaction is determined to be a pre-release test transaction related to the pre-release stage; if the operating environment tag carried by the blockchain transaction is a grayscale environment tag, the blockchain transaction is determined to be a grayscale release test transaction related to the grayscale release stage; if the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry the operating environment tag, the blockchain transaction is determined not to be a test transaction related to the grayscale upgrade; When it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, the test transaction is forwarded to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing.

2. The method according to claim 1, wherein adding an operating environment tag indicating the type of the software operating environment to the blockchain transaction comprises: Determining the software operating environment of the transaction initiator; If the software operating environment is determined to be a pre-release environment, adding a pre-release environment tag indicating that the software operating environment is a pre-release environment to the blockchain transaction initiated by the transaction initiator; If the software operating environment is determined to be a grayscale release environment, adding a grayscale environment tag indicating that the software operating environment is a grayscale release environment to the blockchain transaction initiated by the transaction initiator; If the software operating environment determined to be a production environment is a production environment, a production environment tag indicating that the software operating environment is a production environment is added to the blockchain transaction initiated by the transaction initiator.

3. The method according to claim 2, further comprising: In response to a notification message issued by the blockchain service platform that the transaction processing logic supported by at least some node devices in the blockchain is replaced with a new version of the transaction processing logic after the grayscale upgrade, the current software operating environment is switched to the pre-release environment.

4. The method according to claim 3, if the software operating environment is a pre-release environment, the method further comprises: In response to the notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the pre-release test, the current software operating environment is switched from the pre-release environment to the grayscale environment.

5. The method according to claim 4, if the software operating environment is a grayscale environment, the method further comprises: In response to the notification message issued by the blockchain service platform that the new version of the transaction processing logic has passed the grayscale release test, the current software running environment is switched from the grayscale release environment to the production environment.

6. A method for grayscale upgrade of a blockchain service platform, wherein the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; The grayscale upgrade for the blockchain service platform includes: A pre-release phase for the transaction execution logic of the new version; And, in the phased release phase after the pre-release phase is completed, the method includes: Receiving a blockchain transaction initiated by a transaction initiator; wherein the blockchain transaction includes an operating environment tag indicating the type of the software operating environment of the transaction initiator; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release stage, and a grayscale release environment corresponding to the grayscale release stage; In response to the blockchain transaction, determining the type of the operating environment tag carried by the blockchain transaction; if the operating environment tag carried by the blockchain transaction is a pre-release environment tag, determining that the blockchain transaction is a pre-release test transaction related to the pre-release stage; if the operating environment tag carried by the blockchain transaction is a grayscale environment tag, determining that the blockchain transaction is a grayscale release test transaction related to the grayscale release stage; if the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry an operating environment tag, determining that the blockchain transaction is not a test transaction related to a grayscale upgrade; If it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, the test transaction is forwarded to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing.

7. The method according to claim 6, wherein the blockchain service platform maintains a traffic diversion strategy for the blockchain transaction; in, During the pre-release phase of the new version of the transaction processing logic, the traffic diversion strategy includes: if the blockchain transaction is a pre-release test transaction related to the pre-release phase, forwarding the test transaction to a node device supporting the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device supporting the old version of the transaction processing logic for transaction processing; If it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, forwarding the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, forwarding the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing, including: If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

8. According to the method of claim 7, during the phased release of the new version of the transaction processing logic, the traffic diversion strategy includes: If the blockchain transaction is a pre-release test transaction related to the pre-release stage; Alternatively, for a grayscale release test transaction related to the grayscale release phase, the test transaction is forwarded to a node device that supports the transaction processing logic of the new version for transaction processing; Otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing; If it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, forwarding the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing; Otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing, including: If it is determined that the blockchain transaction is a pre-release test transaction related to the pre-release stage; or, a grayscale release test transaction related to the grayscale release stage, based on the traffic diversion strategy of the pre-release stage, the node device that supports the new version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the node device that supports the old version of the transaction processing logic is determined as the node device for executing the blockchain transaction, and the blockchain transaction is forwarded to the node device that supports the old version of the transaction processing logic for transaction processing.

9. The method according to claim 8, further comprising: Based on the preset grayscale upgrade progress, the grayscale upgrade range of the node devices in the blockchain is gradually increased, and the binary codes corresponding to the transaction processing logic supported by the node devices within the grayscale upgrade range are replaced with the binary codes corresponding to the new version of the transaction processing logic.

10. The method according to claim 8, further comprising: Obtaining the execution result of the blockchain transaction from the node device; determining, based on the execution result, whether the transaction processing logic of the new version passes a pre-release test corresponding to the pre-release stage; If yes, a notification message is sent to the transaction initiator indicating that the new version of the transaction processing logic has passed the pre-release test; as well as, Determining, based on the execution result, whether the transaction processing logic of the new version passes the phased release test corresponding to the phased release stage; If yes, a notification message is sent to the transaction initiator indicating that the new version of the transaction processing logic has passed the grayscale release test.

11. The method according to claim 8, further comprising: In response to the new version of the transaction processing logic passing the pre-release test, switching the traffic diversion strategy from the pre-release stage traffic diversion strategy to the phased release stage traffic diversion strategy; as well as, In response to the new version of the transaction processing logic passing the phased release test, switching the traffic diversion strategy from the phased release phase traffic diversion strategy to the post-phased release traffic diversion strategy; Among them, the traffic diversion strategy after the grayscale upgrade is completed includes: forwarding the blockchain transaction to the node device that supports the new version of the transaction processing logic for transaction processing by default.

12. The method according to claim 10, further comprising: In response to the new version of the transaction execution logic failing the pre-release test or the phased release test, switching the traffic diversion strategy to a default traffic diversion strategy; The default traffic diversion strategy includes forwarding the blockchain transaction to a node device that supports the old version of the transaction processing logic for transaction processing by default.

13. A device for grayscale upgrade of a blockchain service platform, wherein the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; The grayscale upgrade of the blockchain service platform includes: a pre-release phase for the transaction execution logic of the new version; and a grayscale release phase after the pre-release phase is completed; the device includes: Transaction receiving unit, receiving blockchain transactions initiated by the transaction initiator; a label adding unit, in response to the blockchain transaction, adding an operating environment label indicating the type of the software operating environment of the transaction initiator to the blockchain transaction; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release stage, and a grayscale release environment corresponding to the grayscale release stage; The grayscale upgrade unit sends the blockchain transaction with the operating environment tag added to the blockchain, so that the blockchain responds to the blockchain transaction and determines the type of the operating environment tag carried by the blockchain transaction; if the operating environment tag carried by the blockchain transaction is a pre-release environment tag, the blockchain transaction is determined to be a pre-release test transaction related to the pre-release stage; if the operating environment tag carried by the blockchain transaction is a grayscale environment tag, the blockchain transaction is determined to be a grayscale release test transaction related to the grayscale release stage; if the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry the operating environment tag, the blockchain transaction is determined not to be a test transaction related to the grayscale upgrade, and when it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade, the test transaction is forwarded to a node device that supports the new version of the transaction processing logic for transaction processing; otherwise, the test transaction is forwarded to a node device that supports the old version of the transaction processing logic for transaction processing.

14. A device for grayscale upgrading a blockchain service platform, wherein the transaction processing logic supported by at least some node devices in the blockchain managed by the blockchain service platform is replaced with a new version of the transaction processing logic after the grayscale upgrade; The grayscale upgrade for the blockchain service platform includes: A pre-release phase for the transaction execution logic of the new version; and, a phased release phase after the completion of the pre-release phase; The device comprises: A receiving unit, configured to receive a blockchain transaction initiated by a transaction initiator; wherein the blockchain transaction includes an operating environment tag indicating the type of the software operating environment of the transaction initiator; the software operating environment includes a production environment, a pre-release environment corresponding to the pre-release stage, and a grayscale release environment corresponding to the grayscale release stage; A determining unit, in response to the blockchain transaction, determines a type of an operating environment tag carried by the blockchain transaction; if the operating environment tag carried by the blockchain transaction is a pre-release environment tag, determines that the blockchain transaction is a pre-release test transaction related to the pre-release stage; if the operating environment tag carried by the blockchain transaction is a grayscale environment tag, determines that the blockchain transaction is a grayscale release test transaction related to the grayscale release stage; if the operating environment tag carried by the blockchain transaction is a production environment tag, or the blockchain transaction does not carry an operating environment tag, determines that the blockchain transaction is not a test transaction related to a grayscale upgrade; The processing unit forwards the test transaction to a node device that supports the new version of the transaction processing logic for transaction processing if it is determined that the blockchain transaction is a test transaction related to the grayscale upgrade; otherwise, the processing unit forwards the test transaction to a node device that supports the old version of the transaction processing logic for transaction processing.

15. An electronic device comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 12 by running the executable instructions.

Citation Information

Patent Citations

  • Gray scale upgrading method and device for smart contract in block chain, and electronic equipment

    CN114780123A