Blockchain ledger generation method and apparatus, blockchain node, and storage medium

By generating sub-networks within the blockchain network and employing consensus algorithms, the blockchain ledger is dynamically and distributedly stored, solving the problem of insufficient node storage space, achieving efficient blockchain ledger management, and improving node efficiency and network reliability.

CN115271717BActive Publication Date: 2026-03-31吴小平
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-13
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

The problem of insufficient node storage space, especially the inability of smartphones and tablets to store large amounts of blockchain ledger data, and the unreliability of blocks or blockchain ledgers when block storage nodes are attacked.

Method used

By generating sub-networks within the blockchain network to store only user data related to transactions, and employing consensus algorithms such as POW, POS, DPOS, BFT, or DAG, dynamic distributed storage of the blockchain ledger is achieved, reducing node storage requirements.

Benefits of technology

It significantly saves ledger storage space, improves node efficiency, ensures the reliability and decentralization of the blockchain network, and reduces data transmission workload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115271717B_ABST
    Figure CN115271717B_ABST
Patent Text Reader

Abstract

The application discloses a blockchain ledger generation method and device, a blockchain node and a storage medium. The blockchain network comprises a plurality of nodes, and one or more users are attached to each node. The generation method comprises the following steps: Step 100, generating a genesis block based on a specified asset and a set consensus algorithm in the blockchain network; Step 200, generating a respective subnetwork for all nodes in the blockchain network; Step 300, two users in the blockchain network who need to trade the specified asset join the subnetworks in which they are located; Step 400, completing the transaction in the subnetworks of the two parties and writing the transaction into the blockchain ledgers of the two parties to form a new blockchain ledger; and then repeating Steps 300-400. In the application, the nodes only need to store the data of the users related to the transaction, and therefore, the ledger storage space can be significantly saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of blockchain, and more specifically, to a method, apparatus, blockchain node, and storage medium for generating a blockchain ledger. Background Technology

[0002] Blockchain is a distributed data storage system that includes multiple nodes, each with its own independent blockchain ledger. A typical blockchain ledger consists of a chain-like data table composed of continuously generated blocks. Each block comprises a block number, the hash value of the previous block, a timestamp, and a Merkle tree. Each block's Merkle tree consists of a root, intermediate nodes, and leaf nodes. Leaf nodes store record data, while intermediate and root nodes store the hash values ​​of their child nodes. By using the hash values ​​of the Merkle tree's root and intermediate nodes, the system can quickly verify the consistency of the record data in the leaf nodes to determine if the record data has been modified.

[0003] As the number of transactions increases during the operation of a blockchain, the blockchain ledger also expands continuously. However, each node may struggle to store a large-scale blockchain ledger, especially user-facing apps such as smartphones and tablets, which cannot store large amounts of blockchain ledger data. Storing the blockchain ledger on one or more block storage nodes can alleviate the problem of insufficient node storage space to some extent. However, if block storage nodes are attacked simultaneously, the blocks or blockchain ledger provided by those block storage nodes will become unreliable. Summary of the Invention

[0004] The main objective of this invention is to provide a method, apparatus, blockchain node, and storage medium for generating a blockchain ledger, in order to solve the technical problem of insufficient node storage space in the prior art.

[0005] To achieve the above objectives, according to a first aspect of the present invention, a method for generating a blockchain ledger is provided, the technical solution of which is as follows:

[0006] The method for generating a blockchain ledger involves the following steps: A blockchain network comprises multiple nodes, each with one or more users attached.

[0007] Step 100: Genesis blocks are generated by users in the blockchain network based on the consensus algorithm adapted to the specified asset selection and settings.

[0008] Step 200: Generate a sub-network for each node in the blockchain network;

[0009] Step 300: Two users who need to conduct the specified asset transaction in the blockchain network join each other's sub-networks;

[0010] Step 400: Complete the transaction in the sub-networks of both parties and write the transaction into the blockchain ledgers of both parties to form a new blockchain ledger;

