Intelligent contract processing method, device, computer equipment and storage medium
Technical field
The present invention relates to block chain technical field more particularly to a kind of intelligent contract processing methods, device, computer equipment
And storage medium.
Background technique
Block chain is a decentralization, distributed computer system, and intelligent contract is that the transaction of block chain generates
And the core of verifying, it ensure that in the case where not needing the third-party institution, the transfer of assets can be carried out between two sides, thus
Ensure the safety of money flow links.
Different block catenary systems may use different digital asset models, representational to have the transaction not spent defeated
(Unspent Transaction Output, UTXO) asset model and Account asset model out, wherein UTXO asset model
It is that non-figure spirit is complete, it is highly-safe although using simply, circulation is not included in its instruction set for realizing contract function
Equal complicated orders, it is thereby achieved that contract function it is limited.And the complete intelligence of figure spirit is directly realized by based on the complete contract of Fei Tuling
Energy contract is very difficult.
Therefore, it is necessary to a kind of new intelligent contract processing scheme is provided, it can not be direct to solve UTXO asset model
The technical issues of spirit complete intelligent contract, is schemed in realization.
Summary of the invention
The main purpose of the present invention is to provide a kind of intelligent contract processing method, device, computer equipment and storages to be situated between
Matter, it is intended to the technical issues of UTXO asset model can not be directly realized by figure spirit complete intelligent contract is solved, by converting UTXO
The contract transaction request of assets is the input message of the complete intelligent contract of figure spirit, enables UTXO assets calling figure spirit complete
Contract carry out assets transfer or more more complicated function.
To achieve the above object, the first aspect of the present invention provides a kind of intelligent contract processing method, which comprises
When block chain node receives the transaction request of the UTXO assets from the first account, what will be traded is described
UTXO assets are converted to the input information for the intelligent contract that exchange to be called;
By trading described in virtual machine call Intelligent target contract instruction execution corresponding with the input information;
The state of the UTXO assets of first account is updated according to the contract state that the virtual machine returns.
An alternative embodiment according to the present invention, the method also includes:
The intelligent contract instruction of generation is compiled to the intelligent contract write out using the complete language of figure spirit;
According to the intelligent contract instruction and the initialization contract state deployment intelligent contract.
An alternative embodiment according to the present invention, it is described when block chain node receives the money of the UTXO from the first account
When the transaction request of production, the UTXO assets that will be traded are converted to the input packet for the intelligent contract that exchange to be called
It includes:
First account is determined as to produce account in the input information;
The input amount of money in the transaction request is determined as to produce the amount of money in the input information;
Process of import expense in the transaction request is determined as the transaction procedure expense in the input information.
An alternative embodiment according to the present invention passes through virtual machine call mesh corresponding with the input information described
It marks before trading described in intelligent contract instruction execution, the method also includes:
The remaining the face whether amount of money takes with the transaction procedure and value is greater than in the UTXO assets is produced described in judgement
Value;
When the produce the amount of money and transaction procedure expense and value is less than remaining face amount in the UTXO assets, count
The amount of money and transaction procedure expense and the remaining face amount in value and the UTXO assets difference are produced described in calculation;
The amount of money corresponding with the difference in Account assets is converted into the UTXO assets.
An alternative embodiment according to the present invention, the method also includes:
Judge the transaction procedure expense whether greater than service charge needed for executing the transaction;
When the service charge needed for the transaction procedure takes and is greater than or equal to the execution transaction, held by the virtual machine
The row transaction;
When the service charge needed for the transaction procedure takes and is less than the execution transaction, terminate described in the virtual machine execution
Transaction.
An alternative embodiment according to the present invention, service charge needed for the execution transaction is in the following way
Determining:
The Intelligent target contract is called to instruct according to the input amount of money by the virtual machine;
The exchange is executed by calling the service charge for generation of trading described in the Intelligent target contract instruction execution to determine
The service charge needed;
Service charge needed for showing the execution transaction.
An alternative embodiment according to the present invention, after the transaction request is performed, the method also includes:
Extra service charge is back to first account;Alternatively,
A new UTXO, which is created, according to the extra service charge is back to first account to achieve the above object,
The second aspect of the present invention provides a kind of intelligent contract processing unit, and described device includes:
Conversion module will when for receiving the transaction request of the UTXO assets from the first account when block chain node
The UTXO assets to be traded are converted to the input information for the intelligent contract that exchange to be called;
Calling module, for passing through virtual machine call Intelligent target contract instruction execution corresponding with input information institute
State transaction;
Update module, the contract state for being returned according to the virtual machine update the UTXO assets of first account
State.
To achieve the above object, the third aspect of the present invention provides a kind of computer equipment, and the computer equipment includes
Memory and processor are stored with the downloading journey for the intelligent contract processing that can be run on the processor on the memory
The downloading program of sequence, the intelligence contract processing realizes the intelligent contract processing method when being executed by the processor.
To achieve the above object, the fourth aspect of the present invention provides a kind of computer readable storage medium, the computer
The downloading program of intelligent contract processing is stored on readable storage medium storing program for executing, the downloading program of the intelligence contract processing can be by one
Or multiple processors are executed to realize the intelligent contract processing method.
Intelligent contract processing method, device, computer equipment and storage medium described in the embodiment of the present invention, by will
The UTXO assets of transaction are converted to the input information for the intelligent contract that exchange to be called;Pass through virtual machine call and institute again
State transaction described in the corresponding Intelligent target contract instruction execution of input information;The contract state finally returned according to the virtual machine
Update the state of the UTXO assets of first account.The contract for enabling the spirit of UTXO assets calling figure complete carries out assets and turns
Shifting or more more complicated functions.
Detailed description of the invention
Fig. 1 is the flow diagram of the intelligent contract processing method of first embodiment of the invention;
Fig. 2 is the functional block diagram of the intelligent contract processing unit of second embodiment of the invention;
Fig. 3 is the schematic diagram of internal structure of the computer equipment of third embodiment of the invention.
The object of the invention is realized, the embodiments will be further described with reference to the accompanying drawings for functional characteristics and advantage.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not
For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work
Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
The description and claims of this application and the term " first " in above-mentioned attached drawing, " second " are for distinguishing class
As object, without being used to describe a particular order or precedence order.It should be understood that the data used in this way are in appropriate situation
Under can be interchanged, so that the embodiments described herein can be real with the sequence other than the content for illustrating or describing herein
It applies.In addition, term " includes " and " having " and their any deformation, it is intended that cover it is non-exclusive include, for example, packet
The process, method, system, product or equipment for having contained a series of steps or units those of be not necessarily limited to be clearly listed step or
Unit, but may include other steps being not clearly listed or intrinsic for these process, methods, product or equipment or
Unit.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot
It is interpreted as its relative importance of indication or suggestion or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the
One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment
Art scheme can be combined with each other, but must be based on can be realized by those of ordinary skill in the art, when technical solution
Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims
Protection scope within.
Embodiment one
As shown in fig.1, the flow chart of the intelligent contract processing method disclosed for first embodiment of the invention.
The intelligence contract processing method, specifically includes following steps, according to different requirements, step in the flow chart
Sequence can change, and certain steps can be omitted.
S11, when block chain node receives the transaction request of the UTXO assets from the first account, the institute that will trade
State the input information that UTXO assets are converted to the intelligent contract that exchange to be called.
In the present embodiment, at least two accounts can be created in block chain node, at least two account includes two
And the above account.Illustratively, creation has the first account and the second account in block chain node, and first account can be not
The transaction of cost exports (Unspent Transaction Output, UTXO) account, is based on UTXO asset model, the second account
It can be Account account, be based on Account asset model.
User can select any one account (hereinafter referred to as " to hand over as contract transaction request by block chain link point
Easily request ") initiation account.For example, there are two contract accounts for display on block chain node: UTXO account and Account account,
User can be by clicking or touching the corresponding virtual icon of UTXO account shown on block chain link point or physical button
To select initiation account of the UTXO account as contract transaction request.Alternatively, being shown on block chain link point by clicking or touching
The corresponding virtual icon of the Account account shown or physical button select Account account as contract transaction request
Initiate account.
Wherein, the contract transaction request includes executing the description information of contract.The description information for executing contract can
To include: the input parameter etc. for executing contract.The corresponding description information for executing contract of different contract accounts is different.
In an alternative embodiment, the friendship that the UTXO assets from the first account are received when block chain node
When easily requesting, the input information that the UTXO assets that will be traded are converted to the intelligent contract that exchange to be called includes:
First account is determined as to produce account in the input information;
The input amount of money in the transaction request is determined as to produce the amount of money in the input information;
Process of import expense in the transaction request is determined as the transaction procedure expense in the input information.
In the optional embodiment, in order to improve the enthusiasm stayed away from work without leave on block chain, intelligent contract is motivated using Gas
Mechanism needs payment procedure expense when executing intelligent contract.
The input amount of money is at least carried in the contract transaction request and process of import expense, the input amount of money refer to user
The amount of money that produces for being used to carry out contract transaction inputted by block chain node, the process of import expense refer to that user passes through block
The service charge of chain node input traded for executing contract.It is described intelligence contract input information may include: produce account,
Produce the amount of money, transaction procedure expense (that is, paying the service charge for executing the transaction).Contract by converting UTXO assets is handed over
Easily request is to scheme the input message of the complete intelligent contract of spirit, and the contract for enabling the spirit of UTXO assets calling figure complete is provided
Produce transfer or more more complicated functions.
In an alternative embodiment, when block chain node receives the friendship of the Account assets from the second account
Easily request when, second account is determined as to the account that produces of the intelligent contract, and by the input in the transaction request
The amount of money is determined as producing the amount of money in the input information, and the process of import expense in the transaction request is determined as the input
Transaction procedure in information takes.
In an alternative embodiment, before S11, the method can also include:
The intelligent contract instruction of generation is compiled to the intelligent contract write out using the complete language of figure spirit;
According to the intelligent contract instruction and the initialization contract state deployment intelligent contract.
In the optional embodiment, all computable problems can be calculated, such virtual machine or programming language
Just make figure spirit complete.The complete programming language of figure spirit may include, but be not limited to: Sodility, c, c++, C#, pascal,
List processing (List Processing, LISP) language etc..Since intelligent contract is to write out using the complete language of figure spirit
, thus the function for the intelligent contract realized in the optional embodiment can be flexible, increasingly complex.
S12, by trading described in virtual machine call Intelligent target contract instruction execution corresponding with the input information.
In the present embodiment, the virtual machine is that figure spirit is complete, including calculator and instruction system.
After the input information that contract transaction request is converted to intelligent contract, sends input information in virtual machine and hold
Row.Virtual machine can generate a series of contract state during executing the transaction, for example, the member variable of contract, conjunction
Function entrance address table about, global variable table, static variable table etc..The data structure of these contract states may include letter
Single list also may include complicated multidimensional data structure.Virtual machine these contract states can be converted to key assignments (KV,
Key-Value form) is stored, and is saved in the databases such as Level DB.
The storage address of these contract states can also be returned to block chain network by virtual machine.In the account of block chain network
The corresponding relationship of the transaction ID and storage address that are generated before record in this.
In an alternative embodiment, it is described by UTXO assets with the receipts that carry in the contract transaction request
Enter before the corresponding face amount of the amount of money is split as producing the amount of money and transaction procedure expense, the method also includes:
The remaining the face whether amount of money takes with the transaction procedure and value is greater than in the UTXO assets is produced described in judgement
Value;
When the produce the amount of money and transaction procedure expense and value is less than remaining face amount in the UTXO assets, count
The amount of money and transaction procedure expense and the remaining face amount in value and the UTXO assets difference are produced described in calculation;
The amount of money corresponding with the difference in Account assets is converted into the UTXO assets.
In the optional embodiment, the face amount in UTXO account have to be larger than produce the amount of money and transaction procedure expense it is total
With.It, can be by one in Account account when the face amount in UTXO account is less than the summation for producing the amount of money and transaction procedure expense
Partial amount is converted to the corresponding face amount of UTXO account, so that the new face amount in UTXO account, which is greater than, produces the amount of money and transaction hand
The summation to continue to pay dues, to realize the function of the intelligent contract.
S13 updates the state of the UTXO assets of first account according to the contract state that the virtual machine returns.
In the present embodiment, virtual machine executes the transaction using the input information of the intelligent contract, after execution, is closed
The implementing result of about middle correlation function, contract state shift, and produce new contract state and return to block chain node.
New contract state may include the service condition to the expense of pre-paid.Such as which contract account takes how many expense,
Remaining how many expense.For another example, which contract account has received how many expense.Block chain node returns new according to virtual machine
Contract state updates the state of the UTXO assets of first account.For example, when the intelligent contract that virtual machine executes is to transfer accounts,
Then block chain node updates the remaining sum shape in the initiation account of the contract transaction request according to the balance status that virtual machine returns
State.
In an alternative embodiment, the method also includes:
Judge the transaction procedure expense whether greater than service charge needed for executing the transaction;
When the service charge needed for the transaction procedure takes and is greater than or equal to the execution transaction, held by the virtual machine
The row transaction;
When the service charge needed for the transaction procedure takes and is less than the execution transaction, terminate described in the virtual machine execution
Transaction.
In the optional embodiment, the transaction procedure expense in the input information refers to the expense paid in advance.Due to
Over time, service charge needed for executing the transaction every time may be varied, thus the practical execution friendship
Easily required service charge is uncertain.
Virtual machine needs to judge to input whether transaction procedure expense in information is greater than execution institute when reality executes the transaction
Service charge needed for stating transaction, that is, judge whether the expense of prepayment is able to carry out the transaction.When virtual machine determines the transaction
When service charge needed for service charge is greater than or equal to the execution transaction, it is determined that the expense of prepayment is able to carry out the transaction,
To execute the transaction by virtual machine.The hand needed for virtual machine determines that the transaction procedure expense is less than the execution transaction
When continuing to pay dues, it is determined that the expense of prepayment can not execute the transaction, so that terminating virtual machine executes the transaction.
In an alternative embodiment, service charge needed for the execution transaction is to be determined as follows
:
The Intelligent target contract is called to instruct according to the input amount of money by the virtual machine;
The exchange is executed by calling the service charge for generation of trading described in the Intelligent target contract instruction execution to determine
The service charge needed.
In the optional embodiment, in the input information for receiving intelligent contract, first simulation executes primary virtual machine
The intelligence contract, and the service charge generated during simulation is executed the transaction is as hand needed for executing the transaction
It continues to pay dues.Virtual machine can also show the service charge that simulation generates on block chain node, check for user.Only when input is believed
When transaction procedure in breath is taken greater than service charge needed for executing the transaction, the transaction could be executed.
In an alternative embodiment, after the transaction request is performed, the method also includes:
Extra service charge is back to first account;Alternatively,
A new UTXO, which is created, according to the extra service charge is back to first account.
Reimbursement operation may be implemented during executing intelligent contract in the virtual machine.If the transaction procedure takes
More than or equal to service charge needed for executing the transaction, it is extra or remaining to show that the transaction procedure inputted in information expense has,
It can then be operated by reimbursement, extra or remaining service charge is returned into user.
In an alternative embodiment, when block chain node receives the friendship of the Account assets from the second account
Easily request and after the transaction request is performed, the method also includes:
Extra service charge is back to second account or first account.
Illustratively, extra Account assets are back to the second account, or are first converted to Account assets
UTXO assets are returned again into the second account.It, can be with as selecting which kind of mode replaces extra or remaining transaction procedure expense
It presets or adjusts according to actual conditions, to improve the multifunctionality of contract account, promote the usage experience of user.
This implementation intelligent contract processing method, is converted to exchange by the UTXO assets that will be traded and wants
The input information of the intelligent contract of calling;Pass through virtual machine call Intelligent target contract instruction corresponding with the input information again
Execute the transaction;The shape of the UTXO assets of first account is finally updated according to the contract state that the virtual machine returns
State.The contract for enabling the spirit of UTXO assets calling figure complete carries out assets transfer or more more complicated functions.
Embodiment two
As shown in fig.2, the functional block diagram of the intelligent contract processing unit disclosed for the embodiment of the present invention two.
In some embodiments, the intelligent contract processing unit 20 is run in Resource Server.The intelligence contract
Processing unit 20 may include multiple functional modules as composed by program code segments.In the intelligence contract processing unit 20
The program code of each program segment can store in the memory of computer equipment, and be held by least one described processor
Row, the processing with execution (being detailed in Fig. 1 description) to intelligent contract.
In the present embodiment, function of the intelligence contract processing unit 20 according to performed by it can be divided into multiple
Functional module.The functional module may include: deployment module 201, conversion module 202, calling module 203, judgment module
204, computing module 205, update module 206, first return module 207 and second return module 208.The so-called module of the present invention
Refer to it is a kind of performed by least one processor and can complete the series of computation machine program segment of fixed function,
Storage is in memory.In the present embodiment, it will be described in detail in subsequent embodiment about the function of each module.
Deployment module 201, for disposing intelligent contract.
Specifically, the deployment module 201 disposes intelligent contract includes:
The intelligent contract instruction of generation is compiled to the intelligent contract write out using the complete language of figure spirit;
According to the intelligent contract instruction and the initialization contract state deployment intelligent contract.
In the optional embodiment, all computable problems can be calculated, such virtual machine or programming language
Just make figure spirit complete.The complete programming language of figure spirit may include, but be not limited to: Sodility, c, c++, C#, pascal,
List processing (List Processing, LISP) language etc..Since intelligent contract is to write out using the complete language of figure spirit
, thus the function for the intelligent contract realized in the optional embodiment can be flexible, increasingly complex.
Conversion module 202, when for receiving the transaction request of the UTXO assets from the first account when block chain node,
The UTXO assets that will be traded are converted to the input information for the intelligent contract that exchange to be called.
In the present embodiment, at least two accounts can be created in block chain node, at least two account includes two
And the above account.Illustratively, creation has the first account and the second account in block chain node, and first account can be not
The transaction of cost exports (Unspent Transaction Output, UTXO) account, is based on UTXO asset model, the second account
It can be Account account, be based on Account asset model.
User can select any one account (hereinafter referred to as " to hand over as contract transaction request by block chain link point
Easily request ") initiation account.For example, there are two contract accounts for display on block chain node: UTXO account and Account account,
User can be by clicking or touching the corresponding virtual icon of UTXO account shown on block chain link point or physical button
To select initiation account of the UTXO account as contract transaction request.Alternatively, being shown on block chain link point by clicking or touching
The corresponding virtual icon of the Account account shown or physical button select Account account as contract transaction request
Initiate account.
Wherein, the contract transaction request includes executing the description information of contract.The description information for executing contract can
To include: the input parameter etc. for executing contract.The corresponding description information for executing contract of different contract accounts is different.
In an alternative embodiment, the conversion module 202 is received in block chain node from the first account
When the transaction request of UTXO assets, the UTXO assets that will be traded are converted to the input for the intelligent contract that exchange to be called
Information includes:
First account is determined as to produce account in the input information;
The input amount of money in the transaction request is determined as to produce the amount of money in the input information;
Process of import expense in the transaction request is determined as the transaction procedure expense in the input information.
In the optional embodiment, in order to improve the enthusiasm stayed away from work without leave on block chain, intelligent contract is motivated using Gas
Mechanism needs payment procedure expense when executing intelligent contract.
The input amount of money is at least carried in the contract transaction request and process of import expense, the input amount of money refer to user
The amount of money that produces for being used to carry out contract transaction inputted by block chain node, the process of import expense refer to that user passes through block
The service charge of chain node input traded for executing contract.It is described intelligence contract input information may include: produce account,
Produce the amount of money, transaction procedure expense (that is, paying the service charge for executing the transaction).Contract by converting UTXO assets is handed over
Easily request is to scheme the input message of the complete intelligent contract of spirit, and the contract for enabling the spirit of UTXO assets calling figure complete is provided
Produce transfer or more more complicated functions.
In an alternative embodiment, the conversion module 202 is also used to receive when block chain node from second
When the transaction request of the Account assets of account, second account is determined as to the account that produces of the intelligent contract, and will
The input amount of money in the transaction request is determined as producing the amount of money in the input information, by the input in the transaction request
Service charge is determined as the transaction procedure expense in the input information.
Calling module 203, for being held by virtual machine call Intelligent target contract instruction corresponding with the input information
The row transaction.
In the present embodiment, the virtual machine is that figure spirit is complete, including calculator and instruction system.
After the input information that contract transaction request is converted to intelligent contract, sends input information in virtual machine and hold
Row.Virtual machine can generate a series of contract state during executing the transaction, for example, the member variable of contract, conjunction
Function entrance address table about, global variable table, static variable table etc..The data structure of these contract states may include letter
Single list also may include complicated multidimensional data structure.Virtual machine these contract states can be converted to key assignments (KV,
Key-Value form) is stored, and is saved in the databases such as Level DB.
The storage address of these contract states can also be returned to block chain network by virtual machine.In the account of block chain network
The corresponding relationship of the transaction ID and storage address that are generated before record in this.
In an alternative embodiment, it is described by UTXO assets with the receipts that carry in the contract transaction request
Enter before the corresponding face amount of the amount of money is split as producing the amount of money and transaction procedure expense, the intelligence contract processing unit 20 further include:
Judgment module 204, for judging the produce the amount of money and transaction procedure expense and value whether greater than described in
Remaining face amount in UTXO assets;
Computing module 205, for producing the amount of money takes with the transaction procedure and value less than the UTXO assets when described
In remaining face amount when, the amount of money and transaction procedure expense and in value and the UTXO assets remaining faces are produced described in calculating
The difference of value;
The computing module 205 is also used to be converted to the amount of money corresponding with the difference in Account assets described
UTXO assets.
In the optional embodiment, the face amount in UTXO account have to be larger than produce the amount of money and transaction procedure expense it is total
With.It, can be by one in Account account when the face amount in UTXO account is less than the summation for producing the amount of money and transaction procedure expense
Partial amount is converted to the corresponding face amount of UTXO account, so that the new face amount in UTXO account, which is greater than, produces the amount of money and transaction hand
The summation to continue to pay dues, to realize the function of the intelligent contract.
Update module 206, the contract state for being returned according to the virtual machine update the UTXO money of first account
The state of production.
In the present embodiment, virtual machine executes the transaction using the input information of the intelligent contract, after execution, is closed
The implementing result of about middle correlation function, contract state shift, and produce new contract state and return to block chain node.
New contract state may include the service condition to the expense of pre-paid.Such as which contract account takes how many expense,
Remaining how many expense.For another example, which contract account has received how many expense.Block chain node returns new according to virtual machine
Contract state updates the state of the UTXO assets of first account.For example, when the intelligent contract that virtual machine executes is to transfer accounts,
Then block chain node updates the remaining sum shape in the initiation account of the contract transaction request according to the balance status that virtual machine returns
State.
In an alternative embodiment, the judgment module 204, is also used to judge whether the transaction procedure expense is greater than
Service charge needed for executing the transaction;
The calling module 203 is also used to execute institute when judgment module 204 judges that the transaction procedure expense is greater than or equal to
When service charge needed for stating transaction, the transaction is executed by the virtual machine;
The calling module 203 is also used to execute the transaction when judgment module 204 judges that the transaction procedure expense is less than
When required service charge, terminates the virtual machine and execute the transaction.
In the optional embodiment, the transaction procedure expense in the input information refers to the expense paid in advance.Due to
Over time, service charge needed for executing the transaction every time may be varied, thus the practical execution friendship
Easily required service charge is uncertain.
Virtual machine needs to judge to input whether transaction procedure expense in information is greater than execution institute when reality executes the transaction
Service charge needed for stating transaction, that is, judge whether the expense of prepayment is able to carry out the transaction.When virtual machine determines the transaction
When service charge needed for service charge is greater than or equal to the execution transaction, it is determined that the expense of prepayment is able to carry out the transaction,
To execute the transaction by virtual machine.The hand needed for virtual machine determines that the transaction procedure expense is less than the execution transaction
When continuing to pay dues, it is determined that the expense of prepayment can not execute the transaction, so that terminating virtual machine executes the transaction.
In an alternative embodiment, service charge needed for the execution transaction is to be determined as follows
:
The Intelligent target contract is called to instruct according to the input amount of money by the virtual machine;
The exchange is executed by calling the service charge for generation of trading described in the Intelligent target contract instruction execution to determine
The service charge needed.
In the optional embodiment, in the input information for receiving intelligent contract, first simulation executes primary virtual machine
The intelligence contract, and the service charge generated during simulation is executed the transaction is as hand needed for executing the transaction
It continues to pay dues.Virtual machine can also show the service charge that simulation generates on block chain node, check for user.Only when input is believed
When transaction procedure in breath is taken greater than service charge needed for executing the transaction, the transaction could be executed.
In an alternative embodiment, after the transaction request is performed, the intelligence contract processing unit 20 is also
Include:
First returns module 207, for extra service charge to be back to first account.
Described first returns module 207, is also used to be back to according to extra one new UTXO of service charge creation
First account.
Reimbursement operation may be implemented during executing intelligent contract in the virtual machine.If the transaction procedure takes
More than or equal to service charge needed for executing the transaction, it is extra or remaining to show that the transaction procedure inputted in information expense has,
It can then be operated by reimbursement, extra or remaining service charge is returned into user.
In an alternative embodiment, when block chain node receives the friendship of the Account assets from the second account
Easily request and after the transaction request is performed, the intelligence contract processing unit 20 further include:
Second returns module 208, for extra service charge to be back to second account or first account.
Illustratively, extra Account assets are back to the second account, or are first converted to Account assets
UTXO assets are returned again into the second account.It, can be with as selecting which kind of mode replaces extra or remaining transaction procedure expense
It presets or adjusts according to actual conditions, to improve the multifunctionality of contract account, promote the usage experience of user.
This implementation intelligent contract processing unit, is converted to exchange by the UTXO assets that will be traded and wants
The input information of the intelligent contract of calling;Pass through virtual machine call Intelligent target contract instruction corresponding with the input information again
Execute the transaction;The shape of the UTXO assets of first account is finally updated according to the contract state that the virtual machine returns
State.The contract for enabling the spirit of UTXO assets calling figure complete carries out assets transfer or more more complicated functions.
Embodiment three
Fig. 3 is the schematic diagram of internal structure for the computer equipment that the embodiment of the present invention discloses.
In the present embodiment, computer equipment 3 can be client, be also possible to Resource Server, can also be other
Electronic equipment.
The computer equipment 3 may include memory 31, processor 32 and bus 33.
Wherein, memory 31 include at least a type of readable storage medium storing program for executing, the readable storage medium storing program for executing include flash memory,
Hard disk, multimedia card, card-type memory (for example, SD or DX memory etc.), magnetic storage, disk, CD etc..Memory 31
It can be the internal storage unit of the computer equipment 3, such as the hard disk of the computer equipment 3 in some embodiments.
Memory 31 is also possible to the External memory equipment of the computer equipment 3, such as the computer in further embodiments
The plug-in type hard disk being equipped in equipment 3, intelligent memory card (Smart Media Card, SMC), secure digital (Secure
Digital, SD) card, flash card (Flash Card) etc..Further, memory 31 can also both include that the computer is set
Standby 3 internal storage unit also includes External memory equipment.Memory 31 can be not only used for storage and be installed on the computer
The application application program and Various types of data of equipment 3, such as the code etc. and modules of intelligent contract processing unit 20, can be with
For temporarily storing the data that has exported or will export.
Specifically, the memory 31 is stored with the multiple modules that can be run by processor 32, for example, conversion module, is used
When receiving the transaction request of the UTXO assets from the first account when block chain node, the UTXO assets that will trade
Be converted to the input information for the intelligent contract that exchange to be called;Calling module, for passing through virtual machine call and the input
It trades described in the corresponding Intelligent target contract instruction execution of information;Update module, the contract for being returned according to the virtual machine
State updates the state of the UTXO assets of first account.
Processor 32 can be in some embodiments a central processing unit (Central Processing Unit,
CPU), controller, microcontroller, microprocessor or other data processing chips, the program for being stored in run memory 31
Code or processing data.
Specifically, the processor 32 realizes following method when executing the program code stored in the memory 31: when
When block chain node receives the transaction request of the UTXO assets from the first account, the UTXO assets that will be traded are converted
For the input information of exchange's intelligent contract to be called;Pass through virtual machine call Intelligent target corresponding with the input information
It trades described in contract instruction execution;The UTXO assets of first account are updated according to the contract state that the virtual machine returns
State.
The bus 33 can be Peripheral Component Interconnect standard (peripheral component interconnect, PCI)
Bus or expanding the industrial standard structure (extended industry standard architecture, EISA) bus etc..It should
Bus can be divided into address bus, data/address bus, control bus etc..Only to be indicated with a thick line in Fig. 3 convenient for indicating, but
It is not offered as only a bus or a type of bus.
Further, the computer equipment 3 can also include network interface, and network interface optionally may include wired
Interface and/or wireless interface (such as WI-FI interface, blue tooth interface), commonly used in the computer equipment 3 and other computers
Communication connection is established between equipment.
Optionally, which can also include user interface, and user interface may include display
(Display), input unit such as keyboard (Keyboard), optional user interface can also include standard wireline interface,
Wireless interface.Optionally, in some embodiments, it is aobvious to can be light-emitting diode display, liquid crystal display, touch control type LCD for display
Show that device and Organic Light Emitting Diode (Organic Light-Emitting Diode, OLED) touch device etc..Wherein, display
Appropriate it can also be known as display screen or display unit, for being shown in the message handled in the computer equipment and being used for
Show visual user interface.
Fig. 3 illustrates only the computer equipment 3 with component 31-33, it will be appreciated by persons skilled in the art that
Structure shown in Fig. 3 does not constitute the restriction to the computer equipment 3, either bus topology, is also possible to star
Structure, the computer equipment 3 can also include than illustrate less perhaps more components perhaps combine certain components or
Different component layouts.Other electronic products that are existing or being likely to occur from now on are such as adaptable to the present invention, should also be included in
Within protection scope of the present invention, and it is incorporated herein by reference.
In the above-described embodiments, can come wholly or partly by application program, hardware, firmware or any combination thereof
It realizes.When being realized using application program, can entirely or partly realize in the form of a computer program product.
The computer program product includes one or more computer instructions.Load and execute on computers the meter
When calculation machine program instruction, entirely or partly generate according to process or function described in the embodiment of the present invention.The computer can
To be general purpose computer, special purpose computer, computer network or other programmable devices.The computer instruction can be deposited
Storage in a computer-readable storage medium, or from a computer readable storage medium to another computer readable storage medium
Transmission, for example, the computer instruction can pass through wired (example from a web-site, computer, server or data center
Such as, coaxial cable, optical fiber, Digital Subscriber Line) or wireless (for example, infrared, wireless, microwave etc.) mode to another website station
Point, computer, server or data center are transmitted.The computer readable storage medium can be computer and can store
Any usable medium either include that the data storages such as one or more usable mediums integrated server, data center are set
It is standby.The usable medium can be magnetic medium (for example, floppy disk, hard disk, tape), optical medium (for example, DVD), or partly lead
Body medium (for example, solid state hard disk (Solid State Disk, SSD)) etc..
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unit
It closes or communicates to connect, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.Some or all of unit therein can be selected to realize the scheme in the present embodiment according to the actual needs
Purpose.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also be realized in the form of function of application unit.
If the integrated unit realized in the form of function of application unit and as independent product sale or
In use, can store in a computer readable storage medium.Based on this understanding, the technical solution sheet of the application
The all or part of the part that contributes to existing technology or the technical solution can be produced in other words with application program in matter
The form of product embodies, which is stored in a storage medium, including some instructions are to make
It obtains a computer equipment (can be personal computer, server or the network equipment etc.) and executes each embodiment of the application
The all or part of the steps of the method.And storage medium above-mentioned includes: USB flash disk, hard disk, read-only memory (Read-Only
Memory, ROM), the various media that can store program code such as magnetic or disk.
It should be noted that the serial number of the above embodiments of the invention is only for description, do not represent the advantages or disadvantages of the embodiments.And
The terms "include", "comprise" herein or any other variant thereof is intended to cover non-exclusive inclusion, so that packet
Process, article or the method for including a series of elements not only include those elements, but also other including being not explicitly listed
Element, or further include for this process, article or the intrinsic element of method.In the absence of more restrictions,
The element limited by sentence "including a ...", it is not excluded that also deposited in process, article or the method for including the element
In other identical element.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.