Methods, devices, electronic equipment, and storage media for processing transactions in blockchain

By determining the contract address and calling relationship of the transaction in the blockchain, the construction of the DAG diagram for parallel processing has solved the problem of low transaction processing efficiency in existing technology, and achieved more efficient transaction execution and accurate calling relationship analysis.

CN112037061BActive Publication Date: 2025-01-28WEBANK (CHINA)
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010896174.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-31
Publication Date
2025-01-28
Estimated Expiration
2040-08-31

AI Technical Summary

Technical Problem

In existing blockchain technology, transaction processing efficiency is low, and parallel processing cannot be effectively used to improve transaction execution speed.

Method used

By determining the contract address of each transaction in the block transaction list, and determining the calling relationship dependent on each exchange dependencies according to the contract address, a loopless diagram DAG is constructed to achieve parallel processing of at least two transactions in the transaction list. Essence

Benefits of technology

It improves the efficiency of transaction processing, saves the time of block consensus, and improves the accuracy of the call relationship that each exchange depends on.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112037061B_ABST
    Figure CN112037061B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for processing transactions in a blockchain, the method comprising: determining the contract address of each transaction in the transaction list of a block; determining the call relationship that each transaction depends on according to the contract address; and processing at least two transactions in the transaction list in parallel according to the call relationship that each transaction depends on. In the embodiment of the present application, since the call relationship that each transaction depends on can be determined according to the contract address of the transaction, and then the call relationship that each transaction depends on can be used to process the transactions in parallel, compared with the prior art of sequentially processing the transactions in the transaction list or manually identifying the critical code blocks for parallel processing in the code, the transaction processing efficiency is improved, and the time for block consensus is effectively saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a method, device, electronic device and storage medium for processing transactions in a blockchain. Background Art