[0011] Then repeat steps 300 to 400.

[0012] As a further improvement to the first aspect of the present invention: the consensus algorithm is of the POW, POS, DPOS, BFT type or DAG type.

[0013] As a further improvement to the first aspect of the present invention: in step 300, any user in the blockchain network can join the sub-network of other users.

[0014] As a further improvement to the first aspect of the present invention: after joining the sub-network of other users, all historical ledgers of this sub-network are synchronized; and after joining the sub-network of other users, new block data is monitored and participation is made in the generation of blockchain consensus of this sub-network.

[0015] As a further improvement to the first aspect of the present invention: Step 400 specifically includes the following steps:

[0016] Step 410: The first user signs the transaction;

[0017] Step 420: Write the transaction into the first user's blockchain ledger;

[0018] Step 430: The first user's first sub-network broadcasts this transaction to the second user's second sub-network;

[0019] Step 440: After receiving the broadcast, all users of the second sub-network verify the transaction.

[0020] Step 450: If the verification is successful, the transaction is accepted and written into the second user's blockchain ledger; if the verification fails, the transaction is not accepted.

[0021] As a further improvement to the first aspect of the present invention:

[0022] Step 410 also includes: the first user broadcasting the signed transaction to the first sub-network;

[0023] Step 420 also includes: other users in the first sub-network verifying the correctness of the transaction and generating a proof of the transaction's legitimacy;

[0024] Step 430 also includes: the first sub-network broadcasting the validity certificate to the second sub-network;

[0025] Step 440 also includes: all users in the second sub-network verifying the validity proof.

[0026] As a further improvement to the first aspect of the present invention: Step 420 further includes packaging the transaction and the proof of legitimacy into a block according to the consensus algorithm and writing it into the blockchain ledger of the first user; Step 450 further includes packaging the verified transaction and the proof of legitimacy into a block according to the consensus algorithm and writing it into the blockchain ledger of the second user.

[0027] To achieve the above objectives, according to a second aspect of the present invention, an apparatus for storing the blockchain ledger generated by the generation method described in the first aspect is provided, the technical solution of which is as follows:

[0028] An apparatus for storing blockchain ledgers, wherein the apparatus performs the following operations for each node: a storage unit for storing blocks in the blockchain to form a storage pool for the current node's blockchain ledger; and a table creation unit for creating a connection table, wherein the connection table includes block storage information of the blockchain ledgers of connected nodes to the current node.

[0029] To achieve the above objectives, according to a third aspect of the present invention, a blockchain node is provided, the technical solution of which is as follows:

[0030] A blockchain node includes: a memory; a processor; and a computer program; wherein the computer program is stored in the memory and configured to be executed by the processor to implement the blockchain ledger generation method described in the first aspect above.

[0031] To achieve the above objectives, according to a fourth aspect of the present invention, a computer-readable storage medium is provided, the technical solution of which is as follows:

[0032] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the blockchain ledger generation method described in the first aspect above.

[0033] In the blockchain ledger generation method, apparatus, blockchain node, and storage medium of the present invention, the node no longer needs to store the data of all users on the entire network, but only needs to store the data of users related to the transaction. Therefore, the ledger storage space can be significantly saved.

[0034] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0035] The accompanying drawings, which form part of this invention, are used to aid in understanding the invention. The content provided in the drawings and their related descriptions can be used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings:

[0036] Figure 1 This is a flowchart of a first embodiment of the blockchain ledger generation method of the present invention.

[0037] Figure 2 This is a flowchart of Step 400 in the first embodiment of the blockchain ledger generation method of the present invention.

[0038] Figure 3 This is a flowchart of Step 400 in the second embodiment of the blockchain ledger generation method of the present invention.

[0039] Figure 4 This is a schematic block diagram illustrating an embodiment of the apparatus for storing a blockchain ledger according to the present invention.

