WO2021032115A1 - 智能合约并行执行的方法、装置、设备和介质 - Google Patents

智能合约并行执行的方法、装置、设备和介质 Download PDF

Info

Publication number
WO2021032115A1
WO2021032115A1 PCT/CN2020/109984 CN2020109984W WO2021032115A1 WO 2021032115 A1 WO2021032115 A1 WO 2021032115A1 CN 2020109984 W CN2020109984 W CN 2020109984W WO 2021032115 A1 WO2021032115 A1 WO 2021032115A1
Authority
WO
WIPO (PCT)
Prior art keywords
contract
transaction
parallel
call
execution
Prior art date
Application number
PCT/CN2020/109984
Other languages
English (en)
French (fr)
Inventor
邱炜伟
李伟
何奇
陶烨琪
尹可挺
李启雷
Original Assignee
杭州趣链科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201910764308.6A external-priority patent/CN110532038B/zh
Priority claimed from CN201911180710.6A external-priority patent/CN110968437A/zh
Application filed by 杭州趣链科技有限公司 filed Critical 杭州趣链科技有限公司
Priority to US17/636,366 priority Critical patent/US20220292082A1/en
Priority to JP2022510861A priority patent/JP7394211B2/ja
Publication of WO2021032115A1 publication Critical patent/WO2021032115A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Definitions

  • the present invention relates to the field of blockchain technology, in particular to methods, devices, equipment and media for parallel execution of smart contracts.
  • Blockchain technology is a new type of decentralized protocol that can safely store digital currency transactions or other data, and the information cannot be forged and tampered with; smart contracts are a type that can be deployed and executed in a blockchain network environment The deployment and execution of this code can be presented in the form of transactions in the blockchain network, and the deployment and execution results can be agreed by the entire network along with the transaction; since the results need to be handed over to the consensus layer consensus, The result of this execution must ensure consistency on each node.
  • the traditional alliance blockchain smart contract execution engine includes evm and jvm, but whether it is the execution of evm or jvm, all the execution of each packaged transaction of the block is completely executed serially.
  • the next transaction must completely wait for the completion of the execution of the previous transaction before it can start execution. This does not make full use of the multi-core characteristics of current general computers, which limits the execution performance of blockchain smart contracts to a certain extent.
  • all transactions packaged in a block are simply parallel, because of the existence of cross-contract calls, it may involve concurrent operations on the same contract state.
  • the purpose of the present invention is to provide a method, device, equipment and medium for parallel execution of smart contracts.
  • a method for parallel execution of smart contracts contains annotations for cross-contract calls.
  • the method specifically includes the following steps: load the smart contract in the first transaction, and obtain the In the first transaction, the cross-contract call annotation in the smart contract is obtained, the cross-contract call address corresponding to the cross-contract call annotation is obtained, and the smart contract corresponding to the cross-contract call address is loaded.
  • the transaction invocation chain is executed in parallel in the virtual machine instances, and each virtual machine instance executes one transaction invocation chain, and returns the execution result.
  • the determination of the call dependency relationship of the transaction according to the cross-contract call link table of each transaction in the target execution transaction and the contract type of the smart contract in the target execution transaction includes: In the case that the contract type of a transaction is the calling contract, and the smart contract in the second transaction is included in the cross-contract calling link table, the second transaction is combined with the first transaction Put them into the same transaction invocation chain; in the case that the contract type of the first transaction is the deployment contract, the first transaction separately forms a transaction invocation chain.
  • the method includes: obtaining a cross-contract call address corresponding to the cross-contract call annotation, and read from the ledger
  • the contract source code corresponding to the cross-contract call address is obtained from the database, and the contract source code is loaded, wherein the method of loading multiple contract source codes is the same.
  • the cross-contract call link table of each transaction in the target execution transaction and the contract type of the smart contract in the target execution transaction, and the determination of the call dependency of the transaction includes: traversing the target The cross-contract call link table of each transaction in the execution transaction determines the call of the transaction according to all the contract addresses included in each cross-contract call link table and the contract type of the smart contract in the target execution transaction Dependency.
  • the method includes: after the execution of the transaction invocation chains in all the virtual machine instances ends, returning to the Execution result, if one of the virtual machines does not return the execution result within a specified time, it is determined that all transactions executed by the virtual machine are illegal.
  • the method before obtaining the transaction invocation chain that will not affect each other during execution according to the invocation dependency relationship, the method further includes: in the case of invoking the smart contract in the transaction invocation chain, Obtain the method annotations of the methods in the smart contract through reflection.
  • the method annotations contain @Parallel annotations
  • judge whether the smart contract can be successfully registered according to the method bytecode of the smart contract Parallel execution contract method judge whether the smart contract can be successfully registered according to the method bytecode of the smart contract Parallel execution contract method; when multiple transactions call the successfully registered contract method that can be executed in parallel, analyze the call parameters of the contract method in the transaction, and when the call parameters are different Next, the contract method is executed in parallel; when the calling parameters are the same, a dependency relationship is constructed according to the order of the transaction, and a Directed Acyclic Graph is generated to determine the order of the transaction.
  • the methods in the smart contract belong to member methods of the contract class.
  • the method annotations of the methods in the smart contract are obtained through reflection.
  • the method of judging whether the smart contract has a successfully registered parallel executable contract method according to the method bytecode of the smart contract includes: obtaining the method of the smart contract with @Parallel annotation The number and types of method parameters, where the smart contract method obtains the parameters from the local variable table of the current method stack frame; parses the method parameters, and in the method bytecode, the method parameters are modified In the case of type instruction operation or calling other methods as a parameter, it is judged as registration failure; in the case that the parameter can be used by more than the persistent variables of @StoreField, it is judged as registration failure.
  • the method includes: after the smart contract is successfully registered In the case of a contract method that can be executed in parallel, a method signature is stored in the state data of the contract method, and the method signature includes the name of the contract method, the number of method parameters, and the method parameter type.
  • constructing a dependency relationship according to the order of the transaction includes: Construct the dependency relationship to the Directed Acyclic Graph, and when the transaction with the lower sequence number has the same parameters as the transaction with the higher sequence number, a transaction with the higher sequence number is established in the Directed Acyclic Graph Point to the dependent side of the transaction with the later sequence number, wherein the sequence number indicates the order in which the transaction is packaged.
  • a method for parallel execution of smart contracts includes annotations for cross-contract calls.
  • the method specifically includes the following steps: Step 1: Blockchain nodes receive the packaged When the transaction is executed, first extract the corresponding contract source code from the ledger database according to the contract address specified in the transaction, and load it; Step 2: For all the loaded contracts, obtain whether there are cross-contract calls in the contract through reflection If yes, take out the address of the cross-contract call, and take out the corresponding contract source code from the ledger database, load it, and recursively analyze the cross-contract call address in the contract; finally, for each transaction, get A cross-contract call link table starting with the address of the contract called by the current transaction; Step 3: According to the call chain of all the obtained transactions corresponding to the contract, perform the call dependency analysis of all transactions, if the transaction contract is a calling contract , Traverse the contract call chain corresponding to this contract obtained in step 2.
  • Step 4 The multiple transaction call chains obtained in step 3 will not affect each other's execution. It is executed in parallel in multiple virtual machine instances that have been turned on in advance. Each virtual machine executes a transaction link, and a single virtual machine executes serially within a single virtual machine. After all virtual machine execution links are over, the results are collected and returned to The upper layer performs other operations.
  • the cross-contract call link table contains all the contract addresses involved in the current transaction execution, and the length is at least 1.
  • the method of loading the extracted contract source code needs to be consistent.
  • step 3 when analyzing and comparing, it must be compared with all the contract addresses involved in all other transactions, that is to say, the first identical address is found during the traversal process. After the address, it does not terminate directly, but continues to traverse to find all.
  • step 4 when collecting the results, you must wait for all the virtual machines to execute before returning the execution results. If there is a virtual machine that does not return within the specified time, then directly determine all the execution of the virtual machine The transaction is illegal.
  • a device for parallel execution of smart contracts includes: a registration module for judging whether a method in a Java smart contract has an @Parallel annotation, and analyzing the @Parallel annotations
  • the Java bytecode of the method of the Java smart contract is used to determine whether it belongs to the successfully registered contract method that can be executed in parallel; the parsing module is used to first obtain whether the called contract has a successfully registered parallel execution method when the contract is invoked.
  • Contract method If multiple transactions in the current block are all called contract methods that can be executed in parallel, the smart contract executor will analyze the parameters passed to the contract method in the transaction. When the parameters of the calling contract are different, it will The contract method is executed in parallel; if the parameters are the same, the dependency relationship is constructed according to the transaction sequence in the block, and the Directed Acyclic Graph is generated to determine the sequence.
  • the registration module includes: a parameter acquisition unit for acquiring the number and types of parameters of a Java smart contract annotated with @Parallel, and a Java smart contract method is known to acquire parameters It is obtained from the local variable table of the current method stack frame.
  • the variables in the local variable table of the method stack frame are the parameters of the current method; the first analysis and judgment unit is used for analysis
  • the method parameters obtained from the local variable table are in the entire method bytecode, whether there is a modified type instruction operation or as a parameter to call other methods, if there is a modified type instruction operation or as a parameter to call other methods, register Failed; the second analysis and judgment unit is used to judge whether the parameter can only be used by the persistent variables of @StoreField. If it can be used by more than the persistent variables of @StoreField, it will also cause registration failure.
  • a device which includes: one or more processors; a memory for storing one or more programs; when the one or more programs are used by the one or more One processor executes, so that the one or more processors implement the following smart contract parallel execution method: determine whether the method in the Java smart contract is annotated with @Parallel, and analyze the method of the Java smart contract with the @Parallel annotation To determine whether it belongs to a successfully registered contract method that can be executed in parallel; when initiating a contract call, first obtain whether the called contract has a successfully registered contract method that can be executed in parallel. If there are multiple contracts in the current block Transactions are all called contract methods that can be executed in parallel.
  • the smart contract executor will analyze the parameters passed to the contract method in the transaction. When the parameters of the calling contract are different, the contract method will be executed in parallel; if the parameters are the same, According to the transaction sequence in the block, the dependency relationship is constructed, and the Directed Acyclic Graph is generated to determine the sequence.
  • a computer-readable storage medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the following method for parallel execution of smart contracts is realized: judging that the Java smart contract Whether the method is annotated with @Parallel, analyze the Java bytecode of the method of the Java smart contract with @Parallel annotation, and determine whether it belongs to the successfully registered contract method that can be executed in parallel; when the contract call is initiated, get it first Whether the called contract has a successfully registered contract method that can be executed in parallel. If multiple transactions in the current block are all called contract methods that can be executed in parallel, the smart contract executor will perform the parameters passed to the contract method in the transaction.
  • the above method, device, equipment and medium for parallel execution of smart contracts according to the cross-contract call link table of each transaction in the target execution transaction and the contract type of the smart contract in the target execution transaction, determine the call dependency of the transaction, and according to the call dependency
  • the relationship is obtained by the transaction call chain that does not affect each other during the execution process, and the transactions packaged in a block can be executed in parallel, which improves the execution efficiency, and the modification of all state quantities will not occur during the parallel execution of the transaction. Concurrency issues.
  • Fig. 1 is a flowchart of a method for parallel execution of smart contracts according to an embodiment of the present invention.
  • Fig. 2 is a flowchart of a method for parallel execution of a single smart contract according to an embodiment of the present invention.
  • Fig. 3 is a schematic diagram of parallel deployment and registration of contracts in the parallel execution of a single smart contract according to a specific embodiment of the present invention.
  • Fig. 4 is a schematic diagram of the parallel execution flow of a single smart contract according to a specific embodiment of the present invention.
  • Fig. 5 is a schematic flowchart of a method for parallel execution of smart contracts according to an embodiment of the present invention.
  • Fig. 6 is a flowchart of acquiring a transaction call link according to an embodiment of the present invention.
  • Fig. 7 is a schematic structural diagram of a device for parallel execution of smart contracts according to an embodiment of the present invention.
  • connection is not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
  • the "plurality” referred to in this application refers to two or more.
  • “And/or” describes the association relationship of the associated objects, which means that there can be three kinds of relationships. For example, “A and/or B” can mean: A alone exists, A and B exist at the same time, and B exists alone.
  • the character “/” generally indicates that the associated objects are in an “or” relationship.
  • first”, “second”, “third”, etc. involved in this application only distinguish similar objects, and do not represent a specific order for objects.
  • FIG. 1 is a flowchart of a method for parallel execution of smart contracts according to an embodiment of the present invention. As shown in FIG. 1, the present invention provides a method for parallel execution of smart contracts. The method includes the following steps:
  • Step S110 load the smart contract in the first transaction, obtain the cross-contract call annotation in the smart contract in the first transaction through reflection, obtain the cross-contract call address corresponding to the cross-contract call annotation, and load the smart contract corresponding to the cross-contract call address
  • a cross-contract call link table with the contract address called by the first transaction as the starting address is obtained recursively.
  • the blockchain node receives the packaged transaction for execution, it first retrieves the corresponding contract source code from the ledger database according to the contract address specified in the transaction, and loads it.
  • the aforementioned first transaction is one of the packaged transactions. For all the loaded contracts, obtain the cross-contract call annotations through reflection.
  • cross-contract call link table starting from the address of the contract called by the current transaction is obtained.
  • the related cross-contract call link table is generated by analyzing the contract recursive analysis of cross-contract call. It contains all the contract addresses involved in the current transaction execution, and its length is at least 1, and when obtaining the cross-contract call annotation, Need to get the annotations of all cross-contract calls in the contract.
  • the above reflection refers to the reflection mechanism in the computer programming language, which is self-checking and operating on internal members when running, that is, the corresponding class or function can be obtained through the string type.
  • Step S120 Determine the call dependency of the transaction according to the cross-contract call link table of each transaction in the target execution transaction and the contract type of the smart contract in the target execution transaction, and obtain transactions that will not affect each other during execution according to the call dependency Call chain.
  • the target execution transaction includes the first transaction
  • the contract type includes call contract and deployment contract.
  • the contract type of the first transaction is a calling contract
  • the smart contract in the second transaction is included in the cross-contract calling link table
  • the second transaction and the first transaction are placed In the same transaction call chain;
  • the contract type of the first transaction is a deployment contract
  • the first transaction separately forms a transaction call chain.
  • the call chain of the contract corresponding to all the transactions obtained analyze the call dependency relationship of all transactions. If the transaction contract is a call contract, traverse the contract call chain corresponding to this contract obtained in step 2. If the contract call chain contains For contracts involved in other transactions, these two transactions are placed in a transaction call chain, otherwise, this transaction is treated as a transaction call chain separately.
  • the transaction contract is a deployment contract
  • the transaction is directly used as a transaction call chain; after the dependency analysis of all transactions is completed, multiple transaction call chains that will not affect each other are finally obtained.
  • Choosing different transaction chain merging methods according to the contract type can further improve the efficiency and accuracy of the transaction call chain acquisition.
  • step S130 the transaction call chain is executed in parallel in the virtual machine instances, and each virtual machine instance executes a transaction call chain and returns the execution result.
  • the multiple transaction call chains that are executed in step S120 that will not affect each other and execute in parallel in multiple virtual machine instances that have been turned on beforehand.
  • Each virtual machine instance executes a transaction call link, and a single virtual machine Internal serial execution. After all virtual machine execution links are over, the results are collected and then returned to the upper layer for other operations.
  • Steps S110 to S130 by loading the smart contract in the first transaction, obtain the cross-contract call annotation in the smart contract in the first transaction through reflection, obtain the cross-contract call address corresponding to the cross-contract call annotation, and load and cross-contract call
  • the smart contract corresponding to the address obtains the cross-contract call link table with the contract address called by the first transaction as the starting address in a recursive manner, and executes the cross-contract call link table of each transaction in the transaction according to the target and the target execution transaction.
  • the contract type of the smart contract determines the call dependency of the transaction, and obtains the transaction call chain that will not affect each other during the execution process according to the call dependency.
  • the cross-contract call link table of each transaction in the target execution transaction and the contract type of the smart contract in the target execution transaction determine the call dependency of the transaction, and obtain the transaction call chain that will not affect each other during the execution process according to the call dependency.
  • the parallel execution of transactions packaged in a block improves the execution efficiency, and the modification of all state quantities during the parallel execution of the transaction will not cause concurrency problems.
  • the method of loading the source code of the above multiple contracts is the same, that is, obtain the cross-contract call annotation in the smart contract in the first transaction through reflection, obtain the cross-contract call address corresponding to the cross-contract call annotation, and load the corresponding cross-contract call address
  • the smart contract obtains the cross-contract call link table with the contract address called by the first transaction as the starting address in a recursive manner.
  • the transaction is determined based on all contract addresses included in each cross-contract call link table and the contract type of the smart contract in the target execution transaction Call dependencies.
  • traversing the contract call chain corresponding to the called contract it must be compared with all contract addresses involved in all other transactions. As long as the same address is found, the two transactions need to be placed in one transaction call chain. That is to say, after finding the first identical address in the traversal process, it does not terminate directly, but continues to traverse to find all.
  • This implementation manner can make the finally acquired transaction invocation chain independent of each other, and improve the reliability of the transaction invocation chain.
  • each virtual machine instance executes a transaction invocation chain
  • the execution result is returned, and one of the virtual machines does not return to execution within a specified time
  • each virtual machine is executed in multiple threads, and when collecting results, it is necessary to wait for all virtual machines to finish executing before returning results.
  • By executing block transactions in parallel in virtual machine instances it makes full use of the multi-core characteristics and computing resources of general computers. If a virtual machine does not return within a specified time, then it is directly determined that all transactions executed by this virtual machine are illegal. Avoid data concurrency problems in the process of concurrent execution of transactions.
  • FIG. 2 is a flowchart of a method for parallel execution of a single smart contract in an embodiment of the present invention, as shown in FIG.
  • the method further includes the following steps:
  • Step S210 in the case of invoking the smart contract in the transaction invocation chain, obtain the method annotations of the method in the smart contract through reflection.
  • the method annotation has the @Parallel annotation, judge according to the method bytecode of the smart contract Whether the smart contract has successfully registered contract methods that can be executed in parallel.
  • the virtual machine execution engine accepts the contract file in the form of jar to be deployed on the blockchain platform, loads the contract file through a custom class loader and initializes the contract Instances, and call smart contracts in the form of interfaces.
  • the methods in the smart contract belong to the member methods of the contract class, and the contract execution engine will scan the member methods of the contract class through java reflection.
  • the contract When the member methods of the contract class are scanned with @Parallel annotations, the contract The member method of the method performs bytecode inspection to determine whether the member method of the contract belongs to the successfully registered contract method that can be executed in parallel.
  • the @Parallel annotation is provided to the method. Only when the annotation is marked can the parallel execution registration be performed.
  • Step S220 When multiple transactions call the successfully registered contract method that can be executed in parallel, analyze the call parameters of the contract method in the transaction. In the case of different call parameters, the contract method is executed in parallel; In the same situation, the dependency relationship is constructed according to the order of transactions, and a Directed Acyclic Graph (DAG) graph is generated to determine the order of transactions.
  • DAG Directed Acyclic Graph
  • judging whether the smart contract has a successfully registered parallel executable contract method according to the method bytecode of the smart contract includes: obtaining the number and type of method parameters of the smart contract method with @Parallel annotation , Analyze method parameters.
  • the method bytecode if the method parameter has a modified type instruction operation or is used as a parameter to call other methods, it will be judged as registration failure; this parameter can not only be used by @StoreField persistent variables In this case, it is determined that the registration has failed.
  • the smart contract method obtains parameters from the local variable table of the current method stack frame.
  • a method for judging whether the registration of a contract method that can be executed in parallel is successful is provided, and the method parameter of the smart contract makes the judgment of the method bytecode of the smart contract faster and more accurate.
  • the contract method is stored in the state data of the method.
  • the method signature includes the name of the contract method, the number of method parameters, and the type of method parameters. Since the method signature includes the name of the contract method, the number of method parameters and the method parameter type, it can be guaranteed that the same method signature cannot appear in a contract, making the judgment of the contract method more accurate.
  • the dependency relationship is constructed by establishing a directed acyclic graph.
  • a transaction with the higher sequence number is created to point to the lower sequence.
  • the out degree is 0; if there are the same conditions as the previous transaction parameters, the current transaction will build a dependent edge for the previous transaction with the same parameter, which mainly adds the in-degree edge for the current transaction, and the previous transaction with the same parameter adds out To measure the edge, the dependency relationship changes from the previous transaction to the current transaction. DAG diagram can make the dependency relationship more intuitive and clear.
  • the contract for the parallel execution of a single contract, the contract’s virtual machine execution engine Java virtual machine, which accepts contract files in the form of jars, is deployed on the blockchain platform through a custom class
  • the loader loads the contract file and initializes the contract instance, and calls the smart contract through the interface.
  • the member variables of the contract need to be annotated with @StoreField.
  • the methods in the Java smart contract belong to the member methods of the contract class.
  • the @Parallel annotation is used to mark the opening of parallelism, and the contract bytecode is checked during deployment or upgrade; the @Parallel annotation is provided to the method, and only the annotation is marked Perform registration that can be executed in parallel.
  • FIG. 3 is a schematic diagram of the parallel deployment and registration of a contract in the parallel execution of a single smart contract according to a specific embodiment of the present invention. As shown in FIG. 3, it is illustrated by using a blockchain DApp.
  • the Java smart contract recorded in the embodiment of the present application may be an integration scenario, and the following parallel execution is an integration scenario as an example for detailed description.
  • each blockchain server a blockchain application for recharge and redemption of points, that is, the Java smart contract, through the pre-set logic of the contract to achieve openness and transparency Processing to ensure that the data is true and not tampered with, and the points of consumers can be shared among various institutions.
  • an agreement is reached between the institutions to initiate the deployment of the contract.
  • the contract includes the ID of the consumer account to be stored and the corresponding point value, and the corresponding point value can be exchanged for the physical objects and the remaining number of physical objects.
  • the Java The smart contract provides the point that the institution generates after the consumer’s consumption is recharged to the user’s corresponding Java smart contract’s point record account.
  • each institution can regularly list some points that can be redeemed in kind, and finally provide the user point query, The function of point redemption physical query and points redemption physical object, thus is the functional description of the Java smart contract of our point scenario.
  • the institution's recharge points for users can be executed in parallel without affecting the final state consistency of the blockchain network. Therefore, before deploying the contract, the institution can describe the contract interface for consumers to recharge points as a parallel Java smart contract method, which is described by @Parallel annotation.
  • the contract method has two parameters, one for the consumer contract account ID and the number of points to be recharged.
  • After the organization defines the functions of the smart contract it initiates contract deployment. The security of the Java smart contract will be verified by the blockchain node. Here, it will be verified whether the recharge method can be parallelized.
  • the method of analyzing the Java smart contract is annotated with @Parallel, that is, the point recharge interface, and the Java bytecode of the method is analyzed.
  • the virtual machine execution engine obtains a method marked with @Parallel annotation through reflection
  • the execution engine obtains the method in the Java bytecode class file
  • the corresponding code attribute is obtained in the Java bytecode specification
  • the method code attribute includes all the processes of method execution.
  • the variables in the local variable table of the method stack frame are the parameters of the current method; secondly, the method parameters obtained from the local variable table are analyzed in the entire method.
  • the registration fails; finally, it is judged whether the parameter can only be used by the persistent variable of @StoreField, if it can be used by @ The use of StoreField's persistent variables will also cause registration failure.
  • the @StoreField variable is the relationship table between the consumer account of the contract and the point mapping when the points are recharged. If the contract method check meets the requirements, the blockchain node will register the changed method as a parallel contract, otherwise the registration will fail. When you successfully judge that @Parallel’s method is parallel when deploying the contract, save the method signature of the current parallel method in the state data of the contract.
  • the method signature includes the name of the contract method, the number of method parameters, and the type of method parameters. It can be guaranteed that the same method signature cannot appear in a contract.
  • the attributes of a method in the Java bytecode file specification include the size of the local variable table that the method needs to use, the depth of the operation stack that needs to be used, and the specific instructions to be executed.
  • the signature of a method includes the aspect name, the number and types of method parameters, and a method signature can be guaranteed to be unique in a class.
  • the method parameters obtained from the local variable table have not been modified, which can be reflected by whether there is a modification instruction to use the parameters in the local variable table; the parameters can only be used by the persistent variables modified by the @StoreField annotation. In the case of different parameters, the stored data is concurrently safe.
  • FIG. 4 is a schematic diagram of the parallel execution process of a single smart contract according to a specific embodiment of the present invention.
  • the institution initiates a blockchain transaction for recharging points.
  • the institution has registered the parallel method successfully, and the blockchain node After the transactions within a certain period of time are packaged and sequenced, each node will execute the transaction for verification.
  • the transaction call smart contract parameter analysis is found to be a parallel contract method
  • the parallel execution contract method will be analyzed by DAG graph.
  • Parallel execution methods for judging successful registration need to achieve mutual exclusion of method parameters during parallel analysis, that is, inconsistent call contract method parameters.
  • inconsistent call contract method parameters In the institutional points recharge interface, if the parameters of the consumer contract account are inconsistent, it can be executed in parallel.
  • Blockchain nodes determine whether the parameters of the point recharge interface are mutually exclusive according to the order of transaction packaging. If they are mutually exclusive with all previous transaction (referring to transactions with parallel contract methods), they will be regarded as a separate node in the DAG graph and output The degree is 0; if there are the same conditions as the previous transaction parameters, the current transaction will build a dependent edge for the previous transaction with the same parameter, mainly adding the in-degree edge for the current transaction, and the out-degree edge for the previous transaction with the same parameter , The dependency is from the previous transaction to the current transaction.
  • the blockchain node After the construction of the DAG graph is completed, according to the topological sorting algorithm, the blockchain node will parallel all the transactions with an entry degree of 0, and update the DAG graph after the execution is completed, reduce the entry degree for the corresponding transaction, and obtain the entry degree of 0 again All transactions are in parallel, until the end of the cycle. Eventually all transaction execution is completed and the process execution ends.
  • FIG. 5 is a schematic flow diagram of the method for parallel execution of smart contracts in an embodiment of the present invention.
  • the flow chart of the road, as shown in Figure 5 and Figure 6, the smart contract contains annotations for cross-contract calls.
  • the parallel execution method is applied to the blockchain smart contract execution engine under the background of the alliance chain, which can be packaged into a block
  • the parallel execution of transactions in also ensures that the modification of all state quantities during the parallel execution of transactions will not cause concurrency problems. It is a major breakthrough in the execution engine of the Java virtual machine under the blockchain virtual machine execution engine.
  • the method specifically includes the following steps: Step 1: When the blockchain node receives the packaged transaction for execution, it first retrieves the corresponding contract source code from the ledger database according to the contract address specified in the transaction, and loads it. Step 2: For all the loaded contracts, use reflection to obtain whether there are cross-contract call annotations in the contract. If so, retrieve the cross-contract call address, and retrieve the corresponding contract source code from the ledger database, load it, and Recursively analyze the cross-contract call address in the contract; finally, for each transaction, a cross-contract call link table starting with the contract address called by the current transaction is obtained; the cross-contract call link table involved is analyzed It is generated by the recursive analysis of the cross-contract call.
  • Step 3 According to the call chain of the contract corresponding to all the transactions obtained, analyze the call dependency relationship of all transactions. If the transaction contract is a call contract, traverse the contract call chain corresponding to this contract obtained in step 2. If the contract is called If the chain contains contracts involved in other transactions, these two transactions are placed in a transaction call chain, otherwise, this transaction is treated as a transaction call chain.
  • Step 4 Put the multiple transaction call chains that are executed in step 3 that will not affect each other and execute in parallel in multiple virtual machine instances that have been opened in advance. Each virtual machine executes a transaction link, a single virtual machine Internal serial execution. After all virtual machine execution links are over, the results are collected and then returned to the upper layer for other operations.
  • each virtual machine is executed in multiple threads, and when collecting results, it is necessary to wait for all virtual machines to finish executing before returning results.
  • By executing block transactions in parallel it makes full use of the multi-core characteristics and computing resources of general computers. Furthermore, by analyzing the dependencies of calls between transactions, it is ensured that data concurrency problems will not occur in the process of concurrently executing transactions. If a virtual machine does not return within the specified time, it is directly determined that all transactions executed by this virtual machine are illegal.
  • an embodiment of the present invention provides a device for parallel execution of smart contracts.
  • the invention is applied to a blockchain platform to provide a new set of devices for parallel execution of a single contract of smart contracts. Realizes contract bytecode analysis, parallel method registration, and mutually exclusive analysis of method parameters. It provides a parallel execution plan for the blockchain platform contract. At the same time, the method can be analyzed and registered in parallel during contract deployment and upgrade.
  • the device includes:
  • the registration module is used to determine whether the method in the Java smart contract is annotated with @Parallel, analyze the Java bytecode of the method of the Java smart contract with @Parallel annotation, and determine whether it belongs to a successfully registered contract that can be executed in parallel method;
  • the parsing module is used to first obtain whether the called contract has successfully registered parallel execution contract methods when initiating a contract call. If multiple transactions in the current block are all called parallel execution contract methods, smart contracts The executor will analyze the parameters passed to the contract method in the transaction. When the parameters of the calling contract are different, the contract method will be executed in parallel; if the parameters are the same, the dependency relationship will be constructed according to the transaction sequence in the block, and the DAG chart to determine the order.
  • the registration module includes: a parameter fetching unit for obtaining the number and types of parameters of a Java smart contract annotated with @Parallel, and it is known that a Java smart contract method obtains parameters from the current method stack Obtained from the local variable table of the frame.
  • the variables in the local variable table of the method stack frame are the parameters of the current method; the first analysis and judgment unit is used to analyze and obtain from the local variable table
  • the output method parameter is in the whole method bytecode, whether there is a modified type instruction operation or as a parameter to call other methods, if the condition is not met, the registration fails; the second analysis and judgment unit is used to judge whether the parameter can only be
  • the use of @StoreField's persistent variables will also cause registration failure if the conditions are not met.
  • Fig. 7 is a schematic structural diagram of a device for parallel execution of smart contracts according to an embodiment of the present invention. As shown in Fig. 7, a block diagram of an exemplary device 1 suitable for implementing embodiments of the present invention.
  • the device shown in FIG. 7 is only an example, and should not bring any limitation to the function and application scope of the embodiment of the present invention.
  • the device 1 can typically be a device that implements parallel execution of a single contract based on a Java smart contract.
  • the device 1 is represented in the form of a general-purpose computing device.
  • the components of the device 1 may include, but are not limited to: one or more processors or processing units 2, a memory 3, and a bus 4 connecting different system components (including the memory 3 and the processing unit 2).
  • Bus 4 represents one or more of several types of bus structures, including a memory bus or a memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any bus structure among multiple bus structures.
  • these architectures include but are not limited to industry standard architecture (ISA) bus, microchannel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and peripheral component interconnection ( PCI) bus.
  • ISA industry standard architecture
  • MAC microchannel architecture
  • VESA Video Electronics Standards Association
  • PCI peripheral component interconnection
  • the device 1 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the device 1, including volatile and non-volatile media, removable and non-removable media.
  • the memory 3 may include a computer system readable medium in the form of a volatile memory, such as a random access memory (RAM) 5 and/or a cache memory 6.
  • the device 1 may further include other removable/non-removable, volatile/non-volatile computer system storage media.
  • the storage system 8 can be used to read and write non-removable, non-volatile magnetic media (not shown in FIG. 3, and is generally referred to as a "hard drive").
  • a disk drive for reading and writing to removable non-volatile disks (such as "floppy disks") and a removable non-volatile disk (such as CDROM, DVD-ROM or other Optical media) optical drive for reading and writing.
  • each drive can be connected to the bus 4 through one or more data medium interfaces.
  • the memory 3 may include at least one program product, and the program product has a set (for example, at least one) program modules, which are configured to perform the functions of the embodiments of the present invention.
  • program modules 8 There is a set of (at least one) program modules 8, which can be stored in, for example, the memory 3.
  • Such program modules 8 include but are not limited to an operating system, one or more application programs, other program modules, and program data. Each of these examples One or a certain combination may include the realization of the network environment.
  • the program module 8 usually executes the functions and/or methods in the described embodiments of the present invention.
  • the device 1 can also communicate with one or more external devices 10 (such as keyboards, pointing devices, display devices 9, etc.), and can also communicate with one or more devices that enable a user to interact with the device 1, and/or communicate with
  • the device 1 can communicate with any device (such as a network card, modem, etc.) that communicates with one or more other computing devices. This communication can be performed through an input/output (I/O) interface 11.
  • the device 1 may also communicate with one or more networks (for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through the network adapter 12.
  • the network adapter 12 communicates with other modules of the device 1 through the bus 4.
  • other hardware and/or software modules can be used in conjunction with device 1, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.
  • the processing unit 2 executes various functional applications and data processing by running a program stored in the memory 3, for example, realizes the block chain-based data block confirmation method provided by the embodiment of the present invention.
  • an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, characterized in that, when the program is executed by a processor, a computer-based Single contract parallel execution method of Java smart contract.
  • the computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media.
  • the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above.
  • computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), Erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CDROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read-only memory
  • EPROM or flash memory Erasable programmable read-only memory
  • CDROM portable compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, apparatus, or device.
  • the computer-readable signal medium may include a data signal propagated in baseband or as a part of a carrier wave, and computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable medium can send, propagate or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
  • the computer program code used to perform the operations of the present invention can be written in one or more programming languages or a combination thereof.
  • the programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also conventional Procedural programming languages, such as "C" language or similar programming languages.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect via the Internet) ).
  • LAN local area network
  • WAN wide area network
  • an Internet service provider for example, using an Internet service provider to connect via the Internet

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

