CN112948496B - 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
CN112948496B
CN112948496B CN202110246886.8A CN202110246886A CN112948496B CN 112948496 B CN112948496 B CN 112948496B CN 202110246886 A CN202110246886 A CN 202110246886A CN 112948496 B CN112948496 B CN 112948496B
Authority
CN
China
Prior art keywords
parallel chain
block
transaction
parallel
chain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110246886.8A
Other languages
Chinese (zh)
Other versions
CN112948496A (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

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 application provides a parallel chain block generation method, a computer device and a storage medium, wherein the method comprises the following steps: receiving a first lane registration transaction for 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 packing rights of the first blocks of the first block height, fetching a number of first transactions from the memory Chi La and performing for 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 restored in the memory pool; if so, the first transaction is packed into the first block. The application stabilizes the squeeze of transaction peaks and reduces the commission.

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 generating method, a computer device, and a storage medium.
Background
In the existing architecture of the main chain parallel chains, parallel chain transactions of different parallel chains are mixed into one main chain block, and the parallel chains filter own transactions according to own title.
The mechanism can lead to the increase of parallel chain transactions in a certain period, and a large number of parallel chain transactions can squeeze packaging resources of main chain transactions, so that a blockchain network is congested; the handling fee of the consensus transaction depends on the network congestion, and the mechanism can cause the problem of wasting the handling fee for parallel chain transactions which are not urgent to the uplink of the consensus transaction.
Disclosure of Invention
In view of the foregoing drawbacks or shortcomings in the prior art, it is desirable to provide a parallel chain block generation method, computer device, and storage medium that suppresses peak trading, and reduces handling costs.
In a first aspect, the present application provides a parallel chain block generation method applicable to a main chain node, where the method includes:
receiving a first lane registration transaction for a first parallel chain; wherein the first lane registration transaction includes a first lane number and a first parallel chain name of the first parallel chain;
judging whether the first channel number is registered:
if not, recording a first corresponding relation between the first channel number and the first parallel chain name on the main chain;
in response to obtaining the packing rights of the first blocks of the first block height, fetching a number of first transactions from the memory Chi La and performing for 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 restored in the memory pool;
if yes, packaging the first transaction into a first block;
wherein the first block is used for parallel chain nodes of each parallel chain:
judging whether the first block height and the second channel number of the affiliated parallel chain meet the second parallel chain block generation rule of the affiliated parallel chain or not:
if yes, generating a first parallel chain block according to the first block;
if not, the first block header of the first block is synchronized.
In a second aspect, the present application provides a parallel chain block generation method applicable to parallel chain 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; acquiring a first block of a main chain; the first block is packed with a plurality of first transactions, the packed first transaction comprises a first parallel chain block generation rule of a parallel chain to which the first transaction belongs in response to the packing right of the first block with the first block height obtained by the main chain node and the plurality of first transactions fetched from the memory Chi La, the packed first transaction is a parallel chain transaction, and the channel number corresponding to the parallel chain name of the parallel chain to which the first block height and the first transaction belong meets the first parallel chain block generation rule of the parallel chain to which the first transaction belongs;
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 or not:
if yes, generating a first parallel chain block according to the first block;
if not, the first block header of the first block is synchronized.
In a third aspect, the present application 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 the parallel chain block generation method provided in accordance with embodiments of the present application.
In a fourth aspect, the present application also provides a storage medium storing a computer program for causing a computer to execute the parallel chain block generation method provided according to the embodiments of the present application.
The parallel chain block generation method, the computer equipment and the storage medium provided by the embodiments of the application register transactions 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 packing rights of the first blocks of the first block height, fetching a number of first transactions from the memory Chi La and performing for 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 restored in the memory pool; if so, the method of packing the first transaction into the first block can stabilize the squeeze of the transaction peak and reduce the commission.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments, 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 application.
FIG. 2 is a flowchart of another parallel chain block generation method according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The application is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be noted that, for convenience of description, only the portions related to the application are shown in the drawings.
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
FIG. 1 is a flowchart of a parallel chain block generation method according to an embodiment of the present application. As shown in fig. 1, in this embodiment, the present application provides a parallel chain block generation method applicable to a main chain node, where the method includes:
s12: receiving a first lane registration transaction for a first parallel chain; wherein the first lane registration transaction includes a first lane number and a first parallel chain name of the first parallel chain;
s141: judging whether the first channel number is registered:
if not, then step S142 is performed: 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 packing rights of the first blocks of the first block height, fetching a number of first transactions from the memory Chi La and performing for 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 restored in the memory pool;
if yes, packaging the first transaction into a first block;
wherein the first block is used for parallel chain nodes of each parallel chain:
judging whether the first block height and the second channel number of the affiliated parallel chain meet the second parallel chain block generation rule of the affiliated parallel chain or not:
if yes, generating a first parallel chain block according to the first block;
if not, the first block header 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 value; judging whether 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 judging whether the first block height and the second channel number of the parallel chain to which the first transaction belongs meet the second parallel chain block generation rule of the parallel chain to which the first transaction belongs comprises' calculating the first remainder; judging whether the first remainder and the second channel number are the same or not as an example; assuming that a main chain and parallel chains parallel 1-parallel 3 (hereinafter referred to as pc 1-pc 3) exist in the block chain network; pc1 registration channel number 1, pc2 registration channel number 2, pc3 registration channel number 3; the first block with the first value of 10 and the first block height is block (101);
the parallel link point of pc1 generates a lane registration transaction tx1 and sends it to the backbone, tx1 comprising lane number 1 and parallel chain name pc1; it will be appreciated by those skilled in the art that the lane registration transaction may be generated by common parallel link points or may be further defined, for example, by parallel link points that can only be deployed by the operator of the parallel chain, the application not being particularly limited;
the main chain node executes step S12 to receive tx1;
the master node performs step S141 to determine whether 1 is registered:
since it is not registered, the main chain node performs step S142 to record the correspondence relationship "1, pc1" to the main chain;
similarly, the parallel link point of pc2 generates and transmits a lane registration transaction tx2 (2, pc 2) to the backbone, and the parallel link point of pc3 generates and transmits a lane registration transaction tx3 (3, pc 3) to the backbone;
the final backbone had recorded "1, pc1", "2, pc2", "3, pc3";
the main chain node executes step S16, and in response to obtaining the packing right of the block (101), takes tx11 to tx20 from the memory Chi La (where tx11 to tx15 are parallel chain transactions of pc1, tx16 is parallel chain transaction of pc2, and tx17 to tx20 are main chain transactions);
for tx11 to tx15, taking tx11 as an example:
calculating the remainder of 101 and 10, wherein the remainder is 1;
since channel numbers 1 and pc1 are the same, tx11 is packed into block (100); likewise, tx12 to tx15 are also packed into block (100);
for tx16:
calculating the remainder of 101 and 10, wherein the remainder is 1;
because the channel numbers of 1 and pc2 are different, storing tx16 into the memory pool again;
for tx17 to tx20:
since tx17 to tx20 are not parallel chain transactions, then tx17 to tx20 are restored to the memory pool;
transactions in the final block (101) are tx11 to tx15;
the parallel chain node of pc1 calculates the remainder of 101 and 10, the remainder being 1;
if the parallel chain node of pc1 judges that the channel numbers of 1 and pc1 are the same, generating a parallel chain block according to the block (101);
the parallel chain node of pc2 judges that the channel numbers of 1 and pc2 are different, and synchronizes the blockheader (101); the parallel chain node of pc3 is identical to the parallel link point of pc2, and not described in detail herein, the parallel chain node of pc3 also synchronizes the blockheader (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 further 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, "whether the second channel number of the parallel chain to which the first block height belongs satisfies the second parallel chain block generation rule of the parallel chain to which the first block height belongs" should be configured to determine whether the mantissa of the first block height is the same as the second channel number of the parallel chain to which the first block height belongs.
In more embodiments, the first value may be further configured according to actual requirements, for example, configured as 100, so that the same technical effect can be achieved. The first value is preferably configured to be associated with the total number of parallel chains in the current blockchain network, e.g., when the total number of parallel chains in the blockchain network is 20, the first value is configured to be 100.
Those skilled in the art will appreciate that in the above embodiment, where the transactions in block (101) are tx 11-tx 15, then the parallel chain node of pc1 should generate a parallel chain block from tx 11-tx 15; if there is no transaction in the real block (101), each node of pc1 will generate a parallel chain empty block.
Those skilled in the art will appreciate that when the first remainder is other than 1-3, the backbone nodes will pull several backbone transactions to generate backbone blocks.
In the prior art, if a large number of parallel chain transactions of pc3 are generated within a period of time, the peak of the parallel chain transactions of pc3 squeezes the packaging resources of the main chain transactions, thereby causing packaging congestion of the main chain transactions; the embodiment can disperse the transactions of parallel chains to different blocks, and can effectively stabilize the extrusion of transaction peaks.
In the prior art, when the packing congestion situation is generated, the problem of increasing transaction fee 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 reduces the cost of handling while stabilizing the squeeze of the transaction peak.
In the prior art, it was assumed that there was a backbone, parallel chain pc1 in the blockchain network; the main chain block (101) has main chain transactions tx1 and tx2 and parallel chain transactions tx3 and tx4 of pc1; after tx3 and tx4 are obtained from the block (101), the parallel chain node of pc1 cannot directly generate corresponding parallel chain blocks through tx3 and tx4, but needs to verify whether the transaction in the block (101) is tampered or not; the verification mode is as follows: the merck path of tx3 and the merck root of block (101) are obtained to verify if tx3 is tampered, the merck path of tx4 and the merck root of block (101) are obtained to verify if tx4 is tampered, and corresponding parallel chain blocks are generated according to tx3 and tx4 if neither tx3 nor tx4 is tampered.
In the application, since only the transaction of pc1 is included in the block (101), each parallel chain node of pc1 does not need to acquire the merck path of each transaction of pc1 in the block (101), only needs to directly calculate the merck root according to each transaction in the block (101), if the calculated merck root is the same as the merck root carried by the block header (101), the transaction is not tampered, and a parallel chain block can be directly generated according to each transaction in the block (101), so that the parallel chain transaction is verified faster to generate the parallel chain block.
Preferably, generating the first parallel chain block from the first block comprises:
determining whether the first block includes a parallel chain transaction of the parallel chain:
if so, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain;
and if not, generating a first empty block.
The parallel chain block generation principle of the above embodiment may refer to the method shown in fig. 1, and will not be described herein.
Preferably, the method further comprises:
receiving a second transaction, and judging whether the second transaction is a parallel chain transaction or not:
if yes, judging whether a first value of a parallel link transaction of a parallel link to which the second transaction belongs is stored in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
The embodiment ensures that only a certain number of parallel chain transactions can be reserved in the memory pool of the main chain node for the same parallel chain, so that the memory pool of the main chain node is prevented from being jammed, and packaging resources of the main chain transactions are squeezed.
Preferably, 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 value;
judging whether 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;
the determining whether the first block height and the second channel number of the affiliated parallel chain meet the second parallel chain block generation rule of the affiliated parallel chain comprises:
calculating a first remainder;
and judging whether the first remainder and the second channel number are the same.
The parallel chain block generation principle of the above embodiment may refer to the method shown in fig. 1, and will not be described herein.
Assuming a first application scenario where some parallel chains in the blockchain network are no longer operational (assumed to be pc 2); pc2 still occupies lane number 2, meaning that it is still necessary to generate a main chain block storing only the parallel chain transactions of pc2, and pc2 is no longer operated, which would result in resource waste of the main chain block storing only the parallel chain transactions of pc 2; because there is no transaction in the main chain block storing only the parallel chain transaction of pc2, the merkel root does not need additional calculation, and the like, even part of main chain nodes may be profitable, while malicious contend for the packing right of the main chain block storing only the parallel chain transaction of pc 2. The problems arising for the first application scenario can be solved by the method of the following embodiments.
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 the fourth parallel chain of the replaced third parallel chain;
inquiring a third channel number according to a 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, while pc4 has no lane number to which it belongs;
the parallel chain node of pc4 generates a channel registration update transaction tx30, tx30 comprising the parallel chain names pc2, pc4 of pc 2;
the backbone node receives tx30;
the main chain node inquires a channel number 2 according to pc 2;
the backbone nodes generate a correspondence "2, pc4", with "2, pc2" replaced by "2, pc4" on the backbone.
Assuming a second application scenario where some parallel chains in the blockchain network are no longer operational within a certain blockheight (assuming pc3 is no longer operational before block (1000) due to system upgrades); while pc3 still occupies channel number 3 in front of block (1000), meaning that a main chain block for storing only the parallel chain transaction of pc3 still needs to be generated, and pc3 is no longer operated in front of block (1000), which results in resource waste of the main chain block for storing only 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 merkel root does not need additional calculation, and the like, even part of main chain nodes may be profitable, while malicious contend for the packing 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 lending transaction; wherein the first lane lending transaction includes a fifth parallel chain name of a fifth parallel chain being lent, a sixth parallel chain name of a sixth parallel chain borrowing lanes of the fifth parallel chain, a second block height of a lending termination;
inquiring a fifth channel number according to a fifth parallel chain name;
caching a fourth corresponding relation of a fifth parallel chain name and a 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 the main chain;
when the block height reaches the second block height, the fifth corresponding relation is replaced by the fourth corresponding relation.
Assuming pc3 is no longer operating before block (1000) due to system upgrades, pc3 lends the channel of channel number 3 to pc5 before 1000;
the parallel link point generation channel of pc3 lends transaction tx40, tx40 including parallel chain names pc3, pc5 of pc3, parallel chain name pc5, height 1000 of end of lending;
the backbone node receives tx40;
the main chain node inquires a channel number 3 according to pc 3;
the backbone node caches "3, pc3";
the main chain nodes generate corresponding relations of 3 and pc5, and the 3 and pc3 are replaced by the 3 and pc5 on the main chain;
when the tile height reaches 1000, "3, pc5" is replaced back with "3, pc3".
FIG. 2 is a flowchart of another parallel chain block generation method according to an embodiment of the present application. As shown in fig. 2, in this embodiment, the present application provides a parallel chain block generation method applicable to parallel chain 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; acquiring a first block of a main chain; the first block is packed with a plurality of first transactions, the packed first transaction comprises a first parallel chain block generation rule of a parallel chain to which the first transaction belongs in response to the packing right of the first block with the first block height obtained by the main chain node and the plurality of first transactions fetched from the memory Chi La, the packed first transaction is a parallel chain transaction, and the channel number corresponding to the parallel chain name of the parallel chain to which the first block height and the first transaction belong meets the first parallel chain block generation rule of the parallel chain to which the first transaction belongs;
s241: 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 or not:
if yes, step S242 is executed: generating a first parallel chain block according to the first block;
no, step S243 is performed: the first block header of the first block is synchronized.
The parallel chain block generation principle of the above embodiment may refer to the method shown in fig. 1, and will not be described herein.
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;
and if not, generating a first empty block.
The parallel chain block generation principle of the above embodiment may refer to the method shown in fig. 1, and will not be described herein.
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 calculated according to the first block height and the first numerical value;
the determining 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 a first remainder;
it is determined whether the first remainder is the same as the first lane number.
The parallel chain block generation principle of the above embodiment may refer to the method shown in fig. 1, and will not be described herein.
Preferably, the method further comprises:
generating a first channel lending transaction; wherein the first channel lending transaction includes a first parallel chain name, a second parallel chain name of a second parallel chain borrowing the channel of the current parallel chain, a second block height of a lending termination;
transmitting a first channel lending transaction to the backbone 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;
when the block height reaches the second block height, the second corresponding relation is replaced by the first corresponding relation.
The parallel chain block generation principle of the above embodiment may refer to a method of a preferred embodiment shown in fig. 1, and will not be described herein.
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
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 required for the operation of the computer device are also stored. The CPU301, ROM302, and RAM303 are connected to each other through 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 section 306 including a keyboard, a mouse, and the like; an output portion 307 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 308 including a hard disk or 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. The 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 installed on the drive 310 as needed, so that a computer program read therefrom is installed into the storage section 308 as needed.
In particular, according to embodiments 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 via the communication portion 309, and/or installed from the removable medium 311.
As still another aspect, the present application also provides a computer-readable storage medium, which may be a computer-readable storage medium contained in the apparatus of the above-described embodiment; or may be a computer-readable storage medium, alone, that is not assembled into a computer device. The computer-readable storage medium stores one or more programs for use by one or more processors to perform the methods described herein.
The flowcharts 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 application. 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 involved in the embodiments of the present application may be implemented in software or in hardware. The described units or modules may also be provided in a processor, for example, each of the units may be a software program provided in a computer or a mobile smart device, or may be separately configured hardware devices. Wherein the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
The above description is only illustrative of the preferred embodiments of the present application and of the principles of the technology employed. It will be appreciated by persons skilled in the art that the scope of the application referred to in the present application is not limited to the specific combinations of the technical features described above, but also covers other technical features formed by any combination of the technical features described above or their equivalents without departing from the spirit of the application. Such as the above-mentioned features and the technical features disclosed in the present application (but not limited to) having similar functions are replaced with each other.

Claims (12)

1. A method of parallel chain block generation, the method being applicable to a backbone node, the method comprising:
receiving a first lane registration transaction for a first parallel chain; wherein the first lane registration transaction includes a first lane number and a first parallel chain name of the first parallel chain;
judging whether the first channel number is registered or not:
if not, recording a first corresponding relation between the first channel number and the first parallel chain name to a main chain;
in response to obtaining the packing rights of the first block height, fetching a number of first transactions from the memory Chi La and performing, for each of the first transactions, respectively:
when the first transaction is a parallel chain transaction, judging whether the first block height and a channel number corresponding to a parallel chain name of a 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 restored to the memory pool;
if yes, packaging the first transaction into the first block;
wherein the first block is for parallel chain nodes of each parallel chain:
judging whether the first block height and the second channel number of the affiliated parallel chain meet a second parallel chain block generation rule of the affiliated parallel chain or not:
if yes, generating a first parallel chain block according to the first block;
and if not, 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:
determining whether a parallel chain transaction of the parallel chain is included in the first block:
if so, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain;
and if not, generating a first empty block.
3. The method as recited in claim 1, further comprising:
receiving a second transaction, and judging whether the second transaction is a parallel chain transaction or not:
if yes, judging whether a first value of a parallel link transaction of a parallel link to which the second transaction belongs is stored in a memory pool reaches a first threshold value:
if so, the second transaction is discarded.
4. The method of claim 1, wherein determining whether the first block height, the channel number corresponding to the parallel chain name of the parallel chain to which the first transaction belongs, satisfy a 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 the first 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 determining 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:
calculating the first remainder;
and judging whether the first remainder and the second channel number are the same.
5. The method of 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 replaced third parallel chain, a fourth parallel chain name of a fourth parallel chain replacing 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 a third corresponding relation generated by the third channel number and the third parallel chain name with the second corresponding relation on a main chain.
6. The method of any one of claims 1-4, further comprising:
receiving a first channel lending transaction; wherein the first lane lending transaction includes a fifth parallel chain name of a fifth parallel chain being lent, a sixth parallel chain name of a sixth parallel chain borrowing a lane of the fifth parallel chain, a second block height of a lending termination;
inquiring a fifth channel number according to the name of the fifth parallel chain;
caching a fourth corresponding relation of 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 when the block height reaches the second block height, replacing the fifth corresponding relation with the fourth corresponding relation.
7. A method of parallel chain block generation, the method being applicable to parallel chain nodes, the method comprising:
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; acquiring 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 fetched from a memory Chi La in response to obtaining the packaging weight of the first block with a first block height at a main chain node, the packaged first transactions are parallel chain transactions, and channel numbers corresponding to the parallel chain names of the parallel chains of the first block height and the first transaction meet a first parallel chain block generation rule of the parallel chains of the first transaction;
judging whether the first block height and the second channel number of the current parallel chain meet a second parallel chain block generation rule of the current parallel chain or not:
if yes, generating a first parallel chain block according to the first block;
and if not, 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 the first block includes a parallel chain transaction of a current parallel chain:
if yes, generating a first parallel chain block according to the parallel chain transaction of each current parallel chain;
and if not, 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 the same as a lane number corresponding to a parallel chain name of a parallel chain to which the first transaction belongs, the first remainder being calculated from the first block height and a first numerical remainder;
the determining 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 includes:
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 lending transaction; wherein the first channel lending transaction includes the first parallel chain name, a second parallel chain name of a second parallel chain borrowing channels of a current parallel chain, a second block height of a lending termination;
transmitting the first channel lending transaction to a backbone 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 of any of claims 1-10.
12. A storage medium storing a computer program, which when executed by a processor implements the method of 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 CN112948496A (en) 2021-06-11
CN112948496B true 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
区块链技术在新型网络购物平台设计中的应用;陈齐;王正国;李文锋;曹菁菁;;武汉理工大学学报(信息与管理工程版)(02);全文 *

Also Published As

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

Similar Documents

Publication Publication Date Title
CN102541657B (en) The method and apparatus that during for running hardware accelerator, function is distributed
CN111798316B (en) Parallel chain consensus method, apparatus and storage medium
CN110083745B (en) Data query method, device and storage medium
CN109756566B (en) Block chain based data storage method, related equipment and storage medium
CN111242780A (en) Method, device and storage medium for sending consensus transaction
CN111639902A (en) Data auditing method based on kafka, control device, computer equipment and storage medium
CN110490734B (en) Transaction group construction and broadcasting method and system, equipment and storage medium
CN112948496B (en) Parallel chain block generation method, computer device and storage medium
CN110322350B (en) Method, device, equipment and storage medium for cutting hollow block in consensus network
CN109857805B (en) Block chain based data storage method, related equipment and storage medium
CN112839091B (en) Block generation method, computer device and storage medium
CN112948495B (en) Parallel chain constant block output method, computer device and storage medium
CN112448833A (en) Multi-management-domain communication method and device
CN112819625B (en) Parallel chain arbitration consensus method, computer device, and storage medium
CN114579054A (en) Data processing method and device, electronic equipment and computer readable medium
CN108964904A (en) Group cipher method for managing security, device, electronic equipment and storage medium
CN112948497B (en) Parallel chain block generation method, computer device, and storage medium
CN112950171A (en) Bank business processing system and method
CN112804322B (en) Block generation method, computer device and storage medium
CN112948388A (en) Parallel chain arbitration consensus method, computer device and storage medium
CN112733202A (en) Parallel chain supervision consensus method, computer device and storage medium
CN107707383B (en) Put-through processing method and device, first network element and second network element
CN111639939A (en) Block restoring method, equipment and storage medium
CN111798239A (en) Parallel chain consensus method, device and storage medium
CN111858772A (en) Parallel chain transaction group execution method, device and storage medium

Legal Events

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