[0040] Figure 5 This is a schematic block diagram illustrating an embodiment of the blockchain node of the present invention. Detailed Implementation

[0041] The present invention will now be clearly and completely described in conjunction with the accompanying drawings. Those skilled in the art will be able to implement the present invention based on these descriptions. Before describing the present invention in conjunction with the accompanying drawings, it should be particularly noted that:

[0042] The technical solutions and features provided in the various parts of this invention, including the following description, can be combined with each other without conflict.

[0043] Furthermore, the embodiments of the present invention described below are generally only some, not all, of the embodiments of the present invention. Therefore, all other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort should fall within the scope of protection of the present invention.

[0044] Regarding the terminology and units used in this invention: The terms "comprising," "having," and any variations thereof in the specification, claims, and related parts of this invention are intended to cover non-exclusive inclusion.

[0045] Figure 1 This is a flowchart of a first embodiment of the blockchain ledger generation method of the present invention.

[0046] like Figure 1 As shown, a blockchain network includes multiple nodes, each with one or more users attached. The method for generating a blockchain ledger includes the following steps:

[0047] Step 100: Genesis blocks are generated by users in the blockchain network based on the consensus algorithm adapted to the specified asset selection and settings.

[0048] Step 200: Generate a sub-network for each node in the blockchain network;

[0049] Step 300: Two users who need to conduct the specified asset transaction in the blockchain network join each other's sub-networks;

[0050] Step 400: Complete the transaction in the sub-networks of both parties and write the transaction into the blockchain ledgers of both parties to form a new blockchain ledger;

[0051] Then repeat steps 300 to 400;

[0052] In step 100, the consensus algorithm may be, but is not limited to, POW (Proof of Work), POS (Proof of Stake), DPOS (Delegated Proof of Stake), BFT (Byzantine Fault Tolerance), or DAG (Directed acyclic graph).

[0053] Figure 2 This is a flowchart of Step 400 in the first embodiment of the blockchain ledger generation method of the present invention.

[0054] like Figure 2 As shown, when a transaction involves the transfer of a specific asset from a first user to a second user, Step 400 specifically includes the following steps:

[0055] Step 410: The first user signs the transaction;

[0056] Step 420: Write the transaction into the first user's blockchain ledger;

[0057] Step 430: The first user's first sub-network broadcasts this transaction to the second user's second sub-network;

[0058] Step 440: After receiving the broadcast, all users of the second sub-network verify the transaction.

[0059] Step 450: If the verification is successful, the transaction is accepted and written into the second user's blockchain ledger; if the verification fails, the transaction is not accepted.

[0060] Furthermore, the present invention also provides a second embodiment of the method for generating a blockchain ledger. In the second embodiment, any user in the blockchain network can join the sub-network of other users. After joining the sub-network of other users, the user can synchronize all historical ledgers of the sub-network, listen for new block data, and participate in the generation of blockchain consensus of the sub-network.

[0061] Figure 3 This is a flowchart of Step 400 in the second embodiment of the blockchain ledger generation method of the present invention.

[0062] like Figure 3 As shown, Step 400 specifically includes the following steps:

[0063] Step 410: The first user signs the transaction and broadcasts the transaction to the first user's first sub-network.

[0064] Step 420: All other users in the first sub-network of the first user verify the correctness of the transaction and generate a proof of the transaction's legitimacy; the transaction and the proof of legitimacy are packaged into a block according to the consensus algorithm and written into the first user's blockchain ledger;

[0065] Step 430: The first user's first sub-network broadcasts this transaction and its proof of legitimacy to the second user's second sub-network;

[0066] Step 440: After the second user's second sub-network receives the broadcast, all users in the second sub-network verify the transaction and its proof of legitimacy.

[0067] Step 450: If the verification passes, the transaction is accepted, and the transaction and proof of legitimacy are packaged into a block according to the consensus algorithm and written into the second user's blockchain ledger; if the verification fails, the transaction is not accepted.