[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech, and blockchain technology is no exception. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology.

[0003] In the prior art, the blockchain starts from the genesis block state, continuously collects transactions that occur on the network, and the master node sorts and packages the transactions into blocks to execute the transactions in the blocks among all nodes participating in the consensus. The existing transaction execution scheme 1 in the block is usually that the master node of the blockchain broadcasts the transaction list in the block and sends it to all nodes participating in the consensus for consensus. The execution unit reads out the transactions one by one from the block to be agreed upon. After executing each transaction, the state machine will migrate to the next state until all transactions are executed serially. The existing transaction execution scheme 2 in the block is for the serial scheme in the Bitcoin network. Since Bitcoin does not have smart contracts, it is mainly the addition and subtraction of account amounts, so parallelism is relatively simple. The existing transaction execution scheme 3 in the block is a method for parallel computing of the blockchain for smart contracts. It is usually manually identified by the user for transactions that can be processed in parallel, which has high requirements for users.

[0004] However, in the prior art, the transaction execution method adopted has low processing efficiency. Summary of the invention

[0005] The present application provides a method, device, electronic device and storage medium for processing transactions in a blockchain, so as to realize parallel processing of transactions in each block and improve transaction processing efficiency.

[0006] In a first aspect, an embodiment of the present application provides a method for processing transactions in a blockchain, including:

[0007] In the transaction list of the block, determine the contract address of each transaction; based on the contract address, determine the calling relationship that each transaction depends on; based on the calling relationship that each transaction depends on, process at least two transactions in the transaction list in parallel.

[0008] In the embodiment of the present application, the calling relationship that each transaction depends on can be determined according to the contract address of the transaction, and then the calling relationship that each transaction depends on can be used to process the transactions in parallel. Compared with the prior art of processing the transactions in the transaction list one by one, or manually identifying the transactions that can be processed in parallel by the user, the transaction processing efficiency is improved, and the time for block consensus is effectively saved. In addition, in the embodiment of the present application, since the contract address is also taken into consideration, not only the dependency relationship between functions is obtained, but also the dependency relationship between specific contract instances can be obtained, thereby improving the accuracy of the calling relationship that each transaction depends on.

[0009] In a possible implementation, the call relationship that each transaction depends on is determined based on the contract address, including:

[0010] According to the contract address, determine the contract type of the transaction, which is a deployment contract or a call contract; if the contract type is a deployment contract, determine the contract code file of the transaction, and according to the contract code file, determine the calling relationship called by the first function under the contract address to generate the calling relationship that the transaction depends on.

[0011] If the contract type is a calling contract, the contract address is used to determine whether there is a calling relationship that the exchange depends on; if there is no calling relationship that the exchange depends on, the contract code file of the transaction is determined, and based on the contract code file, the calling relationship called by the first function under the contract address is determined.

[0012] In the embodiment of the present application, the contract type of the transaction is determined by the contract address, and for different contract types, the calling relationship that each transaction depends on under different contract addresses is determined respectively.

[0013] In a possible implementation, determining the calling relationship of the first function under the contract address according to the contract code file includes:

[0014] Parse the contract code file to determine the instruction file of the first function; detect the internal function call instruction and the external function call instruction in the instruction file; and determine the call relationship called by the first function according to the internal function call instruction and / or the external function call instruction.

[0015] In an embodiment of the present application, by parsing the instruction file of the first function in the contract code file, and through the internal function call instructions and external function call instructions in the instruction file, the calling relationship of the first function within the contract and the calling relationship of other contracts are taken into consideration, thereby ensuring the integrity and reliability of the calling relationship called by the first function.

[0016] In a possible implementation, the instruction file includes an internal function calling instruction, and determining the calling relationship called by the first function according to the internal function calling instruction includes:

[0017] According to the internal function calling instruction, determine a first internal calling function, the first internal calling function being an internal calling function of the first function, and add function information of the first function and function information of the first internal calling function to a calling relationship called by the first function;

[0018] Determine whether there is an N+1th internal calling function of the Nth internal calling function, the N+1th internal calling function being the internal calling function of the Nth internal calling function; if there is an N+1th internal calling function, add the function information of the N+1th internal calling function to the calling relationship called by the first function, so that the function information of the internal calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein N is a positive integer.

[0019] In a possible implementation, the instruction file includes an external function call instruction, and determining a call relationship of the first function call according to the internal function call instruction and the external function call instruction includes:

[0020] Determine function information of a first external calling function of all functions in a calling relationship called by the first function, and add the function information of the first external calling function to the calling relationship of the first function call;

[0021] Determine whether there is an M+1th external calling function before the Mth external calling function, where the M+1th external calling function is the external calling function of the Mth external calling function; if there is an M+1th external calling function, add the function information of the M+1th external calling function to the calling relationship called by the first function, so that the function information of the external calling functions of all functions in the calling relationship called by the first function is added to the calling relationship called by the first function, where M is a positive integer.

[0022] In a possible implementation, the function information includes the contract address of the function and the function name of the function.

[0023] In a possible implementation, determining function information of a first external calling function of all functions in a calling relationship called by a first function includes:

[0024] Obtain the contract address of the first external call function and the offset tag of the first external call function; determine the code of the first external call function using the contract address of the first external call function and the offset tag of the first external call function; parse the code of the first external call function to determine the function name of the first external call function.

[0025] In a possible implementation, the method for processing transactions in a blockchain provided in an embodiment of the present application further includes:

[0026] Stores the call relationships that each transaction depends on.

[0027] In a possible implementation, the transactions in the transaction list are processed in parallel according to the call relationship on which each transaction depends, including:

[0028] According to the call relationship that each transaction depends on, the dependency relationship of each transaction in the transaction list is determined; the directed acyclic graph DAG of the transaction list is constructed using the dependency relationship; according to the DAG, at least two transactions in the transaction list are processed in parallel.

[0029] In a possible implementation, the device for processing transactions in a blockchain provided in an embodiment of the present application further includes:

[0030] Use the status root after all transactions in the transaction list are executed to update the execution status of the block.

[0031] In the embodiment of the present application, the consistency of the block consensus node is ensured by updating the execution status of the block with the status root after all transactions in the transaction list are executed.

[0032] The following introduces the device, electronic device, computer-readable storage medium, and computer program product provided in the embodiments of the present application. The content and effects of these devices can be referred to the method for processing transactions in the blockchain provided in the embodiments of the present application, and will not be repeated here.

[0033] In a second aspect, an embodiment of the present application provides a device for processing transactions in a blockchain, including:

[0034] The determination module is used to determine the contract address of each transaction in the transaction list of the block.

[0035] The determination module is also used to determine the calling relationship that each transaction depends on based on the contract address.

[0036] The processing module is used for processing at least two transactions in the transaction list in parallel according to the calling relationship on which each transaction depends.

[0037] In a possible implementation, the determination module is specifically configured to:

[0038] According to the contract address, determine the contract type of the transaction, which is a deployment contract or a call contract; if the contract type is a deployment contract, determine the contract code file of the transaction, and determine the calling relationship called by the first function under the contract address based on the contract code file to generate the calling relationship that the exchange depends on; if the contract type is a call contract, determine whether there is a calling relationship that the exchange depends on, if there is no calling relationship that the exchange depends on, determine the contract code file of the transaction, and determine the calling relationship called by the first function under the contract address based on the contract code file.

[0039] In a possible implementation, the determination module is specifically configured to:

[0040] Parse the contract code file to determine the instruction file of the first function; detect the internal function call instruction and the external function call instruction in the instruction file; and determine the call relationship called by the first function according to the internal function call instruction and / or the external function call instruction.

[0041] In a possible implementation, the determination module is specifically configured to:

[0042] According to the internal function calling instruction, determine the first internal calling function, the first internal calling function is the internal calling function of the first function, add the function information of the first function and the function information of the first internal calling function to the calling relationship called by the first function; determine whether the Nth internal calling function exists with the N+1th internal calling function, the N+1th internal calling function is the internal calling function of the Nth internal calling function; if the N+1th internal calling function exists, add the function information of the N+1th internal calling function to the calling relationship called by the first function, so that the function information of the internal calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein N is a positive integer.

[0043] In a possible implementation, the determination module is specifically configured to:

[0044] Determine the function information of the first external calling function of all functions in the calling relationship called by the first function, and add the function information of the first external calling function to the calling relationship called by the first function; determine whether there is an M+1th external calling function for the Mth external calling function, and the M+1th external calling function is the external calling function of the Mth external calling function; if there is an M+1th external calling function, add the function information of the M+1th external calling function to the calling relationship called by the first function, so that the function information of the external calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein M is a positive integer.

[0045] In a possible implementation, the function information includes the contract address of the function and the function name of the function.

[0046] In a possible implementation, the determination module is specifically configured to:

[0047] Obtain the contract address of the first external call function and the offset tag of the first external call function; determine the code of the first external call function using the contract address of the first external call function and the offset tag of the first external call function; parse the code of the first external call function to determine the function name of the first external call function.

[0048] In a possible implementation, the device for processing transactions in a blockchain provided in an embodiment of the present application further includes:

[0049] The storage module is used to store the call relationship that each transaction depends on and determine the storage address of the call relationship that each transaction depends on.

[0050] In a possible implementation manner, the processing module is specifically configured to:

[0051] According to the call relationship that each transaction depends on, the dependency relationship of each transaction in the transaction list is determined; the directed acyclic graph DAG of the transaction list is constructed using the dependency relationship; according to the DAG, at least two transactions in the transaction list are processed in parallel.

[0052] In a possible implementation, the device for processing transactions in a blockchain provided in an embodiment of the present application further includes:

[0053] The update module is used to update the execution status of the block using the status root after all transactions in the transaction list are executed.

[0054] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0055] at least one processor; and

[0056] a memory communicatively coupled to at least one processor; wherein

[0057] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method provided in the first aspect or in an implementable manner of the first aspect.

