CN107193672B - Cross-block asynchronous contract calling system - Google Patents

Cross-block asynchronous contract calling system Download PDF

Info

Publication number
CN107193672B
CN107193672B CN201710402925.2A CN201710402925A CN107193672B CN 107193672 B CN107193672 B CN 107193672B CN 201710402925 A CN201710402925 A CN 201710402925A CN 107193672 B CN107193672 B CN 107193672B
Authority
CN
China
Prior art keywords
contract
execution
contract execution
verification
unit
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201710402925.2A
Other languages
Chinese (zh)
Other versions
CN107193672A (en
Inventor
陈小虎
徐卿
李正鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuxi Well Pass Network Technology Co Ltd
Original Assignee
Wuxi Well Pass Network Technology Co Ltd
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 Wuxi Well Pass Network Technology Co Ltd filed Critical Wuxi Well Pass Network Technology Co Ltd
Priority to CN201710402925.2A priority Critical patent/CN107193672B/en
Publication of CN107193672A publication Critical patent/CN107193672A/en
Application granted granted Critical
Publication of CN107193672B publication Critical patent/CN107193672B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Retry When Errors Occur (AREA)

Abstract

A cross-partition asynchronous call contract system, the system comprising: a distributed system verification unit: the system comprises one or more service nodes and a plurality of verification nodes, wherein the verification nodes are used for verifying the commonly identified { TX }; { TX } comprises a contract invocation request TX and a payment request TX; a distributed contract execution unit: the remote server is positioned at the remote end of the local or verification unit, communicates with the verification unit through a predefined protocol, is used for acquiring information required by contract execution, and returns a result to the verification node after the contract execution is finished; contract execution cache unit: the contract execution method comprises the steps of receiving a contract calling request from a verification node, sending the request to a contract execution unit, receiving a contract execution result, and returning a current contract execution state to the verification node so as to realize asynchronous calling of the contract. The block consensus of the system does not depend on the contract execution result, the concurrency of the contract execution and the number of contracts which can be supported by the blocks can be improved, and the fault-tolerant capability of the system is improved.

Description

Cross-block asynchronous contract calling system
Technical Field
The invention relates to the technical field of block chains, in particular to a trans-block asynchronous contract calling system.
Background
The execution of the existing intelligent contract adopts a synchronous mode, contract calling is triggered by transaction or automatically, when the contract is executed specifically, a consensus mechanism of a block chain needs to wait for the contract to be executed completely, and the operation can be continued after a result is returned, so that the consensus on the current block is completed.
The intelligent contract execution mode has the following defects:
(1) the speed of contract execution severely impacts the time of block generation:
since the block consensus depends on the result of contract execution, each node must agree on the result of contract execution, and therefore, the execution speed of the contract directly affects the subsequent operation of the block, resulting in a delay in block generation time.
(2) The speed of contract execution severely impacts the amount of contract execution concurrency that a blockchain can support:
in the case that the frequency of block chain generation is generally approximately fixed, in the same time period, the speed of executing one contract directly affects the execution of other contracts in the same block, and in an extreme case, a malicious contract may cause the system to be unable to process other contracts, resulting in a great reduction in the concurrency of processing contracts.
(3) The fault tolerance during contract execution is limited:
due to the adoption of the synchronous execution mode, the processing of various error conditions during the execution of the contract needs to be considered comprehensively, and the quick processing of various time-sensitive operations is realized, for example, the corresponding processing needs to be carried out on the timeout conditions of various operations.
Some existing solutions, such as etherhouses, use the amount of gas to estimate the computation amount of each contract, and use a total amount of gas of the system to control the total computation amount that the current block can support, so as to ensure that the consensus is completed in time. However, the total number of contracts that the system can support is limited by the total amount gas, and if the codes of the contracts are more and more complex, the number of contracts that the whole system can support is less and less; in addition, the time of consensus in the ether workshop is limited, and the maximum value of gas cannot be greatly increased.
Disclosure of Invention
Aiming at the problems of the existing intelligent contract execution technology, the invention provides a trans-block asynchronous contract calling system, the block consensus of the system does not depend on the contract execution result, the concurrency of contract execution and the number of contracts which can be supported by the block can be improved, and the fault-tolerant capability of the system is improved.
In order to achieve the technical purpose, the technical scheme of the invention is as follows:
a cross-block asynchronous call contract system comprising the following elements:
a distributed system verification unit: the system comprises one or more service nodes and a plurality of verification nodes, wherein the service nodes are used for receiving a transaction request set { TX } submitted by a user, and the verification nodes are used for verifying the transaction request set { TX } which is identified; the set of transaction requests { TX } includes a contract invocation request TX and a payment request TX;
a distributed contract execution unit: the distributed system verification unit is positioned locally or at the far end of the distributed system verification unit, communicates with the distributed system verification unit through a predefined protocol, is used for acquiring information required by contract execution, and returns a result to the verification node after the contract execution is finished;
contract execution cache unit: the contract execution system comprises a contract execution unit, a contract execution unit and a contract execution unit, wherein the contract execution unit is used for receiving the contract calling request from the verification node, sending the contract calling request to the distributed contract execution unit, receiving a contract execution result and returning the current contract execution state to the verification node so as to realize asynchronous calling of a contract;
each verification node corresponds to one or more contract execution cache units and one or more distributed contract execution units;
the system implementation method comprises the following steps:
a, the service node receives transaction requests TX submitted by users, and each verification node collects the TX and assembles a transaction request set { TX }i
B:{TX}iThe contract calling request contained in the contract execution cache unit is sent to the contract execution cache unit, and the contract execution cache unit immediately returns to the current contract execution state after receiving the request;
c, receiving the { TX } at all verification nodesiThen, the { TX }iAfter all verification nodes finish consensus, generating a block i, wherein the verification nodes perform consensus on the { TX }after consensusiVerifying, and writing the verified state into a block i; while each of said verification nodes creates a query contract TXqAnd adds it to the transaction request set { TX } for block (i + k)(i+k)Performing the following steps;
d, when B-C is carried out, the contract execution cache unit sends the contract calling request to the distributed contract execution unit in an asynchronous calling mode, the contract is executed in a background, and after the execution is finished, the contract execution cache unit obtains the final result of the contract execution and waits for processing;
e block (i + k) processing period begins, the { TX }(i+k)The contract calling request contained in the contract execution cache unit is sent to the contract execution cache unit, the contract execution cache unit immediately returns the current contract execution state, and meanwhile, the verification node inquires the contract TXqExtract out ofContract related information and sends a query request to the contract execution cache unit, and the contract execution cache unit returns the execution result of the contract calling request of the block i to the verification node and updates the query contract TXq
F, receiving the { TX } at all verification nodes(i+k)Then, the updated query contract TXqAnd said { TX }(i+k)Combining the two nodes together to form a new set, completing consensus at all verification nodes, generating a block (i + k), verifying the consensus TX by the verification nodes, and writing the verified state into the block (i + k); while each of said verification nodes creates a new query contract TXqAnd adds it to the transaction request set { TX } for block (i + k + k)(i+k+k)Performing the following steps;
g, when E-F is carried out, the contract execution cache unit adopts an asynchronous calling mode to transfer the { TX }(i+k)The contract calling request contained in the contract is sent to the distributed contract execution unit, the contract is executed in a background, and after the execution is finished, the contract execution unit obtains the final result of the contract execution and waits for processing;
wherein i and k are integers greater than or equal to 1, and the i and k are configured as required.
Preferably, the distributed contract execution unit is a sandbox located remotely from the distributed system verification unit and decoupled from the distributed system verification unit.
Specifically, the current contract execution state includes, but is not limited to: not completed, normal execution completed or error.
Preferably, k is 1.
Specifically, the mechanisms employed by the consensus include, but are not limited to: BFT, POW or POS.
Preferably, each verification node corresponds to one contract execution cache unit and one distributed contract execution unit.
The invention takes the block chain system and asynchronous call as the background core technology, and has the following advantages compared with the prior intelligent contract execution technology:
(1) the contract execution and the system consensus unit are isolated, and the contract execution can be at a far end, so that the contract execution no longer occupies the system consensus resource;
(2) the contract execution unit and the system consensus unit are decoupled, so that the contract execution module and the consensus module are relatively independent and support hot plug;
(3) a contract execution cache unit is set between the consensus verification unit and the contract execution unit, an asynchronous call execution mode is creatively adopted in the whole contract execution process, so that the call and execution results of the contract are respectively realized between cross blocks (block i and block (i + k)), and the consensus among all verification nodes can be ensured; the contract asynchronous calling execution mode improves the concurrency of contract execution, the consensus process does not need to wait for the execution result of the contract, and the number of the contracts which can be supported by the block is greatly improved.
(4) The fault tolerance of the whole system is improved, on one hand, the system can set a proper overtime processing mechanism to process contract delay, and on the other hand, a user can configure a proper k value in contract calling to ensure that a contract executed for a long time is correctly processed.
Drawings
Fig. 1 is a schematic diagram of a contract execution and call path in the cross-block asynchronous call contract system according to the embodiment.
Fig. 2 is a schematic diagram of the operating principle of the cross-block asynchronous call contract system according to this embodiment.
Detailed Description
The following detailed description of the present invention is provided by way of example and with reference to the accompanying drawings, but not intended to limit the claims of the present invention in any way.
As shown in fig. 1 to fig. 2, the cross-block asynchronous call contract system of the present embodiment includes the following units:
a distributed system verification unit: the system comprises a service node and N verification nodes, wherein the service node is used for receiving a transaction request set { TX } submitted by a user, and the verification nodes are used for verifying a commonly-identified transaction request set { TX }; the transaction request set { TX } includes a contract invocation request TX and a payment request TX;
a distributed contract execution unit: the sandbox is located at the far end of the distributed system verification unit and is decoupled with the distributed system verification unit; the unit communicates with the verification unit of the distributed system through a predefined protocol, is used for acquiring information required by contract execution, and returns the result to the verification node after the contract execution is finished;
contract execution cache unit: the contract execution system comprises a contract execution unit, a contract execution unit and a contract execution unit, wherein the contract execution unit is used for receiving a contract calling request from a verification node, sending the contract calling request to the distributed contract execution unit, receiving a contract execution result and returning a current contract execution state to the verification node so as to realize asynchronous calling of a contract;
each verification node corresponds to one contract execution cache unit and one distributed contract execution unit; the system comprises N verification nodes, N contract execution cache units and N distributed contract execution units.
The implementation method of the system of the embodiment is as follows:
a, a service node receives a transaction request TX submitted by a user and forwards the transaction request TX to all verification nodes, and each verification node collects the TX and assembles a transaction request set { TX }1
B:{TX}1The contract calling request contained in the contract execution request is sent to a contract execution cache unit, and the contract execution cache unit immediately returns the current contract execution state (including the states of incomplete execution, normal execution completion, error and the like) after receiving the request;
c, receiving { TX } at all verification nodes1Thereafter, since the return state of each contract invocation request TX is definite, { TX }1Consensus may be done at all verification nodes, block 1 generation, verification node pair consensus { TX }1Verifying one by one, and writing the verified state into a block 1; while each verifying node creates a query contract TXqAnd adds it to the transaction request set { TX }for block 22Performing the following steps;
d, when B-C is carried out, the contract execution cache unit sends a contract calling request to the distributed contract execution unit in an asynchronous calling mode, executes the contract in a background, and after the execution is finished, the contract execution cache unit obtains the final result of the contract execution and waits for processing;
e block 2 processing cycle start, { TX }2The contract calling request contained in the contract execution request is sent to a contract execution cache unit, the contract execution cache unit immediately returns the current contract execution state, and meanwhile, the verification node inquires the contract TXqExtracting contract related information, sending a query request to a contract execution cache unit, returning the execution result of the contract calling request of the block 1 to the verification node by the contract execution cache unit, and updating the query contract TXq
F, receiving { TX } at all verification nodes2Later, updated query contracts TXqAnd { TX }2Form a new set together, since each query contract TXqAnd the return state of the contract calling request TX is determined, so that consensus can be completed at all verification nodes, block 2 is generated, the verification nodes verify the commonly-recognized TX, and the verified state is written into the block 2; while each verifying node creates a new query contract TXqAnd adds it to the transaction request set { TX }for block 33Performing the following steps;
g, when E-F is carried out, the contract execution cache unit adopts an asynchronous calling mode to convert { TX }2The contract calling request contained in the contract is sent to a distributed contract execution unit, the contract is executed in a background, and after the execution is finished, the contract execution unit obtains the final result of the contract execution and waits for processing;
the block 3 processing cycle begins and is performed as described above.
In conclusion, the system of the invention adopts a contract asynchronous calling execution mode, so that the calling and execution results of the contract are respectively realized among the cross-block, and meanwhile, the consensus among all the verification nodes can be ensured to be completed, the concurrency of the contract execution is improved, the execution result of the contract does not need to be waited in the process of the consensus, and the number of the contracts which can be supported by the block and the fault-tolerant capability of the whole system are greatly improved; in addition, the contract execution unit and the system consensus unit are decoupled and relatively independent, so that the execution of the contract no longer occupies the resources of the system consensus unit.
It should be understood that the detailed description of the invention is merely illustrative of the invention and is not intended to limit the invention to the specific embodiments described. It will be appreciated by those skilled in the art that the present invention may be modified or substituted equally as well to achieve the same technical result; as long as the use requirements are met, the method is within the protection scope of the invention.

Claims (5)

1. A cross-block asynchronous call contract system comprising the following elements:
a distributed system verification unit: the system comprises one or more service nodes and a plurality of verification nodes, wherein the service nodes are used for receiving a transaction request set { TX } submitted by a user, and the verification nodes are used for verifying the transaction request set { TX } which is identified; the set of transaction requests { TX } includes a contract invocation request TX and a payment request TX;
a distributed contract execution unit: the distributed system verification unit is positioned locally or at the far end of the distributed system verification unit, communicates with the distributed system verification unit through a predefined protocol, is used for acquiring information required by contract execution, and returns a result to the verification node after the contract execution is finished;
contract execution cache unit: the contract execution system comprises a contract execution unit, a contract execution unit and a contract execution unit, wherein the contract execution unit is used for receiving the contract calling request from the verification node, sending the contract calling request to the distributed contract execution unit, receiving a contract execution result and returning the current contract execution state to the verification node so as to realize asynchronous calling of a contract;
each verification node corresponds to one or more contract execution cache units and one or more distributed contract execution units;
the system implementation method comprises the following steps:
a, the service node receives transaction requests TX submitted by users, and each verification node collects the TX and assembles a transaction request set { TX }i
B the { TX }iIn which comprisesThe contract calling request is sent to the contract execution cache unit, and the contract execution cache unit immediately returns to the current contract execution state after receiving the request;
c, receiving the { TX } at all verification nodesiThen, the { TX }iAfter all verification nodes finish consensus, generating a block i, wherein the verification nodes perform consensus on the { TX }after consensusiVerifying, and writing the verified state into a block i; while each of said verification nodes creates a query contract TXqAnd adds it to the transaction request set { TX } for block (i + k)(i+k)Performing the following steps;
d, when B-C is carried out, the contract execution cache unit sends the contract calling request to the distributed contract execution unit in an asynchronous calling mode, the contract is executed in a background, and after the execution is finished, the contract execution cache unit obtains the final result of the contract execution and waits for processing;
e block (i + k) processing period begins, the { TX }(i+k)The contract calling request contained in the contract execution cache unit is sent to the contract execution cache unit, the contract execution cache unit immediately returns the current contract execution state, and meanwhile, the verification node inquires the contract TXqExtracting contract related information, sending a query request to the contract execution cache unit, returning the execution result of the contract calling request of the block i to the verification node by the contract execution cache unit, and updating the query contract TXq
F, receiving the { TX } at all verification nodes(i+k)Then, the updated query contract TXqAnd said { TX }(i+k)Combining the two nodes together to form a new set, completing consensus at all verification nodes, generating a block (i + k), verifying the consensus TX by the verification nodes, and writing the verified state into the block (i + k); while each of said verification nodes creates a new query contract TXqAnd adds it to the transaction request set { TX } for block (i + k + k)(i+k+k)Performing the following steps;
g, when E-F is carried out, the contract execution cache unit adopts an asynchronous calling mode to carry out E-FThe { TX }(i+k)The contract calling request contained in the contract is sent to the distributed contract execution unit, the contract is executed in a background, and after the execution is finished, the contract execution unit obtains the final result of the contract execution and waits for processing;
wherein i and k are integers greater than or equal to 1, and k is configured as required.
2. The cross-partition asynchronous call contract system of claim 1, wherein: the distributed contract execution unit is a sandbox which is located at the remote end of the distributed system verification unit and is decoupled from the distributed system verification unit.
3. The cross-partition asynchronous call contract system of claim 1, wherein: the current contract execution state includes, but is not limited to: not completed, normal execution completed or error.
4. The cross-partition asynchronous call contract system of claim 1, wherein: and k is 1.
5. The cross-partition asynchronous call contract system of claim 1, wherein: the mechanisms employed by the consensus include, but are not limited to: BFT, POW or POS.
CN201710402925.2A 2017-05-31 2017-05-31 Cross-block asynchronous contract calling system Active CN107193672B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710402925.2A CN107193672B (en) 2017-05-31 2017-05-31 Cross-block asynchronous contract calling system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710402925.2A CN107193672B (en) 2017-05-31 2017-05-31 Cross-block asynchronous contract calling system

Publications (2)

Publication Number Publication Date
CN107193672A CN107193672A (en) 2017-09-22
CN107193672B true CN107193672B (en) 2020-01-14

Family

ID=59876857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710402925.2A Active CN107193672B (en) 2017-05-31 2017-05-31 Cross-block asynchronous contract calling system

Country Status (1)

Country Link
CN (1) CN107193672B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107807991B (en) * 2017-11-07 2020-05-12 泰康保险集团股份有限公司 Method and apparatus for processing blockchain data
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN109146679B (en) * 2018-06-29 2023-11-10 创新先进技术有限公司 Intelligent contract calling method and device based on block chain and electronic equipment
CN109118364A (en) * 2018-08-27 2019-01-01 深圳前海益链网络科技有限公司 Method, apparatus, computer equipment and the storage medium of asynchronous execution intelligence contract
CN109271255A (en) * 2018-09-25 2019-01-25 深圳市元征科技股份有限公司 Resource regulating method, system and electronic equipment and storage medium
CN109495516A (en) * 2019-01-07 2019-03-19 国网江苏省电力有限公司无锡供电分公司 Electric power internet-of-things terminal cut-in method based on block chain
CN111383031B (en) * 2020-05-29 2020-09-22 支付宝(杭州)信息技术有限公司 Intelligent contract execution method and system in block chain and electronic equipment
CN115174067A (en) * 2022-07-07 2022-10-11 中国电信股份有限公司 Transaction processing method, blockchain node and blockchain network

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630609A (en) * 2016-02-24 2016-06-01 杭州复杂美科技有限公司 Block chain packing and storing method
CN106504091A (en) * 2016-10-27 2017-03-15 上海亿账通区块链科技有限公司 The method and device that concludes the business on block chain
CN106533696A (en) * 2016-11-18 2017-03-22 江苏通付盾科技有限公司 Block chain-based identity authentication methods, authentication server and user terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170140408A1 (en) * 2015-11-16 2017-05-18 Bank Of America Corporation Transparent self-managing rewards program using blockchain and smart contracts

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630609A (en) * 2016-02-24 2016-06-01 杭州复杂美科技有限公司 Block chain packing and storing method
CN106504091A (en) * 2016-10-27 2017-03-15 上海亿账通区块链科技有限公司 The method and device that concludes the business on block chain
CN106533696A (en) * 2016-11-18 2017-03-22 江苏通付盾科技有限公司 Block chain-based identity authentication methods, authentication server and user terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链渐行渐近;何广锋,;《中国外汇》;20161231;50-52 *

Also Published As

Publication number Publication date
CN107193672A (en) 2017-09-22

Similar Documents

Publication Publication Date Title
CN107193672B (en) Cross-block asynchronous contract calling system
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
CN101699405B (en) Method and device for interaction between host program and plug-in and interaction between plug-ins
CN111277639B (en) Method and device for maintaining data consistency
CN112446786A (en) Abnormal transaction processing method and device, electronic equipment and readable storage medium
CN106648936A (en) Cooperative processing method and system based on microservices and server
CN111260474B (en) Asset transaction method, device, equipment, system and storage medium of cross-blockchain
CN107436799B (en) Method and device for realizing consistency of distributed transactions
EP3113020A1 (en) Data processing device and method for processing serial tasks
CN110677383B (en) Firewall wall opening method and device, storage medium and computer equipment
CN105677675B (en) Method for processing business and device
CN111859832B (en) Chip simulation verification method and device and related equipment
CN102929698A (en) Task re-judgment method and system
CN108415757A (en) distributed transaction processing method and device
CN113377875A (en) Cross-link data processing method and device, electronic equipment and readable storage medium
CN112596801A (en) Transaction processing method, device, equipment, storage medium and database
CN111127088A (en) Method, device, computer equipment and storage medium for realizing final consistency
CN105450737B (en) A kind of data processing method, device and system
CN109491768A (en) A kind of distributed transaction method for dynamically processing and system based on subtransaction stream
CN113312362B (en) Block chain data modification method, device, equipment and storage medium
KR102342752B1 (en) Apparatus and method for consensus based on blockchain
CN110445848B (en) Method and apparatus for transaction processing
CN110008010B (en) System calling method, device, equipment and readable storage medium
CN110442475B (en) Method and device for realizing distributed consistency group and DRM (digital rights management) equipment
CN111754348A (en) Scene combined transaction method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant