[go: up one dir, main page]

CN114283010A - Multi-main-chain cross-chain method based on multi-main-chain two-layer network state tree - Google Patents

Multi-main-chain cross-chain method based on multi-main-chain two-layer network state tree Download PDF

Info

Publication number
CN114283010A
CN114283010A CN202111668206.8A CN202111668206A CN114283010A CN 114283010 A CN114283010 A CN 114283010A CN 202111668206 A CN202111668206 A CN 202111668206A CN 114283010 A CN114283010 A CN 114283010A
Authority
CN
China
Prior art keywords
transaction
chain
sequence
transactions
main chain
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.)
Granted
Application number
CN202111668206.8A
Other languages
Chinese (zh)
Other versions
CN114283010B (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.)
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Hangzhou Fuzamei 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 Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN202111668206.8A priority Critical patent/CN114283010B/en
Publication of CN114283010A publication Critical patent/CN114283010A/en
Application granted granted Critical
Publication of CN114283010B publication Critical patent/CN114283010B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a multi-main-chain cross-chain method, computer equipment and a storage medium based on a multi-main-chain two-layer network state tree, wherein the method comprises the following steps: when the first main chain block is detected to be generated by the first main chain, synchronizing first transactions in the first main chain block, which need to call the first type of contracts, in sequence; performing the following operations for each first transaction: performing the first transaction to update an asset tree of a second user initiating the first transaction on a two-tier network, a second user root hash of the second user, and a two-tier network tree root; responding to a triggered settlement condition, generating zero-knowledge proof evidence according to second transaction information of each second transaction in sequence, and generating first proof data according to each second transaction and the zero-knowledge proof evidence in sequence; first proof data is sent to each backbone. The application prevents double flowers on the basis of saving cost.

Description

Multi-main-chain cross-chain method based on multi-main-chain two-layer network state tree
Technical Field
The application relates to the technical field of block chains, in particular to a multi-main-chain cross-chain method based on a multi-main-chain two-layer network state tree, computer equipment and a storage medium.
Background
Current link-crossing schemes based on two-layer networks are generally one-to-one, with one two-layer network corresponding to one backbone. The applicant wishes to propose a cross-link scheme for a two-layer network with multiple backbones, which is more cost-effective than the prior art, but also has the problem of double flowers.
Disclosure of Invention
In view of the above-mentioned deficiencies or inadequacies in the prior art, it would be desirable to provide a multi-backbone cross-link method, computer device, and storage medium based on a multi-backbone two-layer network state tree that prevents double flower on a cost effective basis.
In a first aspect, the present invention provides a multi-main-chain cross-link method based on a multi-main-chain two-layer network state tree suitable for nodes of a two-layer network, the two-layer network is configured with a multi-main-chain two-layer network state tree, the multi-main-chain two-layer network state tree is configured with asset trees corresponding to each main chain of each user, a two-layer network root of the two-layer network is generated according to a first user root hash of each first user, the first user root hash is generated according to the first asset tree root of the asset tree of each main chain of the first user, each main chain is configured with a cross-link verification contract, a zero-knowledge verification circuit for verifying transaction information is deployed in the cross-link verification contract, a transaction requiring a first type of contract is saved to the main chain when the transaction is successfully executed by the main-chain node of each main chain, the first type of contract includes a deposit contract and a withdrawal contract, and the method includes:
when the first main chain block is detected to be generated by the first main chain, synchronizing first transactions in the first main chain block, which need to call the first type of contracts, in sequence; the first main chain block is also used for providing main chain nodes of other main chains:
synchronizing each first transaction in sequence when a first main chain block is monitored through a block generation contract;
when the packaging right of the latest second main chain block to be generated of the main chain is obtained, the second main chain block comprising the first transactions in sequence is generated, and the second main chain block is broadcasted to other main chain nodes of the main chain so as to be used by the other main chain nodes of the main chain:
judging whether the sequence of the first transactions in the second main chain block is the same as the sequence of the synchronized first transactions:
otherwise, rejecting the second main chain block;
performing the following operations for each first transaction: performing the first transaction to update an asset tree of a second user initiating the first transaction on a two-tier network, a second user root hash of the second user, and a two-tier network tree root;
responding to a triggered settlement condition, generating zero-knowledge proof evidence according to second transaction information of each second transaction in sequence, and generating first proof data according to each second transaction and the zero-knowledge proof evidence in sequence;
sending the first proof data to each backbone for the backbone nodes of each backbone:
and judging whether the sequence of the second transactions in the first certification data is the same as the sequence of the stored second transactions through the cross-link verification contract:
if the sequence is the same, inputting the zero-knowledge proof into the zero-knowledge proof circuit to verify whether each second transaction message is correct:
if the verification is correct, ending;
the second transaction information comprises an operation type, a user address and a number of certificates.
In a second aspect, the present invention also provides an apparatus comprising one or more processors and memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a multi-backbone cross-chain method based on a multi-backbone two-layer network state tree provided according to embodiments of the present invention.
In a third aspect, the present invention further provides a storage medium storing a computer program, the computer program enabling a computer to execute the multi-backbone cross-linking method based on the multi-backbone two-layer network state tree according to the embodiments of the present invention.
According to the multi-main-chain cross-chain method based on the multi-main-chain two-layer network state tree, the computer equipment and the storage medium, provided by the embodiments of the invention, when it is monitored that the first main-chain block is generated by the first main-chain, the first transactions of the first type of contracts, which need to be called, in the first main-chain block are synchronized in sequence; performing the following operations for each first transaction: performing the first transaction to update an asset tree of a second user initiating the first transaction on a two-tier network, a second user root hash of the second user, and a two-tier network tree root; responding to a triggered settlement condition, generating zero-knowledge proof evidence according to second transaction information of each second transaction in sequence, and generating first proof data according to each second transaction and the zero-knowledge proof evidence in sequence; the method of sending the first certification data to each main chain prevents double blossom on a cost-saving basis.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a multi-backbone cross-link method based on a multi-backbone two-layer network state tree according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a multi-backbone two-layer network state tree.
Fig. 3 is a schematic diagram of a multi-master-chain two-layer network state tree according to an embodiment of the present invention.
Fig. 4 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of a multi-backbone cross-link method based on a multi-backbone two-layer network state tree according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a multi-main-chain cross-link method based on a multi-main-chain two-layer network state tree suitable for nodes of a two-layer network, the two-layer network is configured with the multi-main-chain two-layer network state tree, the multi-main-chain two-layer network state tree is configured with asset trees corresponding to each main chain of each user, a two-layer network root of the two-layer network is generated according to a first user root hash of each first user, the first user root hash is generated according to a first asset tree root of the asset tree of each main chain of the first user, each main chain is configured with a cross-link verification contract, a zero-knowledge verification circuit for verifying transaction information is deployed in the cross-link verification contract, a transaction requiring a first type of contract is verified to the main chain when executed successfully by the main chain node of each main chain, the first type of contract includes a deposit contract, a withdrawal contract, the method comprising:
s11: when the first main chain block is detected to be generated by the first main chain, synchronizing first transactions in the first main chain block, which need to call the first type of contracts, in sequence; the first main chain block is also used for providing main chain nodes of other main chains:
synchronizing each first transaction in sequence when a first main chain block is monitored through a block generation contract;
when the packaging right of the latest second main chain block to be generated of the main chain is obtained, the second main chain block comprising the first transactions in sequence is generated, and the second main chain block is broadcasted to other main chain nodes of the main chain so as to be used by the other main chain nodes of the main chain:
judging whether the sequence of the first transactions in the second main chain block is the same as the sequence of the synchronized first transactions:
otherwise, rejecting the second main chain block;
s12: performing the following operations for each first transaction: performing the first transaction to update an asset tree of a second user initiating the first transaction on a two-tier network, a second user root hash of the second user, and a two-tier network tree root;
s13: responding to a triggered settlement condition, generating zero-knowledge proof evidence according to second transaction information of each second transaction in sequence, and generating first proof data according to each second transaction and the zero-knowledge proof evidence in sequence;
s14: sending the first proof data to each backbone for the backbone nodes of each backbone:
and judging whether the sequence of the second transactions in the first certification data is the same as the sequence of the stored second transactions through the cross-link verification contract:
if the sequence is the same, inputting the zero-knowledge proof into the zero-knowledge proof circuit to verify whether each second transaction message is correct:
if the verification is correct, ending;
the second transaction information comprises an operation type, a user address and a number of certificates.
Current link-crossing schemes based on two-layer networks are generally one-to-one, with one two-layer network corresponding to one backbone. The applicant wishes to propose a cross-chaining scheme in which a two-layer network corresponds to a plurality of backbones. When the prior art is combined with a chain-crossing scheme in which a two-layer network corresponds to a plurality of main chains, it is relatively easy to construct a tree structure as shown in fig. 2. Fig. 2 is a schematic diagram of a multi-backbone two-layer network state tree. As shown in fig. 2, the state tree of the two-layer network is constructed in a structure that one main chain corresponds to one tree.
Assume a total of several main chains (A chain, B chain, C chain … …); assets tokenA1 and tokenA2 run on the chain A, assets tokenB1 and tokenB2 run on the chain B, and assets … … run on the chain C; users such as user A and user B hold tokenA 1;
as shown in fig. 1, on the two-layer network, there are a state tree TreeA of a chain a, a state tree TreeB of a chain B, a state tree TreeC of a chain C, TreeA, TreeB, TreeC … …;
as can be seen, the id root of tokenA1 is generated according to the balance of tokenA1 held by users such as user a and user b; the A chain root is generated by id root of tokenA1 and id root … … of tokenA 2; the root is generated according to the A chain root and the B chain root … …;
if user A also holds tokenB1 on the B chain and tokenC1 on the C chain, then user accounts need to be configured on both TreeB and TreeC.
When the user A needs to search the assets, the user A needs to search in TreeA, TreeB and TreeC … … respectively, which is very inconvenient.
Applicants desire more convenient user asset retrieval and therefore construct the multi-backbone two-tier network state tree shown in FIG. 3; fig. 3 is a schematic diagram of a multi-master-chain two-layer network state tree according to an embodiment of the present invention. As shown in fig. 3, in this embodiment, the present invention provides a multi-main-chain two-layer network state tree, where asset trees corresponding to users in main chains are respectively configured on a two-layer network, a root of the two-layer network is generated according to a first user root hash of each first user, and the first user root hash is generated according to a first asset tree root of the asset tree of the first user in each main chain.
Specifically, the first asset tree root is generated as an example according to the account balance of each certificate of the first user on the first main chain where the first asset tree root is located;
also assume that there are a total of several backbones (A chain, B chain, C chain … …); assets tokenA1 and tokenA2 run on the chain A, assets tokenB1 and tokenB2 run on the chain B, and assets … … run on the chain C; users have tokenA1, tokenA 2;
as shown in fig. 2, taking user a as an example, a two-layer network is configured with an asset tree of a chain a, an asset tree of a chain B, and an asset tree of a chain C … …; the root of the two-layer network tree of the two-layer network is generated according to the root hash of each user (namely the id root of the user A, the id root of the user B and the id root … … of the user C), the id root of the user A is generated according to the asset tree roots (namely the A chain root, the B chain root and the C chain root … …) of the asset tree of each main chain, and the asset tree root (taking the A chain root as an example) is generated according to the account balance (namely tokenA1 id balance and tokenA2 id balance … …) of each certificate of the A chain asset tree of the user A.
When the user A needs to retrieve the assets, the assets can be directly searched on the A chain asset tree of the user A, and the method is very convenient.
The embodiment shown in fig. 1 is illustrated in the following hypothetical scenario:
supposing that 3 main chains (chain A, chain B and chain C) are provided, wherein assets tokenA1 and tokenA2 run on the chain A, assets tokenA B1 and tokenA B2 run on the chain B, and asset tokenC runs on the chain C; the first main chain is an A chain, main chain nodes of the A chain generate a main chain block (100) according to tx 1-tx 10 in sequence, wherein tx1 and tx2 are transactions needing to call a first type of contract;
the main chain node of the A chain generates a main chain block (100) _ A comprising tx1 and tx2, and tx1 and tx2 are stored on the A chain;
the nodes of the two-layer network execute step S11, and synchronize tx1 and tx2 in sequence when detecting that the a chain generates block (100) _ a;
main chain nodes of the B chain and the C chain synchronize tx1 and tx2 in sequence when detecting that the A chain generates a block (100) through a block generation contract;
taking the B chain as an example, assuming that the latest main chain block to be generated by the B chain is block (100) _ B, B1 obtains the packing right of block (100) _ B;
b1 generates a block (100) _ B comprising tx1 and tx2 in sequence and broadcasts the block to B2-B10;
b2 to B10 determine whether the order of tx1 and tx2 in block (100) _ B is the same as the order of tx1 and tx2 to be synchronized:
assuming the same, tx1, tx2 are present on the B chain; those skilled in the art should understand that the subsequent steps of B2-B10 may also be configured according to actual requirements, for example, configured to delete the synchronized tx1, tx2 when block (100) _ B consensus succeeds; the subsequent steps can release the storage space of B2-B10 and prevent B2-B10 from packing tx1 and tx2 subsequently; for B2-B10, if tx1 and tx2 are packed subsequently, memory consumption is needed to delete the packed tx1 and tx2 in a duplicate checking manner;
if different, block (100) _ B is rejected;
the operation of the main chain node of the C chain is similar to that of the main chain node of the B chain, and the description is omitted;
the node of the two-layer network performs step S12, taking tx1 as an example, and performs tx1 to update the asset tree of the user a on the two-layer network (i.e., update the tokenA1 id base of the user a and the a-chain root of the user a), the root hash of the user a (i.e., the id root of the user a) and the root of the two-layer network tree; similarly, tx2 is executed to update the asset tree of user B on the two-tier network (i.e., update the token nA2 id balance of user B and the A-chain root of user B), the root hash of user B (i.e., the id root of user B) and the two-tier network tree root;
assume that each second transaction in order is tx1, tx2, tx 11-tx 20;
responding to the triggered settlement condition, executing a step S13 by the nodes of the two-layer network, generating proof of zero knowledge proof1 according to the transaction information of tx1, tx2 and tx11 to tx20 in sequence, and generating proof data proofchunk1 according to tx1, tx2, tx11 to tx20 and proof 1; in further embodiments, the condition for triggering settlement may be configured according to actual requirements, for example, configured to achieve the same technical effect when the time is the first time since the last settlement, or configured to receive the settlement request;
the node of the two-layer network executes the step S14, and sends proofchunk1 to the a chain, the B chain, and the C chain;
the main chain nodes of the A chain, the B chain and the C chain judge whether the sequence of tx1, tx2 and tx11 to tx20 in proofchunk1 is the same as the sequence of the stored tx1, tx2 and tx11 to tx20 through a cross-chain verification contract or not:
assuming the same sequence, the main chain nodes of the A chain, the B chain and the C chain input proof1 into a zero-knowledge proof circuit to verify whether the transaction information of tx1, tx2, tx11 to tx20 is correct:
assuming the verification is correct, the process is ended.
It should be noted that tx1 and tx2 are transactions synchronized from the a chain, and assuming tx11 to tx20 are transactions synchronized from the B chain, then:
for the A chain, the main chain node of each main chain judges whether the sequence of tx1 and tx2 in proofchunk1 is the same as the sequence of the stored tx1 and tx 2;
for the B chain, the main chain node of each main chain judges whether the sequence of tx11 to tx20 in proofchunk1 is the same as the sequence of the stored tx11 to tx 20;
assuming that each transaction in the proofchunk1 is tx1, tx11, tx2, tx12 to tx20, as long as the sequence of the transaction information of tx1 and tx2 is tx1 → tx2 and the sequence of the transaction information of tx11 to tx20 is tx11 → tx20 in the transaction information of the main chain node certificate of each main chain, the main chain node verification sequence of each main chain is the same;
in more embodiments, the transaction information may also be configured according to actual requirements, for example, configured as a user address, an asset type, an asset quantity, an operation type, and the like, so that the same technical effect may be achieved;
the embodiment enables a plurality of main chains to maintain a common account book on a two-layer network, thereby saving the cost; and only on the basis of correct transaction sequence and transaction information, the two-layer network can continue to operate normally, so that double flowers are prevented.
Preferably, the method further comprises:
when the monitored sequence is incorrect or the verification is incorrect, rolling back each asset tree of each user on the two-layer network to a state when each second transaction is not executed;
and returning to the step of generating the zero-knowledge proof evidence according to the second transaction information of the second transactions in sequence so as to regenerate the zero-knowledge proof evidence and the first proof data.
When the sequence of the A chain, the B chain and the C chain is monitored to be incorrect, or the verification is incorrect, the nodes of the two-layer network roll back the asset trees of the users to the state when tx1, tx2, tx 11-tx 20 are not executed;
the nodes of the two-layer network return the step of generating zero-knowledge proof evidence according to the second transaction information of the second transactions in sequence so as to regenerate proof1 and proof 1;
it will be understood by those skilled in the art that assuming tx21 is also executed on the two-tier network, tx21 requires the execution of one or more transactions via tx1, tx2, tx11 to tx20, then tx21 should also be rolled back when rolling back the asset trees of the users.
Preferably, before generating the zero-knowledge proof evidence according to the second transaction information of the second transactions in sequence, the method further includes:
receiving third transactions which are generated by a plurality of clients and need to call the second type of contracts; wherein the second type of contract comprises a transfer contract and a cross-chain transfer contract;
performing the following operations for each third transaction: performing a third transaction to update an asset tree of a third user initiating the third transaction on the two-layer network, an asset tree of a fourth user receiving the asset specified by the third transaction, a third user root hash of the third user, a fourth user root hash of the fourth user, and a two-layer network tree root;
determining, by the cross-link validation contract, whether the order of the second transactions in the first attestation data is the same as the order of the second transactions deposited includes:
and judging whether the sequence of the second transactions except the third transaction in the first certification data is the same as the sequence of the stored second transactions through the cross-link verification contract.
Specifically, the backbone nodes of the present application are configured to receive transactions of a first type of contract generated by a client, while the nodes of the two-tier network are configured to receive transactions of a second type of contract generated by the client.
In connection with the embodiment shown in FIG. 3, assume that tx 11-tx 15 are third transactions invoking contracts of a second type, and tx 16-tx 20 are first transactions invoking contracts of a first type synchronized from a block (101) of an A-chain; it can be seen that the nodes of the two-layer network are synchronized to tx1 and tx2 from block (100) of the a chain, then sequentially receive tx11 to tx15, and sequentially synchronize to tx16 to tx20 from block (101) of the a chain; the order of transactions is thus tx1, tx2, tx11 to tx 20; accordingly, the sequence of transactions to which the backbone nodes of the B-chain and the C-chain are synchronized is tx1, tx2, tx16 to tx 20.
For tx1, tx2, tx11 to tx 20: the main chain nodes of the A chain, the B chain and the C chain only verify whether the sequence of tx1, tx2, tx16 to tx20 is correct or not.
Those skilled in the art will appreciate that the transaction information for the third transaction that invokes the second type of contract should also include the asset type.
Preferably, generating the first proof data from the sequential second transaction, zero knowledge proof of knowledge proofs comprises:
generating first proof data according to each second transaction, the two-layer network tree root and the zero-knowledge proof evidence in sequence;
determining, by the cross-link verification contract, whether the order of the second transactions in the first attestation data matches the second transaction information stored to verify whether the order of the second transactions in the first attestation data is correct comprises:
calculating a first tree root according to each second transaction and a last stored two-layer network tree root through a cross-link verification contract, and updating the stored two-layer network tree root when the first tree root is the same as the two-layer network tree root; and the number of the first and second groups,
and judging whether the sequence of each second transaction in the first certification data is matched with the stored second transaction information through the cross-link verification contract so as to verify whether the sequence of each second transaction in the first certification data is correct.
Specifically, proofchunk1 also includes a root; assume the root value is R1;
calculating root 'of the last stored root (namely the last root, and assuming that the value of the root is R2) according to tx1, tx2 and tx 11-tx 20 by a cross-chain verification contract, and assuming that the value of the root' is R3; if R1 ═ R3, then the stored root value is updated from R2 to R1; and the number of the first and second groups,
whether the sequence of tx1, tx2 and tx11 to tx20 in the proofchunk1 is matched with the stored transaction information of tx1, tx2 and tx11 to tx20 is judged through a cross-chain verification contract so as to verify whether the sequence of tx1, tx2 and tx11 to tx20 in the proofchunk1 is correct.
Preferably, generating the first proof data from the sequential second transaction, zero knowledge proof of knowledge proofs comprises:
generating first proof data according to the second transaction information and the zero-knowledge proof evidence of each second transaction in sequence;
determining, by the cross-link validation contract, whether the order of the second transactions in the first attestation data is the same as the order of the second transactions deposited includes:
judging whether each second transaction information in the first certification data is matched with each second transaction stored in the first certification data through the cross-link verification contract;
if the sequence is the same, inputting the zero-knowledge proof into the zero-knowledge proof circuit to verify whether the second transaction information includes:
and if the transaction information is matched with the transaction information, inputting the zero-knowledge proof into a zero-knowledge proof circuit to verify whether the second transaction information is correct or not.
The above-described embodiment reduces the data amount of the first certification data.
Preferably, the nodes of the two-layer network pay a plurality of deposit on each main chain, and the main chain nodes of each main chain deduct a first amount of deposit when monitoring the sequence is incorrect or verification is incorrect.
The embodiment punishs the nodes of the two-layer network, and further prevents double flowers.
As shown in fig. 4, as another aspect, the present application also provides an apparatus including one or more Central Processing Units (CPUs) 401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the device 400 are also stored. The CPU401, ROM402, and RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (7)

1. A multi-main chain cross-chain method based on multi-main chain two-layer network state tree is characterized in that a multi-main chain two-layer network state tree is configured on a two-layer network, asset trees corresponding to the users in the main chains are respectively configured on the multi-main-chain two-layer network state tree, the two-layer network tree root of the two-layer network is generated according to the Hash of the first user root of each first user, the first user root hash is generated from a first asset tree root of an asset tree of the first user at each main chain, each main chain is configured with a cross-chain verification contract, the zero-knowledge proof circuit for verifying transaction information is deployed in the cross-chain verification contract, the transaction of the first type of contract needs to be verified to the main chain when the transaction is successfully executed by the main chain nodes of the main chains, the first type of contracts comprise deposit contracts and withdrawal contracts, the method is suitable for nodes of a two-layer network, and the method comprises the following steps:
when the first main chain block is detected to be generated by the first main chain, sequentially synchronizing first transactions in the first main chain block, which need to call the first type of contracts; wherein the first backbone block is further configured to provide backbone nodes of each of the other backbones:
synchronizing each of the first transactions in order upon monitoring the first backbone block via a block generation contract;
when the packaging right of the latest second main chain block to be generated of the main chain is obtained, the second main chain block comprising the first transactions in sequence is generated, and the second main chain block is broadcasted to other main chain nodes of the main chain so as to be used by the other main chain nodes of the main chain:
judging whether the sequence of each first transaction in the second main chain block is the same as the synchronized sequence of each first transaction:
otherwise, rejecting the second main chain block;
performing the following for each of the first transactions: performing the first transaction to update an asset tree of a second user initiating the first transaction on a two-tier network, a second user root hash of the second user, and the two-tier network tree root;
responding to a triggered settlement condition, generating zero-knowledge proof evidence according to second transaction information of each second transaction in sequence, and generating first proof data according to each second transaction and the zero-knowledge proof evidence in sequence;
sending the first proof data to each backbone for the backbone nodes of each backbone:
determining, by the cross-link verification contract, whether an order of each of the second transactions in the first attestation data is the same as an order of each of the second transactions that are attested:
if the sequence is the same, the zero-knowledge proof is input into the zero-knowledge proof circuit to verify whether each second transaction message is correct:
if the verification is correct, ending;
the second transaction information comprises an operation type, a user address and a number of certificates.
2. The method of claim 1, further comprising:
when the monitored sequence is incorrect or the verification is incorrect, rolling back each asset tree of each user on the two-layer network to a state when each second transaction is not executed;
and returning to the step of generating the zero-knowledge proof evidence according to the second transaction information of the second transactions in sequence so as to regenerate the zero-knowledge proof evidence and the first proof data.
3. The method of claim 1, wherein before generating the zero proof of knowledge proof from the second transaction information of the second transactions in the sequence, further comprising:
receiving third transactions which are generated by a plurality of clients and need to call the second type of contracts; wherein the second type of contract comprises a transfer contract and a cross-chain transfer contract;
performing the following for each of the third transactions: performing the third transaction to update an asset tree of a third user initiating the third transaction on a two-layer network, an asset tree of a fourth user receiving assets specified by the third transaction, a third user root hash of the third user, a fourth user root hash of the fourth user, and the two-layer network tree root;
the determining, by the cross-chain validation contract, whether an order of the second transactions in the first attestation data is the same as an order of the second transactions deposited includes:
and judging whether the sequence of the second transactions except the third transaction in the first certification data is the same as the sequence of the stored second transactions through the cross-chain verification contract.
4. The method of claim 1, wherein generating first proof data from the zero knowledge proof of evidence for each of the second transactions in the sequence comprises:
generating first proof data according to each second transaction, the two-layer network tree root and the zero-knowledge proof evidence in sequence;
the determining, by the cross-chain verification contract, whether the order of each of the second transactions in the first attestation data matches the stored second transaction information to verify whether the order of each of the second transactions in the first attestation data is correct comprises:
calculating a first tree root from each of the second transactions and the last stored two-tier network tree root by the cross-link validation contract, and updating the stored two-tier network tree roots when the first tree root is the same as the two-tier network tree root; and the number of the first and second groups,
and judging whether the sequence of each second transaction in the first certification data is matched with the stored second transaction information through the cross-link verification contract so as to verify whether the sequence of each second transaction in the first certification data is correct.
5. The method of claim 1, wherein generating first proof data from the zero knowledge proof of evidence for each of the second transactions in the sequence comprises:
generating first proof data according to second transaction information of each second transaction in sequence and the zero-knowledge proof evidence;
the determining, by the cross-chain validation contract, whether an order of the second transactions in the first attestation data is the same as an order of the second transactions deposited includes:
judging whether each second transaction information in the first certification data is matched with each second transaction stored in the first certification data or not through the cross-link verification contract;
if the sequence is the same, inputting the zero-knowledge proof into the zero-knowledge proof circuit to verify whether each second transaction message is correct comprises:
and if the transaction information is matched with the second transaction information, inputting the zero-knowledge proof into the zero-knowledge proof circuit to verify whether the second transaction information is correct or not.
6. A computer device, the device comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-5.
7. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-5.
CN202111668206.8A 2021-12-31 2021-12-31 Multi-main-chain crossing method based on multi-main-chain two-layer network state tree Active CN114283010B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111668206.8A CN114283010B (en) 2021-12-31 2021-12-31 Multi-main-chain crossing method based on multi-main-chain two-layer network state tree

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111668206.8A CN114283010B (en) 2021-12-31 2021-12-31 Multi-main-chain crossing method based on multi-main-chain two-layer network state tree