[0058] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to cause a computer to execute the method provided in the first aspect or in an implementable manner of the first aspect.

[0059] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising: executable instructions, wherein the executable instructions are used to implement the method provided in the first aspect or in an optional manner of the first aspect.

[0060] The transaction processing method, device, electronic device and storage medium in the blockchain provided by the embodiment of the present application, by determining the contract address and contract code file of each transaction in the transaction list of the block; determining the call relationship that each transaction depends on according to the contract address and contract code file; and processing at least two transactions in the transaction list in parallel according to the call relationship that each transaction depends on. In the embodiment of the present application, since the call relationship that each transaction depends on can be determined according to the contract address and contract code file of the transaction, and then the transaction is processed in parallel using the call relationship that each transaction depends on, compared with the prior art of sequentially processing the transactions in the transaction list, or manually identifying the critical code blocks in the code during parallel processing, the transaction processing efficiency is improved, and the time of block consensus is effectively saved. Moreover, since the contract address is also taken into account, not only the dependency relationship between functions is obtained, but also the dependency relationship between specific contract instances can be obtained, which improves the accuracy of the call relationship that each transaction depends on. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0062] Figure 1 It is a schematic diagram of the structure of an exemplary blockchain;

[0063] Figure 2 It is a flowchart of a method for processing transactions in a blockchain provided by an embodiment of the present application;

[0064] Figure 3 It is a schematic diagram of the structure of establishing a DAG provided in an embodiment of the present application;

[0065] Figure 4 It is a flowchart of a method for processing transactions in a blockchain provided by another embodiment of the present application;

[0066] Figure 5 It is a schematic diagram of a process for determining a call relationship provided in an embodiment of the present application;

[0067] Figure 6 is a flowchart of determining a calling relationship provided by another embodiment of the present application;

[0068] Figure 7 is a flowchart of determining a calling relationship provided by another embodiment of the present application;

[0069] Figure 8 It is a structural diagram of a device for processing transactions in a blockchain provided by an embodiment of the present application;

[0070] Fig. 9 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0072] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0073] With the development of computer technology, more and more technologies are applied in the financial field. Traditional finance is gradually transforming into financial technology, and blockchain technology is no exception. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. In the existing transaction execution scheme in the block, the main node of the blockchain usually broadcasts the transaction list in the block and sends it to all nodes participating in the consensus for consensus. The execution unit reads the transactions one by one from the block to be agreed upon. After executing each transaction, the state machine will migrate to the next state until all transactions are executed serially, and the efficiency of transaction processing is low.

[0074] The inventive concept of the transaction processing method, device, electronic device and storage medium in the blockchain provided by the embodiment of the present application is that by considering the contract address and contract code file of each transaction, the dependency analysis between the contract instance and the contract function is performed to determine the call relationship that each transaction depends on, and more accurately analyze the dependency and call relationship between different transactions. After determining the call relationship that each transaction depends on, the call relationship that each transaction depends on can be used to construct a directed acyclic graph (DAG) data structure to process non-interdependent transactions in parallel, which improves the transaction processing efficiency and effectively saves the time of block consensus compared to the prior art of sequentially processing transactions in the transaction list or manually identifying the critical code blocks in the code during parallel processing.

[0075] The following is an introduction to exemplary application scenarios of the embodiments of the present application.

[0076] The method for processing transactions in a blockchain provided in the embodiment of the present application can be executed by the processing device for processing transactions in a blockchain provided in the embodiment of the present application. The processing device for processing transactions in a blockchain provided in the embodiment of the present application can be integrated on a server, or the processing device for processing transactions in the blockchain can be the server itself. The embodiment of the present application does not limit the specific type of the server.

[0077] Blockchain is a distributed storage system jointly maintained and trusted by multiple nodes. Figure 1 This is a schematic diagram of the structure of an exemplary blockchain, such as Figure 1 As shown in the figure, the bottom layer of blockchain is a chain composed of a series of blocks. In addition to recording the data of the current block, each block also records the hash value of the previous block, forming a chain data structure in this way. Figure 1 In this paper, we take the example of a blockchain consisting of block 1, block 2, and block 3. Block 2 includes the hash value of block 1 and the transaction data in block 2, and block 3 includes the hash value of block 2 and the transaction data in block 3. Each block includes multiple transactions. Transactions are the most important part of the blockchain, representing a transaction request initiated by one party to another, which can be used to transfer assets, change account status or system configuration, etc. The master node of the blockchain takes multiple transactions from the transaction pool, sorts them, and packages them into a block, as shown in the figure below. Figure 1 Take block 2 in as an example, block 2 includes transaction 1, transaction 2, ..., transaction n. The embodiment of the present application does not limit the number of transactions in each block. The master node broadcasts and sends all nodes participating in the consensus to reach a consensus, where the nodes are participants in the blockchain. When transactions in a block are executed on multiple consensus nodes and the status is consistent, we say that a consensus has been reached on the block, and the block is permanently recorded in the blockchain.

[0078] Figure 2 1 is a flow chart of a method for processing transactions in a blockchain provided by an embodiment of the present application. The method can be executed by a device for processing transactions in a blockchain, and the device can be implemented by software and / or hardware. The following describes the method for processing transactions in a blockchain using a server as an execution subject. Figure 2 As shown, the method for processing transactions in the blockchain provided by the embodiment of the present application may include:

[0079] Step S101: In the transaction list of the block, determine the contract address of each transaction.

[0080] During the execution of the block, the node of the blockchain will obtain a complete block package, which includes data such as the block header, transaction list, and signature. The transaction list defines the detailed information of each transaction. The detailed information of each transaction may include the from field, to field, input field, transaction signature field, and transaction hash (HASH) field, etc., where the from field is used to indicate the encoded transaction sender, the to field is used to indicate the contract address of the transaction, the input field is used to pass the binary code into the virtual machine, and the transaction signature field is used to indicate the signature result of the caller on the transaction. The embodiment of the present application does not limit the specific content and encoding protocol of the detailed information contained in each transaction.

