CN112948495B - Parallel chain constant block output method, computer device and storage medium - Google Patents

Parallel chain constant block output method, computer device and storage medium Download PDF

Info

Publication number
CN112948495B
CN112948495B CN202110245530.2A CN202110245530A CN112948495B CN 112948495 B CN112948495 B CN 112948495B CN 202110245530 A CN202110245530 A CN 202110245530A CN 112948495 B CN112948495 B CN 112948495B
Authority
CN
China
Prior art keywords
chain
block
transaction
parallel chain
parallel
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
CN202110245530.2A
Other languages
Chinese (zh)
Other versions
CN112948495A (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 CN202110245530.2A priority Critical patent/CN112948495B/en
Publication of CN112948495A publication Critical patent/CN112948495A/en
Application granted granted Critical
Publication of CN112948495B publication Critical patent/CN112948495B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention provides a parallel chain constant block outputting method, computer equipment and a storage medium, wherein the method comprises the following steps: in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and executing the following steps for each first transaction respectively: when the first transaction is a non-cross-chain parallel chain transaction, judging whether the first block height and a first non-cross-chain block packing parameter of a first parallel chain to which the first transaction belongs meet a first block packing rule of the first parallel chain: if not, the first transaction is stored in the memory pool again; if yes, packaging the first transaction into a first block; when the first transaction is a cross-chain parallel chain transaction, judging whether the first block height and the cross-chain block packaging parameter meet a second block packaging rule of the cross-chain transaction: if not, the first transaction is stored in the memory pool again; if so, the first transaction is packed into the first block. The application stabilizes the exchange peak and reduces the handling charge.

Description

Parallel chain constant block output method, computer device and storage medium
Technical Field
The application relates to the technical field of parallel chains, in particular to a parallel chain constant block output method, computer equipment and a storage medium.
Background
In the existing main chain parallel chain architecture, parallel chain transactions of different parallel chains are mixed into a main chain block, and the parallel chains filter own transactions according to own titles.
The mechanism leads to increase of parallel chain transactions in a certain period, and a large number of parallel chain transactions squeeze packaging resources of main chain transactions, thus causing block chain network congestion; the handling fee of the consensus transaction depends on the network congestion condition, and the above mechanism causes the handling fee waste problem for the parallel chain transaction of the consensus transaction type which is not urgent for the uplink.
Disclosure of Invention
In view of the above-described deficiencies or inadequacies in the prior art, it would be desirable to provide a parallel chain constant block-out method, computer apparatus, and storage medium that levels off peak exchange and reduces commission fees.
In a first aspect, the present invention provides a parallel chain constant block output method suitable for a main chain node, in which a chain-crossing block packing parameter for cross-chain parallel chain transaction and a non-chain-crossing block packing parameter for non-cross-chain parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packing parameter is different from the non-chain-crossing block packing parameter, and the non-chain-crossing block packing parameters are different from each other, the method includes:
in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and executing the following steps for each first transaction respectively:
when the first transaction is a non-cross-chain parallel chain transaction, judging whether the first block height and a first non-cross-chain block packing parameter of a first parallel chain to which the first transaction belongs meet a first block packing rule of the first parallel chain:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into a first block;
when the first transaction is a cross-chain parallel chain transaction, judging whether the first block height and the cross-chain block packaging parameter meet a second block packaging rule of the cross-chain transaction:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into a first block;
wherein, the inter-chain block packing parameter and each non-inter-chain block packing parameter are further used for providing the parallel chain node of each first parallel chain:
judging whether the packing parameters of the first block height and the cross-chain type block meet a second block packing rule:
if yes, caching the cross-chain type parallel chain transaction of the parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the parallel chain meet a third block packing rule of the parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, the first block head of the first block is synchronized.
In a second aspect, the present invention provides a parallel chain constant block output method suitable for parallel chain nodes, where a chain-crossing block packing parameter for cross-chain parallel chain transaction and a non-chain-crossing block packing parameter for non-cross-chain parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packing parameter is different from the non-chain-crossing block packing parameter, and the non-chain-crossing block packing parameters are different from each other, the method includes:
obtaining a first block of a main chain; the first block is packed with a plurality of first transactions, the packed first transactions comprise a plurality of first transactions which are pulled from a memory pool in response to the main chain node obtaining the packing right of the first block with the first block height, when the first transactions are non-cross-chain type parallel chain transactions, the packed first transactions are transactions of which the first block height and the first non-cross-chain type block packing parameter of the first parallel chain to which the first transactions belong meet a first block packing rule of the first parallel chain, and when the first transactions are cross-chain type parallel chain transactions, the packed first transactions are transactions of which the first block height and the cross-chain type block packing parameter meet a second block packing rule of the cross-chain type transactions;
judging whether the packing parameters of the first block height and the cross-chain type block meet a second block packing rule:
if yes, caching the cross-chain type parallel chain transaction of the current parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the current parallel chain meet a third block packing rule of the current parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, the first block head of the first block is synchronized.
In a third aspect, the present invention provides a parallel chain constant block output method suitable for a main chain node, where a chain-crossing block packing parameter for cross-chain parallel chain transaction and a non-chain-crossing block packing parameter for non-cross-chain parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packing parameter is different from the non-chain-crossing block packing parameter, and the non-chain-crossing block packing parameters are different from each other, and the method is suitable for the main chain node, and the method includes:
receiving first parallel chain transactions of non-cross-chain classes, and storing the first parallel chain transactions to a first non-cross-chain class parallel chain transaction cache queue of the first parallel chain;
receiving a second parallel chain transaction of the cross-chain class, and storing the second parallel chain transaction to a cross-chain class parallel chain transaction cache queue;
in response to obtaining the packing right of the first block with the first block height, determining a cross-chain type parallel chain transaction cache queue or a second non-cross-chain type parallel chain transaction cache queue of the transaction to be pulled according to the first block height, a pre-configured block packing rule, cross-chain type block packing parameters and non-cross-chain type block packing parameters;
pulling a plurality of transactions from the cross-chain type parallel chain transaction buffer queue or a second non-cross-chain type parallel chain transaction buffer queue to generate a first block;
wherein, the inter-chain block packing parameter and each non-inter-chain block packing parameter are further used for providing the parallel chain node of each first parallel chain:
judging whether the first block height and the cross-chain type block packaging parameter meet a second block packaging rule of cross-chain type transaction:
if yes, caching the cross-chain type parallel chain transaction of the parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the parallel chain meet a third block packing rule of the parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, the first block head of the first block is synchronized.
In a fourth aspect, the present invention provides a parallel chain constant block outputting method suitable for parallel chain nodes, where a chain-crossing type block packing parameter of a chain-crossing type parallel chain transaction and a non-chain-crossing type block packing parameter of a non-chain-crossing type parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing type block packing parameter is different from the non-chain-crossing type block packing parameter, the non-chain-crossing type block packing parameters are different from each other, the first parallel chain transaction of a non-chain-crossing type is stored in a first non-chain-crossing type parallel chain transaction cache queue of a first parallel chain to which the first parallel chain transaction belongs by the main chain node, and the chain-crossing type parallel chain transaction is stored in a chain-crossing type parallel chain transaction cache queue by the main chain node, where the method is suitable for parallel chain nodes, and the method includes:
obtaining a first block of a main chain; the first block is generated by a main chain node in response to the packaging right of the first block with the first block height, according to a plurality of transactions pulled from the determined cross-chain type parallel chain transaction cache queue or the second non-cross-chain type parallel chain transaction cache queue, and the cross-chain type parallel chain transaction cache queue or the second non-cross-chain type parallel chain transaction cache queue is determined according to the first block height, the pre-configured block packaging rule, the cross-chain type block packaging parameter and each non-cross-chain type block packaging parameter;
judging whether the first block height and the cross-chain type block packaging parameter meet a second block packaging rule of cross-chain type transaction:
if yes, caching the cross-chain type parallel chain transaction of the current parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the current parallel chain meet a third block packing rule of the current parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, the first block head of the first block is synchronized.
In a fifth aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a parallel chain constant out-of-block method provided according to embodiments of the present invention.
In a sixth aspect, the present invention further provides a storage medium storing a computer program, the computer program causing a computer to execute the parallel chain constant block out method provided according to the embodiments of the present invention.
Embodiments of the present invention provide a parallel chain constant block output method, a computer device, and a storage medium, by pulling a number of first transactions from a memory pool in response to obtaining a packing right of a first block height, and performing, respectively for each first transaction: when the first transaction is a non-cross-chain parallel chain transaction, judging whether the first block height and a first non-cross-chain block packing parameter of a first parallel chain to which the first transaction belongs meet a first block packing rule of the first parallel chain: if not, the first transaction is stored in the memory pool again; if yes, packaging the first transaction into a first block; when the first transaction is a cross-chain parallel chain transaction, judging whether the first block height and the cross-chain block packaging parameter meet a second block packaging rule of the cross-chain transaction: if not, the first transaction is stored in the memory pool again; if yes, the first transaction is packed into the first block, so that the exchange of the transaction peak is suppressed, and the handling fee is reduced.
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 parallel chain constant block output method according to an embodiment of the present invention.
Fig. 2 is a flowchart of another parallel chain constant block output method according to an embodiment of the present invention.
Fig. 3 is a flowchart of another parallel chain constant block output method according to an embodiment of the present invention.
Fig. 4 is a flowchart of another parallel chain constant block output method according to an embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a computer device 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 parallel chain constant block output method according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a parallel chain constant block output method suitable for a main chain node, where a chain-crossing block packing parameter of a chain-crossing parallel chain transaction and a non-chain-crossing block packing parameter of a non-chain-crossing parallel chain transaction of each parallel chain are recorded on the main chain, the chain-crossing block packing parameter is different from the non-chain-crossing block packing parameter, and the non-chain-crossing block packing parameters are different from each other, where the method includes:
s12: in response to obtaining packaging rights for a first block of a first block height, pull a number of first transactions from a memory pool,
performing, separately for each first transaction:
s141: when the first transaction is a non-cross-chain parallel chain transaction, judging whether the first block height and a first non-cross-chain block packing parameter of a first parallel chain to which the first transaction belongs meet a first block packing rule of the first parallel chain:
otherwise, step S142 is executed: the first transaction is stored in the memory pool again;
if yes, go to step S143: packaging the first transaction into a first block;
s144: when the first transaction is a cross-chain parallel chain transaction, judging whether the first block height and the cross-chain block packaging parameter meet a second block packaging rule of the cross-chain transaction:
otherwise, step S145 is executed: the first transaction is stored in the memory pool again;
if yes, go to step S146: packaging the first transaction into a first block;
wherein, the inter-chain block packing parameter and each non-inter-chain block packing parameter are further used for providing the parallel chain node of each first parallel chain:
judging whether the packing parameters of the first block height and the cross-chain type block meet a second block packing rule:
if yes, caching the cross-chain type parallel chain transaction of the parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the parallel chain meet a third block packing rule of the parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, the first block head of the first block is synchronized.
Specifically, the step of determining whether the first block height and the first non-inter-chain type block packing parameter of the first parallel chain to which the first transaction belongs satisfy the first block packing rule of the first parallel chain includes "calculating a first remainder of the first block height and a first numerical value; judging whether the first remainder is the same as a non-cross-chain type block packing parameter of a parallel chain to which the first transaction belongs, and judging whether the height of the first block and the cross-chain type block packing parameter meet a second block packing rule of the cross-chain type transaction comprises calculating the first remainder; judging whether the first remainder is the same as the packing parameter of the cross-chain block, and judging whether the height of the first block and the packing parameter of the cross-chain block meet the second block packing rule comprises calculating the first remainder; judging whether the first remainder is the same as the packing parameter of the cross-chain type block, and judging whether the height of the first block and the packing parameter of the third non-cross-chain type block of the belonging parallel chain meet the packing rule of the third block of the belonging parallel chain; determining whether the first remainder is the same as the packing parameter of the non-inter-chain block of the corresponding parallel chain, and the first value is 10, and generating the first parallel chain block according to the first block includes determining whether the first block includes a parallel chain transaction of the corresponding parallel chain: if yes, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain; if not, generating a first empty block; generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the first block includes "determining whether the first block includes the parallel chain transaction of the corresponding parallel chain: if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each corresponding parallel chain; if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache as an example; assuming that a main chain maincalin, parallel chains parachain 1-3 (hereinafter abbreviated as pc 1-pc 3) exist in the block chain network; the packaging parameter of the non-cross-chain type block of the pc1 is 1, the packaging parameter of the non-cross-chain type block of the pc2 is 2, and the packaging parameter of the non-cross-chain type block of the pc3 is 3; the packing parameter of the cross-chain type block is 0;
in response to obtaining the packaging right of the block (99), the main chain node executes step S12, and pulls tx1 to tx5 from the memory pool, where tx1 is a cross-chain transaction of pc1 and pc2, and tx2 to tx5 are all non-cross-chain transactions of pc 1;
for tx 1:
since tx1 is the cross-link transaction between pc1 and pc2, the main chain node performs step S144 to calculate the remainder of 99 and 10, where the remainder is 9, and the remainder 9 is different from the cross-link block packing parameter, and the main chain node performs step S145 to restore tx1 to the memory pool;
for tx 2:
since tx2 is the non-inter-chain transaction of pc1, the main chain node performs step S141, the calculated remainder is 9, and the remainder 9 is different from the non-inter-chain block packing parameter 1 of pc1, and then the main chain node performs step S142, and stores tx2 in the memory pool again;
the operations of tx3 to tx5 are the same as those of tx2, and are not described herein;
calculating a remainder to be 9 by parallel chain link points of pc 1-pc 3;
since 9 is different from non-cross-chain type block packing parameters of pc1, pc2 and pc3, parallel chain nodes of pc1, pc2 and pc3 synchronize the blockheader (99).
In response to obtaining the packaging right of the block (100), the main chain node executes the step S12, and pulls tx1 to tx5 from the memory pool;
for tx 1:
since tx1 is the cross-chain transaction between pc1 and pc2, the main chain node performs step S144 to calculate the remainder between 100 and 10, where the remainder is 0, and the remainder 0 is the same as the cross-chain block packing parameter, and then the main chain node performs step S146 to pack tx1 into block (100);
for tx 2:
since tx2 is the non-inter-chain transaction of pc1, the main chain node performs step S141, calculates the remainder, where the remainder is 0, and the remainder 0 is different from the non-inter-chain block packing parameter 1 of pc1, and then the main chain node performs step S142, and stores tx2 in the memory pool again;
the operations of tx3 to tx5 are the same as those of tx2, and are not described herein;
when the remainder is calculated to be 0 and the remainder 0 is the same as the packing parameter of the cross-chain type block, tx1 in the parallel chain node cache block (100) of pc 1-pc 2 is calculated by the parallel chain nodes of pc 1-pc 3; parallel chain nodes of pc3 do not cache transactions;
parallel chain node synchronization blockheaders (100) of pc 1-pc 3.
In response to obtaining the packaging right of the block (101), the main chain node S12 pulls tx2 to tx6 from the memory pool, wherein tx6 is a non-cross-chain type transaction of pc 2;
for tx 2:
since tx2 is the non-inter-chain transaction of pc1, the main chain node performs step S141, calculates the remainder of 101 and 10, the remainder is 1, and the remainder 1 is the same as the non-inter-chain block packing parameter 1 of pc1, and then the main chain node performs step S143, and packs tx2 into block (100);
the operations of tx3 to tx5 are the same as those of tx2, and are not described in detail here.
For tx 6:
since tx6 is the non-inter-chain transaction of pc2, the main chain node performs step S141, the calculation remainder is 1, and the remainder 1 is different from the non-inter-chain block packing parameter 2 of pc2, and then the main chain node performs step S142, and stores tx6 in the memory pool again;
calculating the remainder to be 1 by parallel chain link points of pc 1-pc 3;
because the packing parameters of the non-cross-chain type blocks of 1 and pc1 are the same, and tx1 is cached in the parallel chain link point of pc1, the parallel chain node of pc1 generates a parallel chain block according to tx1 and tx2 to tx5 in block (101);
since 1 is different from non-cross-chain class block packing parameters of pc2 and pc3, parallel chain nodes of pc2 and pc3 synchronize the blockheader (101).
In response to obtaining the packaging right of the block (102), the main chain node S12 pulls tx6 to tx10 from the memory pool, wherein tx7 to tx10 are cross-chain type transactions of pc1 to pc 3;
for tx 6:
since tx6 is the non-inter-chain type transaction of pc2, the main chain node performs step S141, the calculation remainder is 2, and the remainder 2 is the same as the non-inter-chain type block packing parameter 2 of pc2, then the main chain node performs step S143, and packs tx6 into block (102);
for tx 7:
because tx7 is a cross-chain type transaction from pc1 to pc3, the main chain node executes step S144, the calculated remainder is 2, and the remainder 2 is different from the cross-chain type block packaging parameter, the main chain node executes step S145, and stores tx7 in the memory pool again;
the operations of tx8 to tx10 are the same as those of tx7, and are not described herein;
calculating remainder as 2 by parallel chain link points of pc 1-pc 3;
since the packing parameters of non-cross-chain type blocks of 2 and pc2 are the same, and the parallel chain link point of pc2 is cached with tx2, the parallel chain node of pc2 generates a parallel chain block according to tx1 and tx6 in block (102);
since the non-cross-chain class block packing parameters of 2 are different from those of pc1 and pc3, the parallel chain nodes of pc1 and pc3 synchronize the blockheader (102).
In response to obtaining the packaging right of the block (103), the main chain node S12 pulls tx11 to tx15 from the memory pool, wherein tx11 to tx15 are non-cross-chain type transactions of pc 1;
for tx 11:
since tx11 is the non-inter-chain transaction of pc1, the main chain node performs step S141, the calculated remainder is 3, and the remainder 3 is different from the non-inter-chain block packing parameter 1 of pc1, and then the main chain node performs step S142, and stores tx11 in the memory pool again;
the operations of tx12 to tx15 are the same as those of tx11, and are not described herein;
calculating remainder as 3 by parallel chain link points of pc 1-pc 3;
since the non-cross-chain type block packing parameters of 3 and pc3 are the same, and the parallel chain node of pc3 does not cache transactions, the parallel chain node of pc3 generates a parallel chain empty block;
since the non-cross-chain class block packing parameters of 3 are different from those of pc1 and pc2, the parallel chain nodes of pc1 and pc2 synchronize the blockheader (103).
In further embodiments, the "determining whether the first block height and the first non-inter-chain block packing parameter of the first parallel chain to which the first transaction belongs satisfy the first block packing rule of the first parallel chain" may be further configured according to actual requirements, for example, configured to determine whether the mantissa of the first block height is the same as the first non-inter-chain block packing parameter of the first parallel chain to which the first transaction belongs, and correspondingly, the "determining whether the first block height and the inter-chain block packing parameter satisfy the second block packing rule of the inter-chain transaction" should be configured such that whether the mantissa of the first block height is the same as the inter-chain block packing parameter, "determining whether the first block height and the inter-chain block packing parameter satisfy the second block packing rule" should be configured such that whether the mantissa of the first block height is the same as the inter-chain block packing parameter, whether the packing parameter of the first block height and the third non-inter-chain block of the belonging parallel chain meets the packing rule of the third block of the belonging parallel chain or not is judged, and the configuration is that whether the mantissa of the first block height is the same as the packing parameter of the non-inter-chain block of the belonging parallel chain or not can achieve the same technical effect.
In further embodiments, the first value may be configured according to actual requirements, for example, configured as 100, and the same technical effect may be achieved. The first value is preferably configured to be related to the total number of parallel chains in the current blockchain network, for example, when the total number of parallel chains in the blockchain network is 20, the first value is configured to be 100.
In further embodiments, in some main chain-parallel chain systems, some transactions that do not need to be known immediately (e.g. self-recognition transactions) of the parallel chain may be buffered, and the generating of the first parallel chain block according to the first block may be configured according to actual requirements, for example, configured as: judging whether the first block comprises parallel chain transactions of the parallel chain: if yes, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain and the self-consensus transaction of each cache when the self-consensus transaction of the cache exists; if not, generating a first parallel chain block according to the cached self-consensus transactions when the cached self-consensus transactions exist; correspondingly, generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache is configured to: judging whether the first block comprises parallel chain transactions of the parallel chain: if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache, the self-consensus transaction of each cache and the parallel chain transaction of each parallel chain when the self-consensus transaction of the cache exists; and if not, generating a first parallel chain block according to the cross-chain parallel chain transaction of each cache and the self-consensus transaction of each cache, thereby realizing the same technical effect.
It will be appreciated by those skilled in the art that when the first remainder is other than 0-3, the backbone node will pull several backbone transactions to generate a backbone block.
In the prior art, if a large amount of parallel chain transactions of pc3 are generated within a period of time, the packaging resources of the main chain transaction can be squeezed by the parallel chain transaction peak of pc3, and further the packaging congestion of the main chain transaction is caused; the embodiment can disperse the transaction of the parallel chain to different blocks, and can effectively stabilize the crowding of the transaction peak.
In the prior art, when the packing congestion situation occurs, the problem of improvement of transaction commission charge is caused; additional transaction fee costs may be incurred for some parallel chain transactions that are not particularly urgent for the uplink (e.g., parallel chain consensus transactions); the embodiment can reduce the commission cost while stabilizing the exchange peak.
In the prior art, it is assumed that there are main, parallel chains pcM in the blockchain network; the main chain block (200) has main chain transactions tx100, tx200, and, pcM, parallel chain transactions t x300, tx 400; pcM, after obtaining tx300 and tx400 from the block (200), the parallel chain node cannot directly generate the corresponding parallel chain block through tx3 and tx4, but needs to verify whether the transaction in the block (200) is tampered; the verification method comprises the following steps: acquiring a Merckel path of tx300 and a Merckel root of block (200) to verify whether tx300 is tampered, acquiring a Merckel path of tx400 and a Merckel root of block (200) to verify whether tx400 is tampered, and generating corresponding parallel chain blocks according to tx300 and tx400 under the condition that tx300 and tx400 are not tampered.
In the present application, if a block is also defined in which the "first block height, first non-inter-chain class block packing parameter of the first parallel chain to which the first transaction belongs satisfies the first block packing rule of the first parallel chain", and the block with the first block height and the cross-chain type block packing parameter satisfying the second block packing rule of the cross-chain type transaction cannot be packed into the main chain transaction, and only pcM transactions are included in the block (200), then pcM each parallel chain node need not obtain the merkel path of each transaction pcM in block (200), but need only directly calculate the merkel root according to each transaction in block (200), if the calculated merkel root is the same as the merkel root carried by itself in block header (200), then the transaction is not tampered, the parallel chain block can be generated directly according to each transaction in the block (200), and the parallel chain transaction can be verified more quickly to generate the parallel chain block.
As will be understood by those skilled in the art, the packing parameter of the cross-chain class block and the packing parameter of the non-cross-chain class block are the same as the channel number of the parallel chain, and the channel number of the parallel chain needs to be registered to be recorded on the main chain; taking the above embodiment as an example, the transaction of the cross-chain class should be in the channel with the channel number of 0, the transaction of the non-cross-chain class of pc1 should be in the channel with the channel number of 1, the transaction of the non-cross-chain class of pc2 should be in the channel with the channel number of 2, and the transaction of the non-cross-chain class of pc3 should be in the channel with the channel number of 3.
Assume that there is a first application scenario where some parallel chains in the blockchain network are no longer operational (assume pc 2); pc2 still occupies channel number 2, meaning that the main chain block storing only the parallel chain transaction of pc2 still needs to be generated, and pc2 is no longer operated, which results in the waste of resources of the main chain block storing only the parallel chain transaction of pc 2; because there is no transaction in the main chain block storing only the parallel chain transaction of pc2, the meikerr root does not need extra calculation, and even part of the main chain nodes may be profitable, and maliciously compete for the packaging right of the main chain block storing only the parallel chain transaction of pc 2. The problem caused by the first application scenario can be solved by the method of the following embodiment.
Preferably, the method further comprises:
receiving a first channel registration update transaction; wherein the first registration update transaction includes a third parallel chain name of the replaced third parallel chain, a fourth parallel chain name of a fourth parallel chain of the replacement third parallel chain;
inquiring a third channel number according to the third parallel chain name;
and generating a second corresponding relation according to the third channel number and the fourth parallel chain name, and replacing the third corresponding relation generated by the third channel number and the third parallel chain name with the second corresponding relation on the main chain.
Suppose that pc2 is no longer operational at this time, and pc4 does not have the associated channel number;
the parallel chain node of pc4 generates a channel registration update transaction tx30, tx30 includes parallel chain names pc2 of pc2, and parallel chain names pc4 of pc 4;
the backbone node receives tx 30;
the main chain node inquires a channel number 2 according to pc 2;
the backbone node generates the correspondence "2, pc 4", replacing "2, pc 2" with "2, pc 4" on the backbone.
Assuming a second application scenario in which some parallel chains in the block chain network are no longer operated within a certain block height (assuming pc3 is no longer operated before block (1000) due to system upgrade); while pc3 still occupies channel number 3 before block (1000), which means that the main chain block only storing the parallel chain transaction of pc3 still needs to be generated, and pc3 is not operated before block (1000), which results in the waste of resources of the main chain block only storing the parallel chain transaction of pc 3; because there is no transaction in the main chain block storing only the parallel chain transaction of pc3, the meikerr root does not need extra calculation, and even part of the main chain nodes may be profitable, and maliciously compete for the packaging right of the main chain block storing only the parallel chain transaction of pc 3. The problem generated for the second application scenario can be solved by the method of the following embodiment.
Preferably, the method further comprises:
receiving a first channel loan transaction; wherein the first lane lending transaction comprises a fifth parallel chain name of a fifth parallel chain being lent, a sixth parallel chain name of a sixth parallel chain of a lane borrowing the fifth parallel chain, and a second block height at which lending is terminated;
inquiring a fifth channel number according to the fifth parallel chain name;
caching a fourth corresponding relation between the name of the fifth parallel chain and the serial number of the fifth channel;
generating a fifth corresponding relation according to the fifth channel number and the sixth parallel chain name, and replacing the fourth corresponding relation with the fifth corresponding relation on the main chain;
and replacing the fifth corresponding relation with the fourth corresponding relation when the block height reaches the second block height.
Assuming that pc3 is no longer operational until block (1000) due to system upgrade, pc3 lend the channel with channel number 3 to pc5 until 1000;
the parallel link points of pc3 generate a channel loan transaction tx40, tx40 including the parallel chain name pc3 of pc3, the parallel chain name pc5 of pc5, the height of loan termination 1000;
the backbone node receives tx 40;
the main chain node inquires a channel number 3 according to pc 3;
backbone node cache "3, pc 3";
the main chain node generates a corresponding relation '3, pc 5' according to 3 and pc5, and the '3, pc 3' is replaced by '3, pc 5' on the main chain;
when the tile height reached 1000, the "3, pc 5" was replaced back with "3, pc 3".
Preferably, generating the first parallel chain block from the first block comprises:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the parallel chain transaction of each parallel chain;
if not, generating a first empty block;
generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache comprises the following steps:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each corresponding parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
The parallel chain constant block outputting principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Preferably, the method further comprises:
receiving a second transaction, and judging whether the second transaction is a parallel chain transaction:
if yes, judging whether a first numerical value of the parallel chain transaction of the parallel chain to which the second transaction belongs stored in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
The embodiment enables only a certain number of parallel chain transactions to be reserved in the memory pool of the main chain node for the same parallel chain, prevents the memory pool of the main chain node from being blocked and packs the packaging resources of the main chain transaction.
Fig. 2 is a flowchart of another parallel chain constant block output method according to an embodiment of the present invention. As shown in fig. 2, in this embodiment, the present invention provides a parallel chain constant block output method suitable for parallel chain nodes, where a chain-crossing block packing parameter of a chain-crossing parallel chain transaction and a non-chain-crossing block packing parameter of a non-chain-crossing parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packing parameter is different from the non-chain-crossing block packing parameter, and the non-chain-crossing block packing parameters are different from each other, where the method includes:
s22: obtaining a first block of a main chain; the first block is packed with a plurality of first transactions, the packed first transactions comprise a plurality of first transactions which are pulled from a memory pool in response to the main chain node obtaining the packing right of the first block with the first block height, when the first transactions are non-cross-chain type parallel chain transactions, the packed first transactions are transactions of which the first block height and the first non-cross-chain type block packing parameter of the first parallel chain to which the first transactions belong meet a first block packing rule of the first parallel chain, and when the first transactions are cross-chain type parallel chain transactions, the packed first transactions are transactions of which the first block height and the cross-chain type block packing parameter meet a second block packing rule of the cross-chain type transactions;
s241: judging whether the packing parameters of the first block height and the cross-chain type block meet a second block packing rule:
if yes, go to step S242: caching cross-chain type parallel chain transactions of a current parallel chain in a first block;
s261: judging whether the first block height and a third non-across-chain type block packing parameter of the current parallel chain meet a third block packing rule of the current parallel chain:
if yes, go to step S2621: judging whether cross-chain parallel chain transaction is cached:
otherwise, step S2622 is executed: generating a first parallel chain block according to the first block;
if yes, go to step S2623: generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, step S2624 is executed: the first block header of the first block is synchronized.
The parallel chain constant block outputting principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Preferably, generating the first parallel chain block from the first block comprises:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the parallel chain transaction of each current parallel chain;
if not, generating a first empty block;
generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache comprises the following steps:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each current parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
The parallel chain constant block outputting principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Fig. 3 is a flowchart of another parallel chain constant block output method according to an embodiment of the present invention. As shown in fig. 3, in this embodiment, the present invention provides a parallel chain constant block outputting method suitable for a main chain node, where a cross-chain class block packing parameter of a cross-chain class parallel chain transaction and a non-cross-chain class block packing parameter of a non-cross-chain class parallel chain transaction of each parallel chain are recorded on a main chain, the cross-chain class block packing parameter is different from the non-cross-chain class block packing parameter, and the non-cross-chain class block packing parameter is different from each other, and the method is suitable for the main chain node, where the method includes:
s31: receiving first parallel chain transactions of non-cross-chain classes, and storing the first parallel chain transactions to a first non-cross-chain class parallel chain transaction cache queue of the first parallel chain;
s32: receiving a second parallel chain transaction of the cross-chain class, and storing the second parallel chain transaction to a cross-chain class parallel chain transaction cache queue;
s33: in response to obtaining the packing right of the first block with the first block height, determining a cross-chain type parallel chain transaction cache queue or a second non-cross-chain type parallel chain transaction cache queue of the transaction to be pulled according to the first block height, a pre-configured block packing rule, cross-chain type block packing parameters and non-cross-chain type block packing parameters;
s34: pulling a plurality of transactions from the cross-chain type parallel chain transaction buffer queue or a second non-cross-chain type parallel chain transaction buffer queue to generate a first block;
wherein, the inter-chain block packing parameter and each non-inter-chain block packing parameter are further used for providing the parallel chain node of each first parallel chain:
judging whether the first block height and the cross-chain type block packaging parameter meet a second block packaging rule of cross-chain type transaction:
if yes, caching the cross-chain type parallel chain transaction of the parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the parallel chain meet a third block packing rule of the parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, the first block head of the first block is synchronized.
The above embodiment is different from the embodiment shown in fig. 1 in that the above embodiment allocates transactions to different queues first, and then pulls the transaction generation block from the queues, whereas the embodiment shown in fig. 1 does not have queues, but filters corresponding transactions to generate blocks when generating blocks. The principle of other steps is similar, and the detailed description is omitted here.
The embodiment can also realize the technical effect of dispersing the transaction of the parallel chain to different blocks and effectively stabilizing the extrusion of the transaction peak.
And in the above embodiment, since the transactions are already allocated to different queues, the block cannot be packed into the main chain transaction and the parallel chain transaction at the same time, and the above embodiment naturally achieves the technical effect of verifying the parallel chain transaction to generate the parallel chain block more quickly.
Preferably, generating the first parallel chain block from the first block comprises:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain;
if not, generating a first empty block;
generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache comprises the following steps:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each corresponding parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
Preferably, the above method further comprises:
receiving a second transaction, and judging whether the second transaction is a parallel chain transaction:
if yes, judging whether a first numerical value of the parallel chain transaction of the parallel chain to which the second transaction belongs stored in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
Fig. 4 is a flowchart of another parallel chain constant block output method according to an embodiment of the present invention. As shown in fig. 4, in this embodiment, the present invention provides a parallel chain constant block outputting method suitable for parallel chain nodes, where a chain-crossing block packing parameter of a chain-crossing parallel chain transaction and a non-chain-crossing block packing parameter of a non-chain-crossing parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packing parameter is different from the non-chain-crossing block packing parameter, the non-chain-crossing block packing parameters are different from each other, a first parallel chain transaction of a non-chain crossing is stored in a first non-chain-crossing parallel chain transaction cache queue of a first parallel chain to which the first parallel chain transaction belongs by the main chain node, and a cross-chain parallel chain transaction is stored in a cross-chain parallel chain transaction cache queue by the main chain node, and the method is suitable for parallel chain nodes, and the method includes:
s42: obtaining a first block of a main chain; the first block is generated by a main chain node in response to the packaging right of the first block with the first block height, according to a plurality of transactions pulled from the determined cross-chain type parallel chain transaction cache queue or the second non-cross-chain type parallel chain transaction cache queue, and the cross-chain type parallel chain transaction cache queue or the second non-cross-chain type parallel chain transaction cache queue is determined according to the first block height, the pre-configured block packaging rule, the cross-chain type block packaging parameter and each non-cross-chain type block packaging parameter;
s441: judging whether the first block height and the cross-chain type block packaging parameter meet a second block packaging rule of cross-chain type transaction:
if yes, go to step S442: caching cross-chain type parallel chain transactions of a current parallel chain in a first block;
s461: judging whether the first block height and a third non-across-chain type block packing parameter of the current parallel chain meet a third block packing rule of the current parallel chain:
if yes, go to step S4621: judging whether cross-chain parallel chain transaction is cached:
otherwise, step S4622 is performed: generating a first parallel chain block according to the first block;
if yes, go to step S4623: generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache;
otherwise, step S4624 is performed: the first block header of the first block is synchronized.
The parallel chain constant block outputting principle of the above embodiment can refer to the method shown in fig. 3, and is not described herein again.
Preferably, generating the first parallel chain block from the first block comprises:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the parallel chain transaction of each current parallel chain;
if not, generating a first empty block;
generating a first parallel chain block according to the cross-chain type parallel chain transaction and the first block of each cache comprises the following steps:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each current parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 5, as another aspect, the present application also provides a computer apparatus including one or more Central Processing Units (CPUs) 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the computer apparatus are also stored. The CPU501, ROM502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 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 509, and/or installed from the removable medium 511.
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 computer-readable storage medium that exists separately and is not assembled into a computer 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 (12)

1. A parallel chain constant block output method is characterized in that a chain-crossing block packaging parameter of chain-crossing parallel chain transaction and a non-chain-crossing block packaging parameter of non-chain-crossing parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packaging parameter is different from the non-chain-crossing block packaging parameter, and the non-chain-crossing block packaging parameters are different from each other, the method is suitable for a main chain node, and the method comprises the following steps:
in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and respectively executing the following steps on each first transaction:
when the first transaction is a non-inter-chain type parallel chain transaction, judging whether the first block height and a first non-inter-chain type block packing parameter of a first parallel chain to which the first transaction belongs meet a first block packing rule of the first parallel chain:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into the first block;
when the first transaction is a cross-chain parallel chain transaction, judging whether the first block height and the cross-chain block packing parameter meet a second block packing rule of the cross-chain transaction:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into the first block;
wherein the inter-chain type block packing parameter and each non-inter-chain type block packing parameter are further used for providing a parallel chain node of each first parallel chain:
judging whether the first block height and the cross-chain type block packing parameter meet the second block packing rule:
if yes, caching the cross-chain type parallel chain transaction of the parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the parallel chain meet a third block packing rule of the parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the first block and the cross-chain type parallel chain transaction of each cache;
otherwise, synchronizing the first block head of the first block.
2. The method of claim 1, wherein the generating a first parallel chain block from the first block comprises:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain;
if not, generating a first empty block;
the generating a first parallel chain block according to the first block and the cross-chain type parallel chain transaction of each cache comprises:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each corresponding parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
3. The method of claim 1, further comprising:
receiving a second transaction, and judging whether the second transaction is a parallel chain transaction:
if yes, judging whether a first numerical value of the parallel chain transaction of the parallel chain to which the second transaction belongs stored in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
4. A parallel chain constant block output method is characterized in that a chain-crossing block packaging parameter of chain-crossing parallel chain transaction and a non-chain-crossing block packaging parameter of non-chain-crossing parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packaging parameter is different from the non-chain-crossing block packaging parameter, and the non-chain-crossing block packaging parameters are different from each other, the method is suitable for parallel chain nodes, and the method comprises the following steps:
obtaining a first block of a main chain; when the first transaction is a non-cross-chain type parallel chain transaction, the packed first transaction is a transaction in which the first block height and a first non-cross-chain type block packing parameter of a first parallel chain to which the first transaction belongs meet a first block packing rule of the first parallel chain, and when the first transaction is a cross-chain type parallel chain transaction, the packed first transaction is a transaction in which the first block height and the cross-chain type block packing parameter meet a second block packing rule of the cross-chain type transaction;
judging whether the first block height and the cross-chain type block packing parameter meet the second block packing rule:
if yes, caching the cross-chain type parallel chain transaction of the current parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the current parallel chain meet a third block packing rule of the current parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the first block;
otherwise, synchronizing the first block head of the first block.
5. The method of claim 4, wherein the generating a first parallel chain block from the first block comprises:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the parallel chain transaction of each current parallel chain;
if not, generating a first empty block;
the generating a first parallel chain block according to the first block and the cross-chain type parallel chain transaction of each cache comprises:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each current parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
6. A parallel chain constant block output method is characterized in that a chain-crossing block packaging parameter of chain-crossing parallel chain transaction and a non-chain-crossing block packaging parameter of non-chain-crossing parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packaging parameter is different from the non-chain-crossing block packaging parameter, and the non-chain-crossing block packaging parameters are different from each other, the method is suitable for a main chain node, and the method comprises the following steps:
receiving a first parallel chain transaction of a non-cross-chain class, and storing the first parallel chain transaction to a first non-cross-chain class parallel chain transaction cache queue of the first parallel chain;
receiving a second parallel chain transaction of a cross-chain class, and storing the second parallel chain transaction to a cross-chain class parallel chain transaction cache queue;
in response to obtaining a packing right of a first block with a first block height, determining the cross-chain type parallel chain transaction cache queue or a second non-cross-chain type parallel chain transaction cache queue of a transaction to be pulled according to the first block height, a pre-configured block packing rule, the cross-chain type block packing parameter and each non-cross-chain type block packing parameter;
pulling a number of transactions from the cross-chain class parallel chain transaction buffer queue or the second non-cross-chain class parallel chain transaction buffer queue to generate the first block;
wherein the inter-chain type block packing parameter and each non-inter-chain type block packing parameter are further used for providing a parallel chain node of each first parallel chain:
judging whether the first block height and the cross-chain type block packaging parameter meet a second block packaging rule of cross-chain type transaction:
if yes, caching the cross-chain type parallel chain transaction of the parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the parallel chain meet a third block packing rule of the parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the first block and the cross-chain type parallel chain transaction of each cache;
otherwise, synchronizing the first block head of the first block.
7. The method of claim 6, wherein the generating a first parallel chain block from the first block comprises:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain;
if not, generating a first empty block;
the generating a first parallel chain block according to the first block and the cross-chain type parallel chain transaction of each cache comprises:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each corresponding parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
8. The method of claim 6, further comprising:
receiving a second transaction, and judging whether the second transaction is a parallel chain transaction:
if yes, judging whether a first numerical value of the parallel chain transaction of the parallel chain to which the second transaction belongs stored in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
9. A parallel chain constant block outputting method is characterized in that a chain-crossing block packaging parameter of chain-crossing parallel chain transaction and a non-chain-crossing block packaging parameter of non-chain-crossing parallel chain transaction of each parallel chain are recorded on a main chain, the chain-crossing block packaging parameter is different from the non-chain-crossing block packaging parameter, the non-chain-crossing block packaging parameters are different from each other, a first parallel chain transaction of a non-chain-crossing type is stored to a first non-chain-crossing parallel chain transaction cache queue of a first parallel chain to which the first parallel chain transaction belongs by a main chain node, and a chain-crossing parallel chain transaction is stored to a chain-crossing parallel chain transaction cache queue by the main chain node, and the method is suitable for the parallel chain nodes and comprises the following steps:
obtaining a first block of a main chain; the first block is generated by a main chain node in response to the fact that the packaging right of the first block with the first block height is obtained and according to a plurality of determined transactions pulled from the cross-chain type parallel chain transaction cache queue or the second non-cross-chain type parallel chain transaction cache queue, and the cross-chain type parallel chain transaction cache queue or the second non-cross-chain type parallel chain transaction cache queue is determined according to the first block height, a pre-configured block packaging rule, the cross-chain type block packaging parameter and each non-cross-chain type block packaging parameter;
judging whether the first block height and the cross-chain type block packaging parameter meet a second block packaging rule of cross-chain type transaction:
if yes, caching the cross-chain type parallel chain transaction of the current parallel chain in the first block;
judging whether the first block height and a third non-across-chain type block packing parameter of the current parallel chain meet a third block packing rule of the current parallel chain:
if yes, judging whether cross-chain parallel chain transaction is cached:
if not, generating a first parallel chain block according to the first block;
if yes, generating a first parallel chain block according to the first block and the cross-chain type parallel chain transaction of each cache;
otherwise, synchronizing the first block head of the first block.
10. The method of claim 9, wherein the generating a first parallel-chain block from the first block comprises:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the parallel chain transaction of each current parallel chain;
if not, generating a first empty block;
the generating a first parallel chain block according to the first block and the cross-chain type parallel chain transaction of each cache comprises:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache and the parallel chain transaction of each current parallel chain;
and if not, generating a first parallel chain block according to the cross-chain type parallel chain transaction of each cache.
11. 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-10.
12. 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-10.
CN202110245530.2A 2021-03-05 2021-03-05 Parallel chain constant block output method, computer device and storage medium Active CN112948495B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110245530.2A CN112948495B (en) 2021-03-05 2021-03-05 Parallel chain constant block output method, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110245530.2A CN112948495B (en) 2021-03-05 2021-03-05 Parallel chain constant block output method, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN112948495A CN112948495A (en) 2021-06-11
CN112948495B true CN112948495B (en) 2022-05-24

Family

ID=76247886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110245530.2A Active CN112948495B (en) 2021-03-05 2021-03-05 Parallel chain constant block output method, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN112948495B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107909369A (en) * 2017-10-13 2018-04-13 布比(北京)网络技术有限公司 Based on the common recognition method, apparatus merchandised across chain and storage medium
CN110443708A (en) * 2019-07-29 2019-11-12 杭州复杂美科技有限公司 Parallel chain method of commerce, equipment and storage medium
CN111242780A (en) * 2020-01-12 2020-06-05 杭州复杂美科技有限公司 Method, device and storage medium for sending consensus transaction
CN111275437A (en) * 2020-01-12 2020-06-12 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium
CN111524011A (en) * 2020-05-06 2020-08-11 杭州复杂美科技有限公司 Parallel chain consensus confirming method, equipment and storage medium
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium
CN111861471A (en) * 2020-07-30 2020-10-30 杭州复杂美科技有限公司 Parallel chain consensus method, parallel chain block rollback method, device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107909369A (en) * 2017-10-13 2018-04-13 布比(北京)网络技术有限公司 Based on the common recognition method, apparatus merchandised across chain and storage medium
CN110443708A (en) * 2019-07-29 2019-11-12 杭州复杂美科技有限公司 Parallel chain method of commerce, equipment and storage medium
CN111242780A (en) * 2020-01-12 2020-06-05 杭州复杂美科技有限公司 Method, device and storage medium for sending consensus transaction
CN111275437A (en) * 2020-01-12 2020-06-12 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium
CN111524011A (en) * 2020-05-06 2020-08-11 杭州复杂美科技有限公司 Parallel chain consensus confirming method, equipment and storage medium
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium
CN111861471A (en) * 2020-07-30 2020-10-30 杭州复杂美科技有限公司 Parallel chain consensus method, parallel chain block rollback method, device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链跨链技术分析;郭朝等;《物联网学报》;20200630;第35-48页 *

Also Published As

Publication number Publication date
CN112948495A (en) 2021-06-11

Similar Documents

Publication Publication Date Title
CN111966500B (en) Resource scheduling method and device, electronic equipment and storage medium
CN111522636B (en) Application container adjusting method, application container adjusting system, computer readable medium and terminal device
JP2002505060A (en) Telecommunications performance management system
CN109669789A (en) Transaction queuing strategy, trading pit storage method, equipment and storage medium
CN103248622B (en) A kind of Online Video QoS guarantee method of automatic telescopic and system
CN111324449A (en) Transaction storage and broadcasting method, device and storage medium of memory pool
CN109992392B (en) Resource deployment method and device and resource server
CN110210972B (en) Method, device and storage medium for sending consensus transaction
WO2022100365A1 (en) Method, system, and device for managing artificial intelligence application task, and storage medium
CN112948495B (en) Parallel chain constant block output method, computer device and storage medium
CN111190719A (en) Method, device, medium and electronic equipment for optimizing cluster resource allocation
CN112448833B (en) Multi-management-domain communication method and device
CN111415259A (en) Transaction queuing method, device and storage medium
CN111400043A (en) Transaction pool management method, device and storage medium
CN112948496A (en) Parallel chain block generation method, computer device, and storage medium
CN109710285A (en) A kind of device updating method and system
CN112804322B (en) Block generation method, computer device and storage medium
CN114003374A (en) Node scheduling method and device based on cloud platform, electronic equipment and storage medium
CN112839091A (en) Block generation method, computer device and storage medium
WO2023096109A1 (en) Resource provisioning method for kubernetes pod
CN112948497A (en) Parallel chain block generation method, computer device, and storage medium
WO2023103752A1 (en) Method for downloading network element version, and network element, electronic device and storage medium
CN115981825B (en) Cluster parallel scheduling system based on hybrid shared state view architecture
CN115996404B (en) Dynamic adjustment method and device for node link
US20230354101A1 (en) Resource allocation device, resource allocation method, and control circuit

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