[0068] Figure 4 This is a schematic block diagram illustrating an embodiment of the apparatus for storing a blockchain ledger according to the present invention.

[0069] like Figure 4 As shown, the device for storing the blockchain ledger includes a storage unit 210 and a table creation unit 220. The storage unit 210 stores blocks in the blockchain, forming a storage pool for the current node's blockchain ledger. The table creation unit 220 establishes a connection table, enabling the current node to read all blocks in the blockchain based on the blocks stored in the storage pool and the blocks stored in the blockchain ledgers of connected nodes. The connection table includes block storage information for the blockchain ledgers of connected nodes linked to the current node.

[0070] The device for storing the blockchain ledger may also include an update unit 230, which updates the blocks stored in the storage pool by updating the contact table.

[0071] Storage unit 210, table creation unit 220 and update unit 230 can execute the corresponding steps in the method according to the blockchain ledger generation method in the above method embodiment, for example, by machine-readable instructions executable by storage unit 210, table creation unit 220 and update unit 230. The specific implementation of storage unit 210, table creation unit 220 and update unit 230 can be found in the method embodiment described above, and will not be repeated here.

[0072] Figure 5 This is a schematic block diagram illustrating an embodiment of the blockchain node of the present invention.

[0073] like Figure 5 As shown, the blockchain node includes a processor 120 and a memory 110, with the memory 110 storing a computer program 111. When the computer program 111 is executed by the processor, the blockchain node can perform the steps of the blockchain ledger generation method as described in the above method embodiment. For specific implementation details, please refer to the method embodiment, which will not be repeated here.

[0074] The blockchain nodes provided in this embodiment of the invention may include, but are not limited to, smartphones, tablets, laptops, or desktop computers.

[0075] The processor 120 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 120 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 120 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 120 may further integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 120 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0076] The memory 110 may include one or more computer-readable storage media, which may be non-transitory. The memory 110 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 110 is used to store at least the following computer program 111, which, after being loaded and executed by the processor 120, is capable of implementing the relevant steps of the blockchain ledger generation method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 110 may also include an operating system 112 and data 113, and the storage method may be temporary or permanent storage. The operating system 112 may include Windows, Unix, Linux, etc. The data 113 may include, but is not limited to, accessed data and hot data.

[0077] In some embodiments, a blockchain node may further include a display screen 130, an input / output interface 140, a communication interface 150, a power supply 160, and a communication bus 170.

[0078] Those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on blockchain nodes and may include more or fewer components than illustrated.

[0079] It is understood that if the blockchain ledger generation method in the above embodiments is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes: USB flash drive, mobile hard drive, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk, or optical disk, and other media capable of storing program code.

[0080] Based on this, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described operations. Figures 1 to 3 The steps of the blockchain ledger generation method in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.

[0081] The functions of each functional module of the computer-readable storage medium described in the embodiments of the present invention can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the above method embodiments, which will not be repeated here.

[0082] In the several embodiments provided by this invention, it should be understood that the disclosed blockchain ledger generation method, apparatus, blockchain node, and storage medium can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, and the division of units therein is only a logical functional division. In actual implementation, there may be other division methods, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some communication interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0083] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0084] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0085] According to the blockchain ledger generation method, apparatus, blockchain node, and storage medium of the present invention, the blockchain ledger can be dynamically and distributedly stored in the nodes, thereby reducing the burden on the nodes and improving work efficiency while ensuring the effective operation of the blockchain network.

[0086] Furthermore, according to the blockchain ledger generation method, apparatus, blockchain node, and storage medium of the present invention, the size of the ledger stored by each node can be dynamically adjusted according to the status of active nodes in the network, while ensuring sufficient redundancy of the blockchain ledger and ensuring the requirements of decentralization, trustlessness, collective maintenance, and reliable database of the blockchain system, thereby reducing the burden on nodes and improving work efficiency.