[0081] After determining the detailed information of each transaction, the contract address of each transaction can be obtained by decoding the detailed information of each transaction. In one possible implementation, the method for processing transactions in the blockchain provided in the embodiment of the present application can determine the contract address of the transaction by decoding the to field in the detailed information of the transaction.

[0082] In a possible implementation, the contract code file of each transaction may also be obtained. For example, the contract code file may be determined by decoding the input field in the detailed information of the transaction, wherein the contract code file may be a binary code of the contract.

[0083] In another possible implementation, the contract code file may also be an assembly language file or a conventional language file. In the embodiment of the present application, after determining the binary code of the contract, the binary code of the contract is decompiled into an assembly language file or a conventional language file.

[0084] The embodiments of the present application do not limit the specific implementation method of decompiling the binary code of the contract into an assembly language file. For example, the binary byte code can be converted into assembly language instructions through a decompilation tool, or the database associated with the assembly language file by methodID can be retrieved to obtain the assembly language file corresponding to the binary code of the contract. The embodiments of the present application are not limited to this. The embodiments of the present application do not limit the specific implementation method of decompiling the binary code of the contract into a conventional language file and the type of conventional language file. For example, the binary code of the contract can be decompiled into a solidity code file, etc. The embodiments of the present application only take this as an example.

[0085] In another possible implementation, the contract code file can also be obtained by obtaining the original smart contract code on the chain, which is not limited in this embodiment of the present application.

[0086] Step S102: According to the contract address, determine the call relationship that each transaction depends on.

[0087] After the contract address is determined, the calling relationship that each transaction depends on can be determined based on the contract address. In one possible implementation, if the contract is a calling contract, the calling relationship that each transaction depends on can be queried by the contract address of the calling contract.

[0088] In a possible implementation, the call relationship that each transaction depends on can also be determined based on the contract address and the contract code file. The embodiment of the present application does not limit the specific implementation method of determining the call relationship that each transaction depends on based on the contract address and the contract code file. In a possible implementation, all execution functions and call functions of the execution functions in the contract can be obtained through the contract address and the contract code file, and all execution functions and call functions of the execution functions in the contract can be used as the call relationship that the transaction depends on. The call relationship that the exchange depends on may include the function chain and contract called by the transaction. Among them, the functions in the function chain may be functions in one contract or functions in multiple contracts.

[0089] Exemplarily, the contract called by transaction 1 is contract 1, the execution function of contract 1 includes f1, the contract called by transaction 2 is contract 2, the execution function of contract 2 includes f2, and function f1 calls function f2, then the function chain called by transaction 1 includes function f1 and function f2, and the contract called by transaction 1 includes contract 1 and contract 2. This embodiment of the present application is only taken as an example and is not limited to this. The embodiment of the present application does not limit the representation method of the call relationship on which each transaction depends. For example, the call relationship of each transaction can be represented by at least one set, and each execution function of the contract called by the exchange corresponds to a set. Taking the above as an example, the call relationship of transaction 1 can be represented by a set, which includes function f1 and function f2, wherein each function can be represented by (contract address, function ID), then the set can include: {(contract address of contract 1, ID of f1), (contract address of contract 2, ID of f2)}. This embodiment of the present application is only taken as an example.

[0090] After determining the call relationship that each transaction depends on, in a possible implementation manner, the method for processing transactions in the blockchain provided by the embodiment of the present application may further include: storing the call relationship that each transaction depends on.

[0091] Among them, the call relationship that each transaction depends on can be stored in the contract address of the transaction. By storing the call relationship that each transaction depends on, on the one hand, it is convenient to query the call relationship in the subsequent use process. On the other hand, for the scenario where the same contract is deployed multiple times, the call relationship of each function can be cached for each type of contract. For the same contract, it is only necessary to replace the contract address of each function in the call relationship, which can greatly simplify the solution of the call relationship that the exchange depends on in the scenario where the same contract is deployed multiple times, and improve the calculation efficiency of the call relationship that the exchange depends on.

[0092] Step S103: according to the call relationship on which each transaction depends, at least two transactions in the transaction list are processed in parallel.

[0093] In some application scenarios, there may be dependencies between transactions. For example, if transaction 2 depends on transaction 1, then transaction 1 must be executed before transaction 2 in this batch of transactions, otherwise transaction 2 cannot be executed. There may also be multi-party dependencies. For example, transaction 2 depends on transaction 1, transaction 3, and transaction 4 at the same time, and there is no dependency between transaction 1, transaction 3, and transaction 4. In this case, transaction 1, transaction 3, and transaction 4 can be processed in parallel, and transaction 2 is executed after transaction 1, transaction 3, and transaction 4. Analyzing transaction dependencies has a great impact on whether transactions can be successfully executed in a reasonable order in the blockchain system.

[0094] In a possible implementation, the transactions in the transaction list are processed in parallel according to the call relationship on which each transaction depends, including:

[0095] According to the call relationship that each transaction depends on, the dependency relationship of each transaction in the transaction list is determined; the directed acyclic graph DAG of the transaction list is constructed using the dependency relationship; according to the DAG, at least two transactions in the transaction list are processed in parallel.

[0096] The calling relationship that each transaction depends on includes the contracts and function chains that each transaction depends on. By comparing the contracts and function chains that each transaction depends on, the dependency relationship of each transaction in the transaction list is determined.

