Blockchain-based transaction control method and apparatus, and storage medium

By acquiring transaction attribute information and smart contract grayscale strategies, and dynamically selecting target nodes and grayscale versions, the problem of low transaction processing intelligence caused by the single grayscale management of blockchain smart contracts is solved, achieving more efficient and accurate transaction control.

CN115439241BActive Publication Date: 2025-12-05CHINA MOBILE GROUP ZHEJIANG +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110628780.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-04
Publication Date
2025-12-05
Estimated Expiration
2041-06-04

AI Technical Summary

Technical Problem

In existing technologies, the gray-scale management methods for blockchain smart contracts are limited, resulting in low intelligence in transaction processing and anomalies that are prone to occur during version replacement.

Method used

By acquiring transaction attribute information, the system obtains target nodes according to the smart contract grayscale strategy, and sends transaction information to the target nodes in the blockchain to call the corresponding grayscale version of the smart contract for processing. It supports the combination of grayscale strategy and blockchain differentiation, monitors the transaction process, and performs version rollback in case of anomalies.

Benefits of technology

It improves the intelligence and accuracy of transaction control, ensures the flexibility and reliability of transaction processing, and reduces the risk of anomalies during version replacement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115439241B_ABST
    Figure CN115439241B_ABST
Patent Text Reader

Abstract

The application discloses a transaction control method and device based on a block chain and a storage medium, and the transaction control method based on the block chain comprises the following steps: after receiving a transaction request, transaction information and transaction attribute information in the transaction request are acquired; an intelligent contract gray-scale strategy corresponding to the transaction attribute information is acquired; a target node is acquired according to a gray-scale version in the intelligent contract gray-scale strategy; the transaction information is sent to the target node in the block chain, so that the node calls an intelligent contract of the corresponding gray-scale version to process the transaction information. According to the application, different intelligent contracts are called to process different transaction information, and the intelligence and accuracy of transaction control are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communications, and more particularly to a blockchain-based transaction control method, apparatus, and storage medium. Background Technology

[0002] Blockchain operates based on smart contracts. Currently, the methods for managing the gray-scale release of smart contracts in the market are relatively simple, and they are all based on versions. For example, there is a running smart contract version A, and a smart contract version B is to be released in the gray-scale release: Contract version B is tested in the test environment. After the test is passed, it is released to production to replace all contract versions A (if not all are replaced, inconsistencies will occur when calling). If an error occurs, the contract version is rolled back to version A. In this solution, all nodes install the same smart contract to process transactions, resulting in low intelligence in transaction processing. Summary of the Invention

[0003] The main objective of this invention is to provide a blockchain-based transaction control method, device, and storage medium, aiming to solve the technical problem of low intelligence in transaction processing.

[0004] To achieve the above objectives, the present invention provides a blockchain-based transaction control method, the blockchain-based transaction control method comprising:

[0005] Upon receiving a transaction request, obtain the transaction information and transaction attribute information from the transaction request;

[0006] Obtain the smart contract grayscale strategy corresponding to the transaction attribute information;

[0007] The target node is obtained according to the grayscale version in the smart contract grayscale strategy;

[0008] The transaction information is sent to the target node in the blockchain so that the node can call the corresponding grayscale version of the smart contract to process the transaction information.

[0009] Optionally, the step of obtaining the target node according to the grayscale version in the smart contract grayscale strategy includes:

[0010] The combined grayscale strategies of the smart contracts corresponding to each of the aforementioned transaction attribute information are combined to obtain a combined grayscale strategy.

[0011] The target node is obtained according to the grayscale version in the combined grayscale strategy.

[0012] Optionally, the step of obtaining the target node according to the grayscale version in the smart contract grayscale strategy includes:

[0013] Obtain the target blockchain corresponding to the transaction attribute information;

[0014] The target node in the target blockchain is obtained according to the grayscale version in the smart contract grayscale strategy.

[0015] Optionally, before the step of obtaining transaction information and transaction attribute information from the transaction request after receiving the transaction request, the blockchain-based transaction control method further includes:

[0016] After receiving the smart contract program file uploaded by the client, obtain the gray version corresponding to the smart contract program file, and configure the gray management strategy according to the gray version;

[0017] Obtain the installation node corresponding to the smart contract program file;

