WO2021031472A1 - Intelligent contract processing method and device, computer device and storage medium - Google Patents

Intelligent contract processing method and device, computer device and storage medium Download PDF

Info

Publication number
WO2021031472A1
WO2021031472A1 PCT/CN2019/125615 CN2019125615W WO2021031472A1 WO 2021031472 A1 WO2021031472 A1 WO 2021031472A1 CN 2019125615 W CN2019125615 W CN 2019125615W WO 2021031472 A1 WO2021031472 A1 WO 2021031472A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
utxo
account
smart contract
fee
Prior art date
Application number
PCT/CN2019/125615
Other languages
French (fr)
Chinese (zh)
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
Application filed by 深圳市网心科技有限公司 filed Critical 深圳市网心科技有限公司
Publication of WO2021031472A1 publication Critical patent/WO2021031472A1/en

Links

Images

Classifications

    • 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

Definitions

  • the present invention relates to the field of blockchain technology, and in particular to a smart contract processing method, device, computer equipment and storage medium.
  • Blockchain is a decentralized and distributed computer system, and smart contracts are the core of blockchain transaction generation and verification, ensuring that assets can be exchanged between two parties without the need for third-party institutions. Transfer to ensure the safety of all links in currency circulation.
  • UTXO Unspent Transaction Output
  • Account asset models The mainstream UTXO asset model only supports the blockchain Although the non-Turing complete contract is simple to use and has high security, the instruction set used to implement the contract function does not contain complex instructions such as loops. Therefore, the realized contract functions are limited. However, it is very difficult to directly implement smart contracts that support Turing completeness based on the UTXO model.
  • the main purpose of the present invention is to provide a smart contract processing method, device, computer equipment and storage medium, which aims to solve the technical problem that the UTXO asset model cannot directly realize the Turing-complete smart contract.
  • By changing the contract transaction request of the UTXO asset to The input message of Turing's complete smart contract enables UTXO assets to call Turing's complete contract for asset transfer or more complex functions.
  • the first aspect of the present invention provides a smart contract processing method, the method includes:
  • the blockchain node When the blockchain node receives the UTXO asset transaction request from the first account, it converts the UTXO asset to be traded into the input information of the smart contract to be called by the exchange;
  • the method further includes:
  • the smart contract is deployed according to the smart contract instruction and the initial contract state.
  • the blockchain node when the blockchain node receives a UTXO asset transaction request from the first account, it converts the UTXO asset to be traded into the input information of the smart contract to be called by the exchange include:
  • the input handling fee in the transaction request is determined as the transaction handling fee in the input information.
  • the method before the invoking the target smart contract instruction corresponding to the input information through the virtual machine to execute the transaction, the method further includes:
  • the method further includes:
  • the commission required to execute the transaction is determined in the following manner:
  • the handling fee generated by calling the target smart contract instruction to execute the transaction determines the handling fee required for executing the transaction
  • the method further includes:
  • a smart contract processing device which includes:
  • the conversion module is used to convert the UTXO asset to be traded into the input information of the smart contract to be called by the exchange when the blockchain node receives the transaction request of the UTXO asset from the first account;
  • the calling module is used to call the target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction;
  • the update module is used to update the UTXO asset status of the first account according to the contract status returned by the virtual machine.
  • a third aspect of the present invention provides a computer device, the computer device includes a memory and a processor, the memory stores a download program for smart contract processing that can run on the processor, and When the download program processed by the smart contract is executed by the processor, the smart contract processing method is realized.
  • the fourth aspect of the present invention provides a computer-readable storage medium, the computer-readable storage medium stores a download program for smart contract processing, and the download program for smart contract processing can be used by one or more Each processor executes to implement the smart contract processing method.
  • the smart contract processing method, device, computer equipment, and storage medium described in the embodiments of the present invention convert the UTXO asset to be traded into the input information of the smart contract to be called by the exchange; and then call the input information through a virtual machine
  • the target smart contract instruction corresponding to the information executes the transaction; finally, the UTXO asset status of the first account is updated according to the contract status returned by the virtual machine.
  • UTXO assets can call Turing's complete contract for asset transfer or more complex functions.
  • FIG. 1 is a schematic flowchart of a smart contract processing method according to a first embodiment of the present invention
  • FIG. 2 is a schematic diagram of functional modules of a smart contract processing device according to a second embodiment of the present invention.
  • Fig. 3 is a schematic diagram of the internal structure of a computer device according to a third embodiment of the present invention.
  • FIG. 1 is a flowchart of the smart contract processing method disclosed in the first embodiment of the present invention.
  • the smart contract processing method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
  • At least two accounts can be created in the blockchain node, and the at least two accounts include two or more accounts.
  • a first account and a second account are created in a blockchain node.
  • the first account may be an unspent Transaction Output (UTXO) account.
  • UTXO unspent Transaction Output
  • the second account may be Account account, based on the Account asset model.
  • the user can select any account through the blockchain node as the initiating account of the contract transaction request (hereinafter referred to as the "transaction request").
  • the transaction request there are two contract accounts displayed on the blockchain node: UTXO account and Account account.
  • the user can select the UTXO account as a contract transaction request by clicking or touching the virtual icon or physical button corresponding to the UTXO account displayed on the blockchain node Originating account. Or, by clicking or touching the virtual icon or physical button corresponding to the Account account displayed on the blockchain node, the Account account is selected as the initiating account of the contract transaction request.
  • the contract transaction request includes description information of the execution contract.
  • the description information of the execution contract may include: input parameters of the execution contract and so on.
  • the description information of the executed contract corresponding to different contract accounts is different.
  • the input information for converting the UTXO asset to be traded into a smart contract to be called by the exchange includes :
  • the input handling fee in the transaction request is determined as the transaction handling fee in the input information.
  • the smart contract adopts the Gas incentive mechanism, that is, when the smart contract is executed, a service fee is required.
  • the contract transaction request carries at least an input amount and an input handling fee.
  • the input amount refers to the transfer amount input by the user through the blockchain node for contract transactions, and the input handling fee refers to the user passing through the zone.
  • the input information of the smart contract may include: the transfer-out account, the transfer-out amount, and the transaction fee (that is, the payment for the transaction fee for executing the transaction).
  • a blockchain node when a blockchain node receives a transaction request for Account assets from a second account, it determines that the second account is the transfer-out account of the smart contract, and the transaction The input amount in the request is determined as the transfer-out amount in the input information, and the input handling fee in the transaction request is determined as the transaction handling fee in the input information.
  • the method may further include:
  • the smart contract is deployed according to the smart contract instruction and the initial contract state.
  • Turing complete programming languages can include, but are not limited to: Sodility, c, c++, C#, pascal, List Processing (LISP) language, etc. Since the smart contract is written in a Turing complete language, the functions of the smart contract implemented in this optional embodiment can be flexible and more complex.
  • the virtual machine is Turing complete and includes a calculator and an instruction system.
  • the input information is sent to the virtual machine for execution.
  • the virtual machine will generate a series of contract states, such as contract member variables, contract function entry address table, global variable table, static variable table, etc.
  • the data structure of these contract states can include simple lists or complex multi-dimensional data structures.
  • the virtual machine can convert these contract states into key-value (KV, Key-Value) form for storage, and save them in databases such as LevelDB.
  • the virtual machine can also return the storage address of these contract states to the blockchain network.
  • the correspondence between the previously generated transaction identifier and the storage address is recorded in the ledger of the blockchain network.
  • the method before splitting the face value of the UTXO asset corresponding to the income amount carried in the contract transaction request into the transfer-out amount and the transaction fee, the method further includes:
  • the face value in the UTXO account must be greater than the sum of the transfer amount and the transaction fee.
  • part of the amount in the Account account can be converted to the corresponding face value of the UTXO account, so that the new face value in the UTXO account is greater than the transfer amount and transaction fee The sum of, so as to realize the function of the smart contract.
  • the virtual machine uses the input information of the smart contract to execute the transaction. After the execution, the execution result of the related function in the contract is obtained, the contract state is transferred, and a new contract state is generated and returned to the blockchain node .
  • the new contract status can include the usage of prepaid fees. For example, which contract account has spent how much fees, and how many fees are left. For another example, which contract account received how many fees.
  • the blockchain node updates the state of the UTXO asset of the first account according to the new contract state returned by the virtual machine. For example, when the smart contract executed by the virtual machine is a transfer, the blockchain node updates the balance status in the initiating account of the contract transaction request according to the balance status returned by the virtual machine.
  • the method further includes:
  • the transaction fee in the input information refers to a fee paid in advance. Since the handling fee required for each execution of the transaction may change over time, the handling fee required for the actual execution of the transaction is uncertain.
  • the virtual machine When the virtual machine actually executes the transaction, it needs to determine whether the transaction fee in the input information is greater than the transaction fee required to execute the transaction, that is, to determine whether the prepaid fee can execute the transaction. When the virtual machine determines that the transaction fee is greater than or equal to the fee required to execute the transaction, it is determined that the prepaid fee can execute the transaction, so that the transaction can be executed through the virtual machine. When the virtual machine determines that the transaction fee is less than the transaction fee required for executing the transaction, it is determined that the prepaid fee cannot execute the transaction, thereby terminating the virtual machine from executing the transaction.
  • the commission required to execute the transaction is determined in the following manner:
  • the handling fee generated by calling the target smart contract instruction to execute the transaction determines the handling fee required for executing the transaction.
  • the virtual machine when the virtual machine receives the input information of the smart contract, it first simulates the execution of the smart contract once, and uses the transaction fee generated during the simulation of the transaction as the execution of the transaction The required handling fee.
  • the virtual machine can also display the commission generated by the simulation on the blockchain node for users to view.
  • the transaction can be executed only when the transaction fee in the input information is greater than the fee required to execute the transaction.
  • the method further includes:
  • the virtual machine can implement a refund operation during the execution of the smart contract. If the transaction fee is greater than or equal to the fee required to execute the transaction, indicating that the transaction fee in the input information is redundant or surplus, the excess or remaining fee can be returned to the user through a refund operation.
  • the method when the blockchain node receives a transaction request for the Account asset from the second account and after the transaction request is executed, the method further includes:
  • the excess Account assets are returned to the second account, or the Account assets are first converted into UTXO assets, and then returned to the second account.
  • the method to choose to return the excess or remaining transaction fees it can be preset or adjusted according to the actual situation to improve the versatility of the contract account and enhance the user experience.
  • the UTXO asset to be traded is converted into the input information of the smart contract to be called by the exchange; and then the target smart contract instruction corresponding to the input information is invoked through the virtual machine to execute the Transaction; Finally, the UTXO asset status of the first account is updated according to the contract status returned by the virtual machine.
  • UTXO assets can call Turing's complete contract for asset transfer or more complex functions.
  • FIG. 2 is a schematic diagram of functional modules of the smart contract processing device disclosed in the second embodiment of the present invention.
  • the smart contract processing device 20 runs in a resource server.
  • the smart contract processing device 20 may include multiple functional modules composed of download programs.
  • the program code of each download program in the smart contract processing device 20 can be stored in the memory of the computer device and executed by the at least one processor to execute (see FIG. 1 for details) the processing of the smart contract.
  • the smart contract processing device 20 can be divided into multiple functional modules according to the functions it performs.
  • the functional modules may include: a deployment module 201, a conversion module 202, a calling module 203, a judgment module 204, a calculation module 205, an update module 206, a first return module 207, and a second return module 208.
  • the module referred to in the present invention refers to a series of download programs that can be executed by at least one processor and can complete fixed functions, and are stored in a memory. In this embodiment, the function of each module will be described in detail in subsequent embodiments.
  • the deployment module 201 is used to deploy smart contracts.
  • the deployment of the smart contract by the deployment module 201 includes:
  • the smart contract is deployed according to the smart contract instruction and the initial contract state.
  • Turing complete programming languages can include, but are not limited to: Sodility, c, c++, C#, pascal, List Processing (LISP) language, etc. Since the smart contract is written in a Turing complete language, the functions of the smart contract implemented in this optional embodiment can be flexible and more complex.
  • the conversion module 202 is used for converting the UTXO asset to be traded into the input information of the smart contract to be called by the exchange when the blockchain node receives the transaction request of the UTXO asset from the first account.
  • At least two accounts can be created in the blockchain node, and the at least two accounts include two or more accounts.
  • a first account and a second account are created in a blockchain node.
  • the first account may be an unspent Transaction Output (UTXO) account.
  • UTXO unspent Transaction Output
  • the second account may be Account account, based on the Account asset model.
  • the user can select any account through the blockchain node as the initiating account of the contract transaction request (hereinafter referred to as the "transaction request").
  • the transaction request there are two contract accounts displayed on the blockchain node: UTXO account and Account account.
  • the user can select the UTXO account as a contract transaction request by clicking or touching the virtual icon or physical button corresponding to the UTXO account displayed on the blockchain node Originating account. Or, by clicking or touching the virtual icon or physical button corresponding to the Account account displayed on the blockchain node to select the Account account as the initiating account of the contract transaction request.
  • the contract transaction request includes description information of the execution contract.
  • the description information of the execution contract may include: input parameters of the execution contract and so on.
  • the description information of the executed contract corresponding to different contract accounts is different.
  • the conversion module 202 converts the UTXO asset to be traded into the smart contract to be called by the exchange when the blockchain node receives a transaction request for the UTXO asset from the first account.
  • Input information includes:
  • the input handling fee in the transaction request is determined as the transaction handling fee in the input information.
  • the smart contract adopts the Gas incentive mechanism, that is, when the smart contract is executed, a service fee is required.
  • the contract transaction request carries at least an input amount and an input handling fee.
  • the input amount refers to the transfer amount input by the user through the blockchain node for contract transactions, and the input handling fee refers to the user passing through the zone.
  • the input information of the smart contract may include: the transfer-out account, the transfer-out amount, and the transaction fee (that is, the fee paid for executing the transaction).
  • the conversion module 202 is further configured to determine that the second account is the smart contract's account when the blockchain node receives a transaction request for the Account asset from the second account.
  • the account is transferred out, and the input amount in the transaction request is determined as the transfer amount in the input information, and the input handling fee in the transaction request is determined as the transaction handling fee in the input information.
  • the calling module 203 is configured to call a target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction.
  • the virtual machine is Turing complete and includes a calculator and an instruction system.
  • the input information is sent to the virtual machine for execution.
  • the virtual machine will generate a series of contract states, such as contract member variables, contract function entry address table, global variable table, static variable table, etc.
  • the data structure of these contract states can include simple lists or complex multi-dimensional data structures.
  • the virtual machine can convert these contract states into key-value (KV, Key-Value) form for storage, and save them in databases such as LevelDB.
  • the virtual machine can also return the storage address of these contract states to the blockchain network.
  • the correspondence between the previously generated transaction identifier and the storage address is recorded in the ledger of the blockchain network.
  • the smart contract processing device 20 before the denomination of the UTXO asset corresponding to the income amount carried in the contract transaction request is split into the transfer-out amount and the transaction fee, the smart contract processing device 20 also includes:
  • the judgment module 204 is configured to judge whether the sum of the transfer amount and the transaction fee is greater than the remaining face value in the UTXO asset;
  • the calculation module 205 is configured to calculate the sum of the transfer amount and the transaction fee and the sum of the transfer amount and the transaction fee when the sum of the transfer amount and the transaction fee is less than the remaining face value in the UTXO asset The difference between the remaining face value of UTXO assets;
  • the calculation module 205 is further configured to convert the amount corresponding to the difference in the Account asset into the UTXO asset.
  • the face value in the UTXO account must be greater than the sum of the transfer amount and the transaction fee.
  • part of the amount in the Account account can be converted to the corresponding face value of the UTXO account, so that the new face value in the UTXO account is greater than the transfer amount and transaction fee The sum of, so as to realize the function of the smart contract.
  • the update module 206 is configured to update the UTXO asset status of the first account according to the contract status returned by the virtual machine.
  • the virtual machine uses the input information of the smart contract to execute the transaction. After the execution, the execution result of the related function in the contract is obtained, the contract state is transferred, and a new contract state is generated and returned to the blockchain node .
  • the new contract status can include the usage of prepaid fees. For example, which contract account has spent how much fees, and how many fees are left. For another example, which contract account received how many fees.
  • the blockchain node updates the state of the UTXO asset of the first account according to the new contract state returned by the virtual machine. For example, when the smart contract executed by the virtual machine is a transfer, the blockchain node updates the balance status in the initiating account of the contract transaction request according to the balance status returned by the virtual machine.
  • the judging module 204 is further used to judge whether the transaction fee is greater than the fee required to execute the transaction;
  • the calling module 203 is further configured to execute the transaction through the virtual machine when the determining module 204 determines that the transaction fee is greater than or equal to the fee required to execute the transaction;
  • the calling module 203 is further configured to terminate the execution of the transaction by the virtual machine when the determination module 204 determines that the transaction fee is less than the transaction fee required to execute the transaction.
  • the transaction fee in the input information refers to a fee paid in advance. Since the handling fee required for each execution of the transaction may change over time, the handling fee required for the actual execution of the transaction is uncertain.
  • the virtual machine When the virtual machine actually executes the transaction, it needs to determine whether the transaction fee in the input information is greater than the transaction fee required to execute the transaction, that is, to determine whether the prepaid fee can execute the transaction. When the virtual machine determines that the transaction fee is greater than or equal to the fee required to execute the transaction, it is determined that the prepaid fee can execute the transaction, so that the transaction can be executed through the virtual machine. When the virtual machine determines that the transaction fee is less than the transaction fee required for executing the transaction, it is determined that the prepaid fee cannot execute the transaction, thereby terminating the virtual machine from executing the transaction.
  • the commission required to execute the transaction is determined in the following manner:
  • the handling fee generated by calling the target smart contract instruction to execute the transaction determines the handling fee required for executing the transaction.
  • the virtual machine when the virtual machine receives the input information of the smart contract, it first simulates the execution of the smart contract once, and uses the transaction fee generated during the simulation of the transaction as the execution of the transaction The required handling fee.
  • the virtual machine can also display the commission generated by the simulation on the blockchain node for users to view.
  • the transaction can be executed only when the transaction fee in the input information is greater than the fee required to execute the transaction.
  • the smart contract processing device 20 further includes:
  • the first refund module 207 is used to return the excess handling fee to the first account.
  • the first refund module 207 is further configured to create a new UTXO based on the excess handling fee and return it to the first account.
  • the virtual machine can implement a refund operation during the execution of the smart contract. If the transaction fee is greater than or equal to the fee required to execute the transaction, indicating that the transaction fee in the input information is redundant or surplus, the excess or remaining fee can be returned to the user through a refund operation.
  • the smart contract processing device 20 when the blockchain node receives a transaction request for the Account asset from the second account and after the transaction request is executed, the smart contract processing device 20 further includes:
  • the second refund module 208 is configured to return the excess handling fee to the second account or the first account.
  • the excess Account assets are returned to the second account, or the Account assets are first converted into UTXO assets, and then returned to the second account.
  • the method to choose to return the excess or remaining transaction fees it can be preset or adjusted according to the actual situation to improve the versatility of the contract account and enhance the user experience.
  • the smart contract processing device of this embodiment converts the UTXO assets to be traded into the input information of the smart contract to be called by the exchange; and then calls the target smart contract instruction corresponding to the input information through the virtual machine to execute the Transaction; Finally, the UTXO asset status of the first account is updated according to the contract status returned by the virtual machine. This allows UTXO assets to call Turing's complete contract for asset transfer or more complex functions.
  • FIG. 3 is a schematic diagram of the internal structure of a computer device disclosed in an embodiment of the present invention.
  • the computer device 3 may be a client, a resource server, or other electronic devices.
  • the computer device 3 may include a memory 31, a processor 32, and a bus 33.
  • the memory 31 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc.
  • the memory 31 may be an internal storage unit of the computer device 3 in some embodiments, such as a hard disk of the computer device 3.
  • the memory 31 may also be an external storage device of the computer device 3, for example, a plug-in hard disk equipped on the computer device 3, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital). Digital, SD) card, flash card (Flash Card), etc.
  • the memory 31 may also include both an internal storage unit of the computer device 3 and an external storage device.
  • the memory 31 can be used not only to store application programs and various data installed in the computer device 3, such as download programs of the smart contract processing device 20 and various modules, but also to temporarily store data that has been output or will be output. .
  • the memory 31 stores a plurality of modules that can be run by the processor 32, for example, a conversion module, which is used when the blockchain node receives a transaction request for UTXO assets from the first account, and the transaction will be performed.
  • the UTXO asset is converted into the input information of the smart contract to be called by the exchange;
  • the calling module is used to call the target smart contract instruction corresponding to the input information through the virtual machine to execute the transaction;
  • the update module is used to execute the transaction according to the virtual
  • the contract status returned by the machine updates the UTXO asset status of the first account.
  • the processor 32 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments, and is used to run the download program or processing stored in the memory 31 data.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip in some embodiments, and is used to run the download program or processing stored in the memory 31 data.
  • the processor 32 implements the following method when executing the download program stored in the memory 31: when the blockchain node receives a transaction request for UTXO assets from the first account, convert the UTXO assets to be traded It is the input information of the smart contract to be called by the exchange; the target smart contract instruction corresponding to the input information is called through the virtual machine to execute the transaction; the UTXO asset of the first account is updated according to the contract status returned by the virtual machine status.
  • the bus 33 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc.
  • PCI peripheral component interconnect standard
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus, etc.
  • only one thick line is used in FIG. 3 to represent, but it does not mean that there is only one bus or one type of bus.
  • the computer device 3 may also include a network interface.
  • the network interface may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to connect the computer device 3 with other Establish a communication connection between computer devices.
  • a wireless interface such as a WI-FI interface, a Bluetooth interface, etc.
  • the computer device 3 may also include a user interface.
  • the user interface may include a display (Display) and an input unit such as a keyboard (Keyboard).
  • the optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an organic light-emitting diode (OLED) touch device, and the like.
  • the display can also be called a display screen or a display unit as appropriate, and is used to display messages processed in the computer device and to display a visualized user interface.
  • FIG. 3 only shows the computer device 3 with components 31-33.
  • the structure shown in FIG. 3 does not constitute a limitation on the computer device 3, and may be a bus type
  • the structure may also be a star structure, and the computer device 3 may also include fewer or more components than shown in the figure, or a combination of certain components, or a different component arrangement. If other existing or future electronic products can be adapted to the present invention, they should also be included in the protection scope of the present invention and included here by reference.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website site, computer, server or data center via wired (for example, coaxial cable, optical fiber, digital subscriber line) or wireless (for example, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or application program functional unit.
  • the integrated unit is implemented in the form of an application functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of an application product, and the computer application product is stored in a storage
  • the medium includes a number of instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, hard disk, read-only memory (Read-Only Memory, ROM), magnetic disk or optical disk and other media that can store download programs.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Business, Economics & Management (AREA)
  • Finance (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

Disclosed are an intelligent contract processing method, comprising: when a blockchain node receives a transaction request of UTXO assets from a first account, converting the UTXO assets to be transacted into input information of an intelligent contract to be called by a transaction; calling a target intelligent contract instruction corresponding to the input information by means of a virtual machine to execute the transaction; and updating the UTXO asset state of the first account according to the contract state returned by the virtual machine. Further disclosed are an intelligent contract processing device, a computer device and a storage medium. According to the present invention, the contract transaction request of the UTXO asset is converted into an input message of the Turing-complete intelligent contract, so that the UTXO asset can call the Turing-complete contract to perform asset transfer or more complex functions.

Description

智能合约处理方法、装置、计算机设备及存储介质Smart contract processing method, device, computer equipment and storage medium
本申请要求于2019年08月20日提交中国专利局,申请号为201910769532.4、发明名称为“智能合约处理方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on August 20, 2019. The application number is 201910769532.4 and the invention title is "Smart contract processing methods, devices, computer equipment and storage media". The entire content is by reference Incorporated in this application.
技术领域Technical field
本发明涉及区块链技术领域,尤其涉及一种智能合约处理方法、装置、计算机设备及存储介质。The present invention relates to the field of blockchain technology, and in particular to a smart contract processing method, device, computer equipment and storage medium.
背景技术Background technique
区块链是一个去中心化的、分布式的计算机系统,而智能合约是区块链交易生成及验证的核心,保证了在不需要第三方机构的情况下,两方之间可以进行资产的转移,从而确保货币流通各个环节的安全性。Blockchain is a decentralized and distributed computer system, and smart contracts are the core of blockchain transaction generation and verification, ensuring that assets can be exchanged between two parties without the need for third-party institutions. Transfer to ensure the safety of all links in currency circulation.
不同的区块链系统可能采用不同的数字资产模型,有代表性的有未花费的交易输出(Unspent Transaction Output,UTXO)资产模型和Account资产模型,其中主流的UTXO资产模型的区块链只支持非图灵完备的合约,虽然使用简单,安全性高,但其用于实现合约功能的指令集中不包含循环等复杂指令,因而,实现的合约功能有限。而基于UTXO模型直接实现支持图灵完备的智能合约是非常困难的。Different blockchain systems may use different digital asset models. Representative examples include Unspent Transaction Output (UTXO) asset models and Account asset models. The mainstream UTXO asset model only supports the blockchain Although the non-Turing complete contract is simple to use and has high security, the instruction set used to implement the contract function does not contain complex instructions such as loops. Therefore, the realized contract functions are limited. However, it is very difficult to directly implement smart contracts that support Turing completeness based on the UTXO model.
因此,有必要提供一种的新的智能合约处理方案,以解决UTXO资产模型无法直接实现图灵完备的智能合约的技术问题。Therefore, it is necessary to provide a new smart contract processing solution to solve the technical problem that the UTXO asset model cannot directly implement Turing-complete smart contracts.
发明内容Summary of the invention
本发明的主要目的在于提供一种智能合约处理方法、装置、计算机设备及存储介质,旨在解决UTXO资产模型无法直接实现图灵完备的智能合约的技术问题,通过变换UTXO资产的合约交易请求为图灵完备的智能合约的输入消息,使得UTXO资产能够调用图灵完备的合约进行资产转移或者更多较为复杂的功能。The main purpose of the present invention is to provide a smart contract processing method, device, computer equipment and storage medium, which aims to solve the technical problem that the UTXO asset model cannot directly realize the Turing-complete smart contract. By changing the contract transaction request of the UTXO asset to The input message of Turing's complete smart contract enables UTXO assets to call Turing's complete contract for asset transfer or more complex functions.
为实现上述目的,本发明的第一方面提供一种智能合约处理方法,所述 方法包括:To achieve the above objective, the first aspect of the present invention provides a smart contract processing method, the method includes:
当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;When the blockchain node receives the UTXO asset transaction request from the first account, it converts the UTXO asset to be traded into the input information of the smart contract to be called by the exchange;
通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;Calling the target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction;
根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。Update the state of the UTXO asset of the first account according to the contract state returned by the virtual machine.
根据本发明的一个可选实施例,所述方法还包括:According to an optional embodiment of the present invention, the method further includes:
对采用图灵完备的语言编写出的智能合约进行编译生成智能合约指令;Compile smart contracts written in Turing complete language to generate smart contract instructions;
根据所述智能合约指令与初始化合约状态部署所述智能合约。The smart contract is deployed according to the smart contract instruction and the initial contract state.
根据本发明的一个可选实施例,所述当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息包括:According to an optional embodiment of the present invention, when the blockchain node receives a UTXO asset transaction request from the first account, it converts the UTXO asset to be traded into the input information of the smart contract to be called by the exchange include:
将所述第一账户确定为所述输入信息中的转出账户;Determining the first account as the transfer-out account in the input information;
将所述交易请求中的输入金额确定为所述输入信息中的转出金额;Determining the input amount in the transaction request as the transfer-out amount in the input information;
将所述交易请求中的输入手续费确定为所述输入信息中的交易手续费。The input handling fee in the transaction request is determined as the transaction handling fee in the input information.
根据本发明的一个可选实施例,在所述通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易之前,所述方法还包括:According to an optional embodiment of the present invention, before the invoking the target smart contract instruction corresponding to the input information through the virtual machine to execute the transaction, the method further includes:
判断所述转出金额与所述交易手续费的和值是否大于所述UTXO资产中的剩余面值;Determine whether the sum of the transfer amount and the transaction fee is greater than the remaining face value in the UTXO asset;
当所述转出金额与所述交易手续费的和值小于所述UTXO资产中的剩余面值时,计算所述转出金额与所述交易手续费的和值与所述UTXO资产中的剩余面值的差值;When the sum of the transfer-out amount and the transaction fee is less than the remaining face value in the UTXO asset, calculate the sum of the transfer-out amount and the transaction fee and the remaining face value in the UTXO asset The difference;
将Account资产中与所述差值对应的金额转换为所述UTXO资产。Convert the amount corresponding to the difference in the Account asset into the UTXO asset.
根据本发明的一个可选实施例,所述方法还包括:According to an optional embodiment of the present invention, the method further includes:
判断所述交易手续费是否大于执行所述交易所需的手续费;Determine whether the transaction fee is greater than the fee required to execute the transaction;
当所述交易手续费大于或等于执行所述交易所需的手续费时,通过所述虚拟机执行所述交易;When the transaction fee is greater than or equal to the fee required to execute the transaction, execute the transaction through the virtual machine;
当所述交易手续费小于执行所述交易所需的手续费时,终止所述虚拟机执行所述交易。When the transaction fee is less than the fee required for executing the transaction, terminate the virtual machine to execute the transaction.
根据本发明的一个可选实施例,所述执行所述交易所需的手续费是通过如下方式确定的:According to an optional embodiment of the present invention, the commission required to execute the transaction is determined in the following manner:
通过所述虚拟机根据所述输入金额调用所述目标智能合约指令;Invoking the target smart contract instruction according to the input amount through the virtual machine;
将调用所述目标智能合约指令执行所述交易产生的手续费确定执行所述交易所需的手续费;The handling fee generated by calling the target smart contract instruction to execute the transaction determines the handling fee required for executing the transaction;
显示所述执行所述交易所需的手续费。Shows the fee required to execute the transaction.
根据本发明的一个可选实施例,在所述交易请求被执行后,所述方法还包括:According to an optional embodiment of the present invention, after the transaction request is executed, the method further includes:
将多余的手续费返回至所述第一账户;或者,Return the excess handling fee to the first account; or,
根据所述多余的手续费创建一笔新的UTXO返回至所述第一账户。Create a new UTXO based on the excess handling fee and return it to the first account.
为实现上述目的,本发明的第二方面提供一种智能合约处理装置,所述装置包括:In order to achieve the above objective, a second aspect of the present invention provides a smart contract processing device, which includes:
转换模块,用于当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;The conversion module is used to convert the UTXO asset to be traded into the input information of the smart contract to be called by the exchange when the blockchain node receives the transaction request of the UTXO asset from the first account;
调用模块,用于通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;The calling module is used to call the target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction;
更新模块,用于根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。The update module is used to update the UTXO asset status of the first account according to the contract status returned by the virtual machine.
为实现上述目的,本发明的第三方面提供一种计算机设备,所述计算机设备包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的智能合约处理的下载程序,所述智能合约处理的下载程序被所述处理器执行时实现所述的智能合约处理方法。In order to achieve the above objective, a third aspect of the present invention provides a computer device, the computer device includes a memory and a processor, the memory stores a download program for smart contract processing that can run on the processor, and When the download program processed by the smart contract is executed by the processor, the smart contract processing method is realized.
为实现上述目的,本发明的第四方面提供一种计算机可读存储介质,所述计算机可读存储介质上存储有智能合约处理的下载程序,所述智能合约处理的下载程序可被一个或者多个处理器执行以实现所述的智能合约处理方法。In order to achieve the above objective, the fourth aspect of the present invention provides a computer-readable storage medium, the computer-readable storage medium stores a download program for smart contract processing, and the download program for smart contract processing can be used by one or more Each processor executes to implement the smart contract processing method.
本发明实施例所述的智能合约处理方法、装置、计算机设备及存储介质,通过将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;再通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;最后根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。使得UTXO资产能够调用图灵完备的合约进行资产转移或者更多较为复杂的功能。The smart contract processing method, device, computer equipment, and storage medium described in the embodiments of the present invention convert the UTXO asset to be traded into the input information of the smart contract to be called by the exchange; and then call the input information through a virtual machine The target smart contract instruction corresponding to the information executes the transaction; finally, the UTXO asset status of the first account is updated according to the contract status returned by the virtual machine. UTXO assets can call Turing's complete contract for asset transfer or more complex functions.
附图说明Description of the drawings
图1为本发明第一实施例的智能合约处理方法的流程示意图;FIG. 1 is a schematic flowchart of a smart contract processing method according to a first embodiment of the present invention;
图2为本发明第二实施例的智能合约处理装置的功能模块示意图;2 is a schematic diagram of functional modules of a smart contract processing device according to a second embodiment of the present invention;
图3为本发明第三实施例的计算机设备的内部结构示意图。Fig. 3 is a schematic diagram of the internal structure of a computer device according to a third embodiment of the present invention.
本发明目的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization of the objectives, functional characteristics and advantages of the present invention will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式detailed description
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions, and advantages of the present invention clearer, the following further describes the present invention in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first" and "second" in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than the content illustrated or described herein. In addition, the terms "including" and "having" and any variations of them are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to the clearly listed Those steps or units may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or equipment.
需要说明的是,在本发明中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。It should be noted that the descriptions related to "first", "second", etc. in the present invention are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. . Therefore, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on what can be achieved by a person of ordinary skill in the art. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that this combination of technical solutions does not exist , Is not within the protection scope of the present invention.
实施例一Example one
参阅图1所示,为本发明第一实施例揭露的智能合约处理方法的流程图。Refer to FIG. 1, which is a flowchart of the smart contract processing method disclosed in the first embodiment of the present invention.
所述智能合约处理方法,具体包括以下步骤,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。The smart contract processing method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
S11,当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息。S11: When the blockchain node receives the transaction request of the UTXO asset from the first account, it converts the UTXO asset to be traded into input information of the smart contract to be called by the exchange.
本实施例中,区块链节点中可以创建至少两个账户,所述至少两个账户包括两个及以上账户。示例性的,区块链节点中创建有第一账户和第二账户,所述第一账户可以是未花费的交易输出(Unspent Transaction Output,UTXO)账户,基于UTXO资产模型,第二账户可以是Account账户,基于Account资产模型。In this embodiment, at least two accounts can be created in the blockchain node, and the at least two accounts include two or more accounts. Exemplarily, a first account and a second account are created in a blockchain node. The first account may be an unspent Transaction Output (UTXO) account. Based on the UTXO asset model, the second account may be Account account, based on the Account asset model.
用户可以通过区块链节点选择任意一个账户作为合约交易请求(下文简称为“交易请求”)的发起账户。例如,区块链节点上显示有两个合约账户:UTXO账户和Account账户,用户可以通过点击或者触摸区块链节点上显示的UTXO账户对应的虚拟图标或者物理按键来选择UTXO账户作为合约交易请求的发起账户。或者,通过点击或者触摸区块链节点上显示的Account账户对应的虚拟图标或者物理按键来选择Account账户作为合约交易请求的发起账户。The user can select any account through the blockchain node as the initiating account of the contract transaction request (hereinafter referred to as the "transaction request"). For example, there are two contract accounts displayed on the blockchain node: UTXO account and Account account. The user can select the UTXO account as a contract transaction request by clicking or touching the virtual icon or physical button corresponding to the UTXO account displayed on the blockchain node Originating account. Or, by clicking or touching the virtual icon or physical button corresponding to the Account account displayed on the blockchain node, the Account account is selected as the initiating account of the contract transaction request.
其中,所述合约交易请求包括执行合约的描述信息。所述执行合约的描述信息可以包括:执行合约的输入参数等。不同的合约账户对应的执行合约的描述信息不同。Wherein, the contract transaction request includes description information of the execution contract. The description information of the execution contract may include: input parameters of the execution contract and so on. The description information of the executed contract corresponding to different contract accounts is different.
在一个可选的实施例中,所述当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息包括:In an optional embodiment, when the blockchain node receives a UTXO asset transaction request from the first account, the input information for converting the UTXO asset to be traded into a smart contract to be called by the exchange includes :
将所述第一账户确定为所述输入信息中的转出账户;Determining the first account as the transfer-out account in the input information;
将所述交易请求中的输入金额确定为所述输入信息中的转出金额;Determining the input amount in the transaction request as the transfer-out amount in the input information;
将所述交易请求中的输入手续费确定为所述输入信息中的交易手续费。The input handling fee in the transaction request is determined as the transaction handling fee in the input information.
在该可选的实施例中,为了提高区块链上矿工的积极性,智能合约采用了Gas激励机制,即执行智能合约时,需要支付手续费。In this optional embodiment, in order to increase the enthusiasm of miners on the blockchain, the smart contract adopts the Gas incentive mechanism, that is, when the smart contract is executed, a service fee is required.
所述合约交易请求中至少携带有输入金额和输入手续费,所述输入金额是指用户通过区块链节点输入的用于进行合约交易的转出金额,所述输入手续费是指用户通过区块链节点输入的用于执行合约交易的手续费。所述智能 合约的输入信息可以包括:转出账户、转出金额、交易手续费(即,支付用于执行所述交易的手续费)。通过变换UTXO资产的合约交易请求为图灵完备的智能合约的输入消息,使得UTXO资产能够调用图灵完备的合约进行资产转移或者更多较为复杂的功能。The contract transaction request carries at least an input amount and an input handling fee. The input amount refers to the transfer amount input by the user through the blockchain node for contract transactions, and the input handling fee refers to the user passing through the zone. The commission entered by the blockchain node to execute contract transactions. The input information of the smart contract may include: the transfer-out account, the transfer-out amount, and the transaction fee (that is, the payment for the transaction fee for executing the transaction). By transforming the contract transaction request of UTXO asset into the input message of Turing complete smart contract, UTXO asset can call Turing complete contract for asset transfer or more complex functions.
在一个可选的实施例中,当区块链节点接收到来自第二账户的Account资产的交易请求时,将所述第二账户确定为所述智能合约的转出账户,并将所述交易请求中的输入金额确定为所述输入信息中的转出金额,将所述交易请求中的输入手续费确定为所述输入信息中的交易手续费。In an optional embodiment, when a blockchain node receives a transaction request for Account assets from a second account, it determines that the second account is the transfer-out account of the smart contract, and the transaction The input amount in the request is determined as the transfer-out amount in the input information, and the input handling fee in the transaction request is determined as the transaction handling fee in the input information.
在一个可选的实施例中,在S11之前,所述方法还可以包括:In an optional embodiment, before S11, the method may further include:
对采用图灵完备的语言编写出的智能合约进行编译生成智能合约指令;Compile smart contracts written in Turing complete language to generate smart contract instructions;
根据所述智能合约指令与初始化合约状态部署所述智能合约。The smart contract is deployed according to the smart contract instruction and the initial contract state.
在该可选的实施例中,一切可计算的问题都能计算,这样的虚拟机或者编程语言就叫图灵完备的。图灵完备的编程语言可以包括,但不限于:Sodility,c,c++,C#,pascal,表处理(List Processing,LISP)语言等。由于智能合约是采用图灵完备的语言编写出来的,因而该可选的实施例中实现的智能合约的功能可以灵活、更为复杂。In this optional embodiment, all calculable problems can be calculated, and such a virtual machine or programming language is called Turing complete. Turing complete programming languages can include, but are not limited to: Sodility, c, c++, C#, pascal, List Processing (LISP) language, etc. Since the smart contract is written in a Turing complete language, the functions of the smart contract implemented in this optional embodiment can be flexible and more complex.
S12,通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易。S12, calling a target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction.
本实施例中,所述虚拟机是图灵完备的,包括计算器和指令系统。In this embodiment, the virtual machine is Turing complete and includes a calculator and an instruction system.
在将合约交易请求转换为智能合约的输入信息后,将输入信息发送到虚拟机中执行。虚拟机在执行所述交易的过程中,会产生一系列的合约状态,例如,合约的成员变量、合约的函数入口地址表、全局变量表、静态变量表等。这些合约状态的数据结构,可以包括简单的列表,也可以包含复杂的多维数据结构。虚拟机可以将这些合约状态转换为键值(KV,Key-Value)的形式进行存储,保存到诸如Level DB等数据库中。After converting the contract transaction request into the input information of the smart contract, the input information is sent to the virtual machine for execution. In the process of executing the transaction, the virtual machine will generate a series of contract states, such as contract member variables, contract function entry address table, global variable table, static variable table, etc. The data structure of these contract states can include simple lists or complex multi-dimensional data structures. The virtual machine can convert these contract states into key-value (KV, Key-Value) form for storage, and save them in databases such as LevelDB.
虚拟机还可以将这些合约状态的存储地址返回给区块链网络。在区块链网络的账本中记录之前生成的交易标识与存储地址的对应关系。The virtual machine can also return the storage address of these contract states to the blockchain network. The correspondence between the previously generated transaction identifier and the storage address is recorded in the ledger of the blockchain network.
在一个可选的实施例中,在所述将UTXO资产中的与所述合约交易请求中携带的收入金额对应的面值拆分为转出金额及交易手续费之前,所述方法还包括:In an optional embodiment, before splitting the face value of the UTXO asset corresponding to the income amount carried in the contract transaction request into the transfer-out amount and the transaction fee, the method further includes:
判断所述转出金额与所述交易手续费的和值是否大于所述UTXO资产中的剩余面值;Determine whether the sum of the transfer amount and the transaction fee is greater than the remaining face value in the UTXO asset;
当所述转出金额与所述交易手续费的和值小于所述UTXO资产中的剩余面值时,计算所述转出金额与所述交易手续费的和值与所述UTXO资产中的剩余面值的差值;When the sum of the transfer-out amount and the transaction fee is less than the remaining face value in the UTXO asset, calculate the sum of the transfer-out amount and the transaction fee and the remaining face value in the UTXO asset The difference;
将Account资产中与所述差值对应的金额转换为所述UTXO资产。Convert the amount corresponding to the difference in the Account asset into the UTXO asset.
在该可选的实施例中,UTXO账户中的面值必须大于转出金额和交易手续费的总和。当UTXO账户中的面值小于转出金额和交易手续费的总和时,可以将Account账户中的一部分金额转换为UTXO账户对应的面值,以使得UTXO账户中的新面值大于转出金额和交易手续费的总和,从而实现所述智能合约的功能。In this alternative embodiment, the face value in the UTXO account must be greater than the sum of the transfer amount and the transaction fee. When the face value in the UTXO account is less than the sum of the transfer amount and the transaction fee, part of the amount in the Account account can be converted to the corresponding face value of the UTXO account, so that the new face value in the UTXO account is greater than the transfer amount and transaction fee The sum of, so as to realize the function of the smart contract.
S13,根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。S13: Update the state of the UTXO asset of the first account according to the contract state returned by the virtual machine.
本实施例中,虚拟机利用所述智能合约的输入信息执行所述交易,执行后,得到合约中相关函数的执行结果,合约状态发生转移,产生了新的合约状态并返回给区块链节点。新的合约状态可以包括对预支付的费用的使用情况。例如哪个合约账户花费了多少费用,剩余了多少费用。再如,哪个合约账户收到了多少费用。区块链节点根据虚拟机返回的新的合约状态更新所述第一账户的UTXO资产的状态。例如,当虚拟机执行的智能合约是转账时,则区块链节点根据虚拟机返回的余额状态更新所述合约交易请求的发起账户中的余额状态。In this embodiment, the virtual machine uses the input information of the smart contract to execute the transaction. After the execution, the execution result of the related function in the contract is obtained, the contract state is transferred, and a new contract state is generated and returned to the blockchain node . The new contract status can include the usage of prepaid fees. For example, which contract account has spent how much fees, and how many fees are left. For another example, which contract account received how many fees. The blockchain node updates the state of the UTXO asset of the first account according to the new contract state returned by the virtual machine. For example, when the smart contract executed by the virtual machine is a transfer, the blockchain node updates the balance status in the initiating account of the contract transaction request according to the balance status returned by the virtual machine.
在一个可选的实施例中,所述方法还包括:In an optional embodiment, the method further includes:
判断所述交易手续费是否大于执行所述交易所需的手续费;Determine whether the transaction fee is greater than the fee required to execute the transaction;
当所述交易手续费大于或等于执行所述交易所需的手续费时,通过所述虚拟机执行所述交易;When the transaction fee is greater than or equal to the fee required to execute the transaction, execute the transaction through the virtual machine;
当所述交易手续费小于执行所述交易所需的手续费时,终止所述虚拟机执行所述交易。When the transaction fee is less than the fee required for executing the transaction, terminate the virtual machine to execute the transaction.
在该可选的实施例中,所述输入信息中的交易手续费是指预先支付的费用。由于随着时间的推移,每次执行所述交易所需的手续费可能会有所变化,因而实际执行所述交易所需的手续费是不确定的。In this optional embodiment, the transaction fee in the input information refers to a fee paid in advance. Since the handling fee required for each execution of the transaction may change over time, the handling fee required for the actual execution of the transaction is uncertain.
虚拟机在实际执行所述交易时,需要判断输入信息中交易手续费是否大于执行所述交易所需的手续费,即判断预付的费用是否能够执行所述交易。当虚拟机确定所述交易手续费大于或等于执行所述交易所需的手续费时,则确定预付的费用能够执行所述交易,从而通过虚拟机执行所述交易。当虚拟机确定所述交易手续费小于执行所述交易所需的手续费时,则确定预付的费用不能够执行所述交易,从而终止虚拟机执行所述交易。When the virtual machine actually executes the transaction, it needs to determine whether the transaction fee in the input information is greater than the transaction fee required to execute the transaction, that is, to determine whether the prepaid fee can execute the transaction. When the virtual machine determines that the transaction fee is greater than or equal to the fee required to execute the transaction, it is determined that the prepaid fee can execute the transaction, so that the transaction can be executed through the virtual machine. When the virtual machine determines that the transaction fee is less than the transaction fee required for executing the transaction, it is determined that the prepaid fee cannot execute the transaction, thereby terminating the virtual machine from executing the transaction.
在一个可选的实施例中,所述执行所述交易所需的手续费是通过如下方式确定的:In an optional embodiment, the commission required to execute the transaction is determined in the following manner:
通过所述虚拟机根据所述输入金额调用所述目标智能合约指令;Invoking the target smart contract instruction according to the input amount through the virtual machine;
将调用所述目标智能合约指令执行所述交易产生的手续费确定执行所述交易所需的手续费。The handling fee generated by calling the target smart contract instruction to execute the transaction determines the handling fee required for executing the transaction.
在该可选的实施例中,虚拟机在接收到智能合约的输入信息时,先模拟执行一次所述智能合约,并将模拟执行所述交易的过程中产生的手续费作为执行所述交易所需的手续费。虚拟机还可以将模拟产生的手续费显示在区块链节点上,供用户查看。只有当输入信息中的交易手续费大于执行所述交易所需的手续费时,才能执行所述交易。In this optional embodiment, when the virtual machine receives the input information of the smart contract, it first simulates the execution of the smart contract once, and uses the transaction fee generated during the simulation of the transaction as the execution of the transaction The required handling fee. The virtual machine can also display the commission generated by the simulation on the blockchain node for users to view. The transaction can be executed only when the transaction fee in the input information is greater than the fee required to execute the transaction.
在一个可选的实施例中,在所述交易请求被执行后,所述方法还包括:In an optional embodiment, after the transaction request is executed, the method further includes:
将多余的手续费返回至所述第一账户;或者,Return the excess handling fee to the first account; or,
根据所述多余的手续费创建一笔新的UTXO返回至所述第一账户。Create a new UTXO based on the excess handling fee and return it to the first account.
所述虚拟机在执行智能合约的过程中,可以实现退款操作。如果所述交易手续费大于或等于执行所述交易所需的手续费,表明输入信息中的交易手续费有多余或者剩余,则可以通过退款操作,将多余或者剩余的手续费返还给用户。The virtual machine can implement a refund operation during the execution of the smart contract. If the transaction fee is greater than or equal to the fee required to execute the transaction, indicating that the transaction fee in the input information is redundant or surplus, the excess or remaining fee can be returned to the user through a refund operation.
在一个可选的实施例中,当区块链节点接收到来自第二账户的Account资产的交易请求且在所述交易请求被执行后,所述方法还包括:In an optional embodiment, when the blockchain node receives a transaction request for the Account asset from the second account and after the transaction request is executed, the method further includes:
将多余的手续费返回至所述第二账户或者所述第一账户。Return the excess handling fee to the second account or the first account.
示例性的,将多余的Account资产返回至第二账户,或者先将Account资产转换为UTXO资产,再返回至第二账户中。至于选择何种方式退换多余或者剩余的交易手续费,可以依据实际情况预先设置或者调整,以提高合约账户的多功能性,提升用户的使用体验。Exemplarily, the excess Account assets are returned to the second account, or the Account assets are first converted into UTXO assets, and then returned to the second account. As for the method to choose to return the excess or remaining transaction fees, it can be preset or adjusted according to the actual situation to improve the versatility of the contract account and enhance the user experience.
本实施所述的智能合约处理方法,通过将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;再通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;最后根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。使得UTXO资产能够调用图灵完备的合约进行资产转移或者更多较为复杂的功能。In the smart contract processing method described in this implementation, the UTXO asset to be traded is converted into the input information of the smart contract to be called by the exchange; and then the target smart contract instruction corresponding to the input information is invoked through the virtual machine to execute the Transaction; Finally, the UTXO asset status of the first account is updated according to the contract status returned by the virtual machine. UTXO assets can call Turing's complete contract for asset transfer or more complex functions.
实施例二Example two
参阅图2所示,为本发明实施例二揭露的智能合约处理装置的功能模块示意图。Refer to FIG. 2, which is a schematic diagram of functional modules of the smart contract processing device disclosed in the second embodiment of the present invention.
在一些实施例中,所述智能合约处理装置20运行于资源服务器中。所述智能合约处理装置20可以包括多个由下载程序所组成的功能模块。所述智能合约处理装置20中的各个下载程序的程序代码可以存储于计算机设备的存储器中,并由所述至少一个处理器所执行,以执行(详见图1描述)对智能合约的处理。In some embodiments, the smart contract processing device 20 runs in a resource server. The smart contract processing device 20 may include multiple functional modules composed of download programs. The program code of each download program in the smart contract processing device 20 can be stored in the memory of the computer device and executed by the at least one processor to execute (see FIG. 1 for details) the processing of the smart contract.
本实施例中,所述智能合约处理装置20根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:部署模块201、转换模块202、调用模块203、判断模块204、计算模块205、更新模块206、第一退还模块207及第二退还模块208。本发明所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列下载程序,其存储在存储器中。在本实施例中,关于各模块的功能将在后续的实施例中详述。In this embodiment, the smart contract processing device 20 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a deployment module 201, a conversion module 202, a calling module 203, a judgment module 204, a calculation module 205, an update module 206, a first return module 207, and a second return module 208. The module referred to in the present invention refers to a series of download programs that can be executed by at least one processor and can complete fixed functions, and are stored in a memory. In this embodiment, the function of each module will be described in detail in subsequent embodiments.
部署模块201,用于部署智能合约。The deployment module 201 is used to deploy smart contracts.
具体的,所述部署模块201部署智能合约包括:Specifically, the deployment of the smart contract by the deployment module 201 includes:
对采用图灵完备的语言编写出的智能合约进行编译生成智能合约指令;Compile smart contracts written in Turing complete language to generate smart contract instructions;
根据所述智能合约指令与初始化合约状态部署所述智能合约。The smart contract is deployed according to the smart contract instruction and the initial contract state.
在该可选的实施例中,一切可计算的问题都能计算,这样的虚拟机或者编程语言就叫图灵完备的。图灵完备的编程语言可以包括,但不限于:Sodility,c,c++,C#,pascal,表处理(List Processing,LISP)语言等。由于智能合约是采用图灵完备的语言编写出来的,因而该可选的实施例中实现的智能合约的功能可以灵活、更为复杂。In this optional embodiment, all calculable problems can be calculated, and such a virtual machine or programming language is called Turing complete. Turing complete programming languages can include, but are not limited to: Sodility, c, c++, C#, pascal, List Processing (LISP) language, etc. Since the smart contract is written in a Turing complete language, the functions of the smart contract implemented in this optional embodiment can be flexible and more complex.
转换模块202,用于当区块链节点接收到来自第一账户的UTXO资产的 交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息。The conversion module 202 is used for converting the UTXO asset to be traded into the input information of the smart contract to be called by the exchange when the blockchain node receives the transaction request of the UTXO asset from the first account.
本实施例中,区块链节点中可以创建至少两个账户,所述至少两个账户包括两个及以上账户。示例性的,区块链节点中创建有第一账户和第二账户,所述第一账户可以是未花费的交易输出(Unspent Transaction Output,UTXO)账户,基于UTXO资产模型,第二账户可以是Account账户,基于Account资产模型。In this embodiment, at least two accounts can be created in the blockchain node, and the at least two accounts include two or more accounts. Exemplarily, a first account and a second account are created in a blockchain node. The first account may be an unspent Transaction Output (UTXO) account. Based on the UTXO asset model, the second account may be Account account, based on the Account asset model.
用户可以通过区块链节点选择任意一个账户作为合约交易请求(下文简称为“交易请求”)的发起账户。例如,区块链节点上显示有两个合约账户:UTXO账户和Account账户,用户可以通过点击或者触摸区块链节点上显示的UTXO账户对应的虚拟图标或者物理按键来选择UTXO账户作为合约交易请求的发起账户。或者,通过点击或者触摸区块链节点上显示的Account账户对应的虚拟图标或者物理按键来选择Account账户作为合约交易请求的发起账户。The user can select any account through the blockchain node as the initiating account of the contract transaction request (hereinafter referred to as the "transaction request"). For example, there are two contract accounts displayed on the blockchain node: UTXO account and Account account. The user can select the UTXO account as a contract transaction request by clicking or touching the virtual icon or physical button corresponding to the UTXO account displayed on the blockchain node Originating account. Or, by clicking or touching the virtual icon or physical button corresponding to the Account account displayed on the blockchain node to select the Account account as the initiating account of the contract transaction request.
其中,所述合约交易请求包括执行合约的描述信息。所述执行合约的描述信息可以包括:执行合约的输入参数等。不同的合约账户对应的执行合约的描述信息不同。Wherein, the contract transaction request includes description information of the execution contract. The description information of the execution contract may include: input parameters of the execution contract and so on. The description information of the executed contract corresponding to different contract accounts is different.
在一个可选的实施例中,所述转换模块202在区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息包括:In an optional embodiment, the conversion module 202 converts the UTXO asset to be traded into the smart contract to be called by the exchange when the blockchain node receives a transaction request for the UTXO asset from the first account. Input information includes:
将所述第一账户确定为所述输入信息中的转出账户;Determining the first account as the transfer-out account in the input information;
将所述交易请求中的输入金额确定为所述输入信息中的转出金额;Determining the input amount in the transaction request as the transfer-out amount in the input information;
将所述交易请求中的输入手续费确定为所述输入信息中的交易手续费。The input handling fee in the transaction request is determined as the transaction handling fee in the input information.
在该可选的实施例中,为了提高区块链上矿工的积极性,智能合约采用了Gas激励机制,即执行智能合约时,需要支付手续费。In this optional embodiment, in order to increase the enthusiasm of miners on the blockchain, the smart contract adopts the Gas incentive mechanism, that is, when the smart contract is executed, a service fee is required.
所述合约交易请求中至少携带有输入金额和输入手续费,所述输入金额是指用户通过区块链节点输入的用于进行合约交易的转出金额,所述输入手续费是指用户通过区块链节点输入的用于执行合约交易的手续费。所述智能合约的输入信息可以包括:转出账户、转出金额、交易手续费(即,支付用于执行所述交易的手续费)。通过变换UTXO资产的合约交易请求为图灵完 备的智能合约的输入消息,使得UTXO资产能够调用图灵完备的合约进行资产转移或者更多较为复杂的功能。The contract transaction request carries at least an input amount and an input handling fee. The input amount refers to the transfer amount input by the user through the blockchain node for contract transactions, and the input handling fee refers to the user passing through the zone. The commission entered by the blockchain node to execute contract transactions. The input information of the smart contract may include: the transfer-out account, the transfer-out amount, and the transaction fee (that is, the fee paid for executing the transaction). By transforming the contract transaction request of UTXO assets to the input message of Turing's complete smart contract, UTXO assets can call Turing's complete contract for asset transfer or more complex functions.
在一个可选的实施例中,所述转换模块202,还用于当区块链节点接收到来自第二账户的Account资产的交易请求时,将所述第二账户确定为所述智能合约的转出账户,并将所述交易请求中的输入金额确定为所述输入信息中的转出金额,将所述交易请求中的输入手续费确定为所述输入信息中的交易手续费。In an optional embodiment, the conversion module 202 is further configured to determine that the second account is the smart contract's account when the blockchain node receives a transaction request for the Account asset from the second account. The account is transferred out, and the input amount in the transaction request is determined as the transfer amount in the input information, and the input handling fee in the transaction request is determined as the transaction handling fee in the input information.
调用模块203,用于通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易。The calling module 203 is configured to call a target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction.
本实施例中,所述虚拟机是图灵完备的,包括计算器和指令系统。In this embodiment, the virtual machine is Turing complete and includes a calculator and an instruction system.
在将合约交易请求转换为智能合约的输入信息后,将输入信息发送到虚拟机中执行。虚拟机在执行所述交易的过程中,会产生一系列的合约状态,例如,合约的成员变量、合约的函数入口地址表、全局变量表、静态变量表等。这些合约状态的数据结构,可以包括简单的列表,也可以包含复杂的多维数据结构。虚拟机可以将这些合约状态转换为键值(KV,Key-Value)的形式进行存储,保存到诸如Level DB等数据库中。After converting the contract transaction request into the input information of the smart contract, the input information is sent to the virtual machine for execution. In the process of executing the transaction, the virtual machine will generate a series of contract states, such as contract member variables, contract function entry address table, global variable table, static variable table, etc. The data structure of these contract states can include simple lists or complex multi-dimensional data structures. The virtual machine can convert these contract states into key-value (KV, Key-Value) form for storage, and save them in databases such as LevelDB.
虚拟机还可以将这些合约状态的存储地址返回给区块链网络。在区块链网络的账本中记录之前生成的交易标识与存储地址的对应关系。The virtual machine can also return the storage address of these contract states to the blockchain network. The correspondence between the previously generated transaction identifier and the storage address is recorded in the ledger of the blockchain network.
在一个可选的实施例中,在所述将UTXO资产中的与所述合约交易请求中携带的收入金额对应的面值拆分为转出金额及交易手续费之前,所述智能合约处理装置20还包括:In an optional embodiment, before the denomination of the UTXO asset corresponding to the income amount carried in the contract transaction request is split into the transfer-out amount and the transaction fee, the smart contract processing device 20 Also includes:
判断模块204,用于判断所述转出金额与所述交易手续费的和值是否大于所述UTXO资产中的剩余面值;The judgment module 204 is configured to judge whether the sum of the transfer amount and the transaction fee is greater than the remaining face value in the UTXO asset;
计算模块205,用于当所述转出金额与所述交易手续费的和值小于所述UTXO资产中的剩余面值时,计算所述转出金额与所述交易手续费的和值与所述UTXO资产中的剩余面值的差值;The calculation module 205 is configured to calculate the sum of the transfer amount and the transaction fee and the sum of the transfer amount and the transaction fee when the sum of the transfer amount and the transaction fee is less than the remaining face value in the UTXO asset The difference between the remaining face value of UTXO assets;
所述计算模块205,还用于将Account资产中与所述差值对应的金额转换为所述UTXO资产。The calculation module 205 is further configured to convert the amount corresponding to the difference in the Account asset into the UTXO asset.
在该可选的实施例中,UTXO账户中的面值必须大于转出金额和交易手续费的总和。当UTXO账户中的面值小于转出金额和交易手续费的总和时, 可以将Account账户中的一部分金额转换为UTXO账户对应的面值,以使得UTXO账户中的新面值大于转出金额和交易手续费的总和,从而实现所述智能合约的功能。In this alternative embodiment, the face value in the UTXO account must be greater than the sum of the transfer amount and the transaction fee. When the face value in the UTXO account is less than the sum of the transfer amount and the transaction fee, part of the amount in the Account account can be converted to the corresponding face value of the UTXO account, so that the new face value in the UTXO account is greater than the transfer amount and transaction fee The sum of, so as to realize the function of the smart contract.
更新模块206,用于根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。The update module 206 is configured to update the UTXO asset status of the first account according to the contract status returned by the virtual machine.
本实施例中,虚拟机利用所述智能合约的输入信息执行所述交易,执行后,得到合约中相关函数的执行结果,合约状态发生转移,产生了新的合约状态并返回给区块链节点。新的合约状态可以包括对预支付的费用的使用情况。例如哪个合约账户花费了多少费用,剩余了多少费用。再如,哪个合约账户收到了多少费用。区块链节点根据虚拟机返回的新的合约状态更新所述第一账户的UTXO资产的状态。例如,当虚拟机执行的智能合约是转账时,则区块链节点根据虚拟机返回的余额状态更新所述合约交易请求的发起账户中的余额状态。In this embodiment, the virtual machine uses the input information of the smart contract to execute the transaction. After the execution, the execution result of the related function in the contract is obtained, the contract state is transferred, and a new contract state is generated and returned to the blockchain node . The new contract status can include the usage of prepaid fees. For example, which contract account has spent how much fees, and how many fees are left. For another example, which contract account received how many fees. The blockchain node updates the state of the UTXO asset of the first account according to the new contract state returned by the virtual machine. For example, when the smart contract executed by the virtual machine is a transfer, the blockchain node updates the balance status in the initiating account of the contract transaction request according to the balance status returned by the virtual machine.
在一个可选的实施例中,所述判断模块204,还用于判断所述交易手续费是否大于执行所述交易所需的手续费;In an optional embodiment, the judging module 204 is further used to judge whether the transaction fee is greater than the fee required to execute the transaction;
所述调用模块203,还用于当判断模块204判断所述交易手续费大于或等于执行所述交易所需的手续费时,通过所述虚拟机执行所述交易;The calling module 203 is further configured to execute the transaction through the virtual machine when the determining module 204 determines that the transaction fee is greater than or equal to the fee required to execute the transaction;
所述调用模块203,还用于当判断模块204判断所述交易手续费小于执行所述交易所需的手续费时,终止所述虚拟机执行所述交易。The calling module 203 is further configured to terminate the execution of the transaction by the virtual machine when the determination module 204 determines that the transaction fee is less than the transaction fee required to execute the transaction.
在该可选的实施例中,所述输入信息中的交易手续费是指预先支付的费用。由于随着时间的推移,每次执行所述交易所需的手续费可能会有所变化,因而实际执行所述交易所需的手续费是不确定的。In this optional embodiment, the transaction fee in the input information refers to a fee paid in advance. Since the handling fee required for each execution of the transaction may change over time, the handling fee required for the actual execution of the transaction is uncertain.
虚拟机在实际执行所述交易时,需要判断输入信息中交易手续费是否大于执行所述交易所需的手续费,即判断预付的费用是否能够执行所述交易。当虚拟机确定所述交易手续费大于或等于执行所述交易所需的手续费时,则确定预付的费用能够执行所述交易,从而通过虚拟机执行所述交易。当虚拟机确定所述交易手续费小于执行所述交易所需的手续费时,则确定预付的费用不能够执行所述交易,从而终止虚拟机执行所述交易。When the virtual machine actually executes the transaction, it needs to determine whether the transaction fee in the input information is greater than the transaction fee required to execute the transaction, that is, to determine whether the prepaid fee can execute the transaction. When the virtual machine determines that the transaction fee is greater than or equal to the fee required to execute the transaction, it is determined that the prepaid fee can execute the transaction, so that the transaction can be executed through the virtual machine. When the virtual machine determines that the transaction fee is less than the transaction fee required for executing the transaction, it is determined that the prepaid fee cannot execute the transaction, thereby terminating the virtual machine from executing the transaction.
在一个可选的实施例中,所述执行所述交易所需的手续费是通过如下方式确定的:In an optional embodiment, the commission required to execute the transaction is determined in the following manner:
通过所述虚拟机根据所述输入金额调用所述目标智能合约指令;Invoking the target smart contract instruction according to the input amount through the virtual machine;
将调用所述目标智能合约指令执行所述交易产生的手续费确定执行所述交易所需的手续费。The handling fee generated by calling the target smart contract instruction to execute the transaction determines the handling fee required for executing the transaction.
在该可选的实施例中,虚拟机在接收到智能合约的输入信息时,先模拟执行一次所述智能合约,并将模拟执行所述交易的过程中产生的手续费作为执行所述交易所需的手续费。虚拟机还可以将模拟产生的手续费显示在区块链节点上,供用户查看。只有当输入信息中的交易手续费大于执行所述交易所需的手续费时,才能执行所述交易。In this optional embodiment, when the virtual machine receives the input information of the smart contract, it first simulates the execution of the smart contract once, and uses the transaction fee generated during the simulation of the transaction as the execution of the transaction The required handling fee. The virtual machine can also display the commission generated by the simulation on the blockchain node for users to view. The transaction can be executed only when the transaction fee in the input information is greater than the fee required to execute the transaction.
在一个可选的实施例中,在所述交易请求被执行后,所述智能合约处理装置20还包括:In an optional embodiment, after the transaction request is executed, the smart contract processing device 20 further includes:
第一退还模块207,用于将多余的手续费返回至所述第一账户。The first refund module 207 is used to return the excess handling fee to the first account.
所述第一退还模块207,还用于根据所述多余的手续费创建一笔新的UTXO返回至所述第一账户。The first refund module 207 is further configured to create a new UTXO based on the excess handling fee and return it to the first account.
所述虚拟机在执行智能合约的过程中,可以实现退款操作。如果所述交易手续费大于或等于执行所述交易所需的手续费,表明输入信息中的交易手续费有多余或者剩余,则可以通过退款操作,将多余或者剩余的手续费返还给用户。The virtual machine can implement a refund operation during the execution of the smart contract. If the transaction fee is greater than or equal to the fee required to execute the transaction, indicating that the transaction fee in the input information is redundant or surplus, the excess or remaining fee can be returned to the user through a refund operation.
在一个可选的实施例中,当区块链节点接收到来自第二账户的Account资产的交易请求且在所述交易请求被执行后,所述智能合约处理装置20还包括:In an optional embodiment, when the blockchain node receives a transaction request for the Account asset from the second account and after the transaction request is executed, the smart contract processing device 20 further includes:
第二退还模块208,用于将多余的手续费返回至所述第二账户或者所述第一账户。The second refund module 208 is configured to return the excess handling fee to the second account or the first account.
示例性的,将多余的Account资产返回至第二账户,或者先将Account资产转换为UTXO资产,再返回至第二账户中。至于选择何种方式退换多余或者剩余的交易手续费,可以依据实际情况预先设置或者调整,以提高合约账户的多功能性,提升用户的使用体验。Exemplarily, the excess Account assets are returned to the second account, or the Account assets are first converted into UTXO assets, and then returned to the second account. As for the method to choose to return the excess or remaining transaction fees, it can be preset or adjusted according to the actual situation to improve the versatility of the contract account and enhance the user experience.
本实施所述的智能合约处理装置,通过将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;再通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;最后根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。使得UTXO资产能够调用图灵完 备的合约进行资产转移或者更多较为复杂的功能。The smart contract processing device of this embodiment converts the UTXO assets to be traded into the input information of the smart contract to be called by the exchange; and then calls the target smart contract instruction corresponding to the input information through the virtual machine to execute the Transaction; Finally, the UTXO asset status of the first account is updated according to the contract status returned by the virtual machine. This allows UTXO assets to call Turing's complete contract for asset transfer or more complex functions.
实施例三Example three
图3为本发明实施例揭露的计算机设备的内部结构示意图。FIG. 3 is a schematic diagram of the internal structure of a computer device disclosed in an embodiment of the present invention.
在本实施例中,计算机设备3可以是客户端,也可以是资源服务器,还可以是其他电子设备。In this embodiment, the computer device 3 may be a client, a resource server, or other electronic devices.
所述计算机设备3可以包括存储器31、处理器32和总线33。The computer device 3 may include a memory 31, a processor 32, and a bus 33.
其中,存储器31至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器31在一些实施例中可以是所述计算机设备3的内部存储单元,例如所述计算机设备3的硬盘。存储器31在另一些实施例中也可以是所述计算机设备3的外部存储设备,例如所述计算机设备3上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器31还可以既包括所述计算机设备3的内部存储单元也包括外部存储设备。存储器31不仅可以用于存储安装于所述计算机设备3的应用程序及各类数据,例如智能合约处理装置20的下载程序等及各个模块,还可以用于暂时地存储已经输出或者将要输出的数据。The memory 31 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 31 may be an internal storage unit of the computer device 3 in some embodiments, such as a hard disk of the computer device 3. In other embodiments, the memory 31 may also be an external storage device of the computer device 3, for example, a plug-in hard disk equipped on the computer device 3, a smart memory card (Smart Media Card, SMC), and a secure digital (Secure Digital). Digital, SD) card, flash card (Flash Card), etc. Further, the memory 31 may also include both an internal storage unit of the computer device 3 and an external storage device. The memory 31 can be used not only to store application programs and various data installed in the computer device 3, such as download programs of the smart contract processing device 20 and various modules, but also to temporarily store data that has been output or will be output. .
具体的,所述存储器31存储有可被处理器32运行的多个模块,例如,转换模块,用于当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;调用模块,用于通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;更新模块,用于根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。Specifically, the memory 31 stores a plurality of modules that can be run by the processor 32, for example, a conversion module, which is used when the blockchain node receives a transaction request for UTXO assets from the first account, and the transaction will be performed. The UTXO asset is converted into the input information of the smart contract to be called by the exchange; the calling module is used to call the target smart contract instruction corresponding to the input information through the virtual machine to execute the transaction; the update module is used to execute the transaction according to the virtual The contract status returned by the machine updates the UTXO asset status of the first account.
处理器32在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器31中存储的下载程序或处理数据。The processor 32 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments, and is used to run the download program or processing stored in the memory 31 data.
具体的,所述处理器32执行所述存储器31中存储的下载程序时实现如下方法:当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;通过 虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。Specifically, the processor 32 implements the following method when executing the download program stored in the memory 31: when the blockchain node receives a transaction request for UTXO assets from the first account, convert the UTXO assets to be traded It is the input information of the smart contract to be called by the exchange; the target smart contract instruction corresponding to the input information is called through the virtual machine to execute the transaction; the UTXO asset of the first account is updated according to the contract status returned by the virtual machine status.
该总线33可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图3中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 33 may be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in FIG. 3 to represent, but it does not mean that there is only one bus or one type of bus.
进一步地,所述计算机设备3还可以包括网络接口,网络接口可选的可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该计算机设备3与其他计算机设备之间建立通信连接。Further, the computer device 3 may also include a network interface. The network interface may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to connect the computer device 3 with other Establish a communication connection between computer devices.
可选地,该计算机设备3还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及有机发光二极管(Organic Light-Emitting Diode,OLED)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在所述计算机设备中处理的消息以及用于显示可视化的用户界面。Optionally, the computer device 3 may also include a user interface. The user interface may include a display (Display) and an input unit such as a keyboard (Keyboard). The optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an organic light-emitting diode (OLED) touch device, and the like. Wherein, the display can also be called a display screen or a display unit as appropriate, and is used to display messages processed in the computer device and to display a visualized user interface.
图3仅示出了具有组件31-33的所述计算机设备3,本领域技术人员可以理解的是,图3示出的结构并不构成对所述计算机设备3的限定,既可以是总线型结构,也可以是星形结构,所述计算机设备3还可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。其他现有的或今后可能出现的电子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方式包含于此。FIG. 3 only shows the computer device 3 with components 31-33. Those skilled in the art can understand that the structure shown in FIG. 3 does not constitute a limitation on the computer device 3, and may be a bus type The structure may also be a star structure, and the computer device 3 may also include fewer or more components than shown in the figure, or a combination of certain components, or a different component arrangement. If other existing or future electronic products can be adapted to the present invention, they should also be included in the protection scope of the present invention and included here by reference.
在上述实施例中,可以全部或部分地通过应用程序、硬件、固件或者其任意组合来实现。当使用应用程序实现时,可以全部或部分地以计算机程序产品的形式实现。In the above embodiments, it may be implemented in whole or in part by application programs, hardware, firmware, or any combination thereof. When implemented using an application program, it can be implemented in the form of a computer program product in whole or in part.
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算 机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如,同轴电缆、光纤、数字用户线)或无线(例如,红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带),光介质(例如,DVD),或者半导体介质(例如,固态硬盘(Solid State Disk,SSD))等。The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website site, computer, server or data center via wired (for example, coaxial cable, optical fiber, digital subscriber line) or wireless (for example, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or data center integrated with one or more available media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the above-described system, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例中的方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用应用程序功能单元的形式实现。In addition, the functional units in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or application program functional unit.
所述集成的单元如果以应用程序功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以应用程序产品的形式体现出来,该计算机应用程序产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个 人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、硬盘、只读存储器(Read-Only Memory,ROM)、磁碟或者光盘等各种可以存储下载程序的介质。If the integrated unit is implemented in the form of an application functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of this application essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of an application product, and the computer application product is stored in a storage The medium includes a number of instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage media include: U disk, hard disk, read-only memory (Read-Only Memory, ROM), magnetic disk or optical disk and other media that can store download programs.
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、物品或者方法中还存在另外的相同要素。It should be noted that the serial numbers of the above-mentioned embodiments of the present invention are only for description, and do not represent the superiority of the embodiments. And the terms "include", "include" or any other variations thereof in this article are intended to cover non-exclusive inclusion, so that a process, article or method including a series of elements not only includes those elements, but also includes those that are not explicitly listed The other elements of, or also include elements inherent to this process, article or method. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, article or method that includes the element.
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only the preferred embodiments of the present invention, and do not limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present invention, or directly or indirectly applied to other related technical fields , The same reason is included in the scope of patent protection of the present invention.

Claims (10)

  1. 一种智能合约处理方法,其特征在于,所述方法包括:A smart contract processing method, characterized in that the method includes:
    当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;When the blockchain node receives the UTXO asset transaction request from the first account, it converts the UTXO asset to be traded into the input information of the smart contract to be called by the exchange;
    通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;Calling the target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction;
    根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。Update the state of the UTXO asset of the first account according to the contract state returned by the virtual machine.
  2. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, wherein the method further comprises:
    对采用图灵完备的语言编写出的智能合约进行编译生成智能合约指令;Compile smart contracts written in Turing complete language to generate smart contract instructions;
    根据所述智能合约指令与初始化合约状态部署所述智能合约。The smart contract is deployed according to the smart contract instruction and the initial contract state.
  3. 如权利要求1或2所述的方法,其特征在于,所述当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息包括:The method according to claim 1 or 2, characterized in that, when the blockchain node receives a transaction request for UTXO assets from the first account, the UTXO assets to be traded are converted into those to be called by the exchange. The input information of the smart contract includes:
    将所述第一账户确定为所述输入信息中的转出账户;Determining the first account as the transfer-out account in the input information;
    将所述交易请求中的输入金额确定为所述输入信息中的转出金额;Determining the input amount in the transaction request as the transfer-out amount in the input information;
    将所述交易请求中的输入手续费确定为所述输入信息中的交易手续费。The input handling fee in the transaction request is determined as the transaction handling fee in the input information.
  4. 如权利要求3所述的方法,其特征在于,在所述通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易之前,所述方法还包括:The method according to claim 3, characterized in that, before the invoking the target smart contract instruction corresponding to the input information through the virtual machine to execute the transaction, the method further comprises:
    判断所述转出金额与所述交易手续费的和值是否大于所述UTXO资产中的剩余面值;Determine whether the sum of the transfer amount and the transaction fee is greater than the remaining face value in the UTXO asset;
    当所述转出金额与所述交易手续费的和值小于所述UTXO资产中的剩余面值时,计算所述转出金额与所述交易手续费的和值与所述UTXO资产中的剩余面值的差值;When the sum of the transfer-out amount and the transaction fee is less than the remaining face value in the UTXO asset, calculate the sum of the transfer-out amount and the transaction fee and the remaining face value in the UTXO asset The difference;
    将Account资产中与所述差值对应的金额转换为所述UTXO资产。Convert the amount corresponding to the difference in the Account asset into the UTXO asset.
  5. 如权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, wherein the method further comprises:
    判断所述交易手续费是否大于执行所述交易所需的手续费;Determine whether the transaction fee is greater than the fee required to execute the transaction;
    当所述交易手续费大于或等于执行所述交易所需的手续费时,通过所述虚拟机执行所述交易;When the transaction fee is greater than or equal to the fee required to execute the transaction, execute the transaction through the virtual machine;
    当所述交易手续费小于执行所述交易所需的手续费时,终止所述虚拟机执行所述交易。When the transaction fee is less than the fee required for executing the transaction, terminate the virtual machine to execute the transaction.
  6. 如权利要求5所述的方法,其特征在于,所述执行所述交易所需的手 续费是通过如下方式确定的:The method according to claim 5, wherein the handover fee required to execute the transaction is determined in the following manner:
    通过所述虚拟机根据所述输入金额调用所述目标智能合约指令;Invoking the target smart contract instruction according to the input amount through the virtual machine;
    将调用所述目标智能合约指令执行所述交易产生的手续费确定执行所述交易所需的手续费;The handling fee generated by calling the target smart contract instruction to execute the transaction determines the handling fee required for executing the transaction;
    显示所述执行所述交易所需的手续费。Shows the fee required to execute the transaction.
  7. 如权利要求5或6所述的方法,其特征在于,在所述交易请求被执行后,所述方法还包括:The method according to claim 5 or 6, characterized in that, after the transaction request is executed, the method further comprises:
    将多余的手续费返回至所述第一账户;或者,Return the excess handling fee to the first account; or,
    根据所述多余的手续费创建一笔新的UTXO返回至所述第一账户。Create a new UTXO based on the excess handling fee and return it to the first account.
  8. 一种智能合约处理装置,其特征在于,所述装置包括:A smart contract processing device, characterized in that the device includes:
    转换模块,用于当区块链节点接收到来自第一账户的UTXO资产的交易请求时,将要交易的所述UTXO资产转换为交易所要调用的智能合约的输入信息;The conversion module is used to convert the UTXO asset to be traded into the input information of the smart contract to be called by the exchange when the blockchain node receives the transaction request of the UTXO asset from the first account;
    调用模块,用于通过虚拟机调用与所述输入信息对应的目标智能合约指令执行所述交易;The calling module is used to call the target smart contract instruction corresponding to the input information through a virtual machine to execute the transaction;
    更新模块,用于根据所述虚拟机返回的合约状态更新所述第一账户的UTXO资产的状态。The update module is used to update the UTXO asset status of the first account according to the contract status returned by the virtual machine.
  9. 一种计算机设备,其特征在于,所述计算机设备包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的智能合约处理的下载程序,所述智能合约处理的下载程序被所述处理器执行时实现如权利要求1至7中任意一项所述的智能合约处理方法。A computer device, characterized in that the computer device includes a memory and a processor, the memory stores a download program for smart contract processing that can run on the processor, and the download program for smart contract processing is When the processor is executed, the smart contract processing method according to any one of claims 1 to 7 is realized.
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有智能合约处理的下载程序,所述智能合约处理的下载程序可被一个或者多个处理器执行以实现如权利要求1至7中任意一项所述的智能合约处理方法。A computer-readable storage medium, wherein a download program for smart contract processing is stored on the computer-readable storage medium, and the download program for smart contract processing can be executed by one or more processors to achieve The smart contract processing method described in any one of 1 to 7 is required.
PCT/CN2019/125615 2019-08-20 2019-12-16 Intelligent contract processing method and device, computer device and storage medium WO2021031472A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910769532.4A CN110517138A (en) 2019-08-20 2019-08-20 Intelligent contract processing method, device, computer equipment and storage medium
CN201910769532.4 2019-08-20

Publications (1)

Publication Number Publication Date
WO2021031472A1 true WO2021031472A1 (en) 2021-02-25

Family

ID=68626994

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/125615 WO2021031472A1 (en) 2019-08-20 2019-12-16 Intelligent contract processing method and device, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN110517138A (en)
WO (1) WO2021031472A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111028081A (en) * 2019-12-11 2020-04-17 深圳市亦区科技有限公司 Asset transfer method, device, electronic equipment and storage medium
CN112740251A (en) * 2019-12-31 2021-04-30 深圳市网心科技有限公司 Block chain-based digital currency transaction method, device and system
CN111275414A (en) * 2019-12-31 2020-06-12 深圳市网心科技有限公司 Block chain-based digital currency exchange method, device and system
CN111367621A (en) * 2020-03-06 2020-07-03 深圳市网心科技有限公司 Intelligent contract timing processing method, block chain node and storage medium
CN111324396B (en) * 2020-03-19 2023-09-15 深圳市迅雷网络技术有限公司 Block chain intelligent contract execution method, device and equipment
CN111800506B (en) * 2020-07-06 2023-09-19 深圳市网心科技有限公司 Edge computing node deployment method and related device
CN111932256A (en) * 2020-08-14 2020-11-13 浙江网商银行股份有限公司 Method and device applied to intelligent contract of assets
CN112527460A (en) * 2020-12-17 2021-03-19 山大地纬软件股份有限公司 Method and system for controlling consistency of data state of bottom assets of block chain
CN112907244B (en) * 2021-02-10 2023-11-28 iCALC控股有限公司 Block chain-based data processing method, device, equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190095879A1 (en) * 2017-09-26 2019-03-28 Cornell University Blockchain payment channels with trusted execution environments
CN109559227A (en) * 2018-11-29 2019-04-02 咪咕文化科技有限公司 A kind of method of commerce, device and the storage medium of transregional piece of chain network
CN109697606A (en) * 2018-09-30 2019-04-30 贝克链区块链技术有限公司 The distributed network and the ecosystem of common recognition agreement are proved based on innovative prestige
EP3496027A1 (en) * 2017-12-06 2019-06-12 BlockSettle AB Method for settling a blockchain asset
CN110135993A (en) * 2019-05-17 2019-08-16 深圳银链科技有限公司 Method, equipment and the storage medium of UTXO model adaptation intelligence contract account model

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190095879A1 (en) * 2017-09-26 2019-03-28 Cornell University Blockchain payment channels with trusted execution environments
EP3496027A1 (en) * 2017-12-06 2019-06-12 BlockSettle AB Method for settling a blockchain asset
CN109697606A (en) * 2018-09-30 2019-04-30 贝克链区块链技术有限公司 The distributed network and the ecosystem of common recognition agreement are proved based on innovative prestige
CN109559227A (en) * 2018-11-29 2019-04-02 咪咕文化科技有限公司 A kind of method of commerce, device and the storage medium of transregional piece of chain network
CN110135993A (en) * 2019-05-17 2019-08-16 深圳银链科技有限公司 Method, equipment and the storage medium of UTXO model adaptation intelligence contract account model

Also Published As

Publication number Publication date
CN110517138A (en) 2019-11-29

Similar Documents

Publication Publication Date Title
WO2021031472A1 (en) Intelligent contract processing method and device, computer device and storage medium
CN110147990B (en) Payment withholding subscription method and device based on block chain and electronic equipment
US9201702B2 (en) Integrated cloud data center management
JP7105298B2 (en) Technology for automatically verifying offer functionality in a cloud service broker system
TW201828220A (en) Service processing method and apparatus
CN110011978B (en) Method, system, device and computer equipment for modifying block chain network configuration
US10614454B1 (en) Remote population and redaction of high security data
CN108628605A (en) Stream data processing method, device, server and medium
CN105814539A (en) Method and apparatus for code virtualization and remote process call generation
US9946555B2 (en) Enhanced configuration and property management system
CN103238138A (en) Network interface for partition deployment/re-deployment in a cloud environment
CN106385329A (en) Processing method and device of resource pool and equipment
WO2022083093A1 (en) Probability calculation method and apparatus in graph, computer device and storage medium
CN109471626A (en) Page logic structure, page generation method, page data processing method and device
CN109800083A (en) A kind of method, apparatus, system and storage medium that micro services collaboration is called
CN110490416A (en) Task management method and terminal device
CA3159291A1 (en) Virtual workspace experience visualization and optimization
CN115421922A (en) Current limiting method, device, equipment, medium and product of distributed system
US20190007489A1 (en) System and Methods for Running a Condition-Triggered Process Involving Movement of Objects from a Node to at least one other Node Until a Condition with a Set of Parameters Are Met By An Event
WO2019233454A1 (en) Chain code upgrading method and device
KR20210122212A (en) Transaction processing method, device, equipment, program and medium of Ethereum virtual machine
CN107609119A (en) Document handling method, mobile terminal and computer-readable recording medium
JP3006610B1 (en) Work flow support execution system
CN113312900A (en) Data verification method and device
KR20210105317A (en) A transaction processing method, a device, an equipment, a program and a medium of ethereum virtual machine

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: 19942465

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19942465

Country of ref document: EP

Kind code of ref document: A1