[0097] For example, Figure 3 is a schematic diagram of the structure of establishing a DAG provided in an embodiment of the present application, such as Figure 3 As shown, the transaction list includes transactions A->B, C->D, E->F, D->E, A->F, and E->A. The left figure is the sorted transaction list after the consensus node is packaged. In serial mode, the execution order should be from top to bottom. Among them, in the transaction list, transaction A->F depends on transactions A->B and E->F, transaction D->E depends on transactions E->F and C->D, and transaction E->A depends on transactions A->F and D->E. According to the dependency relationship of each transaction in the transaction list, the DAG of the transaction list is automatically constructed. The embodiment of the present application does not limit the specific implementation method of constructing the DAG of the transaction list by utilizing the dependency relationship of each transaction in the transaction list. For example, it can be implemented by an in-degree table, a DFS (Depth-First-Search) depth-first search algorithm, etc. The details will not be repeated here. The establishment result can be referenced. Figure 3 Finally, at least two transactions in the transaction list are processed in parallel according to the DAG of the transaction list.

[0098] like Figure 3 As shown in the figure, in the first layer of the DAG of the transaction list, the in-degree of transactions A->B, E->F, and C->D is 0, where transactions with in-degree 0 are ready transactions that have no dependencies and can be put into operation immediately. Therefore, transactions A->B, E->F, and C->D can be processed in parallel. When transactions A->B and E->F are completed, the in-degree of transaction A->F decreases by 2 and becomes 0, turning it into a ready transaction. And so on.

[0099] When the number of ready transactions is greater than 1, the ready transactions can be distributed to multiple central processing unit (CPU) cores for parallel execution. When a transaction is executed, the in-degree of all transactions that depend on it is reduced by 1. As transactions are continuously executed, ready transactions are continuously generated.

[0100] In a possible implementation, each transaction in the transaction list is an independent transaction without dependencies, and the number of layers of the DAG of the transaction category is 1. At this time, the increase in the overall transaction execution speed will directly depend on the number of cores of the processor. At this time, if the number of cores is greater than the number of transactions in the transaction list, the execution time of all transactions in the block is approximately the same as the execution time of a single transaction.

[0101] In the process of parallel processing of transactions without related dependencies in the transaction list, a state root can be obtained for each transaction. The embodiment of the present application can save the state root corresponding to each transaction and update the execution status of the block according to the state root corresponding to each transaction.

[0102] In a possible implementation, the device for processing transactions in a blockchain provided by an embodiment of the present application further includes: updating the execution status of the block using the status root after all transactions in the transaction list are executed.

[0103] Based on the same block, using different transaction execution orders will result in different state roots for each execution, which may lead to inconsistent block consensus nodes. In the embodiment of the present application, the consistency of the block consensus node is ensured by updating the execution state of the block with the state root after all transactions in the transaction list are executed.

[0104] In the embodiment of the present application, the calling relationship that each transaction depends on can be determined according to the contract address and contract code file of the transaction, and then the calling relationship that each transaction depends on can be used to process the transactions in parallel. Compared with the prior art of processing the transactions in the transaction list one by one or manually identifying the critical code blocks for parallel processing in the code, the transaction processing efficiency is improved, the time for block consensus is effectively saved, and, because the contract address is also taken into consideration, not only the dependency relationship between functions is obtained, but also the dependency relationship between specific contract instances can be obtained, thereby improving the accuracy of the calling relationship that each transaction depends on.

[0105] exist Figure 2 Based on the embodiment shown, in a possible implementation, Figure 4: is a flow chart of a method for processing transactions in a blockchain provided by another embodiment of the present application. The method can be executed by a device for processing transactions in a blockchain, and the device can be implemented by software and / or hardware. The following describes the method for processing transactions in a blockchain using a server as the execution subject. Figure 4 As shown, step S102 of the method for processing transactions in the blockchain provided by the embodiment of the present application, that is, determining the call relationship that each transaction depends on according to the contract address and the contract code file, may include:

[0106] Step S201: Determine the contract type of the transaction based on the contract address, which is either a deployment contract or a call contract.

[0107] The embodiment of the present application does not limit the specific implementation method of determining the contract type of a transaction based on the contract address. For example, it can be determined by the code segment or contract type identifier in the contract address. For example, if the value of the contract address field is 0 X 0, the contract type is determined to be a deployment contract, otherwise it is a call contract.

[0108] If the contract type is a deployment contract, the contract code file of the transaction is determined, and step S202 is executed. If the contract type is a call contract, the call relationship that the exchange depends on is queried using the contract address to determine whether there is a call relationship that the exchange depends on. If there is no call relationship that the exchange depends on under the contract address, the contract code file of the transaction is determined, and step S202 is executed.

[0109] Step S202: Determine the calling relationship called by the first function under the contract address according to the contract code file to generate the calling relationship on which the transaction depends.

[0110] Among them, the first function is all the execution functions under the contract address. The embodiment of the present application does not limit the specific implementation method of determining the calling relationship called by the first function under the contract address according to the contract code file. In a possible implementation, determining the calling relationship called by the first function under the contract address according to the contract code file includes:

[0111] Parse the contract code file to determine the instruction file of the first function; detect the internal function call instruction and the external function call instruction in the instruction file; and determine the call relationship called by the first function according to the internal function call instruction and / or the external function call instruction.

[0112] Taking the contract code file as an assembly language file as an example, the assembly language file is parsed to obtain the first function and the instruction file of the first function, wherein the instruction file of the first function can be an operation code. By detecting the operation code of the first function, it can be determined whether the operation code of the first function includes an internal function call instruction and an external function call instruction. If the operation code of the first function includes an internal function call instruction, the first function includes an internal call function. If the operation code of the first function includes an external function call instruction, the first function includes an external call function. If the operation code of the first function includes both an internal function call instruction and an external function call instruction, the first function includes an internal call function and an external call function. Among them, the embodiment of the present application does not limit the specific types of internal function call instructions and external function call instructions. For example, the internal function call instruction can be jump, jumpi, etc., and the external function call instruction can be call, callcode, etc. The embodiment of the present application is only taken as an example and is not limited to this.

[0113] After detecting the internal function calling instructions and the external function calling instructions in the instruction file, the calling relationship called by the first function is determined according to the detected internal function calling instructions and / or external function calling instructions.

