CN112948496A - Parallel chain block generation method, computer device, and storage medium - Google Patents

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

Info

Publication number
CN112948496A
CN112948496A CN202110246886.8A CN202110246886A CN112948496A CN 112948496 A CN112948496 A CN 112948496A CN 202110246886 A CN202110246886 A CN 202110246886A CN 112948496 A CN112948496 A CN 112948496A
Authority
CN
China
Prior art keywords
parallel chain
block
transaction
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.)
Granted
Application number
CN202110246886.8A
Other languages
Chinese (zh)
Other versions
CN112948496B (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 CN202110246886.8A priority Critical patent/CN112948496B/en
Publication of CN112948496A publication Critical patent/CN112948496A/en
Application granted granted Critical
Publication of CN112948496B publication Critical patent/CN112948496B/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Business, Economics & Management (AREA)
  • Computational Linguistics (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Bioethics (AREA)
  • Fuzzy Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a parallel chain block generation method, computer equipment and a storage medium, wherein the method comprises the following steps: receiving a first channel registration transaction of a first parallel chain; when the first channel number is not registered, recording a first corresponding relation between the first channel number and a first parallel chain name on a main chain; 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 parallel chain transaction, judging whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs meet a first parallel chain block generation rule of the parallel chain to which the first transaction belongs: 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 commission charge.

Description

Parallel chain block generation method, computer device, and storage medium
Technical Field
The present application relates to the field of parallel chain technologies, and in particular, to a parallel chain block generation method, a computer device, 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-mentioned deficiencies or inadequacies in the prior art, it would be desirable to provide a parallel chain block generation method, computer apparatus, and storage medium that levels off peak exchange and reduces commission fees.
In a first aspect, the present invention provides a method for generating a parallel chain block suitable for a main chain node, where the method includes:
receiving a first channel registration transaction of a first parallel chain; wherein the first channel registration transaction comprises a first channel number and a first parallel chain name of the first parallel chain;
judging whether the first channel number is registered:
if not, recording the first corresponding relation between the first channel number and the first parallel chain name on the main chain;
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 parallel chain transaction, judging whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs meet a first parallel chain block generation rule of the parallel chain to which the first transaction belongs:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into a first block;
wherein the first block is for parallel chain nodes of each parallel chain:
judging whether the height of the first block and the second channel number of the parallel chain meet a second parallel chain block generation rule of the parallel chain:
if yes, generating a first parallel chain block according to the first block;
otherwise, the first block head of the first block is synchronized.
In a second aspect, the present invention provides a parallel link block generation method suitable for parallel link nodes, where the method includes:
generating a first channel registration transaction according to the first channel number and a first parallel chain name of the current parallel chain and sending the first channel registration transaction to the main chain, so that when the first channel number is not registered, a first corresponding relation between the first channel number and the first parallel chain name is recorded on the main chain; obtaining a first block of a main chain; the first block is packaged with a plurality of first transactions, the packaged first transactions comprise a plurality of first transactions pulled from the memory pool in response to the main chain node obtaining the packaging right of the first block with the first block height, the packaged first transactions are parallel chain transactions, and the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs meet the first parallel chain block generation rule of the parallel chain to which the first transaction belongs;
judging whether the height of the first block and the second channel number of the current parallel chain meet a second parallel chain block generation rule of the current parallel chain:
if yes, generating a first parallel chain block according to the first block;
otherwise, the first block head of the first block is synchronized.
In a third 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 block generation method provided according to embodiments of the present invention.
In a fourth aspect, the present invention also provides a storage medium storing a computer program that causes a computer to execute the parallel chain block generation method provided according to the embodiments of the present invention.
In the parallel chain block generation method, the computer device and the storage medium provided by the embodiments of the present invention, a transaction is registered by receiving a first channel of a first parallel chain; when the first channel number is not registered, recording a first corresponding relation between the first channel number and a first parallel chain name on a main chain; 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 parallel chain transaction, judging whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs meet a first parallel chain block generation rule of the parallel chain to which the first transaction belongs: if not, the first transaction is stored in the memory pool again; if yes, the method of packaging the first transaction into the first block can stabilize the exchange of the transaction peak and reduce the commission charge.
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 block generation method according to an embodiment of the present invention.
Fig. 2 is a flowchart of another parallel chain block generation method according to an embodiment of the present invention.
Fig. 3 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 block generation method according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a method for generating a parallel chain block suitable for a main chain node, where the method includes:
s12: receiving a first channel registration transaction of a first parallel chain; wherein the first channel registration transaction comprises a first channel number and a first parallel chain name of the first parallel chain;
s141: judging whether the first channel number is registered:
otherwise, step S142 is executed: recording a first corresponding relation between a first channel number and a first parallel chain name on a main chain;
s16: 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 parallel chain transaction, judging whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs meet a first parallel chain block generation rule of the parallel chain to which the first transaction belongs:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into a first block;
wherein the first block is for parallel chain nodes of each parallel chain:
judging whether the height of the first block and the second channel number of the parallel chain meet a second parallel chain block generation rule of the parallel chain:
if yes, generating a first parallel chain block according to the first block;
otherwise, the first block head of the first block is synchronized.
Specifically, determining whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs satisfy the first parallel chain block generation rule of the parallel chain to which the first transaction belongs includes "calculating a first remainder of the first block height and the first numerical value; judging whether the first remainder is the same as a channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs, and judging whether the height of the first block and the second channel number of the parallel chain to which the first block belongs meet a second parallel chain block generation rule of the parallel chain to which the first block belongs; judging whether the first remainder is the same as the second channel number or not as an example; assuming that a main chain maincalin and parallel chains parachain 1-3 (hereinafter abbreviated as pc 1-pc 3) exist in the block chain network; pc1 registers channel number 1, pc2 registers channel number 2, and pc3 registers channel number 3; the first value is 10, the first block of the first block height is block (101);
the parallel chain link point of pc1 generates a channel registration transaction tx1 and sends the channel registration transaction tx1 to the main chain, wherein tx1 comprises a channel number 1 and a parallel chain name pc 1; those skilled in the art will understand that the channel registration transaction can be generated by a common parallel chain link point, and can also be further defined, for example, only by a parallel chain link point deployed by an operator of a parallel chain, and the application is not particularly limited;
the main chain node performs step S12, receiving tx 1;
the main chain node executes step S141, and determines whether 1 is registered:
if the node is not registered, the main chain node executes step S142 to record the corresponding relationship "1, pc 1" on the main chain;
similarly, the parallel link point of pc2 generates and sends a channel registration transaction tx2(2, pc2) to the main chain, and the parallel link point of pc3 generates and sends a channel registration transaction tx3(3, pc3) to the main chain;
the final backbone recorded "1, pc 1", "2, pc 2", "3, pc 3";
the main chain node executes a step S16, and in response to obtaining the packaging right of the block (101), the main chain node pulls tx11 to tx20 from the memory pool (wherein tx11 to tx15 are parallel chain transactions of pc1, tx16 is parallel chain transactions of pc2, and tx17 to tx20 are main chain transactions);
for tx11 to tx15, take tx11 as an example:
calculating the remainder of 101 and 10, wherein the remainder is 1;
since 1 is the same as the channel number of pc1, tx11 is packed into block (100); similarly, tx 12-tx 15 are also packed into block (100);
for tx 16:
calculating the remainder of 101 and 10, wherein the remainder is 1;
storing the tx16 into the memory pool again because the channel numbers of 1 and pc2 are different;
for tx17 to tx 20:
storing tx17 to tx20 into the memory pool again because tx17 to tx20 are not parallel chain transactions;
the transactions in the final block (101) are tx 11-tx 15;
calculating the remainder of 101 and 10 by the parallel link node of pc1, wherein the remainder is 1;
if the parallel chain node of the pc1 judges that the channel numbers of 1 and pc1 are the same, generating a parallel chain block according to block (101);
if the parallel chain node of the pc2 judges that the channel numbers of 1 and pc2 are different, the blockheader is synchronized (101); the parallel chain link points of the pc3 are the same as those of the pc2, and are not described in detail here, and the parallel chain link points of the pc3 are also synchronized with the blockhead (101).
In more embodiments, the "determining whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs satisfy the first parallel chain block generation rule of the parallel chain to which the first transaction belongs" may be configured according to actual requirements, for example, configured to determine whether the block packing parameter of the parallel chain to which the first transaction belongs is the same as the mantissa of the block height, so that the same technical effect may be achieved; accordingly, the "determining whether the first block height and the second channel number of the corresponding parallel chain satisfy the second parallel chain block generation rule of the corresponding parallel chain" should be configured to determine whether the mantissa of the first block height and the second channel number of the corresponding parallel chain are the same.
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.
It will be appreciated by those skilled in the art that in the above embodiment, the transactions in the block (101) are tx11 to tx15, then the parallel chain nodes of pc1 should generate parallel chain blocks from tx11 to tx 15; if there are no transactions in the real block (101), then each node of pc1 will generate a parallel chain empty block.
It will be appreciated by those skilled in the art that when the first remainder is other than 1-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 pc1 in the blockchain network; the main chain block (101) comprises main chain transactions tx1 and tx2, and parallel chain transactions tx3 and tx4 of pc 1; after a parallel chain node of the pc1 acquires tx3 and tx4 from the block (101), the corresponding parallel chain block cannot be generated directly through the tx3 and tx4, but whether the transaction in the block (101) is tampered or not needs to be verified; the verification method comprises the following steps: acquiring a Merckel path of tx3 and a Merckel root of block (101) to verify whether tx3 is tampered, acquiring a Merckel path of tx4 and a Merckel root of block (101) to verify whether tx4 is tampered, and generating corresponding parallel chain blocks according to tx3 and tx4 under the condition that neither tx3 nor tx4 is tampered.
In the application, as the block (101) only comprises the transaction of the pc1, each parallel chain node of the pc1 does not need to acquire a mercker path of each transaction of the pc1 in the block (101), only needs to directly calculate a mercker root according to each transaction in the block (101), and if the calculated mercker root is the same as the mercker root carried by the block header (101), the transaction is not tampered, a parallel chain block can be directly generated according to each transaction in the block (101), and the parallel chain transaction is verified more quickly to generate the parallel chain block.
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;
otherwise, generating a first empty block.
The parallel chain block generation 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.
Preferably, the determining whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs satisfy the first parallel chain block generation rule of the parallel chain to which the first transaction belongs includes:
calculating a first remainder of the first block height and the first numerical value;
judging whether the first remainder is the same as a channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs;
judging whether the first block height and the second channel number of the parallel chain meet the second parallel chain block generation rule of the parallel chain comprises the following steps:
calculating a first remainder;
and judging whether the first remainder is the same as the second channel number.
The parallel chain block generation principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
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 in operation, 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;
a parallel chain node of the pc4 generates a channel registration update transaction tx30, tx30 comprises parallel chain names pc2 of the pc2 and pc4 of the pc 4;
the backbone node receives tx 30;
the main chain node inquires a channel number 2 according to pc 2;
the main chain node generates a corresponding relation of '2, pc 4', and '2, pc 2' is replaced by '2, pc 4' on the main chain.
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 a main chain block only storing parallel chain transaction of pc3 still needs to be generated, and pc3 is not operated before block (1000), which results in resource waste of the main chain block only storing 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".
Fig. 2 is a flowchart of another parallel chain block generation method according to an embodiment of the present invention. As shown in fig. 2, in this embodiment, the present invention provides a parallel link block generation method suitable for parallel link nodes, where the method includes:
s22: generating a first channel registration transaction according to the first channel number and a first parallel chain name of the current parallel chain and sending the first channel registration transaction to the main chain, so that when the first channel number is not registered, a first corresponding relation between the first channel number and the first parallel chain name is recorded on the main chain; obtaining a first block of a main chain; the first block is packaged with a plurality of first transactions, the packaged first transactions comprise a plurality of first transactions pulled from the memory pool in response to the main chain node obtaining the packaging right of the first block with the first block height, the packaged first transactions are parallel chain transactions, and the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs meet the first parallel chain block generation rule of the parallel chain to which the first transaction belongs;
s241: judging whether the height of the first block and the second channel number of the current parallel chain meet a second parallel chain block generation rule of the current parallel chain:
if yes, go to step S242: generating a first parallel chain block according to the first block;
otherwise, step S243 is executed: the first block header of the first block is synchronized.
The parallel chain block generation 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;
otherwise, generating a first empty block.
The parallel chain block generation principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Preferably, the packed first transaction is a parallel chain transaction, and the first remainder is the same as the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs, and the first remainder is obtained by taking the remainder according to the first block height and the first numerical value;
judging whether the first block height and the second channel number of the current parallel chain meet the second parallel chain block generation rule of the current parallel chain comprises the following steps:
calculating a first remainder;
and judging whether the first remainder is the same as the first channel number.
The parallel chain block generation 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:
generating a first channel loan transaction; the first channel lending transaction comprises a first parallel chain name, a second parallel chain name of a second parallel chain of a channel borrowed from the current parallel chain, and a second block height of lending termination;
sending a first channel loan transaction to the main chain for:
inquiring a first channel number according to the first parallel chain name;
caching the first corresponding relation;
generating a second corresponding relation according to the first channel number and the second parallel chain name, and replacing the first corresponding relation with the second corresponding relation on the main chain;
and when the block height reaches the second block height, replacing the second corresponding relation with the first corresponding relation.
The parallel chain block generation principle of the above embodiment can refer to a method of a preferred embodiment shown in fig. 1, and is not described herein again.
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 3, as another aspect, the present application also provides a computer apparatus including one or more Central Processing Units (CPUs) 301 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage section 308 into a Random Access Memory (RAM) 303. In the RAM303, various programs and data necessary for the operation of the computer apparatus are also stored. The CPU301, ROM302, and RAM303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
The following components are connected to the I/O interface 305: an input portion 306 including a keyboard, a mouse, and the like; an output section 307 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 308 including a hard disk and the like; and a communication section 309 including a network interface card such as a LAN card, a modem, or the like. The communication section 309 performs communication processing via a network such as the internet. A drive 310 is also connected to the I/O interface 305 as needed. A removable medium 311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 310 as necessary, so that a computer program read out therefrom is mounted into the storage section 308 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 309, and/or installed from the removable medium 311.
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 block generation method is applied to a main chain node, and comprises the following steps:
receiving a first channel registration transaction of a first parallel chain; wherein the first channel registration transaction includes a first channel number and a first parallel chain name of the first parallel chain;
judging whether the first channel number is registered:
if not, recording the first corresponding relation between the first channel number and the first parallel chain name on the main chain;
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 parallel chain transaction, judging whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs meet a first parallel chain block generation rule of the parallel chain to which the first transaction belongs:
if not, the first transaction is stored in the memory pool again;
if yes, packaging the first transaction into the first block;
wherein the first block is for parallel chain nodes of parallel chains:
judging whether the height of the first block and the second channel number of the parallel chain meet a second parallel chain block generation rule of the parallel chain:
if yes, generating a first parallel chain block according to the first block;
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;
otherwise, generating a first empty block.
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. The method of claim 1, wherein the determining whether the first block height and the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs satisfy the first parallel chain block generation rule of the parallel chain to which the first transaction belongs comprises:
calculating a first remainder of the first block height and a first numerical value;
judging whether the first remainder is the same as a channel number corresponding to a parallel chain name of a parallel chain to which the first transaction belongs;
the judging whether the first block height and the second channel number of the corresponding parallel chain meet the second parallel chain block generation rule of the corresponding parallel chain comprises:
calculating the first remainder;
and judging whether the first remainder is the same as the second channel number.
5. The method according to any one of claims 1-4, further comprising:
receiving a first channel registration update transaction; wherein the first registration update transaction includes a third parallel chain name of a third parallel chain that is replaced, a fourth parallel chain name of a fourth parallel chain that replaces the 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.
6. The method according to any one of claims 1-4, further comprising:
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, 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 fifth parallel chain name and the fifth channel number;
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 a main chain;
and replacing the fifth corresponding relation with the fourth corresponding relation when the block height reaches the second block height.
7. A parallel chain block generation method is applied to parallel chain nodes, and comprises the following steps:
generating a first channel registration transaction according to a first channel number and a first parallel chain name of a current parallel chain and sending the first channel registration transaction to a main chain, so that when the first channel number is not registered, a first corresponding relation between the first channel number and the first parallel chain name is recorded on the main chain; obtaining a first block of a main chain; the first block is packaged with a plurality of first transactions, the packaged first transactions comprise a plurality of first transactions pulled from a memory pool in response to a main chain node obtaining a packaging right of the first block with a first block height, the packaged first transactions are parallel chain transactions, and the first block height and a channel number corresponding to a parallel chain name of a parallel chain to which the first transactions belong meet a first parallel chain block generation rule of the parallel chain to which the first transactions belong;
judging whether the height of the first block and the second channel number of the current parallel chain meet a second parallel chain block generation rule of the current parallel chain:
if yes, generating a first parallel chain block according to the first block;
otherwise, synchronizing the first block head of the first block.
8. The method of claim 7, 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;
otherwise, generating a first empty block.
9. The method of claim 7, wherein the packed first transaction is a parallel chain transaction, and a first remainder is calculated by taking a remainder of the first block height and a first numerical value, and the first remainder is the same as a lane number corresponding to a parallel chain name of a parallel chain to which the first transaction belongs;
the judging whether the first block height and the second channel number of the current parallel chain meet the second parallel chain block generation rule of the current parallel chain comprises:
calculating the first remainder;
and judging whether the first remainder is the same as the first channel number.
10. The method according to any one of claims 7-9, further comprising:
generating a first channel loan transaction; wherein the first lane lending transaction comprises the first parallel chain name, a second parallel chain name of a second parallel chain of a lane borrowed from the current parallel chain, and a second block height at which lending ends;
sending the first channel loan transaction to a main chain for:
inquiring the first channel number according to the first parallel chain name;
caching the first corresponding relation;
generating a second corresponding relation according to the first channel number and the second parallel chain name, and replacing the first corresponding relation with the second corresponding relation on a main chain;
and when the block height reaches the second block height, replacing the second corresponding relation with the first corresponding relation.
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.
CN202110246886.8A 2021-03-05 2021-03-05 Parallel chain block generation method, computer device and storage medium Active CN112948496B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110246886.8A CN112948496B (en) 2021-03-05 2021-03-05 Parallel chain block generation method, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110246886.8A CN112948496B (en) 2021-03-05 2021-03-05 Parallel chain block generation method, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN112948496A true CN112948496A (en) 2021-06-11
CN112948496B CN112948496B (en) 2023-11-24

Family

ID=76228531

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110246886.8A Active CN112948496B (en) 2021-03-05 2021-03-05 Parallel chain block generation method, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN112948496B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110570576A (en) * 2019-09-06 2019-12-13 杭州复杂美科技有限公司 Lottery system, construction method, operation method, equipment and storage medium thereof
WO2020043048A1 (en) * 2018-08-30 2020-03-05 杭州复杂美科技有限公司 Parallel chain data synchronization method, device, and storage medium
WO2020177537A1 (en) * 2019-03-02 2020-09-10 杭州复杂美科技有限公司 Parallel chain consensus method, data exception processing method, device and storage medium
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020043048A1 (en) * 2018-08-30 2020-03-05 杭州复杂美科技有限公司 Parallel chain data synchronization method, device, and storage medium
WO2020177537A1 (en) * 2019-03-02 2020-09-10 杭州复杂美科技有限公司 Parallel chain consensus method, data exception processing method, device and storage medium
CN110570576A (en) * 2019-09-06 2019-12-13 杭州复杂美科技有限公司 Lottery system, construction method, operation method, equipment and storage medium thereof
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈齐;王正国;李文锋;曹菁菁;: "区块链技术在新型网络购物平台设计中的应用", 武汉理工大学学报(信息与管理工程版), no. 02 *

Also Published As

Publication number Publication date
CN112948496B (en) 2023-11-24

Similar Documents

Publication Publication Date Title
CN111522636A (en) Application container adjusting method, application container adjusting system, computer readable medium and terminal device
CN109756566B (en) Block chain based data storage method, related equipment and storage medium
CN110287196B (en) Block storage method, parallel chain transaction acquisition method, equipment and storage medium
CN110602227B (en) Intelligent contract management method and related device
CN112381543A (en) Multiple signature transaction method, device and storage medium
CN103248622B (en) A kind of Online Video QoS guarantee method of automatic telescopic and system
WO2022100365A1 (en) Method, system, and device for managing artificial intelligence application task, and storage medium
CN112948496A (en) Parallel chain block generation method, computer device, and storage medium
CN112948495B (en) Parallel chain constant block output method, computer device and storage medium
CN112395339A (en) Method and device for checking data access between systems, computer equipment and storage medium
CN109857805B (en) Block chain based data storage method, related equipment and storage medium
CN112948497B (en) Parallel chain block generation method, computer device, and storage medium
CN112839091B (en) Block generation method, computer device and storage medium
CN112804322B (en) Block generation method, computer device and storage medium
CN113094436B (en) Transaction storage method, parallel chain block generation method, device and storage medium
CN112800137A (en) Data scanning method, computer device and storage medium
CN111798239A (en) Parallel chain consensus method, device and storage medium
CN113110934A (en) Parallel chain block generation method, computer device, and storage medium
CN112948388A (en) Parallel chain arbitration consensus method, computer device and storage medium
CN116760906A (en) Information processing method and digital twin system
CN112422305B (en) Upgrading method and device of communication equipment
CN116456292B (en) Signaling interaction method and device for user plane and control plane separation architecture
CN114185896B (en) Data processing method, device, electronic equipment and storage medium
CN116957592B (en) Method for generating digital collection based on blockchain
CN114140237A (en) Transaction screening method, computer 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