[0018] The smart contract program file is sent to the installation node so that the installation node can install the smart contract program file;

[0019] The installation node, grayscale management strategy, and transaction attribute information are associated and saved.

[0020] Optionally, after associating and saving the installation node, grayscale management strategy, and transaction attribute information, the method further includes:

[0021] Obtain the blockchain information corresponding to the transaction attribute information;

[0022] The grayscale management strategy and the blockchain information are associated.

[0023] Optionally, the step of sending the transaction information to the target node in the blockchain, so that the node can call the corresponding grayscale version of the smart contract to process the transaction information, includes:

[0024] Obtain the processing data of the transaction information from each of the target nodes;

[0025] If, based on the processing data, it is determined that the smart contract in the target node does not respond to the transaction information or the response time exceeds a preset time, the version of the smart contract in the target node is rolled back.

[0026] Optionally, the transaction attribute information includes at least one of the grayscale version, user information, terminal information, and business type.

[0027] Furthermore, to achieve the above objectives, the present invention also proposes a blockchain-based transaction control device, which includes:

[0028] The acquisition module, upon receiving a transaction request, acquires the transaction information and transaction attribute information in the transaction request, acquires the smart contract grayscale strategy corresponding to the transaction attribute information, and acquires the target node according to the grayscale version in the smart contract grayscale strategy.

[0029] The sending module is used to send the transaction information to the target node in the blockchain, so that the node can call the corresponding grayscale version of the smart contract to process the transaction information.

[0030] Furthermore, to achieve the above objectives, the present invention also proposes a blockchain-based transaction control device, which includes a memory and a processor. The memory is used to store a blockchain-based transaction control program, and when the blockchain-based transaction control program in the memory is executed by the processor, it implements the blockchain-based transaction control method as described in any of the above claims.

[0031] Furthermore, to achieve the above objectives, the present invention also proposes a computer-readable storage medium, characterized in that the computer-readable storage medium stores a blockchain-based transaction control program, which, when executed by a processor, implements the steps of the blockchain-based transaction control method as described in any of the preceding claims.

[0032] The present invention proposes a blockchain-based transaction control method, device, and storage medium. Upon receiving a transaction request, the method acquires the transaction information and transaction attribute information from the request, obtains the smart contract grayscale strategy corresponding to the transaction attribute information, acquires the target node according to the grayscale version in the smart contract grayscale strategy, and sends the transaction information to the target node in the blockchain. The node then calls the corresponding grayscale version of the smart contract to process the transaction information. In this solution, different smart contracts are called for different transaction information, thereby improving the intelligence and accuracy of transaction control. Attached Figure Description

[0033] Figure 1 This is a schematic diagram of the hardware architecture of the device involved in the blockchain-based transaction control method of the present invention;

[0034] Figure 2 This is a flowchart illustrating an exemplary embodiment of the blockchain-based transaction control method of the present invention.

[0035] Figure 3 This is a flowchart illustrating an exemplary embodiment two of the blockchain-based transaction control method of the present invention.

[0036] Figure 4 This is a schematic diagram illustrating the combination of the smart contract grayscale strategy in this invention;

[0037] Figure 5 This is a flowchart illustrating an exemplary embodiment three of the blockchain-based transaction control method of the present invention.

[0038] Figure 6 This is a flowchart illustrating an exemplary embodiment four of the blockchain-based transaction control method of the present invention.

[0039] Figure 7 This is a flowchart illustrating Exemplary Example 5 of the blockchain-based transaction control method of the present invention;

[0040] Figure 8 This is a schematic diagram of the blockchain-based transaction control device of the present invention. Detailed Implementation

[0041] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0042] Reference Figure 1 , Figure 1 This is a schematic diagram of the hardware architecture of the device involved in the blockchain-based transaction control method of the present invention.

[0043] like Figure 1 As shown, the blockchain-based transaction control device involved in this embodiment can be a server. In this embodiment, the server is connected to the blockchain to manage the various nodes in the blockchain.

[0044] The blockchain-based transaction control device in this embodiment may include a memory 110, a processor 120, and a communication module 130. The memory 110 is used to store a blockchain-based transaction control program; the processor 120 is used to execute the blockchain-based transaction control program in the memory 110; and the communication module 130 is used to communicate with various nodes in the blockchain.