[0114] In an embodiment of the present application, by parsing the instruction file of the first function in the contract code file, and through the internal function call instructions and external function call instructions in the instruction file, the calling relationship of the first function within the contract and the calling relationship of other contracts are taken into consideration, thereby ensuring the integrity and reliability of the calling relationship called by the first function.

[0115] In a possible implementation, the instruction file includes an internal function call instruction. In the embodiment of the present application, determining the call relationship called by the first function according to the internal function call instruction includes:

[0116] According to the internal function calling instruction, determine the first internal calling function, the first internal calling function is the internal calling function of the first function, add the function information of the first function and the function information of the first internal calling function to the calling relationship called by the first function; determine whether the Nth internal calling function exists with the N+1th internal calling function, the N+1th internal calling function is the internal calling function of the Nth internal calling function; if the N+1th internal calling function exists, add the function information of the N+1th internal calling function to the calling relationship called by the first function, so that the function information of the internal calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein N is a positive integer.

[0117] For ease of introduction, Figure 5is a flow chart of determining a calling relationship provided by an embodiment of the present application, such as Figure 5 As shown, first, according to the internal function calling instruction of the first function, the internal calling function of the first function, that is, the first internal calling function, is determined, wherein the number of the first internal calling functions may be one or more, and after determining the first internal calling function, the function information of the first function and the function information of the first internal calling function are added to the calling relationship called by the first function.

[0118] The embodiment of the present application takes a first internal calling function as an example. After determining the first internal calling function, it is determined whether the first internal calling function has a second internal calling function, wherein the second internal calling function is an internal calling function of the first internal calling function. If the second internal calling function does not exist, the process ends. At this time, the calling relationship of the first function includes the function information of the first function and the function information of the first internal calling function. If the second internal calling function exists, the function information of the second internal calling function is added to the calling relationship called by the first function, and then the value of N is increased by 1, then N is two. It is continued to be determined whether the second internal calling function has a third internal calling function, wherein the third internal calling function is an internal calling function of the second internal calling function, so that the function information of the internal calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, and the first calling relationship of the first function is obtained.

[0119] In a possible implementation, the function information may include the contract address where the function is located and the function name of the function. For example, the function information of function f1 of contract 1 is (C1.address, f1.methodId).

[0120] In the above embodiment, only the instruction files of the first function and the Nth internal calling function include only internal function calling instructions as an example.

[0121] In a possible implementation, the first function instruction file includes an external function call instruction, and determining a call relationship of the first function call according to the internal function call instruction and the external function call instruction includes:

[0122] Determine the function information of the first external calling function of all functions in the calling relationship called by the first function, and add the function information of the first external calling function to the calling relationship called by the first function; determine whether there is an M+1th external calling function for the Mth external calling function, and the M+1th external calling function is the external calling function of the Mth external calling function; if there is an M+1th external calling function, add the function information of the M+1th external calling function to the calling relationship called by the first function, so that the function information of the external calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein M is a positive integer.

[0123] For ease of introduction, Figure 6 is a flowchart of determining a calling relationship provided by another embodiment of the present application, such as Figure 6 As shown, first, according to the external function calling instruction of the first function, the external calling function of the first function, that is, the first external calling function, is determined, wherein the number of the first external calling functions may be one or more, and after determining the first external calling function, the function information of the first function and the function information of the first external calling function are added to the calling relationship called by the first function.

[0124] The embodiment of the present application takes a first external call function as an example. After determining the first external call function, it is determined whether the first external call function has a second external call function, wherein the second external call function is an external call function of the first external call function. If the second external call function does not exist, the process ends. At this time, the call relationship of the first function includes the function information of the first function and the function information of the first external call function. If the second external call function exists, the function information of the second external call function is added to the call relationship called by the first function, and then the value of M is increased by 1, then M is two. Continue to determine whether the second external call function has a third external call function, wherein the third external call function is an external call function of the second external call function, so that the function information of the external call functions of all functions in the call relationship called by the first function are added to the call relationship called by the first function, and the second call relationship of the first function is obtained.

[0125] In one possible implementation, the external call instruction may include the contract address of the external call function and the function name of the external call function. The embodiment of the present application determines the function information of the external call function by reading the contract address of the external call function and the function name of the external call function in the external function call instruction. In another possible implementation, the external call function instruction may include the external function call instruction variable and the function name of the external function call function. Then, it is also necessary to parse the function input parameters of the external call function in the contract code file to determine the contract address of the external function call function through the function input parameters of the external call function and the external function call instruction variables; in one possible implementation, the function input parameters of the external call function may be the contract address of the external function call function. Then, the function information of the external call function can be determined by using the function input parameters of the external call function and the name of the external function call function.

[0126] In a possible implementation, determining function information of a first external calling function of all functions in a calling relationship called by a first function includes:

[0127] Obtain the contract address of the first external call function and the offset tag of the first external call function; determine the code of the first external call function using the contract address of the first external call function and the offset tag of the first external call function; parse the code of the first external call function to determine the function name of the first external call function.

[0128] In the above embodiment, only the instruction files of the first function and the Mth external call function include only external function call instructions as an example.

[0129] In a possible implementation, the first function may include an internal call function and an external call function, the internal call function of the first function may also include an internal call function and / or an external call function, and the external call function of the first function may also include an internal call function and / or an external call function. Based on this, Figure 7 FIG. 1 is a flow chart of determining a calling relationship provided by another embodiment of the present application. Figure 7 As shown, determining the calling relationship of the first function may include:

[0130] Step S701: Determine a first calling relationship of a first function.

[0131] The specific implementation method of determining the first call relationship of the first function can refer to Figure 5 In the illustrated embodiment, the functions in the first calling relationship may include a first function, a first internal calling function, a second internal calling function, etc., which are specifically set according to actual conditions.

[0132] Step S702: Determine the second calling relationship of each function in the first calling relationship to obtain the calling relationship of the first function.

