Transaction Group Execution Method, Computer Device, and Storage Medium
By verifying the transaction constraint relationship in the transaction group on the blockchain nodes, ensuring the legality and order of transactions, the problem of inability to guarantee the security of transaction groups in the existing technology is solved, and higher transaction group security and blockchain system stability are achieved.
Patent Information
- Application Number
- CN202110627022.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-04
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2041-06-04
AI Technical Summary
In the prior art, transactions in the transaction group can be combined at will, resulting in the user may issue fake tokens first, which will lead to the security of the transaction group being unable to be guaranteed and economic losses when the blockchain node executes the transaction group.
By implementing a transaction group execution method on a blockchain node, when receiving the transaction group and executing each transaction in sequence, the constraint relationship between transactions is verified to ensure the legality and order of transactions. The specific method includes finding a matching method body in the contract declaration agreement list, and finding a constraint relationship through the protocol interface, determining whether the context transaction complies with the constraint relationship. If it complies, the transaction will be verified and executed.
It improves the security of the transaction group, prevents economic losses caused by users by issuing fake tokens, ensures the orderliness and legality of the transaction group, thereby enhancing the stability and reliability of the blockchain system.
Smart Images

Figure CN115439239B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and particularly to a transaction group execution method, a computer device, and a storage medium. Background Art
[0002] Suppose user A generates a transaction group txgroup1 (including tx1 and tx2), where tx1 represents freezing 10 coin1 of user A, and tx2 represents generating 20 coin2. Coin1 and coin2 are two types of tokens running on the same blockchain; the blockchain node executes txgroup1, so as to freeze 10 coin1 of user A to generate 20 coin2.
[0003] In the prior art, since the transactions in the transaction group can be combined arbitrarily, user A may first issue coin1' on the same blockchain, and coin1' is a fake coin1; then user A generates txgroup2 (including tx3 and tx4), where tx3 represents freezing 10 coin1' of user A, and tx2 represents generating 20 coin2; the blockchain node executes txgroup2, so as to freeze 10 coin1' of user A to generate 20 coin2; since coin1' is a fake coin1, the above mechanism will cause economic losses to the operator of coin2, and the security of the transaction group cannot be guaranteed. Summary of the Invention
[0004] In view of the above defects or deficiencies in the prior art, it is desired to provide a transaction group execution method, a computer device, and a storage medium that can improve the security of the transaction group.
[0005] In a first aspect, the present invention provides a transaction group execution method applicable to a blockchain node. There are several protocol interfaces on the blockchain. The protocol interface includes a protocol interface name and a list of method bodies. Each protocol interface is respectively configured with a protocol constraint on the blockchain. The protocol constraint includes several first constraint relationships of each method body in the corresponding list of method bodies. The first constraint relationship is configured with a prev constraint and a next constraint. Each contract is configured with a declared protocol list, and the declared protocol list stores the declared protocol interfaces. The method is applicable to a blockchain node and includes:
[0006] Receiving a first transaction group, and sequentially performing the following operations on each first transaction in the first transaction group:
[0007] When there is a second method body in the first method body list of the first declared protocol list of the first contract called by the first transaction that matches the first method body of the first contract, finding several second constraint relationships of the second method body through the first protocol interface;
[0008] Performing the following operations on each second constraint relationship respectively:
[0009] Determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract;
[0010] When all the above judgments are affirmative, the first transaction passes the verification;
[0011] When each first transaction passes the verification, execute the first transaction group.
[0012] In a second aspect, the present invention further provides a device, including one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to execute the transaction group execution method provided by various embodiments of the present invention.
[0013] In a third aspect, the present invention further provides a storage medium storing a computer program, and the computer program causes a computer to execute the transaction group execution method provided by various embodiments of the present invention.
[0014] The transaction group execution methods, computer devices, and storage media provided by many embodiments of the present invention receive a first transaction group and perform the following operations on each first transaction in the first transaction group in sequence: when there is a second method body matching the first method body in the first method body list of the first declared protocol list of the first contract called by the first transaction, find several second constraint relationships of the second method body through the first protocol interface; perform the following operations on each second constraint relationship respectively: determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract; when all the above judgments are affirmative, the first transaction passes the verification; when each first transaction passes the verification, execute the method of the first transaction group, improving the security of the transaction group. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] By reading the detailed description of the non-restrictive embodiments with reference to the following drawings, other features, objects, and advantages of the present application will become more apparent:
[0016] Figure 1 The flowchart of a transaction group execution method provided by an embodiment of the present invention.
[0017] Figure 2 The schematic structural diagram of a computer device provided by an embodiment of the present invention. Detailed implementation manners
[0018] The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related invention, rather than limiting the invention. In addition, it should be noted that for the convenience of description, only the parts related to the invention are shown in the drawings.
[0019] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the drawings and embodiments.
[0020] Figure 1 The flowchart of a transaction group execution method provided by an embodiment of the present invention. As Figure 1 shown, in this embodiment, the present invention provides a transaction group execution method applicable to blockchain nodes. There are several protocol interfaces on the blockchain. The protocol interfaces include protocol interface names and method body lists. Each protocol interface is respectively configured with protocol constraints on the blockchain. The protocol constraints include several first constraint relationships of each method body in the corresponding method body list. The first constraint relationships are configured with prev constraints and next constraints. Each contract is configured with a declared protocol list, and the declared protocol list stores the declared protocol interfaces. The above method includes:
[0021] S12: Receive a first transaction group, and perform the following operations on each first transaction in the first transaction group in sequence:
[0022] S14: When there is a second method body in the first method body list of the first declared protocol list of the first contract called by the first transaction that matches the first method body of the first contract, find several second constraint relationships of the second method body through the first protocol interface;
[0023] Perform the following operations on each second constraint relationship respectively:
[0024] S161: Determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract;
[0025] S162: When all the above determinations are yes, the first transaction passes the verification;
[0026] S18: When each first transaction passes the verification, execute the first transaction group.
[0027] Specifically, for determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship includes "when the prev constraint of the second constraint relationship is empty, break; when the prev constraint of the second constraint relationship is not empty, determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship", determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship includes "when the next constraint of the second constraint relationship is empty, break; when the next constraint of the second constraint relationship is not empty, determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship"; and, taking the first constraint relationship also configured with a group constraint, and S161 including "when the group constraint of the second constraint relationship is true, execute step S161" as an example;
[0028] Assume that there are protocol interfaces coinslock, coinsbuy and coinsminer on the blockchain;
[0029] The protocol interface name of coinslock is coinslock, and the method body list is lock and unlock;
[0030] The protocol interface name of coinsbuy is coinsbuy, and the method body list is buy;
[0031] The protocol interface of coinsminer is named coinsminer, and the method body list is miner and burn;
[0032] The protocol constraints of coinslock are:
[0033] coinslock.lock -> {group: true, prev: null, next: coinsminer.miner};
[0034] coinslock.unlock -> {group: true, prev: coinsminer.burn, next: null};
[0035] The protocol constraints of coinsbuy are:
[0036] coinslock.buy -> {group: true, prev: null, next: coinsminer.miner};
[0037] The protocol constraints of coinsminer are:
[0038] coinsminer.miner ->
[0039] {group: true, prev: coinslock.lock, next: null}
[0040] {group: true, prev: coinsbuy.buy, next: null}];
[0041] coinsminer.burn -> {group: true, prev: null, next: coinslock.unlock};
[0042] The declared protocol list configured in Contract A stores: coinslock, coinsbuy;
[0043] The declared protocol list configured in Contract B stores: coinsminer;
[0044] The blockchain node executes step S12 and receives the transaction group txgroup1 (tx1, tx2); among them, tx1 calls the lock method body of Contract A, that is, A.lock, and tx2 calls the miner method body of Contract B, that is, B.miner; the blockchain node executes the following operations on tx1 and tx2 in sequence:
[0045] For tx1:
[0046] Since the declared protocol list of contract A.lock called by tx1 includes coinslock and coinsbuy, and the lock method in coinslock matches the lock method of contract A, the blockchain node executes step S14 to find the constraint relationship of lock through coinslock: coinslock.lock -> {group: true, prev: null, next: coinsminer.miner}; Those skilled in the art should understand that to determine whether the lock method in coinslock matches the lock method of contract A, generally, it is to determine whether the lock method in coinslock and the lock method of contract A have the same parameters, that is, to determine whether the method name and parameter list are the same; When using this matching judgment mechanism, the method body list of the declared protocol interface includes the method body name and parameter list, and the matching judgment mechanism is not specifically limited in this application, and the subsequent matching judgment mechanism is the same and will not be elaborated;
[0047] The blockchain node executes step S161. Since its prev is empty, it breaks, that is, it does not execute the steps of "judging whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judging whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship"; and, since its next is coinsminer.miner, it judges whether the contract called by tx2 declares coinsminer and whether tx2 calls the miner method of contract B.
[0048] Since it does not execute the steps of "judging whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judging whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship", and contract B declares coinsminer and tx2 calls the miner method of contract B, the blockchain node executes step S162 and tx1 passes the verification.
[0049] For tx2:
[0050] Since the declared protocol list of contract B.miner called by tx2 includes coinsminer, and the miner method in coinsminer matches the miner method of contract B, the blockchain node executes step S14 to find the constraint relationship of miner through coinsminer: coinsminer.miner ->
[0051] {group:true,prev:coinslock.lock,next:null}
[0052] {group:true,prev:coinsbuy.buy,next:null}];
[0053] For {group:true,prev:coinslock.lock,next:null}:
[0054] The blockchain node executes step S161. Since its prev is coinslock.lock, it determines whether the contract A called by tx1 declares coinslock, whether tx1 calls the lock method of contract A, and since its next is null, it breaks, that is, it does not execute the step of "determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship";
[0055] Since contract A declares coinslock, tx1 calls the lock method of contract A, and the step of "determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship" is not executed, the blockchain node executes step S162 and tx2 passes the verification; those skilled in the art should understand that at this time tx2 has passed the verification, and then it can be configured according to actual needs whether to still execute step S161 for {group:true,prev:coinsbuy.buy,next:null}, but generally speaking, if one passes the verification, the rest will be ignored, and this configuration is an or relationship;
[0056] Since both tx1 and tx2 pass the verification, the transaction group txgroup1(tx1,tx2) is executed.
[0057] Those skilled in the art should understand that if at least one of tx1 and tx2 fails the verification, the transaction group txgroup1(tx1, tx2) fails to execute; however, for tx1, only by judging a constraint relationship "group: true, prev: null, next: coinsminer.miner" in step S161 can it be determined whether tx1 passes the verification; while for tx2, there are two constraint relationships "{group: true, prev: coinslock.lock, next: null}; {group: true, prev: coinsbuy.buy, next: null}", and only when all constraint relationships are judged in step S161 and all judgments fail can it be determined that tx2 fails the verification.
[0058] In more embodiments, "judging whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judging whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship" can also be configured according to actual needs. For example, it can be configured as "when the first transaction is the first transaction of the transaction group, break; when the first transaction is not the first transaction of the transaction group, judging whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judging whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship"; correspondingly, "judging whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judging whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship" can also be configured according to actual needs. For example, it can be configured as "when the first transaction is the last transaction of the transaction group, break; when the first transaction is not the last transaction of the transaction group, judging whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judging whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship", which can achieve the same technical effect.
[0059] In more embodiments, a method for configuring transactions to be executed by a transaction group according to actual requirements may also be provided. For example, a transaction can be identified by an identifier to determine whether it needs to be executed by a transaction group: if the first constraint relationship is further configured with a group identifier, the execution method of S161 is "when the group constraint of the second constraint relationship is true, determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship, and determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship", which can achieve the same technical effect.
[0060] Those skilled in the art need to understand that the above "there are several protocol interfaces on the blockchain" can be implemented in various ways. For example, static deployment, where several protocol interfaces are statically deployed on the blockchain; or dynamic deployment, where "the blockchain node receives a first protocol interface deployment transaction; when the execution of the first protocol interface deployment transaction is successful, record the first protocol interface on the blockchain".
[0061] Those skilled in the art should understand that before step S161, the first transaction should undergo other validations of the prior art, such as signature validation, transaction fee validation, etc. If the previous validations fail, the first transaction validation fails and the transaction group execution fails.
[0062] Similarly, the above "each protocol interface is respectively configured with a protocol constraint on the blockchain" can be implemented in various ways. For example, static deployment, where the protocol constraints corresponding to each protocol interface are statically deployed on the blockchain; or dynamic deployment, where "the blockchain node receives a first protocol constraint transaction including a third protocol constraint; wherein, the first protocol constraint includes several third constraint relationships of each method body in the corresponding method body list, and the third constraint relationship is configured with a prev constraint and a next constraint; when the execution of the first protocol constraint transaction is successful, record the third protocol constraint on the blockchain".
[0063] Similarly, the above "each contract is configured with a declared protocol list, and the declared protocol interfaces are stored in the declared protocol list" can be implemented in various ways. For example, in static deployment, each contract is statically deployed on the blockchain with a declared protocol list, and the declared protocol interfaces are stored in the declared protocol list; or, in dynamic deployment, "the blockchain node receives a first contract declaration transaction pointing to a third protocol interface; wherein, the first contract declaration transaction includes a fourth contract, and the fourth contract includes a number of third method bodies; when any one of the third method bodies matches any one of the fourth method bodies in the third protocol interface, update the third protocol interface to the declared protocol list of the first contract", which can achieve the same technical effect.
[0064] The above embodiments improve the security of the transaction group.
[0065] In addition, those skilled in the art need to understand that in the prior art, the lock method generally refers to the method of token freezing, so it can be called by the terminals of ordinary users. The miner method generally refers to the method of issuing tokens, so it can generally only be called by the terminal of the administrator. For example, B.miner can generally only be called by the administrator terminal of contract B; therefore, in the above embodiments, it is also possible if the group of tx1 is configured to false. When the group of tx1 is configured to false, the judgment in step S161 is not executed, and it is directly considered that tx1 passes the verification; while the group of the above tx2 must be configured to true, and only then can the terminal of an ordinary user call B.miner in the way of a transaction group, and tx2 must execute the judgment in step S161; the above embodiments enable ordinary users to also call B.miner in the way of a transaction group, and the call of the method is more flexible.
[0066] Preferably, determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship includes:
[0067] When the prev constraint of the second constraint relationship is empty, break;
[0068] When the prev constraint of the second constraint relationship is not empty, determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship;
[0069] Determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship includes:
[0070] When the next constraint of the second constraint relationship is empty, break;
[0071] When the next constraint of the second constraint relationship is not empty, determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship.
[0072] The execution principle of the transaction group in the above embodiment can be referred to Figure 1 the method shown, which will not be elaborated here.
[0073] Preferably, the first constraint relationship is further configured with a group constraint. Determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship, and determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship includes:
[0074] When the group constraint of the second constraint relationship is true, determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship, and determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship.
[0075] The execution principle of the transaction group in the above embodiment can be referred to Figure 1 the method shown, which will not be elaborated here.
[0076] Preferably, the first constraint relationship is also configured with a group identifier. Determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship, and, determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship includes:
[0077] When the second constraint relationship is configured with a group identifier, determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship, and, determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship.
[0078] The execution principle of the transaction group in the above embodiment can be referred to Figure 1 to the method shown, which will not be elaborated here.
[0079] Preferably, determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship, and, determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship includes:
[0080] When the account constraints of the second constraint relationship are all configured as same, determining whether the accounts of the first transaction and other first transactions are the same:
[0081] If so, determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship, and, determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship.
[0082] The account configurations of different method bodies are different. ForFigure 1 In txgroup1 in the method shown, since it is the freezing and generation of assets, the account should be configured to be the same. That is, the assets of user M's account should be frozen, and new assets should be generated in user M's account. In some method bodies, the account can be configured differently according to actual needs.
[0083] Figure 2 The structural schematic diagram of a computer device provided by an embodiment of the present invention.
[0084] As Figure 2 shown, on the other hand, the present application also provides a computer device, including one or more central processing units (CPUs) 201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 202 or the program loaded from the storage section 208 into the random access memory (RAM) 203. In the RAM 203, various programs and data required for the operation of the computer device are also stored. The CPU 201, ROM 202, and RAM 203 are connected to each other through a bus 204. The input / output (I / O) interface 205 is also connected to the bus 204.
[0085] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. The drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed, so that the computer program read from it can be installed into the storage section 208 as needed.
[0086] Specifically, according to the embodiments of the present disclosure, the methods described in any of the above embodiments can be implemented as computer software programs. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes program codes for performing any of the above methods. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 209, and / or installed from the removable medium 211.
[0087] As another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the device of the above embodiments; or may exist alone and be a computer-readable storage medium not assembled into a computer device. The computer-readable storage medium stores one or more programs, and the one or more programs are used by one or more processors to execute the methods described in the present application.
[0088] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0089] The units or modules described in the embodiments of the present application may be implemented in software or in hardware. The described units or modules may also be provided in a processor. For example, each of the units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Among them, the names of these units or modules do not constitute a limitation to the units or modules themselves in some cases.
[0090] The above description is only a preferred embodiment of the present application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the concept of the present application. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present application.
Claims
1. A trading group execution method, characterized in that, There are several protocol interfaces on the blockchain. The protocol interfaces include a protocol interface name and a list of method bodies. Each of the protocol interfaces is respectively configured with a protocol constraint on the blockchain. The protocol constraint includes several first constraint relationships of each method body in the corresponding list of method bodies. The first constraint relationship is configured with a prev constraint and a next constraint. Each contract is configured with a declared protocol list, and the declared protocol interfaces are stored in the declared protocol list. The method is applicable to blockchain nodes, and the method includes: Receiving a first transaction group, and sequentially performing the following operations on each first transaction in the first transaction group: When there is a second method body in the first method body list of the first declared protocol list of the first contract called by the first transaction that matches the first method body of the first contract, finding several second constraint relationships of the second method body through the first protocol interface; Performing the following operations on each of the second constraint relationships respectively: Judging whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, judging whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and judging whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judging whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract; When all the above judgments are yes, the first transaction passes the verification; When each of the first transactions passes the verification, execute the first transaction group.
2. The method according to claim 1, characterized in that, The judgment of whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and the judgment of whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract include: When the prev constraint of the second constraint relationship is empty, break; When the prev constraint of the second constraint relationship is not empty, judge whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and judge whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract; The judgment of whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and the judgment of whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract include: When the next constraint of the second constraint relationship is empty, break; When the next constraint of the second constraint relationship is not empty, determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract.
3. The method according to claim 1, wherein The first constraint relationship is further configured with a group constraint. The steps of determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract include: When the group constraint of the second constraint relationship is true, determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract.
4. The method according to claim 1, wherein The first constraint relationship is further configured with a group identifier. The steps of determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract include: When the second constraint relationship is configured with a group identifier, determine whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determine whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determine whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determine whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship in the third contract.
5. The method according to any one of claims 1 to 4, characterized in that, Determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship includes: When the account constraints of the second constraint relationship are all configured to be the same, determining whether the account of the first transaction is the same as the accounts of the other first transactions: If so, determining whether the second contract called by the previous transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, determining whether the previous transaction of the first transaction calls the method corresponding to the prev constraint of the second constraint relationship in the second contract, and determining whether the third contract called by the next transaction of the first transaction declares the second protocol interface corresponding to the second constraint relationship, and determining whether the next transaction of the first transaction calls the method corresponding to the next constraint of the second constraint relationship.
6. A computer device, characterized in that, The device includes: One or more processors; A memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method according to any one of claims 1-5.
7. A storage medium storing a computer program, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-5.
Citation Information
Patent Citations
Method and apparatus for processing information at node of block chain
CN109063183A
Concurrent state machine processing using a blockchain
US20200204350A1