[0045] In the technical solution disclosed in this embodiment, when the blockchain-based transaction control program in the memory 110 is executed by the processor 120, it performs the following steps:

[0046] Upon receiving a transaction request, obtain the transaction information and transaction attribute information from the transaction request;

[0047] Obtain the smart contract grayscale strategy corresponding to the transaction attribute information;

[0048] The target node is obtained according to the grayscale version in the smart contract grayscale strategy;

[0049] The transaction information is sent to the target node in the blockchain so that the node can call the corresponding grayscale version of the smart contract to process the transaction information.

[0050] Reference Figure 2 , Figure 2 This is a flowchart illustrating an exemplary embodiment of the blockchain-based transaction control method of the present invention. In this embodiment, the blockchain-based transaction control method includes:

[0051] Step S10: After receiving the transaction request, obtain the transaction information and transaction attribute information in the transaction request;

[0052] The transaction attribute information in this embodiment includes at least one of the grayscale version, user information, terminal information, and business type. The grayscale version may correspond to the version of the smart contract installed in the node. The user information may be the user type information or the user identification information. The terminal information may be the terminal type information, the terminal IP address information, or the terminal identification information. The business type can be obtained through the business identification information or the source of the business.

[0053] Step S20: Obtain the smart contract grayscale strategy corresponding to the transaction attribute information;

[0054] In the technical solution disclosed in this application, grayscale environment version isolation can be achieved through transaction attribute information. The corresponding smart contract grayscale strategy can be obtained based on the transaction attribute information. The smart contract grayscale strategy contains the corresponding grayscale version and the execution ratio of the corresponding version. For example, the execution ratio of version A is 20% and the execution ratio of version B is 80%. Then, the transaction information can be allocated according to the execution ratio.

[0055] Step S30: Obtain the target node according to the gray version in the smart contract gray-scale strategy;

[0056] Since different smart contracts run on different nodes, meaning different target nodes correspond to different grayscale versions, the corresponding target node can be obtained through the grayscale version in the grayscale strategy.

[0057] Step S40: Send the transaction information to the target node in the blockchain so that the node can call the corresponding grayscale version of the smart contract to process the transaction information.

[0058] In this embodiment, when the target node in the blockchain receives transaction information, it can process the transaction information through a smart contract. During the process of the target node processing the transaction information, the processing process of the target node can be monitored by a monitoring device, which can record the gray-scale transaction log, response time, transaction parameters and transaction results of each transaction, so as to manage the transaction process.

[0059] In the technical solution disclosed in this embodiment, after receiving a transaction request, the transaction information and transaction attribute information in the transaction request are obtained, the smart contract grayscale strategy corresponding to the transaction attribute information is obtained, the target node is obtained according to the grayscale version in the smart contract grayscale strategy, and the transaction information is sent to the target node in the blockchain so that the node can call the corresponding grayscale version of the smart contract to process the transaction information. In this solution, different smart contracts are called for processing different transaction information, which improves the intelligence and accuracy of transaction control.

[0060] Reference Figure 3 Based on Embodiment 1, Embodiment 2 of the blockchain-based transaction control method of the present invention is proposed. In this embodiment, step S30 includes:

[0061] Step S31: Combine the smart contract grayscale strategies corresponding to each of the transaction attribute information to obtain a combined grayscale strategy.

[0062] Step S32: Obtain the target node according to the grayscale version in the combined grayscale strategy.

[0063] In the technical solution disclosed in this embodiment, there may often be multiple transaction attribute information, such as... Figure 4 As shown, the grayscale strategies of smart contracts corresponding to multiple transaction attribute information can be superimposed to form a combined grayscale strategy. For example, the grayscale strategies of smart contracts corresponding to user information and terminal information can be combined to form a user terminal combined strategy. When combining strategies, multiple smart contract grayscale strategies can be combined directly, or the grayscale strategies of smart contracts can be averaged, weighted averaged, and / or summed. The corresponding combined strategy can be set as needed.

[0064] In this embodiment, after determining the combined grayscale strategy, the target node is determined according to the grayscale version corresponding to the combined grayscale strategy.