[0133] The present application embodiment takes the first function, the first internal calling function and the second internal calling function as examples for explanation. Figure 6 The method for determining the second calling relationship provided in the illustrated embodiment determines the second calling relationship of the first function, the second calling relationship of the first internal calling function, and the second calling relationship of the second internal calling function, and adds the function information in the above second calling relationship to the calling relationship of the first function.

[0134] For example, assume that there are contracts C1 and C2, and their addresses are C1.address and C2.address respectively. The first function is function f1 of contract C1, which calls function f2 in contract C1 and function f3 of contract C2, and function f3 calls function f4 of contract C2 again. Then the calling relationship of the first function is: {(C1.address, f1.methodId), (C1.address, f2.methodId), (C2.address, f3.methodId), (C2.address, f4.methodId)}.

[0135] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0136] Figure 8 is a schematic diagram of the structure of a transaction processing device in a blockchain provided by an embodiment of the present application. The device can be implemented by software and / or hardware, for example, by a terminal device, such as Figure 8 As shown, the processing device for transactions in the blockchain provided in the embodiment of the present application may include: a determination module 81 and a processing module 82

[0137] The determination module 81 is used to determine the contract address of each transaction in the transaction list of the block.

[0138] The determination module 81 is also used to determine the call relationship that each transaction depends on according to the contract address.

[0139] The processing module 82 is used to process at least two transactions in the transaction list in parallel according to the call relationship on which each transaction depends.

[0140] In a possible implementation, the device for processing transactions in a blockchain provided in an embodiment of the present application further includes:

[0141] The storage module 83 is used to store the call relationship that each transaction depends on.

[0142] In a possible implementation, the processing module 82 is specifically configured to:

[0143] According to the call relationship that each transaction depends on, the dependency relationship of each transaction in the transaction list is determined; the directed acyclic graph DAG of the transaction list is constructed using the dependency relationship; according to the DAG, at least two transactions in the transaction list are processed in parallel.

[0144] In a possible implementation, the device for processing transactions in a blockchain provided in an embodiment of the present application further includes:

[0145] The update module 84 is used to update the execution status of the block using the status root after all transactions in the transaction list are executed.

[0146] The device of this embodiment can perform the above Figure 2 The technical principle and technical effect of the method embodiment shown are similar to those of the above-mentioned embodiment and will not be described in detail here.

[0147] exist Figure 8 On the basis of the illustrated embodiment, further, in another embodiment of a device for processing transactions in a blockchain provided by the present application, the determination module 81 is specifically used to:

[0148] According to the contract address, the contract type of the transaction is determined, and the contract type is a deployment contract or a call contract; if the contract type is a deployment contract, the contract code file of the transaction is determined, and according to the contract code file, the calling relationship called by the first function under the contract address is determined to generate the calling relationship that the exchange depends on; if the contract type is a call contract, the contract address is used to determine whether there is a calling relationship that the exchange depends on. If there is no calling relationship that the exchange depends on, the contract code file of the transaction is determined, and according to the contract code file, the calling relationship called by the first function under the contract address is determined.

[0149] In a possible implementation, the determination module 81 is specifically configured to:

[0150] Parse the contract code file to determine the instruction file of the first function; detect the internal function call instruction and the external function call instruction in the instruction file; and determine the call relationship called by the first function according to the internal function call instruction and / or the external function call instruction.

[0151] In a possible implementation, the determination module 81 is specifically configured to:

[0152] According to the internal function calling instruction, determine the first internal calling function, the first internal calling function is the internal calling function of the first function, add the function information of the first function and the function information of the first internal calling function to the calling relationship called by the first function; determine whether the Nth internal calling function exists with the N+1th internal calling function, the N+1th internal calling function is the internal calling function of the Nth internal calling function; if the N+1th internal calling function exists, add the function information of the N+1th internal calling function to the calling relationship called by the first function, so that the function information of the internal calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein N is a positive integer.

[0153] In a possible implementation, the determination module 81 is specifically configured to:

[0154] Determine the function information of the first external calling function of all functions in the calling relationship called by the first function, and add the function information of the first external calling function to the calling relationship called by the first function; determine whether there is an M+1th external calling function for the Mth external calling function, and the M+1th external calling function is the external calling function of the Mth external calling function; if there is an M+1th external calling function, add the function information of the M+1th external calling function to the calling relationship called by the first function, so that the function information of the external calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein M is a positive integer.

[0155] In a possible implementation, the function information includes the contract address of the function and the function name of the function.

[0156] In a possible implementation, the determination module 81 is specifically configured to:

[0157] Obtain the contract address of the first external call function and the offset tag of the first external call function; determine the code of the first external call function using the contract address of the first external call function and the offset tag of the first external call function; parse the code of the first external call function to determine the function name of the first external call function.

[0158] The device of this embodiment can perform the above Figure 4 The technical principle and technical effect of the method embodiment shown are similar to those of the above-mentioned embodiment and will not be described in detail here.

[0159] The device embodiments provided in this application are merely illustrative. Figure 8The module division in the description is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another system. The coupling between the modules can be realized through some interfaces, which are usually electrical communication interfaces, but it is not excluded that they may be mechanical interfaces or other forms of interfaces. Therefore, the modules described as separate components may or may not be physically separated, and may be located in one place or distributed in different locations of the same or different devices.

[0160] Fig. 9 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig. 9 As shown, the electronic device includes:

[0161] Processor 91, memory 92, transceiver 93 and computer program; wherein, transceiver 93 realizes data transmission between other devices, the computer program is stored in memory 92, and is configured to be executed by processor 91, and the computer program includes instructions for executing the processing method of transactions in the above-mentioned blockchain. For its content and effect, please refer to the method embodiment.

[0162] In addition, an embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When at least one processor of a user device executes the computer-executable instructions, the user device executes the above-mentioned various possible methods.

[0163] Among them, computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general or special-purpose computer. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a user device. Of course, the processor and the storage medium can also be present in a communication device as discrete components.

