Information verification method and device, and storage medium
By constructing a smart contract call relationship topology graph and routing table, and using tokens for distribution and verification in the blockchain, the problem of low verification efficiency of parallel execution schemes in the blockchain is solved, and efficient verification of contract call scenarios is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2026-04-14
AI Technical Summary
In blockchain, existing technologies struggle to efficiently verify the correctness and consistency of deterministic multi-contract parallel execution schemes. This necessitates writing smart contracts for testing each contract call scenario, resulting in low verification efficiency.
By constructing a smart contract call relationship topology graph, generating a contract call relationship routing table, and distributing tokens in the initial transaction, the tokens are used to leave traces in the smart contract call relationship, and the correctness and consistency of the parallel execution results are verified based on the number of tokens.
It improves the efficiency of verifying parallel execution schemes, reduces the need to write smart contracts for each contract call scenario, and simplifies the verification process.
Smart Images

Figure CN116089524B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to an information verification method, device, and storage medium. Background Technology
[0002] In internet finance scenarios, blockchain technology is widely used, such as the FISCO BCOS blockchain. The FISCO BCOS blockchain proposes a Deterministic Multi-Contract (DMC) scheme, which allows multiple transactions calling different contracts to be executed in parallel, improving transaction processing efficiency. To ensure system availability, it is necessary to verify and test the effectiveness and correctness of the parallel execution scheme.
[0003] In related technologies, to verify the correctness and consistency of DMC's parallel execution results, numerous smart contracts need to be written for coverage testing. This means writing a corresponding smart contract for each contract call scenario and testing it until the correctness and consistency of DMC's execution results are verified across all call scenarios. Because the contract-to-contract scenarios in DMC are complex and diverse, writing and testing smart contracts for each of these scenarios reduces the efficiency of verifying the parallel execution scheme. Summary of the Invention
[0004] To address the aforementioned technical problems, this application aims to provide an information verification method, apparatus, and storage medium that can improve the efficiency of verifying parallel execution schemes.
[0005] The technical solution of this application is implemented as follows:
[0006] This application provides an information verification method, the information verification method including:
[0007] Upon receiving a verification instruction for the parallel execution scheme of multiple smart contracts, the topology of smart contract call relationships is obtained from the verification instruction;
[0008] Based on the called relationships of each smart contract in the smart contract call relationship topology graph and the multiple contract addresses corresponding to the multiple smart contracts, a contract call relationship routing table is constructed;
[0009] In the case of generating an initial transaction and transmitting the initial transaction in the multiple smart contracts, the multiple tokens in the initial transaction are distributed to the multiple smart contracts according to the contract call relationship routing table;
[0010] When the verification time is reached, a first number of tokens carried in the multiple smart contracts is determined; and the parallel execution scheme of the multiple smart contracts is verified based on the first number and the number of the multiple tokens.
[0011] This application provides an information verification device, the device comprising:
[0012] The acquisition unit is used to acquire a smart contract call relationship topology from the verification instructions when a verification instruction for the parallel execution scheme of multiple smart contracts is received.
[0013] The establishment unit is used to construct a contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology graph and the multiple contract addresses corresponding to the multiple smart contracts;
[0014] A distribution unit is configured to distribute multiple tokens in the initial transaction to the multiple smart contracts according to the contract call relationship routing table when an initial transaction is generated and the initial transaction is transmitted in the multiple smart contracts.
[0015] A determining unit is configured to determine a first number of tokens carried in the plurality of smart contracts when a preset time is reached;
[0016] The verification unit is used to verify the parallel execution scheme of the multiple smart contracts based on the first quantity and the quantity of the multiple tokens.
[0017] This application provides an information verification device, the device comprising:
[0018] The system includes a memory, a processor, and a communication bus. The memory communicates with the processor via the communication bus. The memory stores an information verification program executable by the processor. When the information verification program is executed, the processor performs the information verification method described above.
[0019] This application provides a storage medium storing a computer program for use in an information verification device. The computer program, when executed by a processor, implements the information verification method described above.
[0020] This application provides an information verification method, apparatus, and storage medium. The information verification method includes: upon receiving a verification instruction for a parallel execution scheme of multiple smart contracts, obtaining a smart contract call relationship topology from the verification instruction; constructing a contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology and the multiple contract addresses corresponding to the multiple smart contracts; when an initial transaction is generated and transmitted in multiple smart contracts, distributing multiple tokens in the initial transaction to the multiple smart contracts according to the contract call relationship routing table; when the verification time is reached, determining a first number of tokens carried in the multiple smart contracts; and verifying the parallel execution scheme of the multiple smart contracts based on the first number and the number of multiple tokens. The above-described implementation scheme involves an information verification device constructing a contract call relationship routing table based on the called relationships of each smart contract in the smart contract call relationship topology and the multiple contract addresses corresponding to multiple smart contracts. This routing table records the paths of contract calls. Multiple tokens from the initial transaction are distributed to multiple smart contracts according to the routing table, allowing tokens to leave traces in the smart contract call relationships. The correctness and consistency of the parallel execution results are verified by comparing the number of tokens obtained from the traces in multiple smart contracts with the number of tokens carried in the initial transaction. This eliminates the need to write and test smart contracts for each contract call scenario, improving the efficiency of verifying parallel execution schemes. Attached Figure Description
[0021] Figure 1 A prior art DMC logic diagram provided for embodiments of this application;
[0022] Figure 2 This application provides a schematic diagram of an information verification process.
[0023] Figure 3 A schematic diagram illustrating an exemplary contract call topology provided for embodiments of this application;
[0024] Figure 4 A schematic diagram illustrating an exemplary DMC contract call scenario provided for embodiments of this application;
[0025] Figure 5 An exemplary token distribution diagram provided for embodiments of this application;
[0026] Figure 6 This application provides an exemplary information verification process diagram.
[0027] Figure 7 A schematic diagram of an exemplary star contract call topology provided for embodiments of this application;
[0028] Figure 8 A schematic diagram of the composition structure of an information verification device provided in this application embodiment. Figure 1 ;
[0029] Figure 9 A schematic diagram of the composition structure of an information verification device provided in this application embodiment. Figure 2 . Detailed Implementation
[0030] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0031] To address the performance issues of blockchain, various transaction parallelism solutions have been proposed in the industry. For example, the well-known blockchain FISCO BCOS proposed a deterministic multi-contract parallelism (DMC) solution. The DMC solution requires that there is no shared data between smart contracts on the blockchain, and each contract has its own independent storage space that cannot be read or written by other contracts.
[0032] like Figure 1 As shown: In the DMC scheme, multiple transactions that call different contracts are executed in parallel. Since there is no shared data between smart contracts, the parallel execution between different contracts can always guarantee the consistency of the final result.
[0033] To verify the effectiveness and correctness of the parallel execution scheme and ensure system availability, appropriate verification tools are needed. However, currently, there is no unified verification tool for parallel smart contracts in the industry. Most verification methods involve constructing various contract call scenarios using smart contracts and then verifying the correctness and consistency of the results. However, each contract call scenario requires writing a corresponding smart contract implementation, which significantly increases the workload of verification testing.
[0034] The problems existing in the prior art can be solved by the method described in Example 1.
[0035] This application provides an information verification method, which is applied to an information verification device. Figure 2 A flowchart of an information verification method provided in this application embodiment is shown below. Figure 2 As shown, information verification methods may include:
[0036] S101. Upon receiving a verification instruction for the parallel execution scheme of multiple smart contracts, obtain the smart contract call relationship topology from the verification instruction.
[0037] The information verification method provided in this application embodiment is applicable to scenarios where parallel execution schemes of multiple smart contracts are verified.
[0038] In the embodiments of this application, the information verification device can be implemented in various forms. For example, the information verification device described in this application may include devices such as mobile phones, cameras, tablet computers, laptops, handheld computers, personal digital assistants (PDAs), portable media players (PMPs), navigation devices, wearable devices, smart bracelets, pedometers, etc., as well as devices such as digital TVs, desktop computers, servers, etc.
[0039] In this embodiment of the application, the verification instruction carries a smart contract call relationship topology diagram.
[0040] It should be noted that the smart contract call relationship topology diagram is a topology diagram used to show the mutual call relationships between smart contracts.
[0041] For example, a smart contract call relationship topology diagram is as follows: Figure 3 As shown, where, Figure 3 (a) is the topology of the self-calling relationship of smart contracts, that is, the topology of the calling relationship between smart contract A and smart contract a; Figure 3 (b) is a star topology diagram of smart contract calls, that is, a topology diagram of the call relationships of smart contract A, smart contract B, smart contract C and smart contract D all calling smart contract X; Figure 3 (c) is a DAG-type call relationship topology diagram of smart contracts, that is, smart contracts A and B both call smart contract X, smart contract X calls smart contracts D and E, smart contracts C and B both call smart contract Y, and smart contract Y calls smart contracts F and E. Figure 3 (d) is a circular call relationship topology diagram of smart contracts, that is, smart contract A calls smart contract B; smart contract B calls smart contract C; smart contract C calls smart contract D; smart contract D calls smart contract C; smart contract C calls smart contract B; smart contract B calls smart contract A.
[0042] It should be noted that the information verification scheme in this application can be a technical solution written using Solidity contract code, used to implement a test contract that constructs arbitrary contract call relationships.
[0043] S102. Based on the called relationships of each smart contract in the smart contract call relationship topology diagram and the multiple contract addresses corresponding to multiple smart contracts, construct a contract call relationship routing table.
[0044] In this embodiment of the application, after the information verification device obtains the smart contract call relationship topology map from the verification instruction, the information verification device can construct a contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology map and the multiple contract addresses corresponding to multiple smart contracts.
[0045] In this embodiment of the application, the process of the information verification device constructing a contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology diagram and the multiple contract addresses corresponding to the multiple smart contracts includes: determining multiple upstream call addresses and multiple downstream called addresses corresponding to the multiple smart contracts based on the called relationship of each smart contract in the smart contract call relationship topology diagram; and establishing a contract call relationship routing table based on the multiple smart contracts, the multiple upstream call addresses, and the multiple downstream called addresses.
[0046] In the embodiments of this application, multiple smart contracts correspond one-to-one with multiple upstream calling addresses and multiple downstream called addresses, that is, one smart contract corresponds to one upstream calling address and one downstream called address.
[0047] It should be noted that the upstream calling address is the address of the upstream smart contract that calls this smart contract; the downstream called address is the address of the downstream smart contract that is called by this smart contract.
[0048] For example, smart contract A calls smart contract B, and smart contract B calls smart contract C. Then, smart contract A is the upstream smart contract of smart contract B, and smart contract C is the downstream smart contract of smart contract B. The address of smart contract A is the upstream calling address of smart contract B, and the address of smart contract C is the downstream called address of smart contract B.
[0049] In this embodiment, the information verification device can determine the called relationship of each smart contract in the smart contract call relationship topology diagram, that is, determine the upstream and downstream smart contracts of each smart contract. The information verification device obtains the address of the upstream smart contract to obtain the upstream call address, and obtains the address of the downstream smart contract to obtain the downstream called address.
[0050] It should be noted that each smart contract corresponds to a contract address.
[0051] In this embodiment, the information verification device establishes a correspondence between multiple smart contracts, multiple upstream calling addresses, and multiple downstream called addresses, thereby obtaining a contract calling relationship routing table.
[0052] In this embodiment of the application, an exemplary smart contract call relationship routing table is shown in Table (1):
[0053] Table (1) Contract Call Relationship Routing Table
[0054]
[0055]
[0056] It should be noted that the downstream access addresses of smart contracts F, H, I, J, K, and L are all empty, which means that there are no downstream smart contracts for smart contracts F, H, I, J, K, and L.
[0057] In this embodiment of the application, before the information verification device constructs the contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology diagram and the multiple contract addresses corresponding to the multiple smart contracts, the information verification device will also deploy multiple smart contracts in the blockchain and generate multiple contract addresses corresponding to the multiple smart contracts.
[0058] In this embodiment, the information verification device can utilize the blockchain system's deployment contract interface to deploy multiple smart contracts. If the deployment of multiple smart contracts is successful, multiple contract addresses are generated based on the corresponding smart contracts. If the deployment of the second smart contract among the multiple smart contracts fails, a failure message for the deployment of the second smart contract is generated, allowing for the redeployment of the second smart contract based on the failure message, until the second smart contract is successfully deployed.
[0059] It should be noted that the second smart contract is any one of multiple smart contracts.
[0060] It should be noted that multiple smart contracts correspond one-to-one with multiple contract addresses, that is, one smart contract corresponds to one contract address.
[0061] In this embodiment, the method of deploying multiple smart contracts using the blockchain system's deployment contract interface and generating multiple contract addresses corresponding to these smart contracts is a method found in the prior art. The specific execution process is not limited in this embodiment.
[0062] S103. When an initial transaction is generated and the initial transaction is transmitted in multiple smart contracts, the multiple tokens in the initial transaction are distributed to multiple smart contracts according to the contract call relationship routing table.
[0063] In this embodiment, after the information verification device constructs a contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology diagram and the multiple contract addresses corresponding to multiple smart contracts, when an initial transaction is generated and the initial transaction is transmitted in multiple smart contracts, the information verification device can distribute multiple tokens in the initial transaction to multiple smart contracts according to the contract call relationship routing table.
[0064] It should be noted that a token is the same as a blockchain token.
[0065] In this embodiment, when an initial transaction is generated and transmitted in multiple smart contracts, before distributing multiple tokens in the initial transaction to multiple smart contracts according to the contract call relationship routing table, the information verification device obtains a second number of tokens to be distributed when each smart contract is called from the verification instructions; determines a third number based on the second number and the number of times the multiple smart contracts are called, and uses the third number of tokens as multiple tokens; when an initial transaction is generated, multiple tokens are added to the initial transaction.
[0066] In this embodiment, the verification instruction carries a second quantity. This second quantity is the number of tokens that need to be distributed to a smart contract when it is invoked.
[0067] It should be noted that when multiple smart contracts are invoked, the number of tokens to be distributed can be the same; when multiple smart contracts are invoked, the number of tokens to be distributed can also be different; the specifics can be determined according to the actual situation, and this application embodiment does not limit this.
[0068] In the embodiments of this application, for example, Figure 3 In the smart contract call scenario shown in (b), if multiple smart contracts are called and the number of tokens to be distributed can be the same, and the second quantity is 1, then when the transaction initiator calls smart contract A, 1 token is distributed to smart contract A; when smart contract A calls smart contract X, 1 token is distributed to smart contract X; when the transaction initiator calls smart contract B, 1 token is distributed to smart contract B; when smart contract B calls smart contract X, 1 token is distributed to smart contract X; when the transaction initiator calls smart contract C, 1 token is distributed to smart contract C; when smart contract C calls smart contract X, 1 token is distributed to smart contract X; when the transaction initiator calls smart contract D, 1 token is distributed to smart contract D; when smart contract D calls smart contract X, 1 token is distributed to smart contract X.
[0069] In this embodiment of the application, if the number of tokens to be distributed can be the same when multiple smart contracts are invoked, the information verification device can determine the third quantity based on the second quantity and the number of times the multiple smart contracts are invoked. This can be done by determining the product between the second quantity and the number of times the multiple smart contracts are invoked, and using the product as the third quantity.
[0070] In this embodiment, the information verification device may first determine the product between the second quantity and the number of times the multiple smart contracts are called, and then select any value greater than the product as the third quantity. The specific method of determining the third quantity based on the second quantity and the number of times the multiple smart contracts are called can be determined according to the actual situation, and this embodiment does not limit it.
[0071] In this embodiment of the application, the number of initial transactions is at least one. The process of the information verification device adding multiple tokens to the initial transactions includes: determining at least one set of smart contracts to be called corresponding to at least one initial transaction according to the smart contract call relationship topology; grouping multiple tokens according to the at least one set of smart contracts to be called to obtain at least one set of tokens; and adding at least one set of tokens to at least one initial transaction.
[0072] It should be noted that multiple smart contracts include at least one set of smart contracts to be invoked, that is, multiple smart contracts consist of at least one set of smart contracts to be invoked.
[0073] It should also be noted that at least one set of smart contracts to be invoked can contain the same smart contract in any two sets of smart contracts.
[0074] In this embodiment of the application, the process by which the information verification device determines at least one set of smart contracts to be called corresponding to at least one initial transaction based on the smart contract call relationship topology can be as follows: search for an initial smart contract that has not been called by a smart contract in the smart contract call relationship topology, search for the downstream smart contracts of the initial smart contract, and then determine the other downstream smart contracts of the downstream smart contracts until it is determined that there are no other downstream smart contracts. Then, it is considered that the initial smart contract, the downstream smart contracts, and the other downstream smart contracts constitute a set of smart contracts to be called. The at least one set of smart contracts to be called corresponding to at least one initial transaction is determined from the smart contract call relationship topology in this manner.
[0075] For example, such as Figure 3(b) shows the smart contract invocation scenario. In the smart contract invocation relationship topology, the initial smart contracts that have not been invoked by any other smart contract include smart contract A, smart contract B, smart contract C, and smart contract D. The downstream smart contract of initial smart contract A is smart contract X. Since smart contract X has no downstream smart contract, smart contracts A and X are considered a group of smart contracts to be invoked. Similarly, the downstream smart contract of initial smart contract B is smart contract X. Since smart contract X has no downstream smart contract, smart contracts B and X are considered a group of smart contracts to be invoked. The downstream smart contract of initial smart contract C is smart contract X. Since smart contract X has no downstream smart contract, smart contracts C and X are considered a group of smart contracts to be invoked. Finally, the downstream smart contract of initial smart contract D is smart contract X. Since smart contract X has no downstream smart contract, smart contracts D and X are considered a group of smart contracts to be invoked. This determines the following... Figure 3 In the smart contract call scenario shown in (b), there are 4 initial transactions, and the 4 initial transactions correspond to 4 sets of smart contracts to be called.
[0076] In this embodiment of the application, the process of the information verification device grouping multiple tokens according to at least one set of smart contracts to be invoked to obtain at least one set of tokens can be as follows: determining at least one set of invoked times for at least one set of smart contracts to be invoked; grouping multiple tokens according to the number of invoked times for at least one set to obtain at least one set of tokens.
[0077] For example, such as Figure 4 (a) shows a smart contract invocation scenario: There is only one smart contract A, meaning that smart contracts A form a group of smart contracts to be invoked. Smart contract A is invoked once by the transaction initiator based on the initial transaction (tx), and smart contract A is invoked once by smart contract A. Therefore, the number of times this group of smart contracts to be invoked is invoked is 2. That is, the number of times a group of smart contracts to be invoked is invoked is 2. The process of grouping multiple tokens according to the number of times at least one group is invoked to obtain at least one group of tokens can be as follows: group multiple tokens (2 tokens) to obtain at least one group of tokens.
[0078] For example, such as Figure 4 (b) illustrates the smart contract invocation scenario: In a group of smart contracts to be invoked, consisting of smart contract A and smart contract B, smart contract A is invoked once by the transaction initiator based on the initial transaction (tx), and smart contract B is invoked once by smart contract A. Therefore, the total number of invocations for this group of smart contracts is 2. That is, the number of invocations for a group of smart contracts is 2. The process of grouping multiple tokens according to the number of invocations for at least one group to obtain at least one group of tokens can be achieved by grouping multiple tokens (2 tokens) to obtain at least one group of tokens.
[0079] For example, such as Figure 4 (c) illustrates the smart contract invocation scenario: In a group of smart contracts to be invoked, consisting of smart contracts A, B, and C, smart contract A is invoked once by the transaction initiator based on the initial transaction (tx), and smart contract B is invoked once by smart contract A; smart contract C is invoked once by the transaction initiator based on the initial transaction (tx), and smart contract B is invoked once by smart contract C; smart contract A is invoked once by smart contract C; therefore, the total number of invocations for this group of smart contracts is 5. That is, the first group of smart contracts to be invoked is invoked twice, and the second group is invoked three times. The process of grouping multiple tokens according to the number of invocations for at least one group to obtain at least one group of tokens can be as follows: obtain two tokens from multiple tokens to obtain the first group of tokens; then, the remaining three tokens form the second group of tokens. The first group of tokens and the second group of tokens together constitute at least one group of tokens.
[0080] For example, such as Figure 4 (d) illustrates the smart contract invocation scenario: In a group of smart contracts to be invoked, consisting of smart contracts A, B, C, and D, smart contract A is invoked once by the transaction initiator based on the initial transaction (tx1), smart contract B is invoked once by smart contract A, smart contract C is invoked once by smart contract B, and smart contract D is invoked once by smart contract B; smart contract D is invoked once by the transaction initiator based on the initial transaction (tx2), smart contract C is invoked once by smart contract D, smart contract B is invoked once by smart contract C, and smart contract A is invoked once by smart contract B; therefore, the total number of invocations for this group of smart contracts is 8. That is, each of the two groups of smart contracts to be invoked is invoked 4 times. The process of grouping multiple tokens according to the number of times at least one group is invoked to obtain at least one group of tokens can be as follows: obtain 4 tokens from multiple tokens to obtain the first group of tokens; then, the remaining 4 tokens form the second group of tokens. The first group of tokens and the second group of tokens together constitute at least one group of tokens.
[0081] For example, such as Figure 4(e) illustrates the following smart contract invocation scenario: In a group of smart contracts to be invoked consisting of smart contracts A and X, if smart contract A is invoked once by the transaction initiator based on the initial transaction (tx1), and smart contract X is invoked once by smart contract A, then the total number of invocations for this group of smart contracts is 2; In a group of smart contracts to be invoked consisting of smart contracts B and X, if smart contract B is invoked once by the transaction initiator based on the initial transaction (tx2), and smart contract X is invoked once by smart contract B, then the total number of invocations for this group of smart contracts is 2; In smart contract C... In a group of smart contracts to be invoked, consisting of smart contract C and smart contract X, if smart contract C is invoked once by the transaction initiator according to the initial transaction (tx3), and smart contract X is invoked once by smart contract C, then the total number of times this group of smart contracts to be invoked is 2. Similarly, in a group of smart contracts to be invoked, consisting of smart contract D and smart contract X, if smart contract D is invoked once by the transaction initiator according to the initial transaction (tx4), and smart contract X is invoked once by smart contract D, then the total number of times this group of smart contracts to be invoked is 2. In other words, each of the four groups of smart contracts to be invoked is invoked twice. The process of grouping multiple tokens according to the number of times at least one group is invoked to obtain at least one group of tokens can be as follows: obtain 2 tokens from multiple tokens to obtain the first group of tokens; then obtain 2 more tokens from multiple tokens to obtain the second group of tokens; then obtain 2 more tokens from multiple tokens to obtain the third group of tokens; finally, the remaining 2 tokens constitute the fourth group of tokens. The first group of tokens, the second group of tokens, the third group of tokens, and the fourth group of tokens constitute at least one group of tokens.
[0082] For example, such as Figure 4(f) illustrates the following smart contract invocation scenario: In a group of smart contracts to be invoked, consisting of smart contracts A, B, C, D, E, F, X, and Y, smart contract A is invoked once by the transaction initiator based on the initial transaction (tx1), smart contract X is invoked once by smart contract A, and smart contract X invokes smart contracts D and E once each; smart contract B is invoked once by the transaction initiator based on the initial transaction (tx2), smart contract B invokes smart contracts X and Y once each, smart contract X invokes smart contracts D and E once each; smart contract Y invokes smart contracts F and E once each; smart contract C is invoked once by the transaction initiator based on the initial transaction (tx3), smart contract Y is invoked once by smart contract C, and smart contract Y invokes smart contracts F and E once each; therefore, the total number of invocations for this group of smart contracts is 15. That is, in the three groups of smart contracts to be invoked, the first group is invoked 4 times each; the second group is invoked 7 times each; and the third group is invoked 7 times each. The process of grouping multiple tokens according to the number of times at least one group is invoked to obtain at least one group of tokens can be as follows: obtain 4 tokens from multiple tokens to obtain the first group of tokens; then obtain 7 tokens from multiple tokens to obtain the second group of tokens; finally, the remaining 4 tokens form the third group of tokens. The first group of tokens, the second group of tokens, and the third group of tokens constitute at least one group of tokens.
[0083] For example, such as Figure 4 (g) illustrates the smart contract invocation scenario: In a group of smart contracts to be invoked, consisting of smart contracts A, B, C, D, E, F, G, H, I, J, K, and L, smart contract A is invoked once by the transaction initiator based on the initial transaction (tx), and then smart contract A invokes smart contracts B and C; smart contract B then invokes smart contracts D and E once each; smart contract C then invokes smart contracts F and G once each; smart contract D then invokes smart contracts H and I once each; smart contract E then invokes smart contract J once; and smart contract G then invokes smart contracts K and L once each. Therefore, the total number of invocations for this group of smart contracts is 12. That is, each group of smart contracts to be invoked is invoked 12 times. The process of grouping multiple tokens according to the number of times each group is invoked, to obtain at least one group of tokens, can be achieved by grouping multiple tokens (12 tokens) to obtain at least one group of tokens.
[0084] It should be noted that at least one set of smart contracts to be invoked corresponds one-to-one with at least one set of tokens, that is, one set of smart contracts to be invoked corresponds to one set of tokens.
[0085] In this embodiment of the application, at least one initial transaction corresponds one-to-one with at least one set of tokens, that is, one initial transaction corresponds to one set of tokens. The information processing device adds a first set of tokens in the first initial transaction, adds a second set of tokens in the second initial transaction, and so on, until the at least one set of tokens is added in at least one initial transaction.
[0086] In this embodiment of the application, when the information verification device generates an initial transaction and the initial transaction is transmitted in multiple smart contracts, the process of distributing multiple tokens in the initial transaction to multiple smart contracts according to the contract call relationship routing table includes: determining the initial smart contract that triggers the initial transaction from the contract call relationship routing table; obtaining a second number of tokens from the initial transaction to obtain a first transaction; distributing the second number of tokens to the initial smart contract; determining the downstream call address of the initial smart contract from the contract call relationship routing table; and determining the downstream call contract corresponding to the downstream call address; obtaining the second number of tokens from the first transaction to obtain a second transaction; distributing the second number of tokens to the downstream call contract; until each smart contract is successfully called, the multiple tokens are sequentially distributed to each smart contract.
[0087] It should be noted that the initial smart contract is the smart contract invoked by the transaction initiator.
[0088] In this embodiment of the application, if the information verification device first determines the product between the second quantity and the number of times the multiple smart contracts are called, selects a value greater than the product as the third quantity, and uses the tokens of the third quantity as multiple tokens, then in the case of token distribution, it first determines the difference between the third quantity and the product, determines the target quantity based on the difference and the second quantity, and distributes the target quantity of tokens to the initial smart contract. If the remaining smart contracts other than the initial smart contract are called among the multiple smart contracts, then the second quantity of tokens is distributed to each of the remaining smart contracts.
[0089] It should be noted that there is at least one remaining smart contract. The process of distributing multiple tokens from the initial transaction to multiple smart contracts according to the contract call relationship routing table can be as follows: First, obtain the target number of tokens from the initial transaction to obtain the first transaction; distribute the target number of tokens to the initial smart contract; determine the downstream call address of the initial smart contract from the contract call relationship routing table; determine the downstream call contract corresponding to the downstream call address; obtain the second number of tokens from the first transaction to obtain the second transaction; distribute the second number of tokens to the downstream call contract; and so on, until each smart contract is successfully called, distributing multiple tokens sequentially to each smart contract. That is, the information verification device distributes the second number of tokens to each smart contract when each of the at least one remaining smart contract is successfully called; and distributes the target number of tokens to the initial smart contract when it is successfully called.
[0090] In this embodiment of the application, if the number of tokens to be distributed can be the same when multiple smart contracts are invoked, the process by which the information verification device distributes multiple tokens from the initial transaction to multiple smart contracts according to the contract call relationship routing table can be as follows: Determine the initial smart contract that triggers the initial transaction from the contract call relationship routing table; obtain a second number of tokens from the initial transaction to obtain a first transaction; distribute the second number of tokens to the initial smart contract; determine the downstream call address of the initial smart contract from the contract call relationship routing table; and determine the downstream call contract corresponding to the downstream call address; obtain the second number of tokens from the first transaction to obtain a second transaction; distribute the second number of tokens to the downstream call contract; and so on, until each smart contract is successfully invoked, the multiple tokens are sequentially distributed to each smart contract. That is, the information verification device distributes the second number of tokens to each smart contract when each of the multiple smart contracts is successfully invoked.
[0091] For example, such as Figure 5The smart contract call scenario shown includes the process of distributing multiple tokens from the initial transaction to multiple smart contracts according to the contract call relationship routing table. This process includes: determining the initial smart contract (smart contract A) that triggers the initial transaction from the contract call relationship routing table; obtaining a second quantity (1) of tokens from the initial transaction to obtain the first transaction; distributing the second quantity of tokens to the initial smart contract; determining the downstream call addresses of the initial smart contract (the addresses of smart contract B and smart contract C) from the contract call relationship routing table; and determining the downstream call contracts (smart contract B and smart contract C) corresponding to the downstream call addresses; obtaining the second quantity of tokens from the first transaction and sending them to the downstream call contract (smart contract B). Distribute a second quantity of tokens; then obtain a second quantity of tokens from the first transaction, resulting in a second transaction, and distribute the second quantity of tokens to the downstream calling contract (smart contract C); determine the downstream calling addresses of smart contract B (the addresses of smart contract D and smart contract E) from the contract call relationship routing table; and determine the downstream calling contracts (smart contract D and smart contract E) corresponding to the downstream calling addresses; obtain a second quantity of tokens from the second transaction and distribute the second quantity of tokens to the downstream calling contract (smart contract D); then obtain a second quantity of tokens from the second transaction, resulting in a third transaction, and distribute the second quantity of tokens to the downstream calling contract (smart contract E); determine the downstream calling addresses of smart contract B from the contract call relationship routing table. The downstream calling addresses of contract C (the addresses of smart contract G and smart contract F) are determined; and the corresponding downstream calling contracts (smart contract G and smart contract F) are identified. A second quantity of tokens is obtained from the third transaction and distributed to the downstream calling contract (smart contract G); another second quantity of tokens is obtained from the third transaction to obtain the fourth transaction, which is then transmitted to the downstream calling contract (smart contract F). Due to call failure, the second quantity of tokens cannot be distributed to F. From the contract call relationship routing table, the downstream calling addresses of smart contract D (the addresses of smart contract H and smart contract I) are determined; and the corresponding downstream calling contracts (smart contract H and smart contract F) are identified. I); Obtain the second quantity of tokens from the fourth transaction and distribute the second quantity of tokens to the downstream calling contract (smart contract H); Obtain the second quantity of tokens again from the fourth transaction to obtain the fifth transaction, and distribute the second quantity of tokens to the downstream calling contract (smart contract I); Determine the downstream calling address of smart contract E (the address of smart contract J) from the contract calling relationship routing table; and determine the downstream calling contract (smart contract J) corresponding to the downstream calling address; Obtain the second quantity of tokens from the fifth transaction to obtain the sixth transaction, smart contract E calls smart contract J, but due to the call failure, it is unable to distribute the second quantity of tokens to smart contract J; Determine from the contract calling relationship routing table that smart contract F does not have a downstream calling address.From the contract call relationship routing table, determine the downstream call addresses of smart contract G (the addresses of smart contract K and smart contract L); and determine the downstream call contracts (smart contract K and smart contract L) corresponding to the downstream call addresses; obtain the second quantity of tokens from the sixth transaction and distribute the second quantity of tokens to the downstream call contract (smart contract K); obtain the second quantity of tokens again from the sixth transaction to obtain the seventh transaction, and distribute the second quantity of tokens to the downstream call contract (smart contract L). From the contract call relationship routing table, determine that smart contracts H, I, J, K, and L do not have downstream call addresses.
[0092] S104. When the verification time is reached, determine the first number of tokens carried in multiple smart contracts; and verify the parallel execution scheme of multiple smart contracts based on the first number and the number of multiple tokens.
[0093] In this embodiment of the application, after the information verification device distributes multiple tokens in the initial transaction to multiple smart contracts according to the contract call relationship routing table, when the verification time is reached, the information verification device can determine the first number of tokens carried in the multiple smart contracts; and verify the parallel execution scheme of the multiple smart contracts according to the first number and the number of multiple tokens.
[0094] In this embodiment, the verification time can be the time configured in the information verification device; the verification time can also be the time transmitted from other devices to the information verification device; or it can be the time obtained by the information verification device in other ways; the specific way in which the information verification device obtains the verification time can be determined according to the actual situation, and this embodiment does not limit it.
[0095] It should be noted that the verification time can be a fixed time; the verification time can also be a preset time interval from the verification command; the specific verification time can be determined according to the actual situation, and this application embodiment does not limit it.
[0096] In this embodiment, the information verification device determines the first quantity of tokens carried in multiple smart contracts by counting the number of tokens carried in each of the multiple smart contracts and using the sum of the number of tokens carried in each smart contract as the first quantity. The information verification device may also determine the first quantity of tokens carried in multiple smart contracts in other ways. The specific method for determining the first quantity of tokens carried in multiple smart contracts can be determined according to the actual situation, and this embodiment does not limit this method.
[0097] In this embodiment of the application, the information verification device further includes a query interface (an interface for querying tokens in a general test contract), which is used to query the first quantity of tokens carried in multiple smart contracts through the interface.
[0098] In this embodiment of the application, the process of the information verification device verifying the parallel execution scheme of multiple smart contracts based on the first quantity and the quantity of multiple tokens includes: if the first quantity and the quantity of multiple tokens are the same, determining that the parallel execution scheme of multiple smart contracts has been successfully verified; if the first quantity and the quantity of multiple tokens are different, determining that the parallel execution scheme of multiple smart contracts has failed to be verified.
[0099] In this embodiment of the application, if the parallel execution scheme of multiple smart contracts is successfully verified, the information verification device can transmit a verification success message to the client.
[0100] It should be noted that the verification success message can be text; the verification success message can also be voice; the verification success message can also be in digital form; the verification success message can also be in other forms; the specific form of the verification success message can be determined according to the actual situation, and this application embodiment does not limit it.
[0101] In this embodiment of the application, the process of the information verification device verifying the parallel execution scheme of multiple smart contracts based on the first quantity and the quantity of multiple tokens further includes: determining that the first smart contract call failed if the first smart contract does not contain the tokens of the second quantity; and transmitting abnormal error message information of the node to which the first smart contract belongs to the client.
[0102] In this embodiment, the error message can be text; it can also be voice; it can also be in numerical form; it can also be in other forms. The specific format of the error message can be determined according to the actual situation, and this embodiment does not limit it.
[0103] In this application embodiment, an exemplary information verification method is as follows: Figure 6 As shown:
[0104] S1. Upon receiving a verification instruction for the parallel execution scheme of multiple smart contracts, the information verification device obtains the smart contract call relationship topology from the verification instruction.
[0105] S2. The information verification device determines multiple upstream calling addresses and multiple downstream called addresses corresponding to multiple smart contracts based on the called relationship of each smart contract in the smart contract calling relationship topology diagram.
[0106] S3. The information verification device establishes a contract call relationship routing table based on multiple smart contracts, multiple upstream call addresses, and multiple downstream call addresses.
[0107] S4. The information verification device obtains the second number of tokens to be distributed for each smart contract call from the verification instructions.
[0108] S5. The information verification device determines the third quantity based on the second quantity and the number of times the multiple smart contracts are invoked, and uses the tokens of the third quantity as multiple tokens.
[0109] S6. In the case of generating an initial transaction, the information verification device determines at least one set of smart contracts to be called corresponding to at least one initial transaction based on the smart contract call relationship topology.
[0110] It should be noted that multiple smart contracts include at least one set of smart contracts to be invoked. The number of initial transactions is at least one.
[0111] S7. The information verification device groups multiple tokens according to at least one set of smart contracts to be invoked, and obtains at least one set of tokens.
[0112] S8. The information verification device adds at least one set of tokens in at least one initial transaction.
[0113] S9. When an initial transaction is generated and transmitted in multiple smart contracts, the information verification device distributes the multiple tokens in the initial transaction to multiple smart contracts according to the contract call relationship routing table.
[0114] Specifically, the information verification device can determine the initial smart contract that triggers the initial transaction from the contract call relationship routing; obtain a second number of tokens from the initial transaction to obtain the first transaction; distribute the second number of tokens to the initial smart contract; determine the downstream call address of the initial smart contract from the contract call relationship routing; and determine the downstream call contract corresponding to the downstream call address; obtain the second number of tokens from the first transaction to obtain the second transaction; distribute the second number of tokens to the downstream call contract; and so on, until each smart contract is successfully called, the multiple tokens are distributed to each smart contract in sequence.
[0115] S10. When the verification time is reached, the information verification device determines the first number of tokens carried in multiple smart contracts; if the first number and the number of multiple tokens are the same, it determines that the parallel execution scheme of multiple smart contracts has been successfully verified.
[0116] S11. If the first quantity and the quantity of multiple tokens are different, the information verification device determines that the verification of the parallel execution scheme of multiple smart contracts has failed.
[0117] It should be noted that if the first smart contract in a multi-smart contract does not contain the tokens of the second number of tokens, the information verification device determines that the first smart contract call has failed and transmits an abnormal error message to the client regarding the node to which the first smart contract belongs.
[0118] In this embodiment of the application, the overall process of the information verification method includes:
[0119] Step 1: Determine the smart contract call scenario to be constructed, that is, determine the contract call graph (smart contract call relationship topology graph). The following 3 points need to be confirmed.
[0120] 1. Confirm how many smart contracts make up the contract call graph, i.e. how many smart contracts need to be deployed in total, and then use the blockchain system's contract deployment interface to deploy the contracts and generate contract addresses;
[0121] 2. Confirm the total token value S (multiple tokens). Based on the number of smart contracts N in the contract call graph (specifically, the number of times multiple smart contracts are called), and the tokens T transferred in each contract call (the second quantity), the following relationship exists: S>=T*N. The token value S can be greater than N*T. Any remaining token value will be stored in the first contract address (the address of the initial smart contract).
[0122] 3. Determine how many initial transactions are needed to trigger the event, such as... Figure 4 As shown, this indicates how many Tx (initial transactions) are required;
[0123] Contracts are then deployed according to the number of nodes. If deployment fails, a deployment failure message is returned, and redeployment is performed. If successful, the addresses of each contract are obtained, and a set of contract addresses is generated.
[0124] Step 2: Call the contract path recording module interface to set the call relationships between all contracts. That is, based on the call relationships in the contract call topology diagram, call the interface of the general contract to set the upstream and downstream addresses of each contract, for example... Figure 4 In the final tree-like call graph in (g), for contract A, the tuple of its upstream and downstream addresses is represented as {[transaction initiator address], [contract B address, contract C address]}. For contract B, the tuple of its upstream and downstream addresses can be represented as {[contract A], [contract D, contract E]}, and so on. After recording all contract call relationships in this way, a contract call relationship routing table (contract call relationship routing table) can be generated.
[0125] Step 3: Trigger the contract call relationship by initiating several initial transactions with token S values, and execute the token distribution process. The specific process includes: constructing and issuing one or more tokens pointing to the initial contract address based on the constructed contract call graph (e.g., ...). Figure 5 (Transaction initiated by A in the middle) Each transaction sends in the corresponding total amount of tokens S. x The total amount of tokens S (all tokens S) x The relationship between the sum of S and the number of nodes in the topology graph N and the number of tokens T shared each time is: T = S / N; Examine the constructed contract call relationship routing table R, find its downstream contract based on the current contract address, and initiate a call request to its downstream address through the interface of the general test contract, distributing tokens of value T. The downstream address then checks its downstream address according to the contract call relationship routing table, distributes tokens, and so on; when all tokens are consumed, the token distribution ends.
[0126] Step 4: Query the tokens held by the contract to verify the correctness and consistency of contract execution. Specifically, use the interface for querying tokens in the general test contract to query the token values T1, T2....T held by each contract in the contract call diagram. n And calculate the sum T of all contract tokens. sum Is the (first quantity) equal to the initial input token S (the number of multiple tokens), i.e., T? sum ? = S; If a token T of a certain contract is found x A value of 0 indicates that the x contract failed to be invoked. If the query fails, a node exception error is returned. If the total number of tokens T sum If ! = S (the first quantity and the quantity of multiple tokens are different), it means that the verification of the parallel execution scheme of multiple smart contracts has failed, and then the inconsistency information of the call is returned.
[0127] In this application embodiment, an exemplary star-shaped smart contract call scenario is provided, such as... Figure 7 As shown: The number of smart contracts is 5. Five smart contracts are deployed, and the smart contract addresses are {A,B,C,D,X} respectively. Smart contracts A, B, C, D, and X call the record contract path interface of the general test contract to set the call path and generate the contract call path relationship table as shown in Table (2). It is confirmed that the total token value S of each transaction input is 2, and 1 token is distributed for each call.
[0128] Table (2)
[0129]
[0130]
[0131] Four transactions (tx1, tx2, tx3, tx4) are constructed using a contract and sent to contracts A, B, C, and D respectively. Each call starts with an initial token value of 2. When contracts A, B, C, and D receive a call, they first check if the source address is an SDK address (the transaction initiator address) in the contract table. If so, they request 1 token from the distribution list, then trigger a new transaction, sending a call to downstream address X with the remaining 1 token. When contract X receives a contract call, it follows the same logic: it checks if the caller address is an upstream address; if so, it obtains the distributed token, checks the downstream address (if it's empty), sets the token value to 0, and execution ends.
[0132] Call the token query interface of the general test contract to query the token values of contracts A, B, C, D, and X respectively. If the token value held by contracts A, B, C, and D is 1 and that of contract X is 4, return a DMC execution result verification message indicating that the verification is correct. If the verification result is incorrect or the query of the balance is unsuccessful, return the corresponding result.
[0133] Understandably, the information verification device constructs a contract call relationship routing table based on the called relationships of each smart contract in the smart contract call relationship topology and the multiple contract addresses corresponding to multiple smart contracts. This routing table records the paths of contract calls. Based on the routing table, multiple tokens from the initial transaction are distributed to multiple smart contracts, allowing tokens to leave traces in the smart contract call relationships. The number of tokens obtained from these traces in multiple smart contracts is then compared with the number of tokens carried in the initial transaction to verify the correctness and consistency of the parallel execution results. This eliminates the need to write and test smart contracts for each contract call scenario, improving the efficiency of verifying parallel execution schemes.
[0134] Based on the same inventive concept as the above-mentioned information verification method, this application provides an information verification device 1, corresponding to an information verification method; Figure 8 A schematic diagram of the composition structure of an information verification device provided in this application embodiment. Figure 1 The information verification device 1 may include:
[0135] The acquisition unit 11 is used to acquire a smart contract call relationship topology from the verification instruction when a verification instruction for the parallel execution scheme of multiple smart contracts is received.
[0136] Establishment unit 12 is used to construct a contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology diagram and the multiple contract addresses corresponding to the multiple smart contracts;
[0137] Distribution unit 13 is used to distribute multiple tokens in the initial transaction to the multiple smart contracts according to the contract call relationship routing table when an initial transaction is generated and the initial transaction is transmitted in the multiple smart contracts;
[0138] The determining unit 14 is used to determine a first number of tokens carried in the plurality of smart contracts when a preset time is reached;
[0139] Verification unit 15 is used to verify the parallel execution scheme of the multiple smart contracts based on the first quantity and the quantity of the multiple tokens.
[0140] In some embodiments of this application, the determining unit 14 is used to determine multiple upstream calling addresses and multiple downstream called addresses corresponding to the multiple smart contracts based on the called relationship of each smart contract in the smart contract calling relationship topology diagram.
[0141] The establishment unit 12 is used to establish the contract call relationship routing table based on the multiple smart contracts, the multiple upstream call addresses, and the multiple downstream call addresses.
[0142] In some embodiments of this application, the apparatus further includes an adding unit;
[0143] The acquisition unit 11 is used to obtain the second quantity of tokens to be distributed when each smart contract is called from the verification instruction;
[0144] The determining unit 14 is used to determine a third quantity based on the second quantity and the number of times the plurality of smart contracts are invoked, and to use the tokens of the third quantity as the plurality of tokens;
[0145] The adding unit is used to add the plurality of tokens to the initial transaction when the initial transaction is generated.
[0146] In some embodiments of this application, the apparatus further includes a grouping unit;
[0147] The determining unit 14 is configured to determine at least one set of smart contracts to be called corresponding to at least one initial transaction based on the smart contract call relationship topology graph; the plurality of smart contracts includes the at least one set of smart contracts to be called;
[0148] The grouping unit is used to group the multiple tokens according to the at least one group of smart contracts to be invoked, so as to obtain at least one group of tokens.
[0149] The adding unit is used to add the at least one set of tokens in the at least one initial transaction.
[0150] In some embodiments of this application, the determining unit 14 is used to determine the initial smart contract that triggers the initial transaction from the contract call relationship routing;
[0151] The acquisition unit 11 is used to acquire a second number of tokens from the initial transaction to obtain a first transaction; and to acquire a second number of tokens from the first transaction to obtain a second transaction.
[0152] The distribution unit 13 is used to distribute the second number of tokens to the initial smart contract; distribute the second number of tokens to the downstream calling contract; and distribute the multiple tokens sequentially to each smart contract until each smart contract is successfully called.
[0153] The determining unit 14 is used to determine the downstream call address of the initial smart contract from the contract call relationship routing; and to determine the downstream call contract corresponding to the downstream call address.
[0154] In some embodiments of this application, the apparatus further includes a deployment unit and a generation unit;
[0155] The deployment unit is used to deploy the multiple smart contracts in the blockchain;
[0156] The generation unit is used to generate the multiple contract addresses corresponding to the multiple smart contracts.
[0157] In some embodiments of this application, the determining unit 14 is configured to determine that the parallel execution scheme of the multiple smart contracts is successfully verified when the first quantity and the quantity of the multiple tokens are the same; and to determine that the parallel execution scheme of the multiple smart contracts fails to verify when the first quantity and the quantity of the multiple tokens are different.
[0158] In some embodiments of this application, the apparatus further includes a transmission unit;
[0159] The determining unit 14 is used to determine that the first smart contract call failed if there is no token of the second number of tokens in the first smart contract among the plurality of smart contracts.
[0160] The transmission unit is used to transmit abnormal error messages to the client from the node to which the first smart contract belongs.
[0161] It should be noted that, in practical applications, the aforementioned acquisition unit 11, establishment unit 12, distribution unit 13, determination unit 14, and verification unit 15 can be implemented by the processor 16 on the information verification device 1, specifically by a CPU (Central Processing Unit), MPU (Microprocessor Unit), DSP (Digital Signal Processor), or Field Programmable Gate Array (FPGA), etc.; the aforementioned information verification can be implemented by the memory 17 on the information verification device 1.
[0162] This application embodiment also provides an information verification device 1, such as... Figure 9 As shown, the information verification device 1 includes a processor 16, a memory 17, and a communication bus 18. The memory 17 communicates with the processor 16 through the communication bus 18. The memory 17 stores programs executable by the processor 16. When the program is executed, the information verification method described above is executed by the processor 16.
[0163] In practical applications, the aforementioned memory 17 can be volatile memory, such as random-access memory (RAM); or non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 16.
[0164] This application provides a computer-readable storage medium having a computer program thereon, which, when executed by a processor 16, implements the information verification method as described above.
[0165] Understandably, the information verification device constructs a contract call relationship routing table based on the called relationships of each smart contract in the smart contract call relationship topology and the multiple contract addresses corresponding to multiple smart contracts. This routing table records the paths of contract calls. Based on the routing table, multiple tokens from the initial transaction are distributed to multiple smart contracts, allowing tokens to leave traces in the smart contract call relationships. The number of tokens obtained from these traces in multiple smart contracts is then compared with the number of tokens carried in the initial transaction to verify the correctness and consistency of the parallel execution results. This eliminates the need to write and test smart contracts for each contract call scenario, improving the efficiency of verifying parallel execution schemes.
[0166] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0167] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0168] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0169] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0170] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application.
Claims
1. An information verification method, characterized in that, The method includes: Upon receiving a verification instruction for the parallel execution scheme of multiple smart contracts, the topology of smart contract call relationships is obtained from the verification instruction; Based on the called relationships of each smart contract in the smart contract call relationship topology graph and the multiple contract addresses corresponding to the multiple smart contracts, a contract call relationship routing table is constructed; From the verification instructions, obtain the second number of tokens to be distributed for each smart contract call; A third quantity is obtained by multiplying the second quantity and the number of times the multiple smart contracts are called, and the tokens of the third quantity are used as the multiple tokens. In the case of generating an initial transaction, based on the smart contract call relationship topology, at least one set of smart contracts to be called corresponding to at least one initial transaction is determined; the plurality of smart contracts includes the at least one set of smart contracts to be called; Determine at least one set of call counts for at least one set of smart contracts to be invoked; group multiple tokens according to the number of at least one set of call counts to obtain at least one set of tokens; Add the at least one set of tokens to the at least one initial transaction; In the case of generating an initial transaction and transmitting the initial transaction in the multiple smart contracts, the multiple tokens in the initial transaction are distributed to the multiple smart contracts according to the contract call relationship routing table; When the verification time is reached, a first number of tokens carried in the multiple smart contracts is determined; and the parallel execution scheme of the multiple smart contracts is verified based on the first number and the number of the multiple tokens.
2. The method according to claim 1, characterized in that, The step of constructing a contract call relationship routing table based on the called relationships of each smart contract in the smart contract call relationship topology graph and the multiple contract addresses corresponding to the multiple smart contracts includes: Based on the called relationship of each smart contract in the smart contract call relationship topology diagram, determine multiple upstream call addresses and multiple downstream called addresses corresponding to the multiple smart contracts; The contract call relationship routing table is established based on the multiple smart contracts, the multiple upstream call addresses, and the multiple downstream callees.
3. The method according to claim 1, characterized in that, The step of distributing multiple tokens in the initial transaction to the multiple smart contracts according to the contract call relationship routing table includes: The initial smart contract that triggers the initial transaction is determined from the contract call relationship routing table; Obtain a second number of tokens from the initial transaction to obtain the first transaction; Distribute the second number of tokens to the initial smart contract; From the contract call relationship routing table, determine the downstream call address of the initial smart contract; and determine the downstream call contract corresponding to the downstream call address; Obtain a second number of tokens from the first transaction to obtain the second transaction; The second number of tokens is distributed to the downstream calling contract; until each smart contract is successfully called, the multiple tokens are distributed sequentially to each smart contract.
4. The method according to claim 1, characterized in that, Before constructing the contract call relationship routing table based on the called relationships of each smart contract in the smart contract call relationship topology graph and the multiple contract addresses corresponding to the multiple smart contracts, the method further includes: Deploy the multiple smart contracts in the blockchain and generate the multiple contract addresses corresponding to the multiple smart contracts.
5. The method according to claim 1, characterized in that, The step of validating the parallel execution scheme of the multiple smart contracts based on the first quantity and the quantity of the multiple tokens includes: If the first quantity and the quantity of the multiple tokens are the same, the parallel execution scheme of the multiple smart contracts is determined to be successfully verified. If the first quantity and the quantity of the multiple tokens are different, it is determined that the parallel execution scheme of the multiple smart contracts has failed to be verified.
6. The method according to claim 1, characterized in that, The step of verifying the parallel execution scheme of the multiple smart contracts based on the first quantity and the quantity of the multiple tokens further includes: If the second number of tokens does not exist in the first smart contract among the plurality of smart contracts, it is determined that the call to the first smart contract has failed; Transmit an error message to the client indicating an abnormality in the node to which the first smart contract belongs.
7. An information verification device, characterized in that, The device includes: The acquisition unit is used to acquire a smart contract call relationship topology from the verification instructions when a verification instruction for the parallel execution scheme of multiple smart contracts is received. The establishment unit is used to construct a contract call relationship routing table based on the called relationship of each smart contract in the smart contract call relationship topology graph and the multiple contract addresses corresponding to the multiple smart contracts; A distribution unit is configured to distribute multiple tokens in the initial transaction to the multiple smart contracts according to the contract call relationship routing table when an initial transaction is generated and the initial transaction is transmitted in the multiple smart contracts. A determining unit is used to determine a first number of tokens carried in the plurality of smart contracts when the verification time is reached; The verification unit is used to verify the parallel execution scheme of the multiple smart contracts based on the first quantity and the quantity of the multiple tokens.
8. An information verification device, characterized in that, The device includes: The system includes a memory, a processor, and a communication bus. The memory communicates with the processor via the communication bus. The memory stores a program for verifying information that can be executed by the processor. When the program for verifying information is executed, the processor performs the method as described in any one of claims 1 to 6.
9. A storage medium storing a computer program thereon, used in an information verification device, characterized in that, When executed by a processor, the computer program implements the method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Contact center transaction system using distributed digital ledger
CN111882433A
Method and system for overseeing execution of graph-based contracts using hash chains
US20190266602A1