[0065] Reference Figure 5 Based on Embodiment 1, Embodiment 3 of the blockchain-based transaction control method of the present invention is proposed. In this embodiment, step S30 includes:

[0066] Step S33: Obtain the target blockchain corresponding to the transaction attribute information;

[0067] Step S34: Obtain the target node in the target blockchain according to the gray version in the smart contract gray-scale strategy.

[0068] The target blockchain can be obtained through preset fields in the transaction attribute information, such as the `chain_engine` parameter. If the `chain_engine` parameter matches `fabric`, the transaction is distributed to the `fabric` network for gray-scale trading; if it matches `cita`, the transaction is distributed to the `cita` network for gray-scale trading; if it matches `eos`, the transaction is distributed to the `eos` network for gray-scale trading; alternatively, if the `chain_engine` parameter does not match any of the above fields, an error message can be output.

[0069] In the technical solution disclosed in this embodiment, the blockchain is distinguished by transaction information, making transaction control more intelligent and accurate.

[0070] Reference Figure 6 Based on the first to third embodiments, a fourth embodiment of the blockchain-based transaction control method of the present invention is proposed. In this embodiment, before step S10, the blockchain-based transaction control method further includes:

[0071] Step S50: After receiving the smart contract program file uploaded by the client, obtain the gray version corresponding to the smart contract program file, and configure the gray management strategy according to the gray version.

[0072] Step S60: Obtain the installation node corresponding to the smart contract program file;

[0073] Step S70: Send the smart contract program file to the installation node so that the installation node can install the smart contract program file;

[0074] Step S80: Save the installation node, grayscale management strategy, and transaction attribute information together.

[0075] In the technical solution disclosed in this embodiment, after the latest version of the smart contract is released, the client can upload the smart contract program file to the server. The server can provide a visual configuration interface to the client. Users can configure the gray version, gray management strategy and installation node through the visual configuration interface. After the user completes the configuration, the smart contract program file is sent to the installation node selected by the user.

[0076] After installing the new version of the smart contract program file, the installation node will cache the original version of the smart contract program file so that it can roll back the version in case of an exception.

[0077] It is understandable that different transactions may correspond to different blockchains, so after step S80, the method further includes: obtaining the blockchain information corresponding to the transaction attribute information; associating the grayscale management strategy with the blockchain information.

[0078] The technical solution disclosed in this embodiment allows users to configure the corresponding grayscale management strategy and the association between transaction attribute information as needed, so that after receiving transaction information, the corresponding grayscale management strategy can be flexibly invoked to manage the transaction, thereby improving the flexibility of the transaction.

[0079] Reference Figure 7 Based on the first to third embodiments, a fourth embodiment of the blockchain-based transaction control method of the present invention is proposed. In this embodiment, after step S40, the method further includes:

[0080] Step S90: Obtain the processing data of the transaction information from each of the target nodes;

[0081] Step S100: When it is determined from the processing data that the smart contract in the target node does not respond to the transaction information or the response time is longer than a preset time, the version of the smart contract in the target node is rolled back.

[0082] In the technical solution disclosed in this embodiment, the execution process of transaction information of each node can be monitored. The monitoring of the execution process of transaction information can be obtained through the node's log file. If the smart contract does not respond to the transaction information or the response time is longer than the preset time, it indicates that the transaction information is not compatible with the smart contract, and the version of the smart contract needs to be rolled back.

[0083] In the technical solution disclosed in this implementation, when the smart contract in the node encounters an anomaly in processing transaction information, a version rollback is performed to improve the accuracy of the processing.

[0084] Reference Figure 8 The present invention also proposes a blockchain-based transaction control device, which operates on an edge node and includes:

[0085] The acquisition module 10, upon receiving a transaction request, acquires the transaction information and transaction attribute information in the transaction request, acquires the smart contract grayscale strategy corresponding to the transaction attribute information, and acquires the target node according to the grayscale version in the smart contract grayscale strategy.

[0086] The sending module 20 is used to send the transaction information to the target node in the blockchain, so that the node can call the corresponding grayscale version of the smart contract to process the transaction information.

[0087] The present invention also proposes a blockchain-based transaction control device, which includes a memory and a processor. The memory is used to store a blockchain-based transaction control program. When the blockchain-based transaction control program in the memory is executed by the processor, it implements the blockchain-based transaction control method as described in any of the above embodiments.