[0087] Furthermore, according to the blockchain ledger generation method, apparatus, blockchain node, and storage medium of the present invention, the storage pool of the node can dynamically change according to the number of nodes in the network and its own access frequency, and the stored blocks are also increased or decreased to a limited extent on the original basis, without large-scale data changes, thereby reducing the efficiency of network query and data transmission.

[0088] The foregoing has provided a detailed description of the blockchain ledger generation method, apparatus, blockchain node, and storage medium provided in the embodiments of the present invention. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably.

[0089] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0090] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0091] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. It should be noted that in this specification, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0092] The sequence numbers of the above embodiments of the present invention are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. The above descriptions are only specific implementations of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

[0093] The foregoing has described the relevant content of the present invention. Specific examples have been used in this specification to illustrate the principles and implementation methods of the present invention. The above description of the embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.

Claims

1. A method for generating a blockchain ledger, the blockchain network comprising a plurality of nodes, each node having attached thereto one or more users, the method comprising: The generating method comprises the following steps: ​ Step 100, generating a genesis block based on a specified asset and a consensus algorithm in a blockchain network; Step 200, generating a respective sub-network for all nodes in the blockchain network; Step 300, two users in the blockchain network who need to conduct a transaction of the specified asset join the sub-networks in which the two users are located; Step 400, completing the transaction in the sub-networks of the two users and writing the transaction into the blockchain ledgers of the two users to form new blockchain ledgers; Then, repeating Step 300 to Step 400.

2. The method of claim 1, wherein: The consensus algorithm is POW, POS, DPOS, BFT or DAG.

3. The method of claim 1, wherein: In Step 300, any user in the blockchain network can join the sub-network of another user.

4. The method of claim 3, wherein: After joining the sub-network of another user, all historical ledgers of the sub-network are synchronized; and after joining the sub-network of another user, new block data is listened to and the blockchain consensus of the sub-network is participated in.

5. The method of claim 3, wherein: Step 400 specifically comprises the following steps: Step 410, signing the transaction by the first user; Step 420, writing the transaction into the blockchain ledger of the first user; Step 430, broadcasting the transaction by the first sub-network of the first user to the second sub-network of the second user; Step 440, verifying the transaction by all users of the second sub-network after receiving the broadcast; Step 450, if the verification is passed, receiving the transaction and writing the transaction into the blockchain ledger of the second user; if the verification is not passed, not receiving the transaction.

6. The generating method of the blockchain ledger according to claim 5, wherein: Step 410 further comprises broadcasting the signed transaction by the first user to the first sub-network; Step 420 further comprises verifying the correctness of the transaction by other users of the first sub-network and generating a legality proof of the transaction; Step 430 further comprises broadcasting the legality proof by the first sub-network to the second sub-network; Step 440 further comprises verifying the legality proof by all users of the second sub-network.

7. The method of claim 6, wherein: In Step 420, the transaction and the legality proof are packaged into a block according to the consensus algorithm and written into the blockchain ledger of the first user; and in Step 450, the transaction and the legality proof that pass the verification are packaged into a block according to the consensus algorithm and written into the blockchain ledger of the second user.

8. Apparatus for storing a blockchain ledger generated by the generation method of one of claims 1-7, characterized in that: The device for storing the blockchain ledger performs the following operations for each node: a storage unit that stores blocks in the blockchain and forms a storage pool of the blockchain ledger of the current node; a table establishing unit that establishes a contact table, wherein the contact table comprises block storage information of the blockchain ledger of a contact node connected to the current node.

9. A blockchain node, characterized in that, comprises: a memory; a processor; and a computer program; wherein the computer program is stored in the memory and configured to be executed by the processor to implement the generating method of the blockchain ledger according to any one of claims 1-7.

10. A storage medium readable by a computer, characterized by: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method for generating the blockchain ledger in any one of claims 1-7.

Citation Information

Patent Citations

  • Chain routing and system for realizing block chain cross-chain communication

    CN107231299A

  • Block chain whole network splitting method and system

    CN107528886A