Publications (2)

Publication Number Publication Date
CN114283010A true CN114283010A (en) 2022-04-05
CN114283010B CN114283010B (en) 2024-05-24

Family

ID=80879370

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111668206.8A Active CN114283010B (en) 2021-12-31 2021-12-31 Multi-main-chain crossing method based on multi-main-chain two-layer network state tree

Country Status (1)

Country Link
CN (1) CN114283010B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115063125A (en) * 2022-06-13 2022-09-16 杭州复杂美科技有限公司 Layer 2 network-based NFT application method, computer equipment and storage medium
CN118200014A (en) * 2024-04-12 2024-06-14 中证信息技术服务有限责任公司 Cross-chain verification system and method based on two-layer network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020258848A1 (en) * 2019-06-28 2020-12-30 创新先进技术有限公司 Method and apparatus for cross-chain transmission of resources
CN113592476A (en) * 2021-08-02 2021-11-02 杭州复杂美科技有限公司 Cross-chain asset transfer method, computer device, and storage medium
CN113592475A (en) * 2021-08-02 2021-11-02 杭州复杂美科技有限公司 Cross-chain asset transfer method, computer device, and storage medium
CN113657900A (en) * 2021-07-13 2021-11-16 中国人民银行数字货币研究所 A cross-chain transaction verification method, system and cross-chain transaction system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020258848A1 (en) * 2019-06-28 2020-12-30 创新先进技术有限公司 Method and apparatus for cross-chain transmission of resources
CN113657900A (en) * 2021-07-13 2021-11-16 中国人民银行数字货币研究所 A cross-chain transaction verification method, system and cross-chain transaction system
CN113592476A (en) * 2021-08-02 2021-11-02 杭州复杂美科技有限公司 Cross-chain asset transfer method, computer device, and storage medium
CN113592475A (en) * 2021-08-02 2021-11-02 杭州复杂美科技有限公司 Cross-chain asset transfer method, computer device, and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
叶少杰;汪小益;徐才巢;孙建伶;: "BitXHub:基于侧链中继的异构区块链互操作平台", 计算机科学, no. 06, 15 June 2020 (2020-06-15) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115063125A (en) * 2022-06-13 2022-09-16 杭州复杂美科技有限公司 Layer 2 network-based NFT application method, computer equipment and storage medium
CN118200014A (en) * 2024-04-12 2024-06-14 中证信息技术服务有限责任公司 Cross-chain verification system and method based on two-layer network

