[go: up one dir, main page]

CN116566576A - Contract ordering executing method in multi-chain parallel structure - Google Patents

Contract ordering executing method in multi-chain parallel structure Download PDF

Info

Publication number
CN116566576A
CN116566576A CN202310534557.2A CN202310534557A CN116566576A CN 116566576 A CN116566576 A CN 116566576A CN 202310534557 A CN202310534557 A CN 202310534557A CN 116566576 A CN116566576 A CN 116566576A
Authority
CN
China
Prior art keywords
contract
request
chain
execution
sorter
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.)
Pending
Application number
CN202310534557.2A
Other languages
Chinese (zh)
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.)
Anhui Zhongke Lattice Technology Co ltd
Original Assignee
Anhui Zhongke Lattice 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 Anhui Zhongke Lattice Technology Co ltd filed Critical Anhui Zhongke Lattice Technology Co ltd
Priority to CN202310534557.2A priority Critical patent/CN116566576A/en
Publication of CN116566576A publication Critical patent/CN116566576A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a contract ordering execution method in a multi-chain parallel structure, which comprises the following steps: s1, starting a contract request by an account link point, and for the contract deployment request, S21, distributing contract sorters of the contract through a host selecting service; s22, inquiring contract sorters distributed by the selected main service in the deployment stage of the contract through the selected main service for contract execution requests; s3, sending a contract request to a contract sorter of the contract; s4, after receiving the contract request, the contract sorter adds the corresponding contract request into a list to be sorted; s5, sorting the contract transactions in the list according to the current list to be sorted by the contract sorter according to the time sequence, and then sequentially packing according to the actual deployment or actual execution program of the contract transaction completion contract to generate a contract transaction block and broadcasting, S6, receiving the contract transaction block by other nodes, verifying execution and updating the account book. The contract transaction can be completed without execution of a daemon chain, and the efficiency is high.

Description