[0088] The present invention also proposes a computer-readable storage medium, characterized in that the computer-readable storage medium stores a blockchain-based transaction control program, which, when executed by a processor, implements the steps of the blockchain-based transaction control method as described in the above embodiments.

[0089] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0090] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the methods of each embodiment of the present invention.

[0092] The above are merely preferred embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A blockchain-based transaction control method, characterized by, The blockchain-based transaction control method comprises: After receiving the smart contract program file uploaded by the client, a gray version corresponding to the smart contract program file is obtained, and a gray strategy is configured according to the gray version; An installation node corresponding to the smart contract program file is obtained; The smart contract program file is sent to the installation node, so that the installation node installs the smart contract program file; The installation node, the gray strategy and transaction attribute information are associated and saved; After receiving a transaction request, transaction information and transaction attribute information in the transaction request are obtained; A smart contract gray strategy corresponding to the transaction attribute information is obtained, wherein the gray strategy comprises a corresponding gray version and an execution ratio of the corresponding version; A target node is obtained according to the gray version in the smart contract gray strategy; The transaction information is sent to the target node in the blockchain, so that the node calls the smart contract of the corresponding gray version to process the transaction information. 2.The blockchain-based transaction control method of claim 1, wherein, The step of obtaining the target node according to the gray version in the smart contract gray strategy comprises: The smart contract gray strategies corresponding to each transaction attribute information are combined to obtain a combined gray strategy; The target node is obtained according to the gray version in the combined gray strategy. 3.The blockchain-based transaction control method of claim 1, wherein, The step of obtaining the target node according to the gray version in the smart contract gray strategy comprises: A target blockchain corresponding to the transaction attribute information is obtained; The target node in the target blockchain is obtained according to the gray version in the smart contract gray strategy. 4.The blockchain-based transaction control method of claim 1, wherein, After the installation node, the gray strategy and the transaction attribute information are associated and saved, the method further comprises: Obtaining blockchain information corresponding to the transaction attribute information; Associating the gray strategy and the blockchain information. 5.The blockchain-based transaction control method of claim 1, wherein, The step of sending the transaction information to the target node in the blockchain, so that the node calls the smart contract of the corresponding gray version to process the transaction information, comprises: Obtaining processing data of each target node on the transaction information; When it is determined according to the processing data that the smart contract in the target node has no response to the transaction information or the response time is greater than a preset time, a version rollback processing is performed on the version of the smart contract in the target node. 6.The blockchain-based transaction control method of claim 1, wherein, The transaction attribute information comprises at least one of the gray version, user information, terminal information and business type. 7.A blockchain-based transaction control apparatus, characterized by, The blockchain-based transaction control device comprises: After receiving the smart contract program file uploaded by the client, a gray version corresponding to the smart contract program file is obtained, and a gray strategy is configured according to the gray version; an installation node corresponding to the smart contract program file is obtained; the smart contract program file is sent to the installation node, so that the installation node installs the smart contract program file; the installation node, the gray strategy and transaction attribute information are associated and saved; An obtaining module, after receiving a transaction request, obtains transaction information and transaction attribute information in the transaction request, obtains a smart contract gray-scale strategy corresponding to the transaction attribute information, and obtains a target node according to a gray-scale version in the smart contract gray-scale strategy, wherein the gray-scale strategy contains a corresponding gray-scale version and an execution ratio of the corresponding version; A sending module, configured to send the transaction information to the target node in the block chain, so that the node calls a smart contract of the corresponding gray-scale version to process the transaction information. 8.A blockchain-based transaction control apparatus, characterized by, The block chain-based transaction control device includes a memory and a processor, the memory is used to store a block chain-based transaction control program, and the block chain-based transaction control program in the memory is executed by the processor to realize the block chain-based transaction control method in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a block chain-based transaction control program, and the block chain-based transaction control program is executed by the processor to realize the steps of the block chain-based transaction control method in any one of claims 1-6.

Citation Information

Patent Citations

  • Intelligent contract invocation method and device based on block chain, and electronic device

    CN109146679A

  • Transaction early warning method, device and equipment based on block chain

    CN110503435A