Also Published As

Publication number Publication date
CN114283010B (en) 2024-05-24

Similar Documents

Publication Publication Date Title
US11824996B2 (en) Parachain data synchronization method, device and storage medium
CN111405019B (en) Data processing method, data processing device, computer equipment and storage medium
CN109492013B (en) Data processing method, device and system applied to database cluster
CN110597907A (en) Cross-block-chain data information synchronization method, device, equipment and medium
CN111091429A (en) Electronic bill identification distribution method and device and electronic bill generation system
CN110083745B (en) Data query method, device and storage medium
CN114283010A (en) Multi-main-chain cross-chain method based on multi-main-chain two-layer network state tree
CN109005208B (en) Method and device for pushing information
CN114266665B (en) Contract multi-main chain crossing method, equipment and storage medium
WO2022206438A1 (en) Method and apparatus for providing cross-chain message
CN111798238A (en) Parallel chain consensus method, device and storage medium
CN111245910A (en) Block chain light node multi-copy deployment method
CN114202425B (en) Oracle multi-main chain cross-chain method, device and storage medium
CN109345249A (en) A kind of payment fail processing method and device
CN113177843A (en) Cross-bank loan service processing method and device based on block chain
CN113850578B (en) Method, system, equipment and storage medium for value circulation on chain under DAG structure based on account chain and daemon chain
CN111524011B (en) Parallel link consensus validation method, apparatus, and storage medium
CN112258184B (en) Method, apparatus, electronic device and readable storage medium for freezing blockchain network
CN114138903B (en) Multi-main-chain cross-chain method, computer device and storage medium
CN114219646A (en) Multi-main chain two-layer network state tree, multi-main chain cross-chain method
CN117764728A (en) Method, device, equipment and storage medium for cross-contract calling of blockchain
CN117527243A (en) Block chain consensus method, device, computer readable medium and electronic equipment
CN113592653A (en) Proxy delayed transaction method, computer device and storage medium
CN115002183B (en) Information generation method, device, electronic equipment, medium and program product
CN111798239A (en) Parallel chain consensus method, device and storage medium

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