CN112839091A - Block generation method, computer device and storage medium - Google Patents

Block generation method, computer device and storage medium Download PDF

Info

Publication number
CN112839091A
CN112839091A CN202110028693.5A CN202110028693A CN112839091A CN 112839091 A CN112839091 A CN 112839091A CN 202110028693 A CN202110028693 A CN 202110028693A CN 112839091 A CN112839091 A CN 112839091A
Authority
CN
China
Prior art keywords
block
parallel chain
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
CN202110028693.5A
Other languages
Chinese (zh)
Other versions
CN112839091B (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 CN202110028693.5A priority Critical patent/CN112839091B/en
Publication of CN112839091A publication Critical patent/CN112839091A/en
Application granted granted Critical
Publication of CN112839091B publication Critical patent/CN112839091B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • Bioethics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (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 block generation method, computer equipment and a storage medium, wherein the method comprises the following steps: in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and executing the following steps for each first transaction: judging whether the first time slot parameter value of the first transaction is null: if not, judging whether the first block height and the first time slot parameter value meet a first time slot judgment rule of a parallel chain to which the first transaction belongs: if not, the first transaction is stored in the memory pool again; a first block is generated according to each pulled first transaction. The parallel chain block discharging method and the parallel chain block discharging device enable the parallel chain block discharging to be constant, and stability and practicability of the parallel chain are improved.

Description

Block generation method, computer device and storage medium
Technical Field
The present application relates to the field of block chain technology, and in particular, to a block generation method, a computer device, and a storage medium.
Background
In the prior art, the more constant the block-out time, the more stable the blockchain system. Assuming that the block-out interval of the parallel chain parachain1 (hereinafter referred to as p1) is 5 blocks, if there is no parallel chain transaction of p1 in the continuous 5 main chain blocks, the parachain1 generates a parallel chain empty block; assuming that no transaction of p1 exists in blocks (1_ main) to (20_ main) on the main chain, the p1 generates four empty blocks (1_ p1) to (4_ p1) with constant generation time, but if the block (23_ main) includes a transaction of p1, the p1 generates a block (5_ p1) from the block (23_ main); the generation time of block (5_ p1) is not constant compared with the generation times of blocks (1_ p1) to (4_ p 1); and because the parallel chain is simple in construction mode and low in cost, many operators prefer to construct the parallel chain, for example, a game parallel chain; the parallel chain block output is more regular, the block output time is more controllable, and the block output time can be calculated to be more consistent with the actual business scene of the parallel chain.
Disclosure of Invention
In view of the above-mentioned drawbacks and deficiencies of the prior art, it is desirable to provide a block generation method, a computer device, and a storage medium with constant block output.
In a first aspect, the present invention provides a block generation method suitable for a main chain node, where parallel chain transactions of a same parallel chain are configured with a same time slot parameter value, a time slot determination rule and a block interval rule of the same parallel chain are the same, each parallel chain is configured with a corresponding block interval, and the block interval and the corresponding time slot parameter value are the same, the method includes:
in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and executing the following steps for each first transaction:
judging whether the first time slot parameter value of the first transaction is null:
if not, judging whether the first block height and the first time slot parameter value meet a first time slot judgment rule of a parallel chain to which the first transaction belongs:
if not, the first transaction is stored in the memory pool again;
generating a first block according to each pulled first transaction;
wherein the first block is for parallel chain nodes of each first parallel chain:
judging whether the first block height and the first block interval of the parallel chain meet the block interval judgment 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 block generation method suitable for parallel chain nodes, where parallel chain transactions of the same parallel chain are configured with the same time slot parameter value, a time slot judgment rule and a block interval rule of the same parallel chain are the same, each parallel chain is configured with a corresponding block interval, and the block interval is the same as the corresponding time slot parameter value, where the method includes:
obtaining a first block of a main chain; the first block is generated by a main chain node according to each pulled first transaction, the pulled first transaction comprises a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining the packaging right of the first block with the first block height, and the first time slot parameter of the pulled first transaction is not empty, and the first block height of the first block and the first time slot parameter value of the first transaction meet a first time slot judgment rule of a parallel chain to which the first transaction belongs;
judging whether the first block height and the first block interval of the current parallel chain meet a first block interval judgment 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 provides a block generation method suitable for a main chain node, where each parallel chain has a corresponding block interval registered in the main chain, the method includes:
in response to obtaining the packaging right of the first block with the first block height, pulling a plurality of first transactions from the memory pool, and executing the following steps for each first transaction respectively: when the first transaction is a parallel chain transaction, judging whether the first block height and the first block interval of the parallel chain to which the first transaction belongs meet a first block interval judgment rule of the parallel chain to which the first transaction belongs: if not, the first transaction is stored in the memory pool again;
generating a first block according to each pulled first transaction;
wherein the first block is for parallel chain nodes of each first parallel chain:
judging whether the first block height and the second block interval of the parallel chain meet a second block interval judgment 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 fourth aspect, the present invention provides a block generation method suitable for parallel chain nodes, where each parallel chain has a corresponding block interval registered in a main chain, and the method includes:
obtaining a first block of a main chain; the first block is generated by a main chain node according to each pulled first transaction, the pulled first transaction comprises a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining the packaging right of the first block with the first block height, the pulled first transactions are parallel chain transactions, and the first block height and the first block interval of the parallel chain to which the first transactions belong meet a first block interval judgment rule of the parallel chain to which the first transactions belong;
judging whether the first block height and the first block interval of the current parallel chain meet a second block interval judgment 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 fifth aspect, the present invention also provides a computer device 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 block generation method provided according to embodiments of the present invention.
In a sixth aspect, the present invention also provides a storage medium storing a computer program that causes a computer to execute the block generation method provided according to the embodiments of the present invention.
In the block generating method, the computer device, and the storage medium according to embodiments of the present invention, in response to obtaining the packing right of the first block with the first block height, a plurality of first transactions are pulled from the memory pool, and the following steps are performed for each first transaction: judging whether the first time slot parameter value of the first transaction is null: if not, judging whether the first block height and the first time slot parameter value meet a first time slot judgment rule of a parallel chain to which the first transaction belongs: if not, the first transaction is stored in the memory pool again; the method for generating the first block according to the first transaction of each pulling ensures that the block output of the parallel chain is constant, and increases the stability and the practicability of the parallel chain.
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 block generation method according to an embodiment of the present invention.
Fig. 2 is a flowchart of another block generation method according to an embodiment of the present invention.
Fig. 3 is a flowchart of another block generation method according to an embodiment of the present invention.
Fig. 4 is a flowchart of another block generation method according to an embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of a block generation method according to an embodiment of the present invention. As shown in fig. 1, in the present embodiment, the present invention provides a block generation method for a main chain node, where parallel chain transactions of the same parallel chain are configured with the same timeslot parameter value, and the method includes:
s12: 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:
s141: judging whether the first time slot parameter value of the first transaction is null:
otherwise, step S1421 is executed: judging whether the first block height and the first time slot parameter value meet a first time slot judgment rule of a parallel chain to which the first transaction belongs:
otherwise, go to step S1422: the first transaction is stored in the memory pool again;
s16: generating a first block according to each pulled first transaction;
wherein the first block is for parallel chain nodes of each first parallel chain:
judging whether the first block height and the first block interval of the parallel chain meet the block interval judgment 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, the determining whether the first block height and the first slot parameter value satisfy the pre-configured slot determination rule includes "determining whether a remainder of the first block height and the first slot parameter value is 0", the determining whether the first block height and a first block interval of the belonging parallel chain satisfy the block interval determination rule of the belonging parallel chain includes "determining whether a remainder of the first block height and a first block interval of the belonging parallel chain is 0", and the generating the first parallel chain block according to the first block includes "determining whether a parallel chain transaction of the belonging parallel chain is included in the first block: if yes, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain; if not, generating a first empty block as an example; the block chain network is assumed to have parachain1 and 2; the parallel chain transaction of the parachain1 is configured with a timeslot parameter value of 5, the block interval of the parachain1 is also 5, the parallel chain transaction of the parachain2 is configured with a timeslot parameter of 8, and the block interval of the parachain2 is also 8;
assuming that a first block of the first block height is a block (100); tx1 is the parallel chain transaction of parachain1, tx2 is the parallel chain transaction of parachain2, and tx3 to tx10 are the main chain transactions;
the block link point, in response to obtaining the packing right of the block (100), performs step S12: the transactions tx 1-tx 10 are pulled from the memory pool and the following steps are performed for tx 1-tx 10, respectively:
for tx 1:
the block chain node performs step S141: judging whether the time slot parameter value of tx1 is null:
since the timeslot parameter value of tx1 is 5 and is not null, the tile link point performs step S1421: determine whether the remainder of 100 and 5 is 0:
if the value is 0, the operation is ended;
for tx 2:
the block chain node performs step S141: judging whether the time slot parameter value of tx2 is null:
since the timeslot parameter value of tx2 is 8 and is not null, the block link point performs step S1421: determine whether the remainder of 100 and 8 is 0:
if not, the block link point executes step S1422 to restore tx2 to the memory pool;
for tx3 to tx 10:
since tx 3-tx 10 are all backbone transactions, the above method is not performed;
the block chain node executes the step S16, and generates a block (100) according to tx1, tx3 to tx 10;
the parallel chain link point of parachain1 determines whether the remainder of 100 and 5 is 0:
since 0, the parallel chain node of parachain1 determines whether the block (100) includes a parallel chain transaction of parachain 1:
since block (100) includes tx1, parallel chain blocks are generated according to tx 1.
The parallel chain link point of parachain2 determines whether the remainder of 100 and 8 is 0:
since it is not 0, the parallel chain node synchronization blockheader of parachain2 (100).
Assuming that a first block of the first block height is a block (105); tx11 is parallel chain transaction of parachain2, and tx 12-tx 20 are main chain transaction;
the block link point, in response to obtaining the packing right of the block (105), performs step S12: the transactions tx 11-tx 20 are pulled from the memory pool and the following steps are performed for tx 11-tx 20, respectively:
for tx 11:
the block chain node performs step S141: judging whether the time slot parameter value of tx11 is null:
since the timeslot parameter value of tx1 is 8 and is not null, the block link point performs step S1421: determine whether the remainder of 100 and 8 is 0:
if not, the block link point executes step S1422 to restore tx11 to the memory pool;
for tx12 to tx 20:
the methods of S12 to S14 are not performed because tx12 to tx20 are all backbone transactions;
the block chain node executes the step S16, and generates a block (105) according to tx 12-tx 20;
the parallel chain node of parachain1 determines whether the remainder of 105 and 5 is 0:
since 0, the parallel chain node of parachain1 determines whether the block (105) includes a parallel chain transaction of parachain 1:
since the parallel chain transaction of parachain1 is not included in block (105), an empty block is generated.
The parallel chain node of parachain2 determines whether the remainder of 105 and 8 is 0:
since it is not 0, the parallel chain node synchronization blockheader of parachain2 (105).
In further embodiments, the time slot determination rule and the block interval determination rule of the first parallel chain may also be configured according to actual requirements, for example, the time slot determination rule is configured to "determine whether a remainder of the first block height and the first time slot parameter value is 1", and correspondingly, the block interval determination rule is configured to "determine whether a remainder of the first block height and the first block interval is 1", and as long as the time slot determination rule and the block interval determination rule on the same parallel chain are correspondingly the same, the same technical effect may be achieved.
In more embodiments, the same time slot determination rule and the corresponding same block interval determination rule may be configured for all parallel chains according to actual requirements, so that the same technical effect may be achieved.
The embodiment enables the parallel chain block to be constant, and increases the stability and the practicability of the parallel chain.
It will be understood by those skilled in the art that the present application is applicable to several scenarios where parallel chains require constant blocks, for example: 1. a scene of a periodic push service; 2. red packets are generated periodically and scenes of points are generated periodically.
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 block generation principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Assume the following first scenario:
the slot parameter value and the block interval configuration of the parachain1 are very large, for example, the configuration is 50, many transactions of parachain1 are necessarily stored in the memory pool of the block chain node and wait to be packaged, and a large number of transactions of parachain1 occupy the storage space of the memory pool;
the problem of the first scenario described above can be solved by the method of the following embodiment.
Preferably, the method further comprises:
receiving a second transaction, and judging whether a third time slot parameter value of the second transaction is null:
if not, judging whether the first value of the transaction stored with the third time slot parameter value in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
Fig. 2 is a flowchart of another block generation method according to an embodiment of the present invention. As shown in fig. 2, in this embodiment, the present invention provides a block generation method suitable for parallel chain nodes, where parallel chain transactions of the same parallel chain are configured with the same timeslot parameter value, a timeslot judgment rule and a block interval rule of the same parallel chain are the same, each parallel chain is configured with a corresponding block interval, and the block interval is the same as the corresponding timeslot parameter value, where the method includes:
s22: obtaining a first block of a main chain; the first block is generated by a main chain node according to each pulled first transaction, the pulled first transaction comprises a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining the packaging right of the first block with the first block height, and the first time slot parameter of the pulled first transaction is not empty, and the first block height of the first block and the first time slot parameter value of the first transaction meet a first time slot judgment rule of a parallel chain to which the first transaction belongs;
s241: judging whether the first block height and the first block interval of the current parallel chain meet a first block interval judgment 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 block generation principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
The embodiment enables the parallel chain block to be constant, and increases the stability and the practicability of the parallel chain.
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 block generation principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Fig. 3 is a flowchart of another block generation method according to an embodiment of the present invention. As shown in fig. 3, in the present embodiment, the present invention provides a block generation method for a main chain node, where each parallel chain has a corresponding block interval registered in the main chain, and the method includes:
s32: 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 first block interval of the parallel chain to which the first transaction belongs meet a first block interval judgment rule of the parallel chain to which the first transaction belongs: if not, the first transaction is stored in the memory pool again;
s34: generating a first block according to each pulled first transaction;
wherein the first block is for parallel chain nodes of each first parallel chain:
judging whether the first block height and the second block interval of the parallel chain meet a second block interval judgment 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, for example, it is determined whether the first block height and the first block interval of the parallel chain to which the first transaction belongs satisfy the first block interval determination rule of the parallel chain to which the first transaction belongs, including "determining whether a remainder of the first block height and the first block interval of the parallel chain to which the first transaction belongs is 0", it is assumed that there are parachain1 and parachain2 in the block chain network; the block interval of parachain1 is 5, and the block interval of parachain2 is 8;
assuming that a first block of the first block height is a block (100); tx1 is the parallel chain transaction of parachain1, tx2 is the parallel chain transaction of parachain2, and tx3 to tx10 are the main chain transactions;
the block link point, in response to obtaining the packing right of the block (100), performs step S32: the transactions tx 1-tx 10 are pulled from the memory pool and the following steps are performed for tx 1-tx 10, respectively:
for tx 1:
block link point determination determines whether the remainder of 100 and 5 is 0: if the value is 0, the operation is ended;
for tx 2:
block link point determination whether the remainder of 100 and 8 is 0:
if not, storing tx2 in the memory pool again;
for tx3 to tx 10:
since tx 3-tx 10 are all backbone transactions, the above method is not performed;
the block chain node executes the step S34, and generates a block (100) according to tx1, tx3 to tx 10;
the parallel chain link point of parachain1 determines whether the remainder of 100 and 5 is 0:
since 0, the parallel chain node of parachain1 determines whether the block (100) includes a parallel chain transaction of parachain 1:
since block (100) includes tx1, parallel chain blocks are generated according to tx 1.
The parallel chain link point of parachain2 determines whether the remainder of 100 and 8 is 0:
since it is not 0, the parallel chain node synchronization blockheader of parachain2 (100).
The above embodiment is different from the embodiment shown in fig. 1 in that, in the embodiment shown in fig. 1, if a client performs malicious actions and tampers with the timeslot parameter value of a certain parallel chain transaction, the parallel chain transaction cannot be executed by the corresponding parallel chain node. In the above embodiment, since the main chain records the block interval of each parallel chain, the problem that the parallel chain transaction is tampered by the client does not exist, and the correct execution of the parallel chain transaction is ensured.
The embodiment enables the parallel chain block to be constant, and increases the stability and the practicability of the parallel chain.
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 block generation principle of the above embodiment can refer to the method shown in fig. 3, and is not described herein again.
Assume the following second scenario:
the slot parameter value and the block interval configuration of the parachain1 are very large, for example, the configuration is 50, many transactions of parachain1 are necessarily stored in the memory pool of the block chain node and wait to be packaged, and a large number of transactions of parachain1 occupy the storage space of the memory pool;
the problem of the second scenario described above can be solved by the method of the following embodiment.
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.
Fig. 4 is a flowchart of another block generation method according to an embodiment of the present invention. As shown in fig. 4, in the present embodiment, the present invention provides a block generation method for parallel chain nodes, where each parallel chain has a corresponding block interval registered in a main chain, and the method includes:
s42: obtaining a first block of a main chain; the first block is generated by a main chain node according to each pulled first transaction, the pulled first transaction comprises a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining the packaging right of the first block with the first block height, the pulled first transactions are parallel chain transactions, and the first block height and the first block interval of the parallel chain to which the first transactions belong meet a first block interval judgment rule of the parallel chain to which the first transactions belong;
s441: judging whether the first block height and the first block interval of the current parallel chain meet a second block interval judgment rule of the current parallel chain:
if yes, go to step S442: generating a first parallel chain block according to the first block;
otherwise, step S443 is executed: the first block header of the first block is synchronized.
The block generation principle of the above embodiment can refer to the method shown in fig. 3, and is not described herein again.
The embodiment enables the parallel chain block to be constant, and increases the stability and the practicability of the parallel chain.
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 block generation principle of the above embodiment can refer to the method shown in fig. 3, and is not described herein again.
Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention. As shown in fig. 5, as another aspect, the present application also provides a computer apparatus including one or more Central Processing Units (CPUs) 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the computer apparatus are also stored. The CPU501, ROM502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a computer-readable storage medium that exists separately and is not assembled into a computer device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (12)

1. A block generation method is characterized in that parallel chain transactions of the same parallel chain are configured with the same time slot parameter value, time slot judgment rules and block interval rules of the same parallel chain are correspondingly the same, each parallel chain is configured with a corresponding block interval, the block interval is the same as the corresponding time slot parameter value, the method is suitable for a main chain node, and the method comprises the following steps:
in response to obtaining packaging rights for a first block of a first block height, pulling a number of first transactions from a memory pool, and for each of the first transactions, performing the following steps:
judging whether the first time slot parameter value of the first transaction is null:
if not, judging whether the first block height and the first time slot parameter value meet a first time slot judgment rule of the parallel chain to which the first transaction belongs:
if not, the first transaction is stored in the memory pool again;
generating a first block according to each pulled first transaction;
wherein the first block is for parallel chain nodes of each first parallel chain:
judging whether the first block height and the first block interval of the parallel chain meet the block interval judgment 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 a third time slot parameter value of the second transaction is null:
if not, judging whether the first value of the transaction stored with the third time slot parameter value in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
4. A block generation method is characterized in that parallel chain transactions of the same parallel chain are configured with the same time slot parameter value, time slot judgment rules and block interval rules of the same parallel chain are correspondingly the same, each parallel chain is configured with a corresponding block interval, the block interval is the same as the corresponding time slot parameter value, the method is suitable for parallel chain nodes, and the method comprises the following steps:
obtaining a first block of a main chain; the first block is generated by a main chain node according to each pulled first transaction, the pulled first transaction comprises a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining the packaging right of the first block with the first block height, and the first time slot parameter of the pulled first transaction is not null, and the first block height of the first block and the first time slot parameter value of the first transaction meet a first time slot judgment rule of a parallel chain to which the first transaction belongs;
judging whether the first block height and the first block interval of the current parallel chain meet a first block interval judgment 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.
5. The method of claim 4, wherein the generating a first parallel chain block from the first block comprises:
determining whether a parallel chain transaction of a current parallel chain is included in the first block:
if yes, generating a first parallel chain block according to the parallel chain transaction of each current parallel chain;
otherwise, generating a first empty block.
6. A block generation method, wherein each parallel chain is registered with a corresponding block interval at a main chain, the method being adapted for main chain nodes, the method comprising:
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 first block interval of the parallel chain to which the first transaction belongs meet a first block interval judgment rule of the parallel chain to which the first transaction belongs: if not, the first transaction is stored in the memory pool again;
generating a first block according to each pulled first transaction;
wherein the first block is for parallel chain nodes of each first parallel chain:
judging whether the first block height and the second block interval of the parallel chain meet a second block interval judgment 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.
7. The method of claim 6, wherein the generating a first parallel chain block from the first block comprises:
judging whether the first block comprises parallel chain transactions of the parallel chain:
if yes, generating a first parallel chain block according to the parallel chain transaction of each belonging parallel chain;
otherwise, generating a first empty block.
8. The method of claim 6, further comprising:
receiving a second transaction, and judging whether the second transaction is a parallel chain transaction:
if yes, judging whether a first numerical value of the parallel chain transaction of the parallel chain to which the second transaction belongs stored in the memory pool reaches a first threshold value:
if so, the second transaction is discarded.
9. A block generation method, wherein each parallel chain is registered with a corresponding block interval at a main chain, the method being applicable to parallel chain nodes, the method comprising:
obtaining a first block of a main chain; the first block is generated by a main chain node according to each pulled first transaction, the pulled first transaction comprises a plurality of first transactions pulled from a memory pool in response to the main chain node obtaining a packaging right of a first block with a first block height, the pulled first transactions are parallel chain transactions, and the first block height and a first block interval of a parallel chain to which the first transactions belong meet a first block interval judgment rule of the parallel chain to which the first transactions belong;
judging whether the first block height and the first block interval of the current parallel chain meet a second block interval judgment 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.
10. The method of claim 9, 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.
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.
CN202110028693.5A 2021-01-11 2021-01-11 Block generation method, computer device and storage medium Active CN112839091B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110028693.5A CN112839091B (en) 2021-01-11 2021-01-11 Block generation method, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110028693.5A CN112839091B (en) 2021-01-11 2021-01-11 Block generation method, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN112839091A true CN112839091A (en) 2021-05-25
CN112839091B CN112839091B (en) 2022-06-24

Family

ID=75929395

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110028693.5A Active CN112839091B (en) 2021-01-11 2021-01-11 Block generation method, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN112839091B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114827167A (en) * 2022-03-03 2022-07-29 杭州复杂美科技有限公司 Node selection and transaction sending method, equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108985774A (en) * 2018-07-18 2018-12-11 百度在线网络技术(北京)有限公司 A kind of motivational techniques, device, equipment and the storage medium of block chain network
CN109395394A (en) * 2018-09-29 2019-03-01 杭州复杂美科技有限公司 Predict guessing game dispositions method and method for gaming, equipment and storage medium
CN110516150A (en) * 2019-08-26 2019-11-29 杭州复杂美科技有限公司 Parallel chain transaction method for pushing, equipment and storage medium
WO2020043048A1 (en) * 2018-08-30 2020-03-05 杭州复杂美科技有限公司 Parallel chain data synchronization method, device, and storage medium
CN111008249A (en) * 2019-12-04 2020-04-14 杭州复杂美科技有限公司 Parallel chain block synchronization method, device and storage medium
CN111242780A (en) * 2020-01-12 2020-06-05 杭州复杂美科技有限公司 Method, device and storage medium for sending consensus transaction
CN111249739A (en) * 2020-02-18 2020-06-09 杭州复杂美科技有限公司 Main chain node selection method, game result display method, equipment and storage medium
CN111432027A (en) * 2020-04-14 2020-07-17 杭州复杂美科技有限公司 Parallel chain block synchronization method, device and storage medium
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108985774A (en) * 2018-07-18 2018-12-11 百度在线网络技术(北京)有限公司 A kind of motivational techniques, device, equipment and the storage medium of block chain network
WO2020043048A1 (en) * 2018-08-30 2020-03-05 杭州复杂美科技有限公司 Parallel chain data synchronization method, device, and storage medium
CN109395394A (en) * 2018-09-29 2019-03-01 杭州复杂美科技有限公司 Predict guessing game dispositions method and method for gaming, equipment and storage medium
CN110516150A (en) * 2019-08-26 2019-11-29 杭州复杂美科技有限公司 Parallel chain transaction method for pushing, equipment and storage medium
CN111008249A (en) * 2019-12-04 2020-04-14 杭州复杂美科技有限公司 Parallel chain block synchronization method, device and storage medium
CN111242780A (en) * 2020-01-12 2020-06-05 杭州复杂美科技有限公司 Method, device and storage medium for sending consensus transaction
CN111249739A (en) * 2020-02-18 2020-06-09 杭州复杂美科技有限公司 Main chain node selection method, game result display method, equipment and storage medium
CN111432027A (en) * 2020-04-14 2020-07-17 杭州复杂美科技有限公司 Parallel chain block synchronization method, device and storage medium
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
贾大宇等: "区块链的存储容量可扩展模型", 《计算机科学与探索》 *
邵奇峰等: "区块链技术:架构及进展", 《计算机学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114827167A (en) * 2022-03-03 2022-07-29 杭州复杂美科技有限公司 Node selection and transaction sending method, equipment and storage medium
CN114827167B (en) * 2022-03-03 2023-10-17 杭州复杂美科技有限公司 Node selection and transaction transmission method, device and storage medium

Also Published As

Publication number Publication date
CN112839091B (en) 2022-06-24

Similar Documents

Publication Publication Date Title
US11064162B2 (en) Intelligent video analysis system and method
CN111798316B (en) Parallel chain consensus method, apparatus and storage medium
CN110442432B (en) Service processing method, system, device, equipment and storage medium
CN110516150B (en) Parallel chain transaction pushing method, equipment and storage medium
CN111242780A (en) Method, device and storage medium for sending consensus transaction
US10039135B2 (en) Communication access method and user equipment
CN112839091B (en) Block generation method, computer device and storage medium
CN111861471A (en) Parallel chain consensus method, parallel chain block rollback method, device and storage medium
CN112381543A (en) Multiple signature transaction method, device and storage medium
CN110210972B (en) Method, device and storage medium for sending consensus transaction
CN111008249B (en) Parallel chain block synchronization method, device and storage medium
CN111259074A (en) Block synchronization method, device and storage medium
CN112600905B (en) Transaction broadcasting and block generating method, apparatus and storage medium
CN110298756B (en) Parallel chain self-consensus method, device and storage medium
CN111400043A (en) Transaction pool management method, device and storage medium
CN112804322B (en) Block generation method, computer device and storage medium
US10250515B2 (en) Method and device for forwarding data messages
CN112733202B (en) Parallel chain supervision consensus method, computer device and storage medium
CN114493875A (en) Transaction execution method, computer device, and storage medium
CN111858772A (en) Parallel chain transaction group execution method, device and storage medium
CN112948496B (en) Parallel chain block generation method, computer device and storage medium
CN112948495B (en) Parallel chain constant block output method, computer device and storage medium
CN111639939A (en) Block restoring method, equipment and storage medium
CN111798239A (en) Parallel chain consensus method, device and storage medium
CN110704382A (en) File deployment method, device, server 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