一种智能合约并行执行的方法、装置、设备和介质。所述智能合约并行执行的方法包括以下步骤:根据目标执行交易中各个交易的跨合约调用链路表以及目标执行交易中智能合约的合约类型,确定交易的调用依赖关系,并根据调用依赖关系得到执行过程中不会互相影响的交易调用链,能够将打包到一个区块中的交易并行的执行,提高了执行效率,并且在交易并行执行的过程中对于所有状态量的修改不会产生并发问题。

Description

智能合约并行执行的方法、装置、设备和介质
相关申请
本申请要求2019年8月19日申请的申请号为201910764308.6、名称为“一种基于Java智能合约的并行执行方法”,2019年11月27日申请的申请号为201911180710.6和名称为“一种基于Java智能合约的单个合约并行执行的方法、装置、设备及介质”的中国专利申请的优先权,在此将其全文引入作为参考。
技术领域
本发明涉及区块链技术领域,具体涉及智能合约并行执行的方法、装置、设备和介质。
背景技术
区块链技术,区块链是一种新型去中心化协议,能安全地存储数字货币交易或其他数据,信息不可伪造和篡改;智能合约是一种可以在区块链网络环境中部署和执行的一段代码,这段代码的部署以及执行都是可以在区块链网络中以交易的形式呈现,其部署和执行结果可以随着交易被全网共识;由于结果需要交给共识层共识,由此执行的结果必须保证在每个节点上的一致性。
传统联盟区块链智能合约执行引擎包括evm和jvm,但是不管是evm还是jvm的执行,对于区块每个打包交易的所有的执行都是完全串行执行的,当一个区块中的交易较多时,下一笔交易必须完全等待上一笔交易的执行完成才能开始执行,这样并没有充分利用当前一般计算机的多核特性,从而在一定程度上限制了区块链智能合约的执行性能。同时,如果打包到一个区块中所有的交易只是简单的并行,因为有跨合约调用的存在,那么可能涉及到对同一个合约状态的并发操作问题。
发明内容
为了克服现有技术的不足,本发明的目的在于提供一种智能合约并行执行的方法、装置、设备和介质。
根据本发明的一个方面,提供了一种智能合约并行执行的方法,所述智能合约包含跨合约调用的注解,该方法具体包括如下步骤:加载第一交易中的智能合约,通过反射获取所述第一交易中智能合约中的跨合约调用注解,获取与所述跨合约调用注解对应的跨合约调用地址并加载与所述跨合约调用地址对应的智能合约,通过递归的方式得到以所述第一交易调用的合约地址为起始地址的跨合约调用链路表;根据目标执行交易中各个交易的跨合约调用链路表以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系,并根 据所述调用依赖关系得到执行过程中不会互相影响的交易调用链,其中,所述目标执行交易包括所述第一交易,所述合约类型包括调用合约和部署合约;在虚拟机的实例中并行执行所述交易调用链,每个所述虚拟机实例执行一条所述交易调用链,返回执行结果。
在其中一些实施例中,所述根据目标执行交易中各个交易的跨合约调用链路表以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系包括:在所述第一交易的所述合约类型为所述调用合约的情况下,在所述跨合约调用链路表中包括第二交易中的智能合约的情况下,将所述第二交易与所述第一交易放入同一个所述交易调用链中;在所述第一交易的所述合约类型为所述部署合约的情况下,所述第一交易单独形成一条所述交易调用链。
在其中一些实施例中,所述通过反射获取所述第一交易中智能合约中的跨合约调用注解之后,所述方法包括:获取与所述跨合约调用注解对应的跨合约调用地址,从账本数据库中获取与所述跨合约调用地址对应的合约源码,加载所述合约源码,其中,加载多个所述合约源码的方式一致。
在其中一些实施例中,所述根据目标执行交易中各个交易的跨合约调用链路表以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系包括:遍历所述目标执行交易中各个交易的所述跨合约调用链路表,根据各个所述跨合约调用链路表中包括的所有合约地址以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系。
在其中一些实施例中,在每个所述虚拟机实例执行一条所述交易调用链之后,所述方法包括:在所有所述虚拟机实例中的所述交易调用链执行结束后,返回所述执行结果,在其中一个虚拟机在规定时间内没有返回所述执行结果,判定所述虚拟机执行的所有交易为非法。
在其中一些实施例中,所述根据所述调用依赖关系得到执行过程中不会互相影响的交易调用链之前,所述方法还包括:在调用所述交易调用链中的智能合约的情况下,通过反射获取所述智能合约中的方法的方法注解,在所述方法注解中带有@Parallel注解的情况下,根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的可并行执行的合约方法;在有多笔交易调用所述成功注册的可并行执行的合约方法的情况下,对所述交易中所述合约方法的调用参数进行分析,在所述调用参数不同的情况下,将所述合约方法进行并行执行;在所述调用参数相同的情况下,根据所述交易的顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph来决定所述交易的先后顺序。
在其中一些实施例中,所述智能合约中的方法属于合约类的成员方法。
在其中一些实施例中,通过反射获取所述智能合约中的方法的方法注解,在所述方法注解中带有@Parallel注解的情况下,根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的的可并行执行的合约方法包括:合约执行引擎将通过java反射扫描所述合约类的成员方法,在扫描到所述合约类的成员方法拥有@Parallel注解的情况下,对所述合约的成 员方法进行字节码检查,判断所述合约的成员方法是否属于成功注册的可并行执行的合约方法。
在其中一些实施例中,所述根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的的可并行执行的合约方法包括:获取带有@Parallel注解的智能合约的方法的方法参数个数和类型,其中,所述智能合约的方法从当前方法栈帧的本地变量表中获取所述参数;解析所述方法参数,在方法字节码中,在所述方法参数被修改类型指令操作或者作为参数调用其他方法的情况下,则判定为注册失败;在该参数不止能被@StoreField的持久化变量使用的情况下,判定为注册失败。
在其中一些实施例中,所述根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的可并行执行的合约方法后,所述方法包括:在所述智能合约有成功注册的可并行执行的合约方法的情况下,在所述合约方法的状态数据中保存方法签名,所述方法签名包括所述合约方法的名称、方法参数数量以及方法参数类型。
在其中一些实施例中,在所述调用参数相同的情况下,根据所述交易的顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph来决定所述交易的先后顺序包括:通过建立有向无环图Directed Acyclic Graph构建所述依赖关系,序号靠后的交易和序号靠前的交易参数相同时,在所述有向无环图Directed Acyclic Graph中由所述序号靠前的交易建立一条指向所述序号靠后的交易的依赖边,其中,所述序号指示所述交易打包的顺序。
根据本发明的另一个方面,提供了一种智能合约并行执行的方法,所述的智能合约包含跨合约调用的注解,该方法具体包括如下步骤:步骤一:区块链节点在接收到打包好的交易进行执行时,首先根据交易中指定的合约地址从账本数据库中取出对应的合约源码,并将其进行加载;步骤二:对于加载到的所有合约,通过反射获取合约中是否有跨合约调用的注解,如果有,则取出跨合约调用的地址,并从账本数据库中取出其对应的合约源码,进行加载,并递归进行合约中跨合约调用地址的分析;最后,对于每一个交易,均得到一个以当前交易调用的合约地址起始的跨合约调用链路表;步骤三:根据得到的所有交易对应合约的调用链,进行所有交易的调用依赖关系分析,如果是交易的合约是一个调用合约,遍历步骤二中获取到的此合约对应的合约调用链,如果合约调用链中包含其他的交易涉及到的合约,则将这两笔交易放在一个交易调用链中,否则,这笔交易单独作为一个交易调用链;如果是交易的合约是一个部署合约,直接将笔交易单独作为一个交易调用链。在进行完所有交易的依赖关系分析之后,最终得到多条彼此之间执行不会互相影响的交易调用链;步骤四:将步骤三得到的多条彼此之间执行不会互相影响的交易调用链放在事先开启好的多个虚拟机实例中并行执行,每个虚拟机执行一条交易链路,单个虚拟机内部串行执行,在所有虚拟机执行链路结束后,将结果收集,然后返回给上层进行其他操作。
在其中一些实施例中,所述的步骤二中,跨合约调用链路表包含当前交易执行涉及到 的所有的合约地址,其长度至少为1。
在其中一些实施例中,所述的步骤二中,加载取出的合约源码的方式需要一致。
在其中一些实施例中,所述的步骤三中,在进行分析对比的时候,必须和其他所有的交易涉及到的所有合约地址进行比对,也就是说在遍历过程中找到第一个相同的地址后不是直接终止,而是继续遍历找到所有的。
在其中一些实施例中,所述的步骤四中,收集结果时必须等待所有虚拟机执行完毕后才能返回执行结果,如果有虚拟机在规定时间内没有返回,那么直接判定这个虚拟机执行的所有交易为非法。
根据本发明的再一个方面,提供了一种智能合约并行执行的装置,该装置包括:注册模块,用于判断Java智能合约中的方法中是否带有@Parallel注解,分析带有@Parallel注解的Java智能合约的方法的Java字节码,判断是否属于成功注册的的可并行执行的合约方法;解析模块,用于当发起合约调用时,先获取被调用合约是否有成功注册的可并行执行的合约方法,若当前区块中有多笔交易都是调用的可并行执行的合约方法,智能合约执行器将对交易中传递给合约方法的参数进行分析,当调用合约的参数不同时,则将该合约方法进行并行执行;若参数相同,则根据区块中的交易顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph图来决定先后顺序。
在其中一些实施例张,所述注册模块包括:取参单元,用于获取到带有@Parallel注解的Java智能合约的方法的参数个数和类型,且已知一个Java智能合约的方法获取参数是通过从当前方法栈帧的本地变量表中获取,当一个方法栈帧被调用时,可知方法栈帧的本地变量表中的变量即为当前方法的参数;第一解析判断单元,用于解析从本地变量表中获取出来的方法参数在整个方法字节码中,是否有被修改类型指令操作或者作为参数去调用其他方法,若有被修改类型指令操作或者作为参数去调用其他方法,则注册失败;第二解析判断单元,用于判断该参数是否只能被@StoreField的持久化变量使用,若不止能被@StoreField的持久化变量使用,则也会导致注册失败。
根据本发明的又一个方面,提供了一种设备,该设备包括:一个或多个处理器;存储器,用于存储一个或多个程序;当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如下智能合约并行执行的方法:判断Java智能合约中的方法中是否带有@Parallel注解,分析带有@Parallel注解的Java智能合约的方法的Java字节码,判断是否属于成功注册的可并行执行的合约方法;当发起合约调用时,先获取被调用合约是否有成功注册的可并行执行的合约方法,若当前区块中有多笔交易都是调用的可并行执行的合约方法,智能合约执行器将对交易中传递给合约方法的参数进行分析,当调用合约的参数不同时,则将该合约方法进行并行执行;若参数相同,则根据区块中的交易顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph图来决定先后顺序。
根据本发明的又一个方面,提供了一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如下智能合约并行执行的方法:判断Java智能合约中的方法中是否带有@Parallel注解,分析带有@Parallel注解的Java智能合约的方法的Java字节码,判断是否属于成功注册的的可并行执行的合约方法;当发起合约调用时,先获取被调用合约是否有成功注册的可并行执行的合约方法,若当前区块中有多笔交易都是调用的可并行执行的合约方法,智能合约执行器将对交易中传递给合约方法的参数进行分析,当调用合约的参数不同时,则将该合约方法进行并行执行;若参数相同,则根据区块中的交易顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph图来决定先后顺序。
上述智能合约并行执行的方法、装置、设备和介质,根据目标执行交易中各个交易的跨合约调用链路表以及目标执行交易中智能合约的合约类型,确定交易的调用依赖关系,并根据调用依赖关系得到执行过程中不会互相影响的交易调用链,能够将打包到一个区块中的交易并行的执行,提高了执行效率,并且在交易并行执行的过程中对于所有状态量的修改不会产生并发问题。
附图说明
图1是根据本发明实施例中智能合约并行执行的方法的流程图。
图2是根据本发明实施例中的单个智能合约并行执行方法流程图。
图3是根据本发明具体实施例中单个智能合约并行执行中合约部署注册并行的示意图。
图4是根据本发明具体实施例中单个智能合约并行执行的流程示意图。
图5是根据本发明实施例中智能合约并行执行方法的流程示意图。
图6是根据本发明实施例中获取交易调用链路的流程图。
图7是根据本发明实施例中智能合约并行执行设备的结构示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行描述和说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。基于本申请提供的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。
显而易见地,下面描述中的附图仅仅是本申请的一些示例或实施例,对于本领域的普通技术人员而言,在不付出创造性劳动的前提下,还可以根据这些附图将本申请应用于其他类似情景。此外,还可以理解的是,虽然这种开发过程中所作出的努力可能是复杂并且冗长的,然而对于与本申请公开的内容相关的本领域的普通技术人员而言,在本申请揭露的技术 内容的基础上进行的一些设计,制造或者生产等变更只是常规的技术手段,不应当理解为本申请公开的内容不充分。
在本申请中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域普通技术人员显式地和隐式地理解的是,本申请所描述的实施例在不冲突的情况下,可以与其它实施例相结合。
除非另作定义,本申请所涉及的技术术语或者科学术语应当为本申请所属技术领域内具有一般技能的人士所理解的通常意义。本申请所涉及的“一”、“一个”、“一种”、“该”等类似词语并不表示数量限制,可表示单数或复数。本申请所涉及的术语“包括”、“包含”、“具有”以及它们任何变形,意图在于覆盖不排他的包含;例如包含了一系列步骤或模块(单元)的过程、方法、***、产品或设备没有限定于已列出的步骤或单元,而是可以还包括没有列出的步骤或单元,或可以还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。本申请所涉及的“连接”、“相连”、“耦接”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电气的连接,不管是直接的还是间接的。本申请所涉及的“多个”是指两个或两个以上。“和/或”描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。本申请所涉及的术语“第一”、“第二”、“第三”等仅仅是区别类似的对象,不代表针对对象的特定排序。
在一个实施例中,图1是根据本发明实施例中智能合约并行执行的方法的流程图,如图1所示,本发明提供一种智能合约的并行执行方法,该方法包括以下步骤:
步骤S110,加载第一交易中的智能合约,通过反射获取第一交易中智能合约中的跨合约调用注解,获取与跨合约调用注解对应的跨合约调用地址并加载与跨合约调用地址对应的智能合约,通过递归的方式得到以第一交易调用的合约地址为起始地址的跨合约调用链路表。区块链节点在接收到打包好的交易进行执行时,首先根据交易中指定的合约地址从账本数据库中取出对应的合约源码,并将其进行加载。上述第一交易即打包的交易中的一个交易。对于加载到的所有合约,通过反射获取合约中是否有跨合约调用的注解,如果有,则取出跨合约调用的地址,并从账本数据库中取出与被调用地址对应的合约源码,进行加载,然后再次通过反射获取合约中是否有跨合约调用的注解,以此类推,递归获取合约中跨合约调用地址的链路。最后,对于每一个交易,均得到一个以当前交易调用的合约地址为起始地址的跨合约调用链路表。涉及到的跨合约调用链路表是通过分析跨合约调用的合约递归分析生成的,其包含当前交易执行涉及到的所有的合约地址,其长度至少为1,并且在获取跨合约调用注解时,需要获取合约中所有的跨合约调用的注解。上述反射是指计算机编程语言中的反射机制,是在运行的时候来自我检查,并对内部成员进行操作,即可以通过字符串型获取对应的 类或者函数。
步骤S120,根据目标执行交易中各个交易的跨合约调用链路表以及目标执行交易中智能合约的合约类型,确定交易的调用依赖关系,并根据调用依赖关系得到执行过程中不会互相影响的交易调用链。其中,目标执行交易包括第一交易,合约类型包括调用合约和部署合约。
在其中一些实施例中,在第一交易的合约类型为调用合约的情况下,在跨合约调用链路表中包括第二交易中的智能合约的情况下,将第二交易与第一交易放入同一个交易调用链中;在第一交易的合约类型为部署合约的情况下,第一交易单独形成一条交易调用链。根据得到的所有交易对应合约的调用链,进行所有交易的调用依赖关系分析,如果交易的合约是一个调用合约,遍历步骤二中获取到的此合约对应的合约调用链,如果合约调用链中包含其他的交易涉及到的合约,则将这两笔交易放在一个交易调用链中,否则,这笔交易单独作为一个交易调用链。如果交易的合约是一个部署合约直接将该笔交易单独作为一个交易调用链;在进行完所有交易的依赖关系分析之后,最终得到多条彼此之间执行不会互相影响的交易调用链。根据合约类型选择不同的交易链合并方式,可以进一步提高交易调用链的获取效率和准确性。
步骤S130,在虚拟机的实例中并行执行交易调用链,每个虚拟机实例执行一条交易调用链,返回执行结果。将步骤S120中得到的多条彼此之间执行不会互相影响的交易调用链放在事先开启好的多个虚拟机实例中并行执行,每个虚拟机实例执行一条交易调用链路,单个虚拟机内部串行执行,在所有虚拟机执行链路结束后,将结果收集,然后返回给上层进行其他操作。
步骤S110至步骤S130,通过加载第一交易中的智能合约,通过反射获取第一交易中智能合约中的跨合约调用注解,获取与跨合约调用注解对应的跨合约调用地址并加载与跨合约调用地址对应的智能合约,通过递归的方式得到以第一交易调用的合约地址为起始地址的跨合约调用链路表,根据目标执行交易中各个交易的跨合约调用链路表以及目标执行交易中智能合约的合约类型,确定交易的调用依赖关系,并根据调用依赖关系得到执行过程中不会互相影响的交易调用链。根据目标执行交易中各个交易的跨合约调用链路表以及目标执行交易中智能合约的合约类型,确定交易的调用依赖关系,并根据调用依赖关系得到执行过程中不会互相影响的交易调用链,能够将打包到一个区块中的交易并行的执行,提高了执行效率,并且在交易并行执行的过程中对于所有状态量的修改不会产生并发问题。
在其中一些实施例中,通过反射获取第一交易中智能合约中的跨合约调用注解之后,获取与跨合约调用注解对应的跨合约调用地址,从账本数据库中获取与跨合约调用地址对应的合约源码,加载上述多个合约源码的方式一致,即通过反射获取第一交易中智能合约中的跨合约调用注解,获取与跨合约调用注解对应的跨合约调用地址并加载与跨合约调用地址对 应的智能合约,通过递归的方式得到以第一交易调用的合约地址为起始地址的跨合约调用链路表。
在其中一些实施例中,通过遍历目标执行交易中各个交易的跨合约调用链路表,根据各个跨合约调用链路表中包括的所有合约地址以及目标执行交易中智能合约的合约类型,确定交易的调用依赖关系。在遍历调用的合约对应的合约调用链的时候,必须和其他所有的交易涉及到的所有合约地址进行比对,只要发现存在相同的地址,那么就需要将两笔交易放在一条交易调用链。也就是说在遍历过程中找到第一个相同的地址后不是直接终止,而是继续遍历找到所有的。本实施方式可以使得最终获取到的交易调用链是互不影响的,提高了交易调用链的可靠性。
在其中一些实施例中,在每个虚拟机实例执行一条交易调用链之后,在所有虚拟机实例中的交易调用链执行结束后,返回执行结果,在其中一个虚拟机在规定时间内没有返回执行结果的情况下,判定虚拟机执行的所有交易为非法。通过开启多个虚拟机,各个虚拟机是多线程执行,收集结果时需等待所有虚拟机执行完毕才能返回结果。通过将区块交易在虚拟机实例中并行执行,充分利用了一般计算机的多核特性以及计算资源,如果有虚拟机在规定时间内没有返回,那么直接判定这个虚拟机执行的所有交易为非法,还避免了在并发执行交易的过程中产生的数据并发问题。
在上述智能合约并行执行的过程中存在着单个合约的执行过程,针对单个合约的并行执行,图2是根据本发明实施例中的单个智能合约并行执行方法流程图,如图2所示,在其中一些实施例中,根据调用依赖关系得到执行过程中不会互相影响的交易调用链之后,该方法还包括以下步骤:
步骤S210,在调用交易调用链中的智能合约的情况下,通过反射获取智能合约中的方法的方法注解,在方法注解中带有@Parallel注解的情况下,根据智能合约的方法字节码判断智能合约是否有成功注册的可并行执行的合约方法。例如,在合约的虚拟机执行引擎Java虚拟机的情况下,该虚拟机执行引擎接受以jar形式的合约文件部署在区块链平台上,通过自定义的类加载器加载合约文件并初始化出合约实例,并通过接口的形式调用智能合约。在一些实施例中,智能合约中的方法属于合约类的成员方法,合约执行引擎将通过java反射扫描合约类的成员方法,在扫描到合约类的成员方法拥有@Parallel注解的情况下,对合约的成员方法进行字节码检查,判断合约的成员方法是否属于成功注册的的可并行执行的合约方法,@Parallel注解提供给方法使用,只有标记了该注解才会进行可并行执行注册。
步骤S220,在有多笔交易调用成功注册的可并行执行的合约方法的情况下,对交易中合约方法的调用参数进行分析,在调用参数不同的情况下,合约方法进行并行执行;在调用参数相同的情况下,根据交易的顺序来构建依赖关系,生成有向无环(Directed Acyclic Graph,简称DAG)图来决定交易的先后顺序。通过步骤S210和步骤S220所提供的实施方 式可以提高单个合约的执行效率。
在其中一些实施例中,根据智能合约的方法字节码判断智能合约是否有成功注册的的可并行执行的合约方法包括:获取带有@Parallel注解的智能合约的方法的方法参数个数和类型,解析方法参数,在方法字节码中,方法参数有被修改类型指令操作或者作为参数调用其他方法的情况下,则判定为注册失败;在该参数不止能被@StoreField的持久化变量使用的情况下,则判定为注册失败。其中,智能合约的方法从当前方法栈帧的本地变量表中获取参数。本实施中提供了可并行执行的合约方法是否注册成功的判断方式,通过方法参数使得智能合约的方法字节码判断更加快速和准确。
在其中一些实施例中,根据智能合约的方法字节码判断智能合约是否有成功注册的可并行执行的合约方法后,在智能合约有成功注册的可并行执行的合约方法的情况下,在合约方法的状态数据中保存方法签名,方法签名包括合约方法的名称、方法参数数量以及方法参数类型。由于方法签名包括了合约方法的名称和方法参数数量以及方法参数类型,可以保证一个合约中不可能出现相同的方法签名,使得合约方法的判定更加准确。
在其中一些实施例中,通过建立有向无环图构建依赖关系,序号靠后的交易和序号靠前的交易有参数冲突时,在DAG图中由序号靠前的交易建立一条指向序号靠后的交易的依赖边,其中,序号指示交易打包的顺序。例如,区块链节点按交易打包顺序,依次判断积分充值接口的参数是否互斥,若与之前所有的交易(指可并行合约方法的交易)参数都互斥,则作为DAG图的单独节点,且出度为0;若与之前的交易参数存在相同的情况,则当前交易将于之前存在参数相同的交易构建依赖边,主要为当前交易增加入度边,之前存在参数形同的交易增加出度边,依赖关系从先前的交易指向当前交易。DAG图能够使得依赖关系更加直观和明确。
在一个具体的实施例中,针对单个合约的并行执行,合约的虚拟机执行引擎Java虚拟机,该虚拟机执行引擎接受以jar形式的合约文件部署在区块链平台上,通过自定义的类加载器加载合约文件并初始化出合约实例,并通过接口的形式调用智能合约。Java智能合约内变量需要保存到区块链账本中时,需要对合约的成员变量标注@StoreField注解。Java智能合约中的方法属于合约类的成员方法,通过@Parallel注解来标记开启并行,并在部署或升级时通过合约字节码检测;@Parallel注解提供给方法使用,只有标记了该注解才会进行可并行执行注册。
图3是根据本发明具体实施例中单个智能合约并行执行中合约部署注册并行的示意图,如图3所示,通过使用区块链DApp来说明。本申请实施例中所记载的Java智能合约可以为一个积分场景,下面的并行执行为积分场景为例进行详细说明。
在本申请实施例中,不同机构之间为促进消费者消费,采取发布积分并提供给消费者积分换实物的奖励政策,将不同机构所使用的积分充值和兑换服务器分别作为区块链网络中 的区块链节点,并在每个区块链服务器上部署用于积分充值和兑换的区块链应用,也就是所述的Java智能合约,通过合约预先设定的逻辑来做到公开透明的处理,保证数据真实,不被篡改,以及能在各家机构之间共享消费者的积分。
图3中机构之间达成协议,发起合约的部署,合约中包括了要存储的消费者账户的ID和对应的积分值,以及相应的积分值可兑换的实物和实物的剩余数量,同时该Java智能合约提供了可以让机构在消费者消费后产生的积分充值到用户对应的Java智能合约的积分记录账户中,同时各家机构可以定期上线一些积分可兑换的实物,最终提供给用户积分查询,积分兑换实物查询和积分兑换实物的功能,由此是我们积分场景的Java智能合约的功能描述。
在上述Java智能合约中,可知用户消费是一件很频繁的事情,这也意味着不同机构之间会有大量的用户积分充值数据发送到区块链,通过上述预定义好的智能合约来为消费者的积分充值,在传统的区块链场景中,需要串行执行合约交易,这必然导致机构在为消费者积分充值时服务器响应时间长,最终区块链节点会累积大量的交易等待执行。
通过以上描述,可发现机构为用户充值积分是可以进行并行执行且不会影响区块链网络的最终状态一致性。由此机构在部署合约之前,可以将为消费者充值积分的合约接口描述为可并行的Java智能合约的方法,通过@Parallel注解来描述,合约方法的参数为两个,一个消费者合约账户的ID和需要充值的积分数。机构定义好智能合约的功能后,发起合约部署,Java智能合约的安全性将经过区块链节点的安全验证,此处将验证该充值方法是否可并行的安全性。
分析Java智能合约的方法中带有@Parallel注解,即积分充值接口,分析该方法的Java字节码。需要说明的是,当虚拟机执行引擎通过反射获取到标记有@Parallel注解的方法时,执行引擎将该方法在Java字节码class文件中,对应的code属性获取出来,在Java字节码规范中,方法code属性包括了方法执行的所有流程。通过对class文件中方法的字节码分析,首先获取到带有@Parallel注解的Java智能合约的方法的参数个数和类型,且已知一个Java智能合约的方法获取参数是通过从当前方法栈帧的本地变量表中获取,当一个方法栈帧被调用时,可知方法栈帧的本地变量表中的变量即为当前方法的参数;其次解析从本地变量表中获取出来的方法参数在整个方法字节码中,是否有被修改类型指令操作或者作为参数去调用其他方法,若不满足条件则注册失败;最后,判断该参数是否只能被@StoreField的持久化变量使用,若不止能被@StoreField的持久化变量使用,则也会导致注册失败。
需要说明此处在积分充值时@StoreField变量为合约的消费者账户和积分映射的关系表。若合约方法检查符合要求,区块链节点将改方法注册为可并行合约,否则注册失败。在部署合约时成功判断@Parallel的方法是和并行的,则在该合约的状态数据中保存当前可并行的方法的方法签名,方法签名包括了合约方法的名称和方法参数数量以及方法参数类型,可以保证一个合约中不可能出现相同的方法签名。
需要说明的是,Java字节码文件规范中一个方法的属性包括该方法需要用到的本地变量表大小,需要用到的操作栈深度大小和执行的具体指令。Java的字节码规范中,一个方法的签名包括了方面名称,方法参数个数和类型,一个方法签名在一个类中可以保证是唯一的。
需要说明的是,从本地变量表中获取方法参数没有经过修改,可以通过是否有修改指令使用了在本地变量表中的参数来体现;参数只能被@StoreField注解修饰的持久化变量使用可以保证在参数不同的情况下,存储的数据时并发安全的。
同理,在进行合约升级时也将对合约进行扫描,这里不再赘述。
图4是根据本发明具体实施例中单个智能合约并行执行的流程示意图,如图4所示,机构发起积分充值的区块链交易,上述步骤中机构已经注册可并行方法成功,区块链节点将一定时间内的交易打包定序后,各个节点将执行交易进行验证,当通过交易的调用智能合约参数分析时,发现为可并行合约方法时,将可并行执行的合约方法做DAG图分析,判断注册成功的可并行执行方法在并行分析时需要做到方法参数互斥,即调用合约方法参数不一致。在机构积分充值接口中,需要消费者合约账户参数不一致,即可并行执行。
区块链节点按交易打包顺序,依次判断积分充值接口的参数是否互斥,若与之前所有的交易(指可并行合约方法的交易)参数都互斥,则作为DAG图的单独节点,且出度为0;若与之前的交易参数存在相同的情况,则当前交易将于之前存在参数相同的交易构建依赖边,主要为当前交易增加入度边,之前存在参数形同的交易增加出度边,依赖关系从先前的交易指向当前交易。
构建有DAG图完毕后,按照拓扑排序的算法,区块链节点将入度为0的所有交易并行,在执行完成后更新DAG图,为相应的交易减少入度,再次获取入度为0的所有交易并行,以次循环知道结束。最终所有交易执行完成,流程执行结束。
根据本发明的另一个方面,提供了一种智能合约并行执行的方法,图5是根据本发明实施例中智能合约并行执行方法的流程示意图,图6是根据本发明实施例中获取交易调用链路的流程图,如图5、图6所示,智能合约包含跨合约调用的注解,并行执行方法应用于联盟链背景下的区块链智能合约执行引擎上,既能够将打包到一个区块中的交易并行的执行,也保证了在交易并行执行的过程中对于所有状态量的修改不会产生并发问题,是区块链虚拟机执行引擎下Java虚拟机执行引擎的大突破。该方法具体包括如下步骤:步骤一:区块链节点在接收到打包好的交易进行执行时,首先根据交易中指定的合约地址从账本数据库中取出对应的合约源码,并将其进行加载。步骤二:对于加载到的所有合约,通过反射获取合约中是否有跨合约调用的注解,如果有,则取出跨合约调用的地址,并从账本数据库中取出其对应的合约源码,进行加载,并递归进行合约中跨合约调用地址的分析;最后,对于每一个交易,均得到一个以当前交易调用的合约地址起始的跨合约调用链路表;涉及到的跨合约调用链路表是通过分析跨合约调用的合约递归分析生成的,其包含当前交易执行涉及到的所有的 合约地址,其长度至少为1,并且在获取跨合约调用注解时,需要获取合约中所有的跨合约调用的注解。对于每个获取到的注解,都需要进行递归的分析以最终获得调用链路表;作为其中一种实施方式,加载取出的合约源码的方式需要一致。步骤三:根据得到的所有交易对应合约的调用链,进行所有交易的调用依赖关系分析,如果交易的合约是一个调用合约,遍历步骤二中获取到的此合约对应的合约调用链,如果合约调用链中包含其他的交易涉及到的合约,则将这两笔交易放在一个交易调用链中,否则,这笔交易单独作为一个交易调用链。如果交易的合约是一个部署合约直接将笔交易单独作为一个交易调用链;在进行完所有交易的依赖关系分析之后,最终得到多条彼此之间执行不会互相影响的交易调用链;在遍历调用的合约对应的合约调用链的时候,必须和其他所有的交易涉及到的所有合约地址进行比对,只要发现存在相同的地址,那么就需要将两笔交易放在一条交易调用链。也就是说在遍历过程中找到第一个相同的地址后不是直接终止,而是继续遍历找到所有的相同地址。步骤四:将步骤三得到的多条彼此之间执行不会互相影响的交易调用链放在事先开启好的多个虚拟机实例中并行执行,每个虚拟机执行一条交易链路,单个虚拟机内部串行执行,在所有虚拟机执行链路结束后,将结果收集,然后返回给上层进行其他操作。
通过开启多个虚拟机,各个虚拟机是多线程执行,收集结果时需等待所有虚拟机执行完毕才能返回结果。通过将区块交易并行执行,充分利用了一般计算机的多核特性以及计算资源,进一步的,通过分析交易间调用的依赖关系,保证了在并发执行交易的过程中不会产生数据并发问题。如果有虚拟机在规定时间内没有返回,那么直接判定这个虚拟机执行的所有交易为非法。
根据本发明的另一个方面,提供了一种本发明实施例提供一种智能合约并行执行装置,本发明应用于区块链平台上,提供了一套全新的智能合约单个合约并行执行的装置,实现了合约字节码分析,并行方法注册,方法参数互斥分析,为区块链平台的合约提供了并行执行的方案,同时在合约部署和升级时都将进行方法可并行的分析和注册。该装置包括:
注册模块,用于判断Java智能合约中的方法中是否带有@Parallel注解,分析带有@Parallel注解的Java智能合约的方法的Java字节码,判断是否属于成功注册的的可并行执行的合约方法;
解析模块,用于当发起合约调用时,先获取被调用合约是否有成功注册的可并行执行的合约方法,若当前区块中有多笔交易都是调用的可并行执行的合约方法,智能合约执行器将对交易中传递给合约方法的参数进行分析,当调用合约的参数不同时,则将该合约方法进行并行执行;若参数相同,则根据区块中的交易顺序来构建依赖关系,生成DAG图来决定先后顺序。
进一步的,注册模块包括:取参单元,用于获取到带有@Parallel注解的Java智能合约的方法的参数个数和类型,且已知一个Java智能合约的方法获取参数是通过从当前方法栈 帧的本地变量表中获取,当一个方法栈帧被调用时,可知方法栈帧的本地变量表中的变量即为当前方法的参数;第一解析判断单元,用于解析从本地变量表中获取出来的方法参数在整个方法字节码中,是否有被修改类型指令操作或者作为参数去调用其他方法,若不满足条件则注册失败;第二解析判断单元,用于判断该参数是否只能被@StoreField的持久化变量使用,若不满足条件,则也会导致注册失败。
图7是根据本发明实施例中智能合约并行执行设备的结构示意图。如图7所示,适于用来实现本发明实施方式的示例性设备1的框图。图7显示的设备仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。设备1典型可以是实现基于Java智能合约的单个合约并行执行的设备。
如图7所示,设备1以通用计算设备的形式表现。设备1的组件可以包括但不限于:一个或者多个处理器或者处理单元2,存储器3,连接不同***组件(包括存储器3和处理单元2)的总线4。
总线4表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,***总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA)总线,微通道体系结构(MAC)总线,增强型ISA总线、视频电子标准协会(VESA)局域总线以及***组件互连(PCI)总线。
设备1典型地包括多种计算机***可读介质。这些介质可以是任何能够被设备1访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。
存储器3可以包括易失性存储器形式的计算机***可读介质,例如随机存取存储器(RAM)5和/或高速缓存存储器6。设备1可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机***存储介质。仅作为举例,存储***8可以用于读写不可移动的、非易失性磁介质(图3未显示,通常称为“硬盘驱动器”)。尽管图7中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CDROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线4相连。存储器3可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本发明各实施例的功能。
具有一组(至少一个)程序模块8,可以存储在例如存储器3中,这样的程序模块8包括但不限于操作***、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块8通常执行本发明所描述的实施例中的功能和/或方法。
设备1也可以与一个或多个外部设备10(例如键盘、指向设备、显示设备9等)通信,还可与一个或者多个使得用户能与该设备1交互的设备通信,和/或与使得该设备1能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以 通过输入/输出(I/O)接口11进行。并且,设备1还可以通过网络适配器12与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器12通过总线4与设备1的其它模块通信。应当明白,尽管图3中未示出,可以结合设备1使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID***、磁带驱动器以及数据备份存储***等。
处理单元2通过运行存储在存储器3中的程序,从而执行各种功能应用以及数据处理,例如实现本发明实施例所提供的基于区块链的数据分块确认方法。
根据本发明的另一个方面,本发明实施例提供一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如第一方面所述的一种基于Java智能合约的单个合约并行执行方法。
本发明实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是但不限于电、磁、光、电磁、红外线、或半导体的***、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CDROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行***、装置或者器件使用或者与其结合使用。
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行***、装置或者器件使用或者与其结合使用的程序。
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、电线、光缆、RF等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言,诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言,诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN)连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连 接)。
本领域普通技术人员可以理解,以上所述仅为发明的优选实例而已,并不用于限制发明,尽管参照前述实例对发明进行了详细的说明,对于本领域的技术人员来说,其依然可以对前述各实例记载的技术方案进行修改,或者对其中部分技术特征进行等同替换。凡在发明的精神和原则之内,所做的修改、等同替换等均应包含在发明的保护范围之内。

