WO2019024674A1 - 智能合约处理方法及装置 - Google Patents
智能合约处理方法及装置 Download PDFInfo
- Publication number
- WO2019024674A1 WO2019024674A1 PCT/CN2018/095784 CN2018095784W WO2019024674A1 WO 2019024674 A1 WO2019024674 A1 WO 2019024674A1 CN 2018095784 W CN2018095784 W CN 2018095784W WO 2019024674 A1 WO2019024674 A1 WO 2019024674A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- class file
- smart contract
- request
- call request
- deployment
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44589—Program code verification, e.g. Java bytecode verification, proof-carrying code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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
- G06Q10/00—Administration; Management
- G06Q10/10—Office automation; Time management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/40—Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
- G06Q20/405—Establishing or using transaction specific rules
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0618—Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
- H04L9/0637—Modes of operation, e.g. cipher block chaining [CBC], electronic codebook [ECB] or Galois/counter mode [GCM]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
- H04L9/3239—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/50—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
Definitions
- the invention belongs to the field of computer data processing, and in particular relates to a smart contract processing method and device.
- a smart contract is a set of commitments defined in digital form on which contract participants can implement these promised agreements.
- the smart contract itself and the contract execution process can be observed, and the process and judgment of the contract execution can be verified.
- the smart contract itself and the contract-related information can only be contacted by the relevant contract party, and the relevant information will be exposed to third-party review when a conflict occurs.
- Blockchain technology is a decentralized peer-to-peer network that combines cryptographic principles with consensus mechanisms to ensure data coherence and persistence across distributed nodes, enabling instant verification, traceability, difficulty in tampering, and unmasking of information. This creates a shared, efficient, and secure shared value system.
- Smart contracts are decentralized application technologies that are implemented by blockchain technology to implement complex functions. The smart contract is written in a high-level language, compiled by the corresponding compiler to generate the code that the blockchain can recognize and execute, deployed in the blockchain, and provides corresponding functions.
- a system or module used to execute a smart contract generally referred to as the execution engine of a smart contract.
- the existing intelligent contract execution engine is mainly realized by creating a scripting language and its interpreter.
- the present invention is directed to the above problems, and proposes a smart contract processing method and apparatus.
- a method for processing a smart contract in a multi-node system includes: determining a class file corresponding to the smart contract based on a call request for a smart contract to be invoked; The class file executes the smart contract; wherein the class file is pre-compiled based on program logic of the smart contract.
- the class file includes an instruction and a counter corresponding to the instruction; wherein the executing the smart contract based on the class file comprises: performing execution of the instruction by using the counter The number of times is counted, and when the number of executions is greater than the preset number of times, the execution of the instruction is stopped.
- the class file includes a plurality of the instructions, each of the instructions is provided with a corresponding weight; wherein, the value of the weight is larger, the instruction corresponding to the weight The fewer the preset times.
- the determining, according to the calling request for the smart contract to be invoked, the class file corresponding to the smart contract includes: searching, according to the calling request, a class file library corresponding to the smart contract Class file.
- the searching for a class file corresponding to the smart contract to be invoked in the class file library based on the calling request includes: acquiring, in the calling request, the smart contract for indicating the smart contract Identifying information; and searching for a class file corresponding to the smart contract in the class file library according to the identification information.
- the determining, according to the calling request for the smart contract to be invoked, the class file corresponding to the smart contract to be invoked includes: indicating, according to the calling request, an identifier for indicating the smart contract The information generates the class file that satisfies the call request.
- the executing the smart contract based on the class file comprises: instantiating the class file, and determining functions and parameters in the call request; and based on the instantiated The class file and the functions and parameters are used to execute the smart contract.
- the method for processing the smart contract in the multi-node system before determining the class file corresponding to the smart contract based on the calling request for the smart contract to be invoked, the method for processing the smart contract in the multi-node system further includes: It is determined that the call request is legal.
- the determining the call request legally includes: agreeing on a format of the call request, and determining that the call request is legal when all nodes consider that the format of the call request is legal.
- the class file is pre-deployed in the multi-node system, wherein the deployment process of the class file includes: loading the class file to be deployed by a class loader; When the non-deterministic class and/or non-deterministic function is not included in the class file, the class file is deployed to form a class file library.
- the process of deploying the class file further includes: setting and executing in the class file when determining that the class file does not include a non-deterministic class and/or a non-deterministic function; A corresponding counter, wherein the counter is configured to count the number of executions of the instruction during execution of the smart contract.
- the method for processing a smart contract in a multi-node system further comprises: determining that a deployment request for deploying the class file is legal.
- the determining that the deployment request of the class file is legally includes: agreeing on a format of the deployment request, and determining, when all nodes consider that the format of the deployment request is legal The call request is legal.
- an apparatus for processing a smart contract in a multi-node system comprising: a determining module configured to determine the smart contract based on a call request for a smart contract to be invoked a corresponding class file; and an execution module configured to execute the smart contract to be invoked based on a class file corresponding to the smart contract to be invoked; wherein the class file is based on a program logic of the smart contract to be invoked in advance Compiled.
- the class file includes an instruction and a counter corresponding to the instruction, wherein the execution module is further configured to: count, by using the counter, the number of executions of the instruction, When the number of executions is greater than the preset number of times, the execution of the instruction is stopped.
- the class file includes a plurality of the instructions, each of the instructions is provided with a corresponding weight; wherein, the value of the weight is larger, the instruction corresponding to the weight The fewer the preset times.
- the determining module is further configured to: look up a class file corresponding to the smart contract in a class file library based on the call request.
- the determining module is further configured to: obtain identifier information used to indicate the smart contract in the call request, and search for and in the class file library according to the identifier information.
- the class file corresponding to the smart contract is further configured to: obtain identifier information used to indicate the smart contract in the call request, and search for and in the class file library according to the identifier information.
- the apparatus for processing a smart contract in a multi-node system further includes: a generating module, configured to generate, according to the identifier information used to indicate the smart contract in the call request The class file of the call request.
- the execution module is further configured to: instantiate the class file, and determine a function and a parameter in an invocation request to invoke the smart contract; and based on the instantiated class The file and the function and parameters execute the smart contract invoked by the call request.
- the apparatus for processing a smart contract in a multi-node system further comprises: a first verification module configured to determine the smart contract based on a call request for a smart contract to be invoked Before the corresponding class file, it is determined that the calling request of the smart contract is legal.
- the first verification module is further configured to: determine a format of the call request, and determine that the call request is legal when all nodes consider that the format of the call request is legal.
- the apparatus for processing a smart contract in a multi-node system further includes: a deployment module configured to load the class file to be deployed by a class loader; and when determining the When non-deterministic classes and/or non-deterministic functions are not included in the class file, the class files are deployed to form a class file library.
- the deployment module is further configured to: when determining that the class file does not include a non-deterministic class and/or a non-deterministic function, set a corresponding to the instruction in the class file. a counter, wherein the counter is configured to count the number of executions of the instruction during execution of the smart contract.
- the deployment module is further configured to deploy the class file at a local node or in a storage device communicatively coupled to the local node to form a class file library.
- the apparatus for processing a smart contract in a multi-node system further includes: a second verification module, configured to determine the deployment before the deployment module deploys the class file The deployment request for the class file is legal.
- the second verification module is further configured to: determine a format of the deployment request, and determine that the call request is legal when all nodes consider that the format of the deployment request is legal.
- a method of deploying a smart contract in a multi-node system comprising: obtaining a deployment request including a smart contract class file, wherein the deployment request includes a class file, the class The file is pre-compiled based on program logic of the smart contract to be deployed; and when it is determined that the class file does not include a non-deterministic class and/or a non-deterministic function, the class file is deployed on the multi-node In the system.
- the process of deploying the class file further includes: setting and executing in the class file when determining that the class file does not include a non-deterministic class and/or a non-deterministic function; A corresponding counter, wherein the counter is configured to count the number of executions of the instruction during execution of the smart contract.
- the class file is deployed at a local node or in a storage device communicatively coupled to the local node to form a class file library.
- the method for deploying the smart contract in the multi-node system further comprises: determining that the deployment request for deploying the class file is legal.
- the determining that the deployment request of the class file is legally includes: agreeing on a format of the deployment request, and determining, when all nodes consider that the format of the deployment request is legal The call request is legal.
- an apparatus for deploying a smart contract in a multi-node system comprising: an acquisition module configured to obtain a deployment request, wherein the deployment request includes a class file, the class file Pre-compiled based on program logic of the smart contract to be deployed; and a deployment execution module configured to deploy the class file when it is determined that the class file does not include a non-deterministic class and/or a non-deterministic function In the multi-node system.
- the deployment execution module is further configured to: when determining that the class file does not include a non-deterministic class and/or a non-deterministic function, set a correspondence with the instruction in the class file. And a counter, wherein the counter is configured to count the number of executions of the instruction during execution of the smart contract.
- the deployment execution module is further configured to deploy the class file at a local node or in a storage device communicatively coupled to the local node to form a class file library.
- the third verification module is configured to determine that the deployment request for deploying the class file is legal before the class file is deployed.
- the third verification module is further configured to: determine a format of the deployment request, and determine that the call request is legal when all nodes consider that the format of the deployment request is legal.
- a computer apparatus comprising a memory, a processor, and a computer program stored on the memory for execution by the processor, wherein the processor executes the computer program
- a computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements a multi-node as described above
- the steps of a method of processing a smart contract in a system, or any of the methods described above for deploying a smart contract in a multi-node system are also provided.
- FIG. 1 is a schematic flowchart diagram of a method for processing a smart contract in a multi-node system according to an embodiment of the present invention.
- FIG. 2 is a schematic flowchart diagram of executing a smart contract to be invoked in a method for processing a smart contract in a multi-node system according to an embodiment of the present invention.
- FIG. 3 is a schematic flowchart diagram of a method for processing a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 4 is a schematic flowchart diagram of a method for processing a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 5 is a schematic flowchart diagram of a method for processing a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 6 is a flowchart of a method for calling a smart contract provided by an embodiment of the invention.
- FIG. 7 is a schematic structural diagram of an apparatus for processing a smart contract in a multi-node system according to an embodiment of the present invention.
- FIG. 8 is a schematic structural diagram of an apparatus for processing a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 9 is a schematic structural diagram of an apparatus for processing a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 10 is a schematic structural diagram of an apparatus for processing a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 11 is a schematic structural diagram of an apparatus for processing a smart contract in a multi-node system according to an embodiment of the present invention.
- FIG. 12 is a schematic flowchart diagram of a method for deploying a smart contract in a multi-node system according to an embodiment of the present invention.
- FIG. 13 is a schematic flowchart diagram of a method for deploying a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 14 is a schematic flowchart diagram of a method for deploying a smart contract in a multi-node system according to another embodiment of the present invention.
- FIG. 15a is a flowchart of a method for deploying a smart contract according to an embodiment of the present invention.
- FIG. 15b is a schematic structural diagram of a class file according to an embodiment of the present invention.
- FIG. 16 is a schematic structural diagram of an apparatus for deploying a smart contract in a multi-node system according to an embodiment of the present invention.
- FIG. 17 is a schematic structural diagram of an apparatus for deploying a smart contract in a multi-node system according to another embodiment of the present invention.
- the Java language is a high-level programming language.
- the class file is a compiled product of the Java source code and carries the specific program logic.
- the environment in which the Java program runs is called the Java Virtual Machine (JVM).
- the Java virtual machine provides a Class Loading mechanism, through which the Java runtime class files can be managed.
- the functional modules that implement this mechanism are called Class Loaders.
- a deterministic function means that the deterministic function always returns the same value each time a particular set of input values is used; correspondingly, if a different result is returned, the function is a non-deterministic function.
- FIG. 1 is a schematic flowchart diagram of a method for processing a smart contract in a multi-node system according to an embodiment of the present invention. As shown in FIG. 1, the method includes the following steps:
- Step 101 Determine a class file corresponding to the smart contract based on a call request for a smart contract to be invoked. This class of files is precompiled based on the program logic of the smart contract to be called.
- Step 102 Perform a smart contract to be invoked based on the class file.
- the specific execution process may include: first instantiating the class file, and determining functions and parameters in the calling request of the smart contract; then executing the smart contract invoked by the calling request based on the instantiated class file and the function and parameters .
- the embodiment of the present invention actually provides a smart contract execution system (execution engine) based on a Java virtual machine and a flow and an algorithm corresponding to the system.
- a smart contract execution system execution engine
- execution engine execution engine
- the blockchain platform of the execution system it is possible to support the development of smart contracts using the Java language.
- all languages also known as JVM languages
- JVM languages running on the Java virtual machine
- Scala Scala
- Groovy Jython
- the program logic of the smart contract is compiled into a class file based on the Java language
- the development of smart contracts based on the Java language eliminates the need to develop additional compilers and interpreters. Developers can use the Java language feature to develop and use blockchain technology, easy to access to meet engineering-level applications, easy to use, and suitable for marketing.
- the content of the class file actually includes the program logic content of the smart contract, so in the description of some embodiments later, there is no concept of the class file and the smart contract.
- the concept is strictly logically distinguished. For example, when a call, execution, and deployment of a smart contract is to be implemented, the call, execution, and deployment of the class file are actually performed.
- a class file can include instructions and counters corresponding to the instructions.
- FIG. 2 when executing the smart contract to be invoked, the following steps may be included:
- Step 1021 The counter is used to count the number of executions of the instruction.
- Step 1022 When the number of executions is greater than the preset number of times, the execution of the instruction is stopped.
- the class file corresponding to the smart contract to be invoked includes instruction 1 and instruction 2, the number of executions of instruction 1 is 1, and the number of executions of instruction 2 is 3. Assuming that instruction 2 is the instruction to be called, the instruction of instruction 2 is incremented once every time instruction 2 is executed. Thus, if the preset number of instructions 2 is set to 4, the file can be completely executed; otherwise, if the preset number of instructions 2 is set to 2, the file will not be fully executed or the prompt will be output. Wrong result.
- different "weights” can also be assigned to different instructions.
- the larger the value of the weight the less the preset number of instructions corresponding to the weight.
- the weight of the corresponding instruction By adjusting the weight of the corresponding instruction, the number of executions of the instruction can be defined accordingly. For example, by increasing the weight of instruction 2, the number of times instruction 2 is allowed to execute will be further reduced; likewise, by lowering the weight of instruction 2, the number of times instruction 2 is allowed to execute will be increased.
- the counters can be placed at different locations depending on the particular application.
- class files including non-deterministic classes and/or non-deterministic functions can be culled when the class files are pre-deployed in a multi-node system to ensure that deterministic calculations can be performed on class files that can be executed.
- the deployment process of the class file may include the following steps: loading the class file to be deployed by, for example, a class loader to determine whether the class file uses a non-deterministic function.
- the deployment of the smart contract is stopped, prompting the deployment to fail. If it is determined that the class file of the smart contract does not use an undetermined function, deploy the file.
- prompting for example, returning the result of the deployment failure to the user, thereby informing (for example, via the user-visible interface) the submitted Smart contracts cannot be deployed into the blockchain.
- the non-determination when considering the deterministic calculation requirement of the smart contract and satisfying the finite calculation requirement, when the class file is deployed, the non-determination may not be included in the determining class file.
- a counter corresponding to the instruction is set in the class file.
- the class file of the smart contract can be processed by a class loader and a bytecode enhancer, wherein the class loader is used to determine whether the loaded class file contains a non-deterministic function, and rejects based on the capability.
- the bytecode enhancer is used to parse and modify the class file, and counts each called instruction in the class file during the execution of the class file.
- the compiled smart contract After the compiled smart contract is compiled, it will be spread in a multi-node system (for example, a blockchain) through P2P or other transmission methods, and each node will receive the class file of the smart contract.
- the nodes in the blockchain (for example, the verification node) will agree on the received class file according to the specified rules, or save the received contract to the memory first, waiting for a new round of consensus time, triggering the share. Consensus and handling of contracts.
- the consensus in the present invention can be directed to one or more class files.
- the node that receives the deployment request may perform a validity check on the deployment request to determine a legitimate deployment request.
- the legality check is a formal check on the deployment request, that is, the above node will detect the format or other parameters of the deployment request, and then determine whether the deployment request is a legitimate deployment request, for example, determining the request. Whether the format applies to the current blockchain. It can be understood that the validity test of other judgment rules also applies.
- the above-described legality check can be performed by a consensus mechanism.
- the format of the deployment request may be agreed upon. When all nodes consider that the format of the deployment request is legal, it is determined that the calling request is legal.
- the PoW, the PoS, the PBFT, or other consensus algorithm is used to ensure that the node that receives the deployment request checks the validity of the deployment request to determine whether the deployment request is a legitimate deployment request for the current blockchain. Consensus-based results will result in different operations.
- the deployment of the smart contract is ended; if the result of the consensus indicates that the deployment request is a legitimate deployment
- the request (such as, but not limited to, the format of the deployment request conforms to the format requirements of the blockchain for the deployment request), then performs subsequent class file deployment operations.
- a class file is pre-deployed into a class file library (for example, deployed to a local node or deployed in a storage device communicatively connected to a local node), based on The calling request finds a class file corresponding to the smart contract to be called in the class file library (step 101'), and executes the smart contract based on the found class file.
- a class file library for example, deployed to a local node or deployed in a storage device communicatively connected to a local node
- the calling request finds a class file corresponding to the smart contract to be called in the class file library (step 101'), and executes the smart contract based on the found class file.
- the identification information in the call request may be acquired first (step 401), and then according to the The identification information looks up the class file corresponding to the smart contract to be called in the class file library (step 402). If the class file pointed to by the identification information is not found in the class file library, the call is stopped and the call fails (step 403). If the class file indicated by the identification information can be found in the class file library, the subsequent smart contract execution operation is performed.
- the class file corresponding to the smart contract to be invoked may also be deployed when the call request is received.
- the calling request of the smart contract may include some programs.
- the logical content at this time, needs to generate a class file that satisfies the call request according to the identification information in the call request.
- the node that receives the call request will perform a validity check on the call request.
- the node will detect the format of the call request or other parameters to determine whether the call request is a valid call request. For example, determine if the format of the request applies to the current blockchain.
- the validity check of the above-mentioned call request to the smart contract can also be performed by a consensus mechanism. Consensus on the format of the call request. When all nodes consider the format of the call request to be legal, it is determined that the call request is legal. For example, a PoW, PoS, PBFT, or other consensus algorithm may be used to allow a plurality of nodes that receive the call request to perform a validity check on the call request, thereby determining whether the call request is a valid call for the current blockchain. request. Based on the judgment result of the legality test, a corresponding operation will be generated. Specifically, if the call request is not a valid call request, the call to the smart contract is ended.
- the result of the failed call is returned to the user, so that the user's visual interface is notified that the smart contract to be called is missing or cannot be called.
- the call request is a legitimate call request (such as, but not limited to, the format of the call request conforms to the format requirement of the blockchain for the call request), then the execution of the subsequent smart contract is performed.
- FIG. 6 is a flowchart of a method for calling a smart contract provided by an embodiment of the invention. As shown in FIG. 6, the method includes the following steps:
- Step S601 Acquire a call request of the smart contract.
- multiple nodes in the blockchain will receive a call request for the smart contract.
- the call request has a particular format. It can be understood that the call request can be received by a certain node first, and then sent to multiple nodes in the blockchain by the node in a P2P manner.
- Step S602 determining whether the calling request has legality.
- the node that received the call request will perform a validity check on the call request.
- the node will detect the format or other parameters of the call request, and then determine whether the call request is a valid call request. For example, determine if the format of the request applies to the current blockchain.
- Step S602 can be performed by a consensus mechanism.
- a consensus mechanism For example, a PoW, PoS, PBFT, or other consensus algorithm may be used to allow a plurality of nodes that receive the call request to perform a validity check on the call request, thereby determining whether the call request is a valid call for the current blockchain. request.
- a corresponding operation will be generated. Specifically, if the call request is not a valid call request, the call of the smart contract is ended, and the operation of step S609 is performed to prompt the smart contract call to fail. For example, the result of the failed call is returned to the user, so that the user's visual interface is notified that the smart contract to be called is missing or cannot be called. If the call request is a legitimate call request (such as, but not limited to, the format of the call request conforms to the format requirement of the blockchain for the call request), the operation in step S603 is performed.
- a legitimate call request such as, but not limited to, the format of the call request conforms to the format requirement of the blockchain for the call request
- Step S603 Determine identification information of the smart contract corresponding to the calling request.
- the call request has a specific format, and also includes identification information of the smart contract to be called and corresponding functions and parameters.
- the legal call request is analyzed to determine the identification information contained in the legitimate call request for indicating the smart contract. It can be understood that in this step, the functions and parameters included in the call request can also be determined.
- Step S604 It is judged whether there is a class file corresponding to the smart contract of the calling request.
- a lookup is performed in the class file library (ie, the set of smart contracts that have been deployed) based on the identification information in the call request, and the corresponding operation is determined based on the result of the lookup. If the class file pointed to by the identification information is not found in the class file library, the call is stopped and the call is failed (step S609). If the class file indicated by the identification information can be found in the class file library, follow-up operations are performed.
- the corresponding class file may also be generated according to the call request.
- a class file that satisfies the call request will be generated by, for example, the deployment method shown in FIG. 1 or a part of the deployment method.
- Step S605 Instantiate the smart contract.
- step S204 the instantiation of the smart contract will be based on the class file found in step S204.
- Step S606 Determine the function and parameters in the call request.
- the function and parameters in the call request are determined by analyzing the call request. It can be understood that the function and the parameters in the call request can also be determined based on the result of step S603.
- Step S607 Execute the smart contract.
- the smart contract will be invoked in conjunction with the results of the operations of steps S605 and S606. Specifically, the smart contract corresponding to the legitimate call request is executed based on the instantiated class file and the function and parameters in the legal call request, and the result of the smart contract is output (step S608).
- step S605 the instantiating the smart contract may be executed first (step S605), and then the function and the parameter in the invoking request are executed (step S606); or step S606 may be performed first, and then step S605 is performed.
- FIG. 7 is a schematic structural diagram of an apparatus for processing a smart contract in a multi-node system according to an embodiment of the present invention.
- the apparatus includes: a determining module 701 configured to determine a class file corresponding to the smart contract based on a call request for the smart contract to be invoked; and an execution module 702 configured to execute the to-be-called based on the class file Smart contract; where the class file is precompiled based on the program logic of the smart contract to be invoked.
- the class file includes an instruction and a counter corresponding to the instruction; wherein the execution module 702 is further configured to: count the number of executions of the instruction by using a counter, and stop executing when the number of executions is greater than a preset number of times instruction.
- the class file includes a plurality of instructions, each of which is set with a corresponding weight; wherein, the greater the value of the weight, the less the preset number of instructions corresponding to the weight.
- the determining module 701 is further configured to: find a class file corresponding to the smart contract in the class file library based on the calling request.
- the determining module 701 is further configured to: obtain identifier information used to indicate the smart contract in the call request; and find a class file corresponding to the smart contract in the class file library according to the identifier information.
- the apparatus for processing a smart contract in a multi-node system further includes: a generating module 703 configured to: according to the identification information used to indicate the smart contract in the call request Generate a class file that satisfies the call request.
- the execution module 702 is further configured to: instantiate the class file and determine functions and parameters in the call request to invoke the smart contract; and execute based on the instantiated class file and functions and parameters Call the smart contract called by the request.
- the apparatus for processing a smart contract in a multi-node system further includes: a first verification module 704 configured to be based on a call for a smart contract to be invoked Before requesting to determine the class file corresponding to the smart contract, it is determined that the call request to invoke the smart contract is legal.
- the first verification module 704 is further configured to: agree on the format of the call request, and determine that the call request is legal when all the nodes consider that the format of the call request is legal.
- the apparatus for processing a smart contract in a multi-node system further includes: a deployment module 705 configured to load a class file to be deployed by using a class loader; When it is determined that the non-deterministic class and/or non-deterministic function is not included in the class file, the class file is deployed to form a class file library.
- the deployment module 705 is further configured to: when the non-deterministic class and/or the non-deterministic function is not included in the class file, set a counter corresponding to the instruction in the class file, where the counter Used to count the number of executions of an instruction during the execution of a smart contract.
- the deployment module 705 is further configured to deploy a class file at a local node or in a storage device communicatively coupled to the local node to form a class file library.
- the apparatus for processing a smart contract in a multi-node system further includes: a second verification module 706 configured to determine a deployment before deploying the module deployment class file The deployment request for the class file is legal.
- the second verification module 706 is further configured to: establish a consensus on the format of the deployment request, and determine that the call request is legal when all the nodes consider that the format of the deployment request is legal.
- each of the modules described in the apparatus for processing a smart contract in a multi-node system provided by the above embodiment is compatible with one of the aforementioned methods for processing a smart contract in a multi-node system.
- the method steps correspond.
- the operations and features described in the foregoing method steps are equally applicable to the device and the corresponding modules included therein, and the repeated content is not described herein again.
- FIG. 11 is a schematic structural diagram of an apparatus for processing a smart contract in a multi-node system according to an embodiment of the present invention.
- the processing apparatus 300 includes an invocation request receiving unit 301, an invocation request analyzing unit 302, a class file selecting unit 303, and an executing unit 304.
- the call request receiving unit 301 is configured to be configured to receive a call request for a smart contract and perform a validity check on the call request to determine a legitimate call request.
- the call request analysis unit 302 is in communication connection with the call request receiving unit 301, and is configured to analyze the legal call request to obtain identification information for indicating the corresponding smart contract in the legal call request.
- the class file selection unit 303 is configured to determine a class file of the smart contract corresponding to the legitimate call request based on the identification information. Based on the identification information, the class file selection unit 303 compares the identification information with the identification information of each class file in the class file library, thereby selecting a class file corresponding to the legal call request.
- the execution unit 304 is configured to execute the corresponding smart contract based on the class file and the call request determined by the class file selection unit 303. Specifically, the execution unit 304 instantiates the class file and, in conjunction with the functions and parameters in the call request, implements the smart contract corresponding to the legal call request.
- FIG. 12 is a schematic flowchart diagram of a method for deploying a smart contract in a multi-node system according to an embodiment of the present invention. As shown in FIG. 12, the method includes the following steps:
- Step 1201 Acquire a deployment request, where the deployment request includes a class file, which is pre-compiled based on program logic of the smart contract to be deployed.
- Step 1202 The class file is deployed in the multi-node system when it is determined that the non-deterministic class and/or the non-deterministic function is not included in the class file. For example, it is deployed at a local node or deployed in a storage device that is in communication with a local node to form a class file library.
- any of the classes in the class file generate a call to a non-deterministic function
- the deployment of the smart contract is stopped, prompting the deployment to fail. If it is determined that the class file of the smart contract does not use a non-deterministic function, then deploy the file.
- prompting for example, returning the result of the deployment failure to the user, thereby informing (for example, via the user-visible interface) the submitted Smart contracts cannot be deployed into the blockchain.
- this type of file deployment method can eliminate class files including non-deterministic classes and/or non-deterministic functions when pre-deploying class files in a multi-node system to ensure that class files can be executed.
- Deterministic calculations can be implemented to meet the following requirements when combining blockchain techniques to implement smart contracts: on different nodes, the same input can get the same output at different times.
- the method for deploying the smart contract in the multi-node system may be The method further includes: when determining that the non-deterministic class and/or the non-deterministic function is not included in the class file, setting a counter corresponding to the instruction in the class file, wherein the counter is used for the instruction in the process of executing the smart contract The number of executions is counted (step 1301).
- the class file of the smart contract can be processed by a class loader and a bytecode enhancer, wherein the class loader is used to determine whether the loaded class file contains a non-deterministic function, and rejects based on the capability.
- the bytecode enhancer is used to parse and modify the class file, and counts each called instruction in the class file during the execution of the class file.
- the compiled smart contract After the compiled smart contract is compiled, it will be spread in a multi-node system (for example, a blockchain) through P2P or other transmission methods, and each node will receive the class file of the smart contract.
- the nodes in the blockchain (for example, the verification node) will agree on the received class file according to the specified rules, or save the received contract to the memory first, waiting for a new round of consensus time, triggering the share. Consensus and handling of contracts.
- the consensus in the present invention can be directed to one or more class files.
- the node that receives the deployment request may perform a validity check on the deployment request to determine a legitimate deployment request.
- the legality check is a formal check on the deployment request, that is, the above node will detect the format or other parameters of the deployment request, and then determine whether the deployment request is a legitimate deployment request, for example, determining the request. Whether the format applies to the current blockchain. It can be understood that the validity test of other judgment rules also applies.
- the above-described legality check can be performed by a consensus mechanism.
- the format of the deployment request may be agreed upon. When all nodes consider that the format of the deployment request is legal, it is determined that the calling request is legal.
- the PoW, the PoS, the PBFT, or other consensus algorithm is used to ensure that the node that receives the deployment request checks the validity of the deployment request to determine whether the deployment request is a legitimate deployment request for the current blockchain. Consensus-based results will result in different operations.
- the deployment of the smart contract is ended; if the result of the consensus indicates that the deployment request is a legitimate deployment
- the request (such as, but not limited to, the format of the deployment request conforms to the format requirements of the blockchain for the deployment request), then performs subsequent class file deployment operations.
- FIG. 15a is a flowchart of a method for deploying a smart contract according to an embodiment of the present invention. As shown in FIG. 15, the deployment method of the smart contract includes the following steps:
- Step S1501 Acquire a deployment request of the smart contract.
- the deployment request has a specific format and includes the class file of the smart contract (ie, the class file to be deployed). It can be understood that the deployment request can be received by a certain node first, and then sent by the node to multiple nodes in the blockchain in a P2P manner.
- step S1502 it is determined whether the deployment request has legality.
- the node that receives the deployment request will perform a validity check on the deployment request to determine a legitimate deployment request.
- the validity check is a formal check on the deployment request, that is, the node detects the format or other parameters of the deployment request, and then determines whether the deployment request is a legitimate deployment request. For example, determine if the format of the request applies to the current blockchain. It can be understood that the validity test of other judgment rules also applies.
- step S1502 can be performed by a consensus mechanism. Specifically, the PoW, the PoS, the PBFT, or other consensus algorithm is used to enable the node that receives the deployment request to check the validity of the deployment request, and determine whether the deployment request is legal for the current blockchain. request.
- the PoW the PoW
- the PoS the PoS
- the PBFT or other consensus algorithm is used to enable the node that receives the deployment request to check the validity of the deployment request, and determine whether the deployment request is legal for the current blockchain. request.
- step S1503 Based on the result of the consensus in step S1502, different operations will be generated. Specifically, if the result of the consensus indicates that the deployment request is not a legitimate deployment request (for example, the format of the deployment request does not meet the requirements), the deployment of the smart contract is ended; if the result of the consensus indicates that the deployment request is a legitimate deployment The request (such as, but not limited to, the format of the deployment request conforms to the format requirement of the blockchain for the deployment request), then the operation in step S1503 is performed.
- Step S1503 Determine whether the deployment request has non-determinism.
- the deployment request has a specific format and includes a class file to be deployed. Therefore, for example, the class loader can be used to determine whether the class file to be deployed uses a non-deterministic function. If any class in the class file generates a call to the non-deterministic function, the deployment of the smart contract is stopped. , in turn, prompting the deployment to fail (step S1507). If the class loader discriminates that the class file of the smart contract does not use a non-deterministic function (ie, the non-deterministic class is not included in the class file), the operation in step S1504 is performed.
- the class loader discriminates that the class file of the smart contract does not use a non-deterministic function (ie, the non-deterministic class is not included in the class file).
- the operation in step S1504 is performed.
- Step S1504 Add a counter.
- the counter will be set after the specified instruction, so that the counting of the called instruction can be realized.
- the execution of the class file after the counter is added will be described below with reference to FIG. 15b.
- the class file 400 will execute the instruction 1 number 1 and the execution instruction 2 number 3 during execution. As described above, assuming that instruction 2 is the specified instruction, the counter is incremented once each time instruction 2 is executed. Thus, if the threshold for the number of executions of the instruction 2 is set to be greater than or equal to 4, the class file 400 can be completely executed; conversely, if the threshold for the number of executions of the instruction 2 is set to 2, the class file 400 cannot be completely executed. Or output a result that prompts an error.
- different "weights" can also be assigned to different instructions. Still taking the instruction shown in FIG. 14b as an example, by adjusting the weight of the corresponding instruction, the number of executions of the instruction can be specified accordingly. For example, by increasing the weight of instruction 2, the number of times instruction 2 is allowed to execute will be further reduced; likewise, by lowering the weight of instruction 2, the number of times instruction 2 is allowed to execute will be increased.
- the counters can be placed at different locations depending on the particular application.
- Step 1505 Store the modified class file.
- the unmodified class file to be deployed does not contain a counter.
- the class file is modified by a bytecode enhancement technique to add a counter after the specified instruction.
- the modified class file to be deployed will be stored in a specified location (for example, stored at a node of the blockchain or stored in a storage device connected to the node), thereby implementing the class file to be deployed to the class.
- the file library complete the construction of the class file library.
- step S1506 the deployment is successful.
- the successful result of the deployment is returned to the user, so that the user's visual interface is informed that the submitted smart contract has been deployed to the blockchain.
- the deployment of the class files of the smart contract is realized, and the class files in the blockchain are both deterministic and limited, thereby improving the stability of the network.
- the class file to be deployed is filtered based on whether the class file includes a non-deterministic class and/or a non-deterministic function or a non-deterministic class, so that the filtered and retained class files are all deterministic.
- the instruction since the counter is set after the specified instruction of the modified class file, when a threshold is set for the number of calls of the instruction, the instruction can be limited by comparing the output value of the counter with the threshold of the number of calls. The number of calls, which in turn makes the class file have limited computational features when called.
- FIG. 16 is a schematic structural diagram of an apparatus for deploying a smart contract in a multi-node system according to an embodiment of the present invention. As shown in Figure 16, the device includes:
- the obtaining module 1601 is configured to obtain a deployment request, where the deployment request includes a class file, which is pre-compiled based on program logic of the smart contract to be deployed;
- the deployment execution module 1602 is configured to deploy the class files in the multi-node system when it is determined that the non-deterministic class and/or the non-deterministic function is not included in the class file.
- the deployment execution module 1602 is further configured to: when the non-deterministic class and/or the non-deterministic function is not included in the class file, set a counter corresponding to the instruction in the class file, where The counter is used to count the number of executions of the instruction during the execution of the smart contract.
- the deployment execution module 1602 is further configured to deploy a class file at a local node or in a storage device communicatively coupled to the local node to form a class file library.
- the apparatus for deploying a smart contract in a multi-node system further includes: a third verification module 1603 configured to determine deployment of the deployment class file before deploying the class file The request is legal.
- the third verification module 1603 is further configured to: implement a consensus on the format of the deployment request, and determine that the call request is legal when all the nodes consider that the format of the deployment request is legal.
- each of the modules described in the apparatus for deploying smart contracts in a multi-node system is compatible with one of the aforementioned methods for deploying smart contracts in a multi-node system.
- the method steps correspond.
- the operations and features described in the foregoing method steps are equally applicable to the device and the corresponding modules included therein, and the repeated content is not described herein again.
- any of the preceding methods may also be implemented as machine readable instructions comprising a program executed by a processor.
- the program can be embodied in software stored on a tangible computer readable medium such as a CD-ROM, floppy disk, hard disk, digital versatile disk (DVD), Blu-ray disk or other form of memory.
- some or all of the steps of any of the prior methods may utilize any of an application specific integrated circuit (ASIC), a programmable logic device (PLD), a field programmable logic device (EPLD), discrete logic, hardware, firmware, and the like.
- ASIC application specific integrated circuit
- PLD programmable logic device
- EPLD field programmable logic device
- the encoding of instructions can be utilized to implement a process of any of the preceding methods, which is stored on a tangible computer readable medium, such as a hard disk, a flash memory, a read only memory (ROM), a compact disk. (CD), digital versatile disc (DVD), cache, random access memory (RAM), and/or any other storage medium on which information can be stored for any time (eg, long, permanent, transient) Situation, temporary buffering, and/or caching of information).
- a tangible computer readable medium such as a hard disk, a flash memory, a read only memory (ROM), a compact disk. (CD), digital versatile disc (DVD), cache, random access memory (RAM), and/or any other storage medium on which information can be stored for any time (eg, long, permanent, transient) Situation, temporary buffering, and/or caching of information).
- a tangible computer readable medium such as a hard disk, a flash memory, a read only memory (ROM), a compact disk. (CD), digital versatile disc (DVD
- an example process such as the previous method may be implemented with encoded instructions (such as computer readable instructions) stored on a non-transitory computer readable medium, such as a hard disk, flash memory, read only memory, optical disk , a digital versatile disc, a cache, a random access memory, and/or any other storage medium in which information can be stored at any time (eg, for a long time, permanently, transiently, temporarily buffered, and/or informational) Cache).
- a non-transitory computer readable medium such as a hard disk, flash memory, read only memory, optical disk , a digital versatile disc, a cache, a random access memory, and/or any other storage medium in which information can be stored at any time (eg, for a long time, permanently, transiently, temporarily buffered, and/or informational) Cache).
- the invention supports the development of intelligent contracts in the Java language, and has the characteristics of deterministic calculation and limited calculation. It does not need to additionally develop a compiler and an interpreter, and basically retains all the functions of the Java language, and is easy to access and use.
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Accounting & Taxation (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Strategic Management (AREA)
- Economics (AREA)
- General Business, Economics & Management (AREA)
- General Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Finance (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Human Resources & Organizations (AREA)
- Entrepreneurship & Innovation (AREA)
- Data Mining & Analysis (AREA)
- Marketing (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- Stored Programmes (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Description
Claims (39)
- 一种用于在多节点系统中对智能合约进行处理的方法,其特征在于,包括:基于针对待调用的智能合约的调用请求确定所述智能合约所对应的类文件;以及基于所述类文件执行所述智能合约;其中,所述类文件基于所述智能合约的程序逻辑预先编译而成。
- 根据权利要求1所述的方法,其特征在于,所述类文件包括指令和与所述指令相对应的计数器;其中,所述基于所述类文件执行所述智能合约包括:利用所述计数器对所述指令的执行次数进行计数,当所述执行次数大于预设次数时,停止执行所述指令。
- 根据权利要求1或2所述的方法,其特征在于,所述类文件包括多个所述指令,每个所述指令设置有对应的权重;其中,所述权重的值越大,与所述权重对应的所述指令的所述预设次数越少。
- 根据权利要求1至3中任一所述的方法,其特征在于,所述基于针对待调用的智能合约的调用请求确定所述智能合约所对应的类文件包括:基于所述调用请求在类文件库中查找与所述智能合约所对应的类文件。
- 根据权利要求4所述的方法,其特征在于,所述基于所述调用请求在类文件库中查找与待调用的所述智能合约所对应的类文件,包括:获取所述调用请求中用于指示所述智能合约的标识信息;以及根据所述标识信息在所述类文件库中查找与所述智能合约所对应的类文件。
- 根据权利要求1至3中任一所述的方法,其特征在于,所述基于针对待调用的智能合约的调用请求确定所述待调用的智能合约所对应的类文件包括:根据所述调用请求中用于指示所述智能合约的标识信息生成满足所述调用请求的所述类文件。
- 如权利要求1至6中任一所述的方法,其特征在于,所述基于所述类文件执行所述智能合约包括:对所述类文件进行实例化,并且确定所述调用请求中的函数和参数;以及基于经实例化的所述类文件以及所述函数和参数来执行所述智能合约。
- 如权利要求1至7中任一所述的方法,其特征在于,在基于针对待调用的智能合约的调用请求确定所述智能合约所对应的类文件之前,进一步包括:确定所述调用请求合法。
- 如权利要求8所述的方法,其特征在于,所述确定所述调用请求合法包括:对所述调用请求的格式进行共识,当所有节点都认为所述调用请求的格式为合法时,确定所述调用请求合法。
- 根据权利要求1至9中任一所述的方法,其特征在于,所述类文件预先部署在所述多节点系统中,其中,所述类文件的部署过程包括:通过类加载器加载待部署的所述类文件;以及当确定所述类文件中并未包括非确定性类和/或非确定性函数时,部署所述类文件以形成类文件库。
- 根据权利要求10所述的方法,其特征在于,所述类文件的部署过程进一步包括:当确定所述类文件中并未包括非确定性类和/或非确定性函数时,在所述类文件中设置与指令对应的计数器,其中,所述计数器用于在所述智能合约执行的过程中对所述指令的执行次数计数。
- 根据权利要求10至11中任一所述的方法,其特征在于,在部署所述类文件之前,进一步包括:确定部署所述类文件的部署请求合法。
- 根据权利要求12所述的方法,其特征在于,所述确定部署所述类文件的部署请求合法包括:对所述部署请求的格式进行共识,当所有节点都认为所述部署请求的格式为合法时,确定所述调用请求合法。
- 一种用于在多节点系统中对智能合约进行处理的装置,其特征在于,包括:确定模块,配置为基于针对待调用的智能合约的调用请求确定所述智能合约所对应的类文件;以及执行模块,配置为基于所述类文件执行所述待调用的智能合约;其中,所述类文件基于所述待调用的智能合约的程序逻辑预先编译而成。
- 根据权利要求14所述的装置,其特征在于,所述类文件包括指令和与所述指令相对应的计数器;其中,所述执行模块进一步配置为:利用所述计数器对所述指令的执行次数进行计数,当所述执行次数大于预设次数时,停止执行所述指令。
- 根据权利要求15所述的装置,其特征在于,所述类文件包括多个所述指令,每个所述指令设置有对应的权重;其中,所述权重的值越大,与所述权重对应的所述指令的所述预设次数越少。
- 根据权利要求14至16中任一所述的装置,其特征在于,所述确定模块进一步配置为:基于所述调用请求在类文件库中查找与所述智能合约所对应的类文件。
- 根据权利要求17所述的装置,其特征在于,所述确定模块进一步配置为:获取所述调用请求中用于指示所述智能合约的标识信息;以及根据所述标识信息在所述类文件库中查找与所述智能合约所对应的类文件。
- 根据权利要求14至18中任一所述的装置,其特征在于,进一步包括:生成模块,配置为根据所述调用请求中用于指示所述智能合约的标识信息生成满足所述调用请求的所述类文件。
- 如权利要求14至19中任一所述的装置,其特征在于,所述执行模块进一步配置为:对所述类文件进行实例化,并且确定调用所述智能合约的调用请求中的函数和参数;以及基于经实例化的所述类文件以及所述函数和参数来执行所述调用请求所调用的所述智能合约。
- 如权利要求14至20中任一所述的装置,其特征在于,进一步包括:第一验证模块,配置为在基于针对待调用的智能合约的调用请求确定所述智能合约所对应的类文件之前,确定调用所述智能合约的调用请求合法。
- 如权利要求21所述的装置,其特征在于,所述第一验证模块进一步配置为:对所述调用请求的格式进行共识,当所有节点都认为所述调用请求的格式为合法时,确定所述调用请求合法。
- 根据权利要求14至22中任一所述的装置,其特征在于,进一步包括:部署模块,配置为通过类加载器加载待部署的所述类文件;以及当确定所述类文件中并未包括非确定性类和/或非确定性函数时,部署所述类文件以形成类文件库。
- 根据权利要求23所述的装置,其特征在于,所述部署模块进一步配置为:当确定所述类文件中并未包括非确定性类和/或非确定性函数时,在所述类文件中设置与指令对应的计数器,其中,所述计数器用于在所述智能合约执行的过程中对所述指令的执行次数计数。
- 根据权利要求23或24所述的装置,其特征在于,所述部署模块进一步配置为:在本地节点处或在与所述本地节点通信连接的存储设备中部署所述类文件,以形成类文件库。
- 根据权利要求23至25中任一所述的装置,其特征在于,进一步包括:第二验证模块,配置为在所述部署模块部署所述类文件之前,确定部署所述类文件的部署请求合法。
- 根据权利要求26所述的装置,其特征在于,所述第二验证模块进一步配置为:对所述部署请求的格式进行共识,当所有节点都认为所述部署请求的格式为合法时,确定所述调用 请求合法。
- 一种在多节点系统中对智能合约进行部署的方法,其特征在于,包括:获取部署请求,其中,所述部署请求包括类文件,所述类文件基于待部署的智能合约的程序逻辑预先编译而成;以及当确定所述类文件中并未包括非确定性类和/或非确定性函数时,将所述类文件部署在所述多节点系统中。
- 根据权利要求28所述的方法,其特征在于,所述类文件的部署过程进一步包括:当确定所述类文件中并未包括非确定性类和/或非确定性函数时,在所述类文件中设置与指令对应的计数器,其中,所述计数器用于在所述智能合约执行的过程中对所述指令的执行次数计数。
- 根据权利要求28或29所述的方法,其特征在于,所述类文件部署在本地节点处或部署在与所述本地节点通信连接的存储设备中,以形成类文件库。
- 根据权利要求28至30中任一所述的方法,其特征在于,在部署所述类文件之前,进一步包括:确定部署所述类文件的部署请求合法。
- 根据权利要求31所述的方法,其特征在于,所述确定部署所述类文件的部署请求合法包括:对所述部署请求的格式进行共识,当所有节点都认为所述部署请求的格式为合法时,确定所述调用请求合法。
- 一种在多节点系统中对智能合约进行部署的装置,其特征在于,包括:获取模块,配置为获取部署请求,其中,所述部署请求包括类文件,所述类文件基于待部署的智能合约的程序逻辑预先编译而成;以及部署执行模块,配置为当确定所述类文件中并未包括非确定性类和/或非确定性函数时,将所述类文件部署在所述多节点系统中。
- 根据权利要求33所述的装置,其特征在于,所述部署执行模块进一步配置为:当确定所述类文件中并未包括非确定性类和/或非确定性函数时,在所述类文件中设置与指令对应的计数器,其中,所述计数器用于在所述智能合约执行的过程中对所述指令的执行次数计数。
- 根据权利要求33或34所述的装置,其特征在于,所述部署执行模块进一步配置为:在本地节点处或在与所述本地节点通信连接的存储设备中部署所述类文件,以形成类文件库。
- 根据权利要求33至35中任一所述的装置,其特征在于,第三验证模块,配置为在部署所述类文件之前,确定部署所述类文件的部署请求合法。
- 根据权利要求36所述的装置,其特征在于,所述第三验证模块进一步配置为:对所述部署请求的格式进行共识,当所有节点都认为所述部署请求的格式为合法时,确定所述调用请求合法。
- 一种计算机设备,包括存储器、处理器以及存储在所述存储器上被所述处理器执行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至13以及28至32中任一项所述方法的步骤。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至13以及28至32中任一项所述方法的步骤。
Priority Applications (5)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020197019035A KR20190107664A (ko) | 2017-07-31 | 2018-07-16 | 스마트 계약 처리 방법 및 장치 |
SG11201907111QA SG11201907111QA (en) | 2017-07-31 | 2018-07-16 | Method and device for processing smart contracts |
JP2019524456A JP2019536153A (ja) | 2017-07-31 | 2018-07-16 | スマート・コントラクト処理方法及び装置 |
AU2018310287A AU2018310287A1 (en) | 2017-07-31 | 2018-07-16 | Smart contract processing method and apparatus |
US16/460,202 US20190324772A1 (en) | 2017-07-31 | 2019-07-02 | Method and device for processing smart contracts |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710638423.X | 2017-07-31 | ||
CN201710638423.XA CN107392619B (zh) | 2017-07-31 | 2017-07-31 | 智能合约处理方法及装置 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US16/460,202 Continuation US20190324772A1 (en) | 2017-07-31 | 2019-07-02 | Method and device for processing smart contracts |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019024674A1 true WO2019024674A1 (zh) | 2019-02-07 |
Family
ID=60342494
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/095784 WO2019024674A1 (zh) | 2017-07-31 | 2018-07-16 | 智能合约处理方法及装置 |
Country Status (8)
Country | Link |
---|---|
US (1) | US20190324772A1 (zh) |
JP (1) | JP2019536153A (zh) |
KR (1) | KR20190107664A (zh) |
CN (1) | CN107392619B (zh) |
AU (1) | AU2018310287A1 (zh) |
SG (1) | SG11201907111QA (zh) |
TW (1) | TW201911032A (zh) |
WO (1) | WO2019024674A1 (zh) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112636981A (zh) * | 2020-12-28 | 2021-04-09 | 杭州趣链科技有限公司 | 区块链主机及其代理方法、装置及存储介质 |
US20210191702A1 (en) * | 2018-10-12 | 2021-06-24 | Alibaba Group Holding Limited | Blockchain Node Service Deployment Method, Apparatus and System, and Computing Device and Medium |
CN113342429A (zh) * | 2021-06-09 | 2021-09-03 | 网易(杭州)网络有限公司 | 智能合约数据处理方法、装置、计算机设备及存储介质 |
CN113805889A (zh) * | 2021-08-27 | 2021-12-17 | 成都质数斯达克科技有限公司 | 一种智能合约调用执行方法、装置、设备及可读存储介质 |
JP2022541929A (ja) * | 2019-09-24 | 2022-09-28 | 京▲東▼科技信息技▲術▼有限公司 | スマートコントラクトを発行するための方法及び装置 |
Families Citing this family (33)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9918605B2 (en) | 2015-04-09 | 2018-03-20 | Irobot Corporation | Wall following robot |
CN107392619B (zh) * | 2017-07-31 | 2020-12-29 | 众安信息技术服务有限公司 | 智能合约处理方法及装置 |
CN108776936A (zh) * | 2018-06-05 | 2018-11-09 | 中国平安人寿保险股份有限公司 | 保险理赔方法、装置、计算机设备和存储介质 |
CN109146679B (zh) | 2018-06-29 | 2023-11-10 | 创新先进技术有限公司 | 基于区块链的智能合约调用方法及装置、电子设备 |
CN108916604B (zh) * | 2018-07-04 | 2020-07-03 | 临沂大学 | 一种便于维护的智能合约转换器 |
US11842322B2 (en) * | 2018-08-22 | 2023-12-12 | Equinix, Inc. | Smart contract interpreter |
CN109067759B (zh) * | 2018-08-27 | 2020-11-03 | 深圳前海益链网络科技有限公司 | 一种智能合约调用单点执行系统 |
CN109376541A (zh) * | 2018-09-21 | 2019-02-22 | 上海点融信息科技有限责任公司 | 用于运行智能合约的方法、装置以及计算机存储介质 |
CN109933404B (zh) * | 2018-12-12 | 2020-05-12 | 阿里巴巴集团控股有限公司 | 一种基于区块链智能合约的编解码方法及系统 |
US10733152B2 (en) | 2018-12-29 | 2020-08-04 | Alibaba Group Holding Limited | System and method for implementing native contract on blockchain |
KR102237015B1 (ko) * | 2018-12-29 | 2021-04-07 | 어드밴스드 뉴 테크놀로지스 씨오., 엘티디. | 블록체인 상의 네이티브 계약을 구현하기 위한 시스템 및 방법 |
CN109710385A (zh) * | 2018-12-29 | 2019-05-03 | 杭州趣链科技有限公司 | 一种基于Java虚拟机的智能合约复杂度限制方法 |
SG11201908890XA (en) * | 2019-03-26 | 2019-10-30 | Alibaba Group Holding Ltd | System and method for implementing different types of blockchain contracts |
CN110188097A (zh) * | 2019-04-19 | 2019-08-30 | 阿里巴巴集团控股有限公司 | 区块链中智能合约的存储、执行方法及装置和电子设备 |
CN110119428B (zh) * | 2019-04-19 | 2023-05-12 | 腾讯科技(深圳)有限公司 | 一种区块链信息管理方法、装置、设备及存储介质 |
WO2019170175A2 (en) * | 2019-06-28 | 2019-09-12 | Alibaba Group Holding Limited | System and method for executing different types of blockchain contracts |
US10783082B2 (en) * | 2019-08-30 | 2020-09-22 | Alibaba Group Holding Limited | Deploying a smart contract |
CN110675256B (zh) * | 2019-08-30 | 2020-08-21 | 阿里巴巴集团控股有限公司 | 部署和执行智能合约的方法及装置 |
CN110633328B (zh) * | 2019-09-25 | 2024-03-22 | 腾讯云计算(北京)有限责任公司 | 一种信息处理方法、装置及计算机可读存储介质 |
CN111160911B (zh) * | 2019-12-31 | 2023-10-24 | 杭州趣链科技有限公司 | 一种面向区块链的智能合约调用频率控制方法 |
US11893002B2 (en) * | 2020-05-04 | 2024-02-06 | Salesforce, Inc. | System or method to run distributed validation of workflows across a network in a shared distributed ledger in multi-tenant cloud environment |
CN111831745B (zh) * | 2020-06-05 | 2023-04-18 | 广东科学技术职业学院 | 定时智能合约的调度方法及装置 |
CN111815330A (zh) * | 2020-08-31 | 2020-10-23 | 支付宝(杭州)信息技术有限公司 | 一种部署智能合约的方法、区块链节点和存储介质 |
CN112070618A (zh) * | 2020-09-02 | 2020-12-11 | 中国平安人寿保险股份有限公司 | 基于区块链的保险核赔方法、装置、设备及介质 |
CN112162851B (zh) * | 2020-09-14 | 2022-12-13 | Oppo(重庆)智能科技有限公司 | dex预编译方法、装置、计算机设备及存储介质 |
CN112417514B (zh) * | 2020-10-30 | 2024-04-05 | 迅鳐成都科技有限公司 | 基于电子合约的多方数据协作方法、系统及存储介质 |
CN112346820A (zh) * | 2020-11-16 | 2021-02-09 | 杭州复杂美科技有限公司 | 区块链jvm应用方法、设备和存储介质 |
CN112445543B (zh) * | 2020-11-26 | 2023-03-10 | 杭州趣链科技有限公司 | 智能合约的类调用方法、装置及电子设备 |
CN112765676B (zh) * | 2020-12-03 | 2024-07-12 | 杭州趣链科技有限公司 | 一种智能合约执行方法、智能合约执行装置及节点设备 |
CN112968930B (zh) * | 2021-01-29 | 2022-08-19 | 东南大学 | 区块链键值对智能合约及其设计方法 |
CN112950237B (zh) * | 2021-05-12 | 2021-08-06 | 常州市市场监管服务中心(常州市特种设备事故调查处置中心) | 基于ocr和区块链的气瓶质量安全追溯系统及控制方法 |
CN113778564B (zh) * | 2021-09-03 | 2023-05-30 | 杭州复杂美科技有限公司 | 一种高效执行evm智能合约的方法、设备及储存介质 |
CN114422535B (zh) * | 2022-01-18 | 2024-04-09 | 网易(杭州)网络有限公司 | 区块链中部署合约的方法、装置、计算机设备及存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1645319A (zh) * | 2005-01-20 | 2005-07-27 | 上海交通大学 | 优化网络环境下部分计值服务的方法 |
CN1710536A (zh) * | 2005-06-30 | 2005-12-21 | 西安交通大学 | 一种应用服务器平台的实现方法 |
CN104731708A (zh) * | 2015-03-25 | 2015-06-24 | 北京信息控制研究所 | 一种Shellcode的动态检测方法 |
CN106101242A (zh) * | 2016-06-24 | 2016-11-09 | 深圳前海微众银行股份有限公司 | 区块链云服务平台的构建方法和装置 |
CN107392619A (zh) * | 2017-07-31 | 2017-11-24 | 众安信息技术服务有限公司 | 智能合约处理方法及装置 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150379510A1 (en) * | 2012-07-10 | 2015-12-31 | Stanley Benjamin Smith | Method and system to use a block chain infrastructure and Smart Contracts to monetize data transactions involving changes to data included into a data supply chain. |
CN106295336B (zh) * | 2015-06-26 | 2020-05-22 | 阿里巴巴集团控股有限公司 | 恶意程序检测方法及装置 |
CN108027867A (zh) * | 2015-07-14 | 2018-05-11 | Fmr有限责任公司 | 计算高效的转账处理、审计以及搜索装置、方法和系统 |
CN105893042A (zh) * | 2016-03-31 | 2016-08-24 | 北京航空航天大学 | 一种基于区块链的智能合约的实现方法 |
CN106651303B (zh) * | 2016-12-02 | 2020-05-26 | 北京轻信科技有限公司 | 一种基于模板的智能合约处理方法和系统 |
CN106874087A (zh) * | 2017-01-25 | 2017-06-20 | 上海钜真金融信息服务有限公司 | 一种区块链智能合约定时任务调度方法 |
-
2017
- 2017-07-31 CN CN201710638423.XA patent/CN107392619B/zh active Active
-
2018
- 2018-07-16 AU AU2018310287A patent/AU2018310287A1/en not_active Withdrawn
- 2018-07-16 SG SG11201907111QA patent/SG11201907111QA/en unknown
- 2018-07-16 KR KR1020197019035A patent/KR20190107664A/ko active Search and Examination
- 2018-07-16 JP JP2019524456A patent/JP2019536153A/ja not_active Withdrawn
- 2018-07-16 WO PCT/CN2018/095784 patent/WO2019024674A1/zh active Application Filing
- 2018-07-30 TW TW107126301A patent/TW201911032A/zh unknown
-
2019
- 2019-07-02 US US16/460,202 patent/US20190324772A1/en not_active Abandoned
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1645319A (zh) * | 2005-01-20 | 2005-07-27 | 上海交通大学 | 优化网络环境下部分计值服务的方法 |
CN1710536A (zh) * | 2005-06-30 | 2005-12-21 | 西安交通大学 | 一种应用服务器平台的实现方法 |
CN104731708A (zh) * | 2015-03-25 | 2015-06-24 | 北京信息控制研究所 | 一种Shellcode的动态检测方法 |
CN106101242A (zh) * | 2016-06-24 | 2016-11-09 | 深圳前海微众银行股份有限公司 | 区块链云服务平台的构建方法和装置 |
CN107392619A (zh) * | 2017-07-31 | 2017-11-24 | 众安信息技术服务有限公司 | 智能合约处理方法及装置 |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210191702A1 (en) * | 2018-10-12 | 2021-06-24 | Alibaba Group Holding Limited | Blockchain Node Service Deployment Method, Apparatus and System, and Computing Device and Medium |
US11604631B2 (en) * | 2018-10-12 | 2023-03-14 | Alibaba Group Holding Limited | Blockchain node service deployment method, apparatus and system and computing device and medium |
JP2022541929A (ja) * | 2019-09-24 | 2022-09-28 | 京▲東▼科技信息技▲術▼有限公司 | スマートコントラクトを発行するための方法及び装置 |
CN112636981A (zh) * | 2020-12-28 | 2021-04-09 | 杭州趣链科技有限公司 | 区块链主机及其代理方法、装置及存储介质 |
CN113342429A (zh) * | 2021-06-09 | 2021-09-03 | 网易(杭州)网络有限公司 | 智能合约数据处理方法、装置、计算机设备及存储介质 |
CN113342429B (zh) * | 2021-06-09 | 2023-08-08 | 网易(杭州)网络有限公司 | 智能合约数据处理方法、装置、计算机设备及存储介质 |
CN113805889A (zh) * | 2021-08-27 | 2021-12-17 | 成都质数斯达克科技有限公司 | 一种智能合约调用执行方法、装置、设备及可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
SG11201907111QA (en) | 2019-09-27 |
KR20190107664A (ko) | 2019-09-20 |
CN107392619B (zh) | 2020-12-29 |
TW201911032A (zh) | 2019-03-16 |
US20190324772A1 (en) | 2019-10-24 |
AU2018310287A1 (en) | 2019-09-05 |
JP2019536153A (ja) | 2019-12-12 |
CN107392619A (zh) | 2017-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019024674A1 (zh) | 智能合约处理方法及装置 | |
CN110941528B (zh) | 一种基于故障的日志埋点设置方法、装置及系统 | |
US20160092350A1 (en) | Callpath finder | |
CN110058864B (zh) | 微服务的部署方法及装置 | |
US7552422B2 (en) | Test case inheritance controlled via attributes | |
US11556348B2 (en) | Bootstrapping profile-guided compilation and verification | |
US9804962B2 (en) | Garbage collection control in managed code | |
US10466985B2 (en) | Hybrid deoptimization mechanism for class hierarchy analysis | |
US20170048008A1 (en) | Method and apparatus for verification of network service in network function virtualization environment | |
US9336020B1 (en) | Workflows with API idiosyncrasy translation layers | |
US10884764B1 (en) | Optimizing managed runtime applications for serverless environments | |
EP3607432B1 (en) | Flow-based scoping | |
US7340725B1 (en) | Smart test attributes and test case scenario in object oriented programming environment | |
WO2021146988A1 (en) | Method and apparatus for protecting smart contracts against attacks | |
US7577541B1 (en) | Test services provider | |
CN113010892B (zh) | 小程序恶意行为检测方法和装置 | |
US10120777B1 (en) | Remediating serialization incompatibilities | |
US9430196B2 (en) | Message inlining | |
US8739136B2 (en) | Validating run-time references | |
US7082376B1 (en) | State full test method executor | |
CA2543989C (en) | System and method for generating safe and efficient component relationships in wireless applications | |
Greci et al. | A framework for contract-policy matching based on symbolic simulations for securing mobile device application | |
CN112416312B (zh) | 一种对象获取方法、装置及电子设备、存储介质 | |
CN117149263A (zh) | 一种对开源框架扩展配置中心持久化方法及服务器 |
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: 18842269 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2019524456 Country of ref document: JP Kind code of ref document: A |
|
ENP | Entry into the national phase |
Ref document number: 20197019035 Country of ref document: KR Kind code of ref document: A |
|
ENP | Entry into the national phase |
Ref document number: 2018310287 Country of ref document: AU Date of ref document: 20180716 Kind code of ref document: A |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 29.05.2020) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18842269 Country of ref document: EP Kind code of ref document: A1 |