Contract ordering executing method in multi-chain parallel structure
Technical Field
The invention relates to the field of blockchains, in particular to a contract ordering executing method in a multi-chain parallel structure.
Background
The traditional block chain is a single chain composed of blocks, and can only be written in sequence according to the time synchronization of the out blocks. The blockchain based on the DAG structure is a network formed by transactions, supports asynchronous concurrency accounting and mutual authentication, and has obvious advantages in expandability and transaction speed compared with the traditional single-chain blockchain structure. As in patent application No. 202111086285.1, specifically disclosed is a system based on DAG blockchain structure of account chain and daemon chain, comprising: a sender account chain, a receiver account chain, and a daemon chain; the sender account chain is used for creating a transaction sending block when a transaction needs to be initiated, carrying out private key signing on the transaction sending block to obtain a signature transaction sending block, and broadcasting the signature sending transaction block; the receiver account chain is used for creating a transaction receiving block after the signature transaction sending block is witnessed in an account chain witness network, and a first block key is established between the transaction receiving block and the transaction sending block; the sender account chain is further used for sending transfer transactions based on the transaction sending block; the receiver account chain is further configured to receive the transfer transaction based on the transaction receiving block; the daemon chain is used for acquiring the first current state information of the transaction sending block and the second current state information of the transaction receiving block, packaging the first current state information and the second current state information, and storing the packaged first current state information and the packaged second current state information so as to daemon the transfer transaction. The sender account chain is further used for creating a contract deployment block when contracts need to be deployed, and issuing contract transactions through the contract deployment block; the daemon chain is further used for performing contract deployment according to the contract deployment block; the receiver account chain is further used for creating a contract execution block when the contract needs to be executed, creating a second block key between the contract deployment block and the contract execution block, and calling the contract transaction through the contract execution block; the daemon chain is further used for executing the contract according to the contract executing block, acquiring third current state information of the contract deploying block and fourth current state information of the contract executing block, packaging the third current state information and the fourth current state information, and storing the packaged third current state information and the fourth current state information to complete a contract calling flow. Optionally, the daemon chain comprises: creating a block and a daemon block; the creation block is used for starting the daemon chain and storing configuration information of the daemon chain; the daemon block is used for acquiring third current state information of the contract deployment block and fourth current state information of the contract execution block, packaging the third current state information and the fourth current state information, and storing the packaged third current state information and the fourth current state information so as to finish daemon of an account chain. Optionally, the sender account chain is further configured to establish a first cross-link pointing to the daemon block based on the transaction sending block when creating the transaction sending block, and establish a second cross-link pointing to the daemon block based on the contract deployment block when creating the contract deployment block; the receiver account chain is further used for establishing a third cross-link which points to the daemon block based on the transaction receiving block when the transaction receiving block is established, and establishing a fourth cross-link which points to the daemon block based on the contract executing block when the contract executing block is established; the daemon chain is further used for acquiring the first current state information based on the first cross-link, acquiring the second current state information based on the second cross-link, acquiring the third current state information based on the third cross-link and acquiring the fourth current state information based on the fourth cross-link to complete the common knowledge daemon of the transaction sending block, the transaction receiving block, the contract deployment block and the contract execution block. Optionally, the sender account chain, the receiver account chain, and the daemon chain form a directed acyclic schema chain structure based on the first blockkey, the second blockkey, the first crosslink, the second crosslink, the third crosslink, and the fourth crosslink.
In addition, patent application No. 2021111360890, 2021114045559 also describes a blockchain system of such DAG architecture.
In a DAG blockchain supporting smart contracts, the generation and invocation of smart contracts is issued by account nodes on an account chain, which is a multi-chain parallel transaction structure. When different account chains call a contract at the same time, multiple chains can read or change the data in the contract at the same time, thereby leading to the failure to confirm the final state.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The present invention is directed to solving the above-mentioned problems, and provides a method for executing contract ordering in a multi-chain parallel structure.
In order to achieve the above object, the technical scheme of the present invention is as follows:
a method of executing contract ordering in a multi-chain parallel structure, comprising a master service, the master service being responsible for assigning contract orderers, the contract orderers being responsible for transacting ordering assigned to their own contracts, the method comprising the steps of:
s1, an account chain node initiates a contract request, wherein the contract request comprises a contract deployment request and a contract execution request;
step S2 is performed in two cases: for a contract deployment request, the steps of: s21, distributing contract sorters of the contracts through a main selecting service;
for a contract execution request, the execution steps are: s22, inquiring contract sorters distributed by the main selecting service in the deployment stage of the contract through the main selecting service;
s3, sending a contract request to a contract sorter of the contract;
s4, after receiving the contract request, the contract sorter judges whether the contract is used as the contract sorter or not, if so, the contract request is added into a list to be sorted; if not, not adding the list to be ordered;
s5, sorting the contract transactions in the list according to the current list to be sorted by a contract sorter according to the time sequence, and then sequentially completing actual deployment or actual execution program of the contracts according to the contract transactions, packaging to generate contract transaction blocks and broadcasting;
s6, other nodes receive the contract transaction block, verify and execute, and update the account book.
Further, only designated contract sorters may transact sorting of the corresponding contracts, and only witness nodes may be entitled to act as contract sorters.
In step S21, if the contract does not call other contracts, selecting the main service to select the witness node with the smallest pressure as the contract sorter; if other contracts are invoked, the same witness node is selected as the contract sequencer assuming that the contract sequencers of the invoked other contracts are the same.
After the master service distributes the contract sequencer, the distribution result is uploaded to the block chain.
After successful assignment by the contract sequencer, the order of subsequent transactions with respect to the contract is sequenced by the assigned contract sequencer.
After the selected main service distributes contract sorters, the distribution result is uplink and can be searched on the link.
In addition, the invention also provides a contract sorting execution system in the multi-chain parallel structure, which comprises a selected main module, wherein the selected main module provides a contract sorter distributing service to distribute a unique contract sorter of a certain contract, and the selected main module also provides a query contract sorter service to provide the unique contract sorter of the query contract to the outside or the inside.
In addition, the invention also provides a contract ordering executing device in the multi-chain parallel structure, which comprises the following components: the system comprises a memory, a processor and a contract ordering executing program in a multi-chain parallel structure which is stored in the memory and can run on the processor, wherein the contract ordering executing program in the multi-chain parallel structure is configured with a contract ordering executing method for realizing the multi-chain parallel structure.
The invention also provides a storage medium, wherein the storage medium stores a contract ordering execution program in a multi-chain parallel structure, and the contract ordering execution program in the multi-chain parallel structure realizes a contract ordering execution method in the multi-chain parallel structure when being executed.
By adopting the technical scheme, the invention has the following advantages:
1. the intelligent contract transaction can be completed without execution of a daemon chain, and the efficiency is high.
2. The invention solves the problem that the final state can not be confirmed when the contract data is changed by multi-chain parallel calling.
3. The invention is also applicable to the scenario of confirming the final state of the contract when reading the contract of the information on the chain and other contract data and carrying out multi-chain parallel calling.
Drawings
FIG. 1 is a schematic flow chart of the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Example 1: in order to solve the problem that the final state cannot be confirmed due to the fact that contracts are called and contract data are changed in a multi-chain parallel mode, the invention provides a contract ordering executing method in a multi-chain parallel structure.
The invention is configured with a selected main service, a service interface layer in a block chain structure, and is responsible for distributing proper contract sorters, and the contract sorters sort contracts, relatively deploy and execute programs.
If the contract does not call other contracts, selecting the witness node with the minimum pressure as the contract sequencer; if the contract invokes another contract, the same witness node is selected as the contract sorter assuming that the contract sorters of the invoked other contracts are the same. Only designated contract sorters may transact sorting of the corresponding contracts, only witness nodes may be entitled to act as contract sorters.
After the main service is selected to allocate the proper contract sorter, the allocation result is uplink, can be searched on the link and the contract sorter is informed of the allocation result.
The contract sequencer allocated by the selected main service is unique, and after the contract sequencer is allocated successfully, the sequence of the subsequent transaction of the contract is sequenced by the allocated contract sequencer, so that the contract sequencer is not changed.
The election service is also responsible for providing a query service, either external or internal, to query a contract sorter for a contract assignment.
The intelligent contract deployment and execution of the present invention is accomplished in an account chain. Thus, both the contract orderer, as well as the related nodes, in the present invention refer to nodes in the account chain.
The invention relates to a contract ordering executing method in a multi-chain parallel structure, which comprises the following steps:
s1, an account chain node initiates a contract request, wherein the contract request comprises a contract deployment request and a contract execution request;
step S2 is performed in two cases: for a contract deployment request, the steps of: s21, distributing contract sorters of the contracts through a main selecting service;
for a contract execution request, the execution steps are: s22, inquiring contract sorters distributed by the main selecting service in the deployment stage of the contract through the main selecting service;
s3, sending a contract request to a contract sorter of the contract;
s4, after receiving the contract request, the contract sorter judges whether the contract is used as the contract sorter or not, if so, the contract request is added into a list to be sorted; if not, not adding the list to be ordered;
s5, sorting the contract transactions in the list according to the current list to be sorted by a contract sorter according to the time sequence, and then sequentially completing actual deployment or actual execution program of the contracts according to the contract transactions, packaging to generate contract transaction blocks and broadcasting;
s6, other nodes receive the contract transaction block, verify and execute, and update the account book.
According to the invention, the contract deployment request and the contract execution request are initiated through the account chain node, the main selection service is used, the intelligent contract transaction can be completed without being executed through a daemon chain, the efficiency is high, and the final state can be well confirmed when the contracts are called and the contract data are changed in parallel by multiple chains.
As shown in fig. 1, specifically, the contract deployment procedure of the present invention is as follows:
D1.Node0, initiating a contract deployment request by an accountkey account to generate a contract deployment block D;
D2. the contract sorter of the selected main service selects the witness Node1 and notifies the witness Node1 of the result;
d3.Node1 adds D into the to-be-ordered list cArray;
D4.Node1 generates a contract transaction block C1 according to the current list cArray and broadcasts;
D5. and C1, the other nodes receive the C1, verify and execute, and update the account book.
The contract execution flow of the invention is as follows:
the Node0 initiates a contract execution request by an accountekey account, and calls a D generation contract execution block E1; at this time, node2, the saintkey account also initiates a contract execution request, calls D to generate a contract execution block E2;
E2. inquiring the contract sequencer of D as Node1 by selecting the main service, and sending a contract execution request to Node1;
E3.Node1 receives two transactions, judges that the transactions are carried out by a contract sorter, and adds E1 and E2 into a to-be-sorted list cArray;
e4.node1 sequentially packages and broadcasts E1, E2 to a contract transaction block C2 according to the current list cArray;
E5. and C2, the other nodes receive the C, verify and execute, and update the account book.
It should be noted that the above-described working procedure is merely illustrative, and does not limit the scope of the present invention, and in practical application, a person skilled in the art may select part or all of them according to actual needs to achieve the object of the present invention, which is not limited herein.
Example 2: in addition, the embodiment of the invention also provides a contract sorting execution system in the multi-chain parallel structure, which comprises a selected main module, wherein the selected main module provides a contract sorter distributing service to distribute a unique contract sorter of a contract for a certain contract, and the selected main module also provides a contract sorter inquiring service to inquire the unique contract sorter of the contract externally or internally.
In addition, the present embodiment is merely a basic description of the contract ordering executing system in the multi-chain parallel structure of the present invention, and technical details not described in detail in the present embodiment may refer to the method provided in any embodiment of the present invention, which is not described herein again.
Example 3: it will be apparent to those skilled in the art that the system and method of the above embodiments may be implemented by software plus a necessary general purpose hardware platform, but may also be implemented by hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. Read Only Memory)/RAM, magnetic disk, optical disk) and including several instructions for causing a terminal device (which may be a mobile phone, a computer, a node packaging device, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The present invention also provides a contract ordering execution apparatus in a multi-chain parallel structure, comprising: the system comprises a memory, a processor and a contract ordering executing program in a multi-chain parallel structure which is stored in the memory and can run on the processor, wherein the contract ordering executing program in the multi-chain parallel structure is configured with a contract ordering executing method for realizing the multi-chain parallel structure.
In addition, the invention also provides a storage medium, wherein the storage medium stores a contract ordering execution program in a multi-chain parallel structure.
Since, in a real situation, when a device or a program is deployed, the execution of a certain program may be to perform all steps, or may be to perform only a certain step, and implement all steps by cooperation of a plurality of programs,
therefore, the contract ordering executing program in the multi-chain parallel structure realizes all or a certain flow in the contract ordering executing method in the multi-chain parallel structure when being executed.
The foregoing description of the preferred embodiments of the present invention should not be taken as limiting the scope of the invention, but rather should be understood to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the invention as defined by the following description and drawings.

Claims (8)

1. A method of executing contract ordering in a multi-chain parallel architecture, comprising a master service, the master service being responsible for assigning contract orderers, the contract orderers being responsible for transacting orders for contracts assigned to themselves, the method comprising the steps of:
s1, an account chain node initiates a contract request, wherein the contract request comprises a contract deployment request and a contract execution request;
step S2 is performed in two cases: for the contract deployment request, executing step S21, distributing contract sorters of the contract through the host selecting service;
for the contract execution request, executing step S22, inquiring a contract sequencer distributed by the selected main service in the deployment stage of the contract through the selected main service;
s3, sending a contract request to a contract sorter of the contract;
s4, after receiving the contract request, the contract sorter judges whether the contract is used as the contract sorter or not, if so, the contract request is added into a list to be sorted; if not, not adding the list to be ordered;
s5, sorting the contract transactions in the list according to the current list to be sorted by a contract sorter according to the time sequence, and then sequentially completing actual deployment or actual execution program of the contracts according to the contract transactions, packaging to generate contract transaction blocks and broadcasting;
s6, other nodes receive the contract transaction block, verify and execute, and update the account book.
2. The method of claim 1, wherein only designated contract sorters can transact the respective contracts, and only witness nodes are entitled to act as contract sorters.
3. The method according to claim 1, wherein in step S21, if the contract does not call other contracts, selecting the master service selects the witness node with the smallest pressure as the contract sorter; if other contracts are invoked, the same witness node is selected as the contract sequencer assuming that the contract sequencers of the invoked other contracts are the same.
4. The method of claim 1, wherein after successful allocation by the contract sequencer, the order of subsequent transactions with respect to the contract is sequenced by the allocated contract sequencer.
5. The method of claim 1, wherein the master service, after assigning the contract sequencer, links the assignment result to be searchable on the link.
6. A contract ordering execution system in a multi-chain parallel architecture, comprising a selection master module that provides an assign contract ranker service to assign a unique contract ranker of a contract to the contract, the selection master module further providing a query contract ranker service to provide a unique contract ranker of a query contract to the outside or inside.
7. A contract ordering execution device in a multi-chain parallel structure, characterized by comprising a memory, a processor and a contract ordering execution program in a multi-chain parallel structure stored on the memory and executable on the processor, the contract ordering execution program in the multi-chain parallel structure being configured to implement the contract ordering execution method in the multi-chain parallel structure as claimed in any one of claims 1 to 5.
8. A storage medium, wherein a contract ordering execution program in a multi-chain parallel structure is stored on the storage medium, and when executed, the contract ordering execution program in the multi-chain parallel structure implements the contract ordering execution method in the multi-chain parallel structure according to any one of claims 1 to 5.
CN202310534557.2A 2023-05-12 2023-05-12 Contract ordering executing method in multi-chain parallel structure Pending CN116566576A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310534557.2A CN116566576A (en) 2023-05-12 2023-05-12 Contract ordering executing method in multi-chain parallel structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310534557.2A CN116566576A (en) 2023-05-12 2023-05-12 Contract ordering executing method in multi-chain parallel structure

Publications (1)

Publication Number Publication Date
CN116566576A true CN116566576A (en) 2023-08-08

Family

ID=87487475

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310534557.2A Pending CN116566576A (en) 2023-05-12 2023-05-12 Contract ordering executing method in multi-chain parallel structure

Country Status (1)

Country Link
CN (1) CN116566576A (en)

Similar Documents

Publication Publication Date Title
CN109325854B (en) Block chain network, deployment method and storage medium
CN112598525B (en) Intelligent contract clustering parallel block chain implementation method and device
CN111612614A (en) Public link-based sub-chain service system
CN112199186B (en) Data processing method, device, equipment and storage medium based on intelligent contract
CN112965974B (en) Data sharing method, node, terminal and system based on blockchain
CN113434283B (en) Service scheduling method and device, server and computer readable storage medium
CN112463211A (en) System architecture transformation method compatible with multiple development architectures and system architecture
CN111861481A (en) Block chain account checking method and system
CN111158703A (en) Chain based intelligent contract chain management method
CN109885612A (en) The synchronization take-effective method and device of block chain intelligence contract
CN112767168B (en) Super account book parallel processing method and parallel processing device based on blockchain
CN113377652A (en) Test data generation method and device
CN109413202A (en) The ordering system and method for block chain Transaction Information
CN113194143B (en) Block chain account creating method and device and electronic equipment
CN116566576A (en) Contract ordering executing method in multi-chain parallel structure
CN114995162A (en) Multi-robot task assignment method, device, electronic device and storage medium
CN114493602A (en) Block chain transaction execution method and device, electronic equipment and storage medium
CN108765138A (en) Object, fund allocation and transfer method and device
CN114119224B (en) Smart contract non-incremental sorting execution method, system, device and storage medium based on DAG structure of account chain and guardian chain
CN111400399A (en) Account book synchronization method and device of block chain system and hardware equipment
CN110113217A (en) Micro services management method, device, management platform and storage medium
CN113837754B (en) System and method for DAG block chain structure based on account chain and daemon chain
US7159012B2 (en) Computational data processing system and computational process implemented by means of such a system
CN113205424B (en) Method and apparatus for deploying and invoking contracts in blockchain
CN112001800A (en) Method and device for processing service in block chain system

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