Claims (20)

  1. 一种智能合约并行执行的方法,其特征在于,所述智能合约包含跨合约调用的注解,该方法具体包括如下步骤:
    加载第一交易中的智能合约,通过反射获取所述第一交易中智能合约中的跨合约调用注解,获取与所述跨合约调用注解对应的跨合约调用地址并加载与所述跨合约调用地址对应的智能合约,通过递归的方式得到以所述第一交易调用的合约地址为起始地址的跨合约调用链路表;
    根据目标执行交易中各个交易的跨合约调用链路表以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系,并根据所述调用依赖关系得到执行过程中不会互相影响的交易调用链,其中,所述目标执行交易包括所述第一交易,所述合约类型包括调用合约和部署合约;
    在虚拟机的实例中并行执行所述交易调用链,每个所述虚拟机实例执行一条所述交易调用链,返回执行结果。
  2. 根据权利要求1所述的智能合约并行执行的方法,其特征在于,所述根据目标执行交易中各个交易的跨合约调用链路表以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系包括:
    在所述第一交易的所述合约类型为所述调用合约的情况下,在所述跨合约调用链路表中包括第二交易中的智能合约的情况下,将所述第二交易与所述第一交易放入同一个所述交易调用链中;
    在所述第一交易的所述合约类型为所述部署合约的情况下,所述第一交易单独形成一条所述交易调用链。
  3. 根据权利要求1或2任一项所述的智能合约并行执行的方法,其特征在于,所述通过反射获取所述第一交易中智能合约中的跨合约调用注解之后,所述方法包括:
    获取与所述跨合约调用注解对应的跨合约调用地址,从账本数据库中获取与所述跨合约调用地址对应的合约源码,加载所述合约源码,其中,加载多个所述合约源码的方式一致。
  4. 根据权利要求1或2任一项所述的智能合约并行执行的方法,其特征在于,所述根据目标执行交易中各个交易的跨合约调用链路表以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系包括:
    遍历所述目标执行交易中各个交易的所述跨合约调用链路表,根据各个所述跨合约调用链路表中包括的所有合约地址以及所述目标执行交易中智能合约的合约类型,确定所述交易的调用依赖关系。
  5. 根据权利要求1或2任一项所述的智能合约并行执行的方案,其特征在于,在每个所述虚拟机实例执行一条所述交易调用链之后,所述方法包括:
    在所有所述虚拟机实例中的所述交易调用链执行结束后,返回所述执行结果,在其中一个虚拟机在规定时间内没有返回所述执行结果,判定所述虚拟机执行的所有交易为非法。
  6. 根据权利要求1所述的方法,其特征在于,所述根据所述调用依赖关系得到执行过程 中不会互相影响的交易调用链之前,所述方法还包括:
    在调用所述交易调用链中的智能合约的情况下,通过反射获取所述智能合约中的方法的方法注解,在所述方法注解中带有@Parallel注解的情况下,根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的可并行执行的合约方法;
    在有多笔交易调用所述成功注册的可并行执行的合约方法的情况下,对所述交易中所述合约方法的调用参数进行分析,在所述调用参数不同的情况下,将所述合约方法进行并行执行;在所述调用参数相同的情况下,根据所述交易的顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph来决定所述交易的先后顺序。
  7. 根据权利要求6所述的智能合约并行执行的方法,其特征在于,所述智能合约中的方法属于合约类的成员方法。
  8. 根据权利要求7所述的智能合约并行执行的方法,其特征在于,通过反射获取所述智能合约中的方法的方法注解,在所述方法注解中带有@Parallel注解的情况下,根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的可并行执行的合约方法包括:
    合约执行引擎将通过java反射扫描所述合约类的成员方法,在扫描到所述合约类的成员方法拥有@Parallel注解的情况下,对所述合约的成员方法进行字节码检查,判断所述合约的成员方法是否属于成功注册的可并行执行的合约方法。
  9. 根据权利要求6所述的智能合约并行执行的方法,其特征在于,所述根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的可并行执行的合约方法包括:
    获取带有@Parallel注解的智能合约的方法的方法参数个数和类型,其中,所述智能合约的方法从当前方法栈帧的本地变量表中获取所述参数;
    解析所述方法参数,在方法字节码中,所述方法参数被修改类型指令操作或者作为参数调用其他方法的情况下,则判定为注册失败;
    在所述参数不止被@StoreField的持久化变量使用的情况下,则判定为注册失败。
  10. 根据权利要求6所述的智能合约并行执行的方法,其特征在于,所述根据所述智能合约的方法字节码判断所述智能合约是否有成功注册的可并行执行的合约方法后,所述方法包括:
    在所述智能合约有成功注册的可并行执行的合约方法的情况下,在所述合约方法的状态数据中保存方法签名,所述方法签名包括所述合约方法的名称、方法参数数量以及方法参数类型。
  11. 根据权利要求6所述的智能合约并行执行的方法,其特征在于,在所述调用参数相同的情况下,根据所述交易的顺序来构建依赖关系,生成有向无环图来决定所述交易的先后顺序包括:
    通过建立有向无环图Directed Acyclic Graph构建所述依赖关系,序号靠后的交易和序号靠前的交易参数相同时,在所述有向无环图Directed Acyclic Graph中由所述序号靠前的交易建立一条指向所述序号靠后的交易的依赖边,其中,所述序号指示所述交易打包的顺序。
  12. 一种智能合约并行执行的方法,其特征在于,所述的智能合约包含跨合约调用的注 解,该方法具体包括如下步骤:
    步骤一:区块链节点在接收到打包好的交易进行执行时,首先根据交易中指定的合约地址从账本数据库中取出对应的合约源码,并将其进行加载;
    步骤二:对于加载到的所有合约,通过反射获取合约中是否有跨合约调用的注解,如果有,则取出跨合约调用的地址,并从账本数据库中取出其对应的合约源码,进行加载,并递归进行合约中跨合约调用地址的分析;最后,对于每一个交易,均得到一个以当前交易调用的合约地址起始的跨合约调用链路表;
    步骤三:根据得到的所有交易对应合约的调用链,进行所有交易的调用依赖关系分析,如果是交易的合约是一个调用合约,遍历步骤二中获取到的此合约对应的合约调用链,如果合约调用链中包含其他的交易涉及到的合约,则将这两笔交易放在一个交易调用链中,否则,这笔交易单独作为一个交易调用链;如果是交易的合约是一个部署合约,直接将笔交易单独作为一个交易调用链;在进行完所有交易的依赖关系分析之后,最终得到多条彼此之间执行不会互相影响的交易调用链;
    步骤四:将步骤三得到的多条彼此之间执行不会互相影响的交易调用链放在事先开启好的多个虚拟机实例中并行执行,每个虚拟机执行一条交易链路,单个虚拟机内部串行执行,在所有虚拟机执行链路结束后,将结果收集,然后返回给上层进行其他操作。
  13. 根据权利要求12所述的智能合约并行执行的方法,其特征在于,所述的步骤二中,跨合约调用链路表包含当前交易执行涉及到的所有的合约地址,其长度至少为1。
  14. 根据权利要求12所述的智能合约并行执行的方法,其特征在于,所述的步骤二中,加载取出的合约源码的方式需要一致。
  15. 根据权利要求12所述的智能合约并行执行的方法,其特征在于,所述的步骤三中,在进行分析对比的时候,必须和其他所有的交易涉及到的所有合约地址进行比对,也就是说在遍历过程中找到第一个相同的地址后不是直接终止,而是继续遍历找到所有的。
  16. 根据权利要求12所述的智能合约并行执行的方法,其特征在于,所述的步骤四中,收集结果时必须等待所有虚拟机执行完毕后才能返回执行结果,如果有虚拟机在规定时间内没有返回,那么直接判定这个虚拟机执行的所有交易为非法。
  17. 一种智能合约并行执行的装置,其特征在于,包括:
    注册模块,用于判断Java智能合约中的方法中是否带有@Parallel注解,分析带有@Parallel注解的Java智能合约的方法的Java字节码,判断是否属于成功注册的可并行执行的合约方法;
    解析模块,用于当发起合约调用时,先获取被调用合约是否有成功注册的可并行执行的合约方法,若当前区块中有多笔交易都是调用的可并行执行的合约方法,智能合约执行器将对交易中传递给合约方法的参数进行分析,当调用合约的参数不同时,则将该合约方法进行并行执行;若参数相同,则根据区块中的交易顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph图来决定先后顺序。
  18. 根据权利要求17所述的装置,其特征在于,所述注册模块包括:
    取参单元,用于获取到带有@Parallel注解的Java智能合约的方法的参数个数和类型,且 已知一个Java智能合约的方法获取参数是通过从当前方法栈帧的本地变量表中获取,当一个方法栈帧被调用时,可知方法栈帧的本地变量表中的变量即为当前方法的参数;
    第一解析判断单元,用于解析从本地变量表中获取出来的方法参数在整个方法字节码中,是否有被修改类型指令操作或者作为参数去调用其他方法,若不满足条件则注册失败;
    第二解析判断单元,用于判断该参数是否只能被@StoreField的持久化变量使用,若不满足条件,则也会导致注册失败。
  19. 一种设备,其特征在于,包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如下智能合约并行执行的方法:
    判断Java智能合约中的方法中是否带有@Parallel注解,分析带有@Parallel注解的Java智能合约的方法的Java字节码,判断是否属于成功注册的的可并行执行的合约方法;
    当发起合约调用时,先获取被调用合约是否有成功注册的可并行执行的合约方法,若当前区块中有多笔交易都是调用的可并行执行的合约方法,智能合约执行器将对交易中传递给合约方法的参数进行分析,当调用合约的参数不同时,则将该合约方法进行并行执行;若参数相同,则根据区块中的交易顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph图来决定先后顺序。
  20. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如下智能合约并行执行的方法:
    判断Java智能合约中的方法中是否带有@Parallel注解,分析带有@Parallel注解的Java智能合约的方法的Java字节码,判断是否属于成功注册的可并行执行的合约方法;
    当发起合约调用时,先获取被调用合约是否有成功注册的可并行执行的合约方法,若当前区块中有多笔交易都是调用的可并行执行的合约方法,智能合约执行器将对交易中传递给合约方法的参数进行分析,当调用合约的参数不同时,则将该合约方法进行并行执行;若参数相同,则根据区块中的交易顺序来构建依赖关系,生成有向无环图Directed Acyclic Graph图来决定先后顺序。