[0164] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for processing transactions in a blockchain, characterized in that: include: In the transaction list of the block, determine the contract address and contract code file of each transaction; Determine the call relationship that each transaction depends on based on the contract address and contract code file; According to the call relationship that each transaction depends on, the transactions in the transaction list that have no dependency relationship are processed in parallel; Determining the calling relationship that each transaction depends on based on the contract address and contract code file includes: Determine the contract type of the transaction according to the contract address, where the contract type is a deployment contract or a call contract; If the contract type is the deployment contract, determine the contract code file of the transaction, and determine the calling relationship called by the first function under the contract address according to the contract code file, so as to generate the calling relationship on which the transaction depends; If the contract type is the calling contract, the calling relationship that the exchange depends on is queried using the contract address to determine whether there is a calling relationship that the exchange depends on; If the call relationship that the transaction depends on does not exist in the contract address, determine the contract code file of the transaction, and determine the call relationship called by the first function under the contract address based on the contract code file; Determining, according to the contract code file, a calling relationship called by the first function under the contract address includes: Parsing the contract code file to determine the instruction file of the first function; Detecting internal function call instructions and external function call instructions in the instruction file; Determining a calling relationship called by the first function according to the internal function calling instruction and / or the external function calling instruction; The instruction file includes the internal function calling instruction, and determining the calling relationship called by the first function according to the internal function calling instruction includes: Determine a first internal calling function according to the internal function calling instruction, where the first internal calling function is an internal calling function of the first function, and add function information of the first function and function information of the first internal calling function to a calling relationship called by the first function; Determine whether the Nth internal calling function has an N+1th internal calling function, the N+1th internal calling function being the internal calling function of the Nth internal calling function; if the N+1th internal calling function exists, add the function information of the N+1th internal calling function to the calling relationship called by the first function, so that the function information of the internal calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein N is a positive integer; The instruction file includes the external function calling instruction, and determining the calling relationship of the first function call according to the external function calling instruction includes: Determine function information of a first external calling function of all functions in a calling relationship called by the first function, and add the function information of the first external calling function to the calling relationship of the first function call; Determine whether there is an M+1th external calling function before the Mth external calling function, the M+1th external calling function being the external calling function of the Mth external calling function; if there is the M+1th external calling function, add the function information of the M+1th external calling function to the calling relationship called by the first function, so that the function information of the external calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein M is a positive integer.

2. The method according to claim 1, characterized in that Function information includes the contract address of the function and the function name of the function.

3. The method according to claim 2, characterized in that The determining function information of the first external calling function of all functions in the calling relationship called by the first function includes: Obtaining the contract address of the first external call function and the offset tag of the first external call function; Determine the code of the first external call function by using the contract address of the first external call function and the offset mark of the first external call function; The code of the first external call function is parsed to determine the function name of the first external call function.

4. The method according to any one of claims 1 to 3, characterized in that: Also includes: Stores the call relationships that each transaction depends on.

5. The method according to any one of claims 1 to 3, characterized in that: The processing of the transactions in the transaction list without dependency relationships in parallel according to the call relationship on which each transaction depends includes: Determine the dependency relationship of each transaction in the transaction list according to the call relationship that each transaction depends on; Constructing a directed acyclic graph DAG of the transaction list using the dependency relationship; According to the DAG, transactions in the transaction list without dependencies are processed in parallel.

6. The method according to claim 5, characterized in that Also includes: The execution status of the block is updated using the status root after all transactions in the transaction list are executed.

7. A device for processing transactions in a blockchain, characterized in that: include: The determination module is used to determine the contract address and contract code file of each transaction in the transaction list of the block; The determination module is further used to determine the call relationship that each transaction depends on according to the contract address and the contract code file; A processing module, used for processing in parallel the transactions without dependency in the transaction list according to the call relationship on which each transaction depends; The determination module is further used to determine the contract type of the transaction according to the contract address, and the contract type is a deployment contract or a call contract; If the contract type is the deployment contract, determine the contract code file of the transaction, and determine the calling relationship called by the first function under the contract address according to the contract code file, so as to generate the calling relationship on which the transaction depends; If the contract type is the calling contract, the calling relationship that the exchange depends on is queried using the contract address to determine whether there is a calling relationship that the exchange depends on; If the call relationship that the transaction depends on does not exist in the contract address, determine the contract code file of the transaction, and determine the call relationship called by the first function under the contract address based on the contract code file; The determination module is further used to parse the contract code file to determine the instruction file of the first function; Detecting internal function call instructions and external function call instructions in the instruction file; Determine the calling relationship called by the first function according to the internal function calling instruction and / or the external function calling instruction; the determining module is further used to determine a first internal calling function according to the internal function calling instruction, the first internal calling function being an internal calling function of the first function, and add function information of the first function and function information of the first internal calling function to the calling relationship called by the first function; Determine whether the Nth internal calling function has an N+1th internal calling function, the N+1th internal calling function being the internal calling function of the Nth internal calling function; if the N+1th internal calling function exists, add the function information of the N+1th internal calling function to the calling relationship called by the first function, so that the function information of the internal calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein N is a positive integer; The determining module is further used to determine function information of a first external calling function of all functions in a calling relationship called by the first function, and add the function information of the first external calling function to the calling relationship of the first function call; Determine whether there is an M+1th external calling function before the Mth external calling function, the M+1th external calling function being the external calling function of the Mth external calling function; if there is the M+1th external calling function, add the function information of the M+1th external calling function to the calling relationship called by the first function, so that the function information of the external calling functions of all functions in the calling relationship called by the first function are added to the calling relationship called by the first function, wherein M is a positive integer.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Business data analysis method for block chain global intelligent contract

    CN107038242A

  • Parallel processing method and device of block chain data, equipment and storage medium

    CN108537543A

  • Parallel execution method based on Java smart contracts

    CN110532038A