PCT/CN2020/109984 2019-08-19 2020-08-19 智能合约并行执行的方法、装置、设备和介质 WO2021032115A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US17/636,366 US20220292082A1 (en) 2019-08-19 2020-08-19 Method, apparatus and device for parallel execution of smart contract, and medium
JP2022510861A JP7394211B2 (ja) 2019-08-19 2020-08-19 スマートコントラクトの並行実行の方法、装置、機器、及び媒体

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201910764308.6 2019-08-19
CN201910764308.6A CN110532038B (zh) 2019-08-19 2019-08-19 一种基于Java智能合约的并行执行方法
CN201911180710.6 2019-11-27
CN201911180710.6A CN110968437A (zh) 2019-11-27 2019-11-27 一种基于Java智能合约的单个合约并行执行的方法、装置、设备及介质

Publications (1)

Publication Number Publication Date
WO2021032115A1 true WO2021032115A1 (zh) 2021-02-25

Family

ID=74659966

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/109984 WO2021032115A1 (zh) 2019-08-19 2020-08-19 智能合约并行执行的方法、装置、设备和介质

Country Status (3)

Country Link
US (1) US20220292082A1 (zh)
JP (1) JP7394211B2 (zh)
WO (1) WO2021032115A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113869902A (zh) * 2021-12-03 2021-12-31 深圳前海微众银行股份有限公司 一种区块链交易执行方法及装置
CN115150409A (zh) * 2022-06-29 2022-10-04 蚂蚁区块链科技(上海)有限公司 在区块链***中执行交易的方法、区块链***和节点

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11936794B2 (en) * 2021-09-16 2024-03-19 Masterard International Incorporated Method and system for parallel processing of smart contracts in permissioned blockchains
CN116382815B (zh) * 2023-06-05 2023-10-10 安徽中科晶格技术有限公司 基于dag模型的合约并行化方法
CN116719627B (zh) * 2023-08-09 2024-01-19 腾讯科技(深圳)有限公司 数据处理方法、装置、设备及存储介质
CN117350724B (zh) * 2023-12-04 2024-03-15 安徽中科晶格技术有限公司 基于账户链的智能合约运行方法、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108537543A (zh) * 2018-03-30 2018-09-14 百度在线网络技术(北京)有限公司 区块链数据的并行处理方法、装置、设备和存储介质
CN108595157A (zh) * 2018-04-28 2018-09-28 百度在线网络技术(北京)有限公司 区块链数据的处理方法、装置、设备和存储介质
CN109636592A (zh) * 2017-10-20 2019-04-16 北京航空航天大学 高性能智能合约设计
WO2019072310A2 (en) * 2018-12-29 2019-04-18 Alibaba Group Holding Limited SYSTEM AND METHOD FOR IMPLEMENTING NATIVE CONTRACT ON BLOCK CHAIN
CN110532038A (zh) * 2019-08-19 2019-12-03 杭州趣链科技有限公司 一种基于Java智能合约的并行执行方法
CN110968437A (zh) * 2019-11-27 2020-04-07 杭州趣链科技有限公司 一种基于Java智能合约的单个合约并行执行的方法、装置、设备及介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110291550A (zh) * 2018-11-27 2019-09-27 阿里巴巴集团控股有限公司 提高区块链上智能合约的安全性的***和方法
EP3566391B1 (en) * 2018-12-28 2021-04-21 Advanced New Technologies Co., Ltd. Parallel execution of transactions in a blockchain network based on smart contract whitelists

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109636592A (zh) * 2017-10-20 2019-04-16 北京航空航天大学 高性能智能合约设计
CN108537543A (zh) * 2018-03-30 2018-09-14 百度在线网络技术(北京)有限公司 区块链数据的并行处理方法、装置、设备和存储介质
CN108595157A (zh) * 2018-04-28 2018-09-28 百度在线网络技术(北京)有限公司 区块链数据的处理方法、装置、设备和存储介质
WO2019072310A2 (en) * 2018-12-29 2019-04-18 Alibaba Group Holding Limited SYSTEM AND METHOD FOR IMPLEMENTING NATIVE CONTRACT ON BLOCK CHAIN
CN110532038A (zh) * 2019-08-19 2019-12-03 杭州趣链科技有限公司 一种基于Java智能合约的并行执行方法
CN110968437A (zh) * 2019-11-27 2020-04-07 杭州趣链科技有限公司 一种基于Java智能合约的单个合约并行执行的方法、装置、设备及介质

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113869902A (zh) * 2021-12-03 2021-12-31 深圳前海微众银行股份有限公司 一种区块链交易执行方法及装置
WO2023098041A1 (zh) * 2021-12-03 2023-06-08 深圳前海微众银行股份有限公司 一种区块链交易执行方法及装置
CN115150409A (zh) * 2022-06-29 2022-10-04 蚂蚁区块链科技(上海)有限公司 在区块链***中执行交易的方法、区块链***和节点

Also Published As

Publication number Publication date
JP2022545422A (ja) 2022-10-27
JP7394211B2 (ja) 2023-12-07
US20220292082A1 (en) 2022-09-15

Similar Documents

Publication Publication Date Title
WO2021032115A1 (zh) 智能合约并行执行的方法、装置、设备和介质
US11062022B1 (en) Container packaging device
CN110968437A (zh) 一种基于Java智能合约的单个合约并行执行的方法、装置、设备及介质
CN110532038B (zh) 一种基于Java智能合约的并行执行方法
US20180074804A1 (en) Systems and methods for dynamically replacing code objects for code pushdown
WO2020015190A1 (zh) 业务规则的生成方法、电子装置及可读存储介质
US20180052708A1 (en) Resource Efficient Acceleration of Datastream Analytics Processing Using an Analytics Accelerator
US20080071802A1 (en) Tranformation of modular finite state transducers
CN109194495B (zh) 服务器、报文处理方法和计算机可读存储介质
US20120166513A1 (en) Unified access to resources
Bose Automated translation of UML models of architectures for verification and simulation using SPIN
Shatnawi et al. Analyzing program dependencies in java ee applications
CN109951553B (zh) 数据处理方法、***、电子设备以及计算机可读存储介质
Lapadula et al. Using formal methods to develop WS-BPEL applications
US10614128B2 (en) Methods and systems for starting computerized system modules
CN111259042B (zh) 一种动态查询方法及***
US11853196B1 (en) Artificial intelligence driven testing
US9009098B1 (en) Methods and apparatus for creating a centralized data store
Tamayo et al. Understanding the behavior of database operations under program control
Yang et al. Linking functions and quality attributes for software evolution
US9507567B2 (en) Facilitating use of techniques implemented by external library functions in process definitions of analytical applications
EP3657351A1 (en) Smart data transition to cloud
CN116644122A (zh) 数据事务处理方法、装置、计算机设备及存储介质
US8196152B2 (en) Container context information propagation in an aspect-oriented environment
US9672020B2 (en) Selectively loading precompiled header(s) and/or portion(s) thereof

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20855264

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022510861

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20855264

Country of ref document: EP

Kind code of ref document: A1