Block chain data processing method and device, storage medium and computer equipment

By employing multi-threaded parallel construction and multi-disk parallel writing methods, the problem of excessively long construction time for large-scale blockchain data models is solved, achieving efficient data generation and performance testing.

CN121722718APending Publication Date: 2026-03-24TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies, the process of building large-scale data models for blockchain is too time-consuming and has low data generation efficiency, which affects the performance testing process of blockchain systems.

Method used

Blockchain transaction data is constructed in parallel using multiple threads, block data sets are written in parallel using multiple disks, hash data is generated serially based on the target order relationship, and finally index data and blockchain state data are constructed to determine the blockchain data to be generated.

Benefits of technology

It improves the efficiency of blockchain data generation, shortens the construction time of large-scale data models, and enhances the performance testing efficiency of blockchain systems under large-scale data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121722718A_ABST
    Figure CN121722718A_ABST
Patent Text Reader

Abstract

The invention provides a block chain data processing method and device, a storage medium and computer equipment. The method comprises the following steps: acquiring a first quantity group of block chain transaction data constructed by multiple threads in parallel; generating a first number of block data sets according to the first number group of block chain transaction data; writing the first number of block data sets into corresponding disks in parallel to obtain a first number of first block files; serially generating Hash data corresponding to each block data in the first number of block data sets based on the target sequence relationship, and writing the Hash data into the corresponding first block file to obtain a first number of second block files; constructing index data and block chain state data based on the first number of second block files; and determining to-be-generated block chain data according to the second block file, the index data and the block chain state data. According to the method, the generation efficiency of large-scale block chain data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of blockchain technology, and in particular to a blockchain data processing method, apparatus, storage medium, and computer equipment. Background Technology

[0002] Blockchain is a decentralized distributed ledger that is stored in a block-chain format, is immutable, secure and reliable. Blockchain combines technologies such as distributed storage, peer-to-peer transmission, consensus mechanisms, and cryptography. It records transaction processing data through a continuously growing chain of data blocks, ensuring data security and transparency.

[0003] With the development of blockchain technology, the scope of blockchain applications is becoming increasingly broad. The increase in business data leads to a surge in the amount of data stored in blockchain systems, resulting in a greater number of databases. Therefore, it is necessary to test whether a blockchain system can support large-scale data. Generally, a blockchain system capable of supporting petabyte (PB) level data is considered to be able to support large-scale data. To verify whether a blockchain system can support large-scale data, its performance under such conditions needs to be tested. Specifically, a real-world large-scale dataset is needed to test the blockchain system's performance under a large-scale data model. However, the time required to construct blockchain data in related technologies is long, resulting in very low data generation efficiency. Summary of the Invention

[0004] This disclosure provides a blockchain data processing method, apparatus, storage medium, and computer device. The method writes block data of multiple blocks to multiple disks in parallel, thereby improving the efficiency of generating large-scale blockchain data, and testing the performance of the blockchain system based on the generated blockchain data.

[0005] According to one aspect of this disclosure, a blockchain data processing method is provided, the method comprising:

[0006] Obtain the first number of sets of blockchain transaction data constructed in parallel by multiple threads;

[0007] A first number of block data sets are generated based on the first number of sets of blockchain transaction data. Each block data set includes block body data and blockchain transaction attribute data. The blockchain transaction attribute data includes data in the block header data excluding hash data.

[0008] The first number of block datasets are merged and written to the corresponding disks to obtain the first number of first block files;

[0009] Hash data corresponding to each block data in the first number of block data sets is generated serially based on the target order relationship, and the hash data is written into the corresponding first block file to obtain the first number of second block files;

[0010] Based on the first number of second block files, construct index data and blockchain state data;

[0011] The blockchain data to be generated is determined based on the second block file, the index data, and the blockchain state data.

[0012] According to one aspect of this disclosure, a blockchain data processing apparatus is provided, the apparatus comprising:

[0013] The acquisition unit is used to acquire the first number of sets of blockchain transaction data constructed in parallel by multiple threads.

[0014] The generation unit is configured to generate a first number of block data sets based on the first number of sets of blockchain transaction data. Each block data set includes block body data and blockchain transaction attribute data. The blockchain transaction attribute data includes data in the block header data excluding hash data.

[0015] The first writing unit is used to write the first number of block datasets merged into rows and written to the corresponding disk to obtain the first number of first block files;

[0016] The second writing unit serially generates hash data corresponding to each block data in the first number of block data sets based on the target order relationship, and writes the hash data into the corresponding first block file to obtain a first number of second block files;

[0017] The construction unit is used to construct index data and blockchain state data based on the first number of second block files;

[0018] The determining unit is used to determine the blockchain data to be generated based on the second block file, the index data, and the blockchain state data.

[0019] Optionally, in some embodiments, the generation unit includes:

[0020] The first determining subunit is used to determine the second number of block data corresponding to each group of blockchain transaction data and the target data structure of the block data, wherein the target data structure indicates that the block data includes block body data and blockchain transaction attribute data;

[0021] The first generation subunit is used to generate a first number of block data sets based on the second quantity, the first quantity of blockchain transaction data, and the target data structure.

[0022] Optionally, in some embodiments, the first generating subunit includes:

[0023] The partitioning module is used to partition each group of blockchain transaction data according to the second quantity, so as to obtain a second quantity of blockchain transaction data sets corresponding to each group of blockchain transaction data.

[0024] The construction module is used to construct corresponding block data based on each set of blockchain transaction data, thereby obtaining a set of block data corresponding to each set of blockchain transaction data, wherein the set of block data includes a second number of block data.

[0025] Optionally, in some embodiments, the building module includes:

[0026] The packaging submodule is used to package the data of each blockchain transaction data set to obtain the block body data corresponding to each blockchain transaction data set.

[0027] The first determining submodule is used to calculate the corresponding blockchain transaction attribute data based on the block body data, and to determine the block data corresponding to each blockchain transaction data set based on the block body data and the corresponding blockchain transaction attribute data.

[0028] Optionally, in some embodiments, the first writing unit includes:

[0029] The first acquisition subunit is used to acquire the mount paths corresponding to the first number of disks respectively;

[0030] The first writing subunit is used to merge the first number of block datasets into rows and write them to the corresponding disk according to the mount path, so as to obtain the first number of first block files.

[0031] Optionally, in some embodiments, the first write subunit includes:

[0032] The first determining module is used to determine the writing order of block data in each block data set based on the block height of the block data in each block data set;

[0033] The writing module is used to write the first number of block data sets to the corresponding disks in parallel according to the corresponding mount paths through multiple data writing threads, based on the writing order of the block data in each block data set, to obtain the first number of first block files.

[0034] Optionally, in some embodiments, the writing module includes:

[0035] The second determining submodule is used to configure multiple block file paths in each disk and determine the correspondence between block data and block file paths in each block data set;

[0036] The write submodule is used to write the block data to the corresponding disk in parallel according to the corresponding relationship and the write order based on the mount path corresponding to each block data set and the corresponding write thread, so as to obtain a first number of first block files.

[0037] Optionally, in some embodiments, the second writing unit includes:

[0038] The second determining subunit is used to determine the target order relationship for hash data generation based on the block height of each block data;

[0039] The second generation subunit is used to generate hash data for each block of data one by one according to the target order relationship;

[0040] The second writing subunit is used to write the hash data into the corresponding first block file to obtain a first number of second block files.

[0041] Optionally, in some embodiments, the second generating subunit includes:

[0042] The generation module is used to generate hash data of the target block data based on the blockchain transaction data of the target block data when the target block data is the genesis block data;

[0043] The second determining module is used to determine the first hash data of the target block data based on the hash data of the preceding block data when the target block data is not the genesis block data.

[0044] The calculation module is used to perform hash calculations on the blockchain transaction data of the target block data to obtain the blockchain transaction tree root hash value of the target block data, and generate the second hash data of the target block data based on the blockchain transaction tree root hash value and the first hash data.

[0045] The third determining module is used to determine the hash data of the target block data based on the first hash data and the second hash data.

[0046] Optionally, in some embodiments, the second write subunit includes:

[0047] The fourth determining module is used to determine the filling order of the hash data based on the block height of each block data in all block data sets;

[0048] The filling module is used to sequentially fill the first hash data and the second hash data into the block header data of each block data according to the filling order, so as to obtain a first number of second block files.

[0049] Optionally, in some embodiments, the building unit includes:

[0050] The second acquisition subunit is used to acquire the first index information of the block data in each of the block data sets in the plurality of second block files;

[0051] The third acquisition subunit is used to acquire the second index information of the blockchain transaction data in the corresponding block data set;

[0052] The third generation subunit is used to generate multiple index data in parallel based on the first index information and the second index information.

[0053] According to one aspect of this disclosure, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the blockchain data processing method as described above.

[0054] According to one aspect of this disclosure, a storage medium is provided that stores a computer program, which, when executed by a processor, implements the blockchain data processing method as described above.

[0055] According to one aspect of this disclosure, a computer program product is provided, the computer program product including a computer program that is read and executed by a processor of a computer device, causing the computer device to perform the blockchain data processing method as described above.

[0056] The blockchain data processing method provided in this disclosure involves: acquiring a first number of sets of blockchain transaction data constructed in parallel by multiple threads; generating a first number of block data sets based on the first number of sets of blockchain transaction data; merging the first number of block data sets and writing them to the corresponding disks to obtain a first number of first block files; serially generating hash data corresponding to each block data in the first number of block data sets based on a target order relationship, and writing the hash data to the corresponding first block files to obtain a first number of second block files; constructing index data and blockchain state data based on the first number of second block files; and determining the blockchain data to be generated based on the second block files, the index data, and the blockchain state data.

[0057] Therefore, the blockchain data processing method disclosed herein constructs multiple sets of blockchain transaction data in parallel using multi-threading, generates corresponding block data sets based on these sets, and then merges these multiple block datasets and writes them to the corresponding disks. This fully utilizes multiple disks to improve overall data writing performance, increases the block data writing speed, and thus improves the generation efficiency of large-scale blockchain data models. Next, hash data for each block can be generated sequentially according to the target order, and the generated hash data is serially filled into the block data to ensure the integrity and rationality of the generated block data. Furthermore, the generated hash data can be written to the corresponding block file. After all block data has been written, index data and blockchain state data can be constructed based on the block file and the block data to ensure the integrity of the generated blockchain data. Finally, a large-scale blockchain data model is determined based on the block file, index data, and blockchain state data. Attached Figure Description

[0058] The accompanying drawings are provided to further understand the technical solutions of this disclosure and constitute a part of the specification. They are used together with the embodiments of this disclosure to explain the technical solutions of this disclosure and do not constitute a limitation on the technical solutions of this disclosure.

[0059] Figure 1 This is a schematic diagram of a blockchain data processing method in related technologies;

[0060] Figure 2 This is a system architecture diagram of the blockchain data processing method according to an embodiment of this disclosure;

[0061] Figure 3 A schematic flowchart illustrating the blockchain data processing method provided in this embodiment of the disclosure;

[0062] Figure 4 A schematic diagram illustrating the multi-threaded construction of blockchain transaction data provided in this embodiment of the disclosure;

[0063] Figure 5 A schematic diagram of the data structure of the block file database provided in this embodiment of the disclosure;

[0064] Figure 6 A schematic diagram of the data structure of block data provided in the embodiments of this disclosure;

[0065] Figure 7 A schematic diagram illustrating the disk-database path mapping provided in this embodiment of the disclosure;

[0066] Figure 8 A schematic diagram of block data in a block file database provided in this embodiment of the disclosure;

[0067] Figure 9A schematic diagram illustrating the generation of hash data provided in an embodiment of this disclosure;

[0068] Figure 10 A schematic diagram illustrating the writing of index data to BlockDB as provided in an embodiment of this disclosure;

[0069] Figure 11 A schematic diagram of the index data provided in the embodiments of this disclosure;

[0070] Figure 12 This is another schematic diagram of the blockchain data processing method provided in the embodiments of this disclosure;

[0071] Figure 13 This is a schematic diagram of the structure of a blockchain data processing device provided in an embodiment of the present disclosure;

[0072] Figure 14 This is a terminal structure diagram for implementing various methods according to an embodiment of the present disclosure;

[0073] Figure 15 This is a server structure diagram illustrating the implementation of various methods according to an embodiment of the present disclosure. Detailed Implementation

[0074] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this disclosure.

[0075] Before providing a further detailed description of the embodiments of this disclosure, the terms and concepts used in these embodiments are explained, and they are subject to the following interpretations:

[0076] Blockchain: Blockchain is a distributed ledger technology that links data blocks sequentially in chronological order to form a chain structure, and uses cryptography to ensure that the data is immutable and unforgeable. Blockchain consists of three basic elements: transaction data, blocks, and the chain.

[0077] Block: A block is a unit in the blockchain that stores transaction processing data and related data. It represents a collection of all transaction processing data generated within a certain period and is used to record the transaction processing data and status results generated within that period. A block typically consists of a block header and a block body. The block header includes a unique identifier (hash value) for each block and contains information such as the identifier of the previous block (the hash value of the preceding block), the Merkle root, the timestamp, the difficulty value, a random number, and the read-write set root. The block body contains each transaction processing data and its corresponding hash value. The hash value, Merkle root, timestamp, difficulty value, and random number of each block constitute the block's metadata.

[0078] Block height: Block height represents the sequential number of each block in the blockchain. It usually starts with 0 or 1 and gradually increases. The creation of each new block will increase the block height by 1.

[0079] Block Database (BlockDB): Generally, the block database is used to store block data, which may include transaction processing data, transaction results, block height, and hash. Therefore, in practical blockchain systems, the BlockDB stores a large amount of data, and the probability of using the BlockDB for data querying is relatively low; it is generally used for backing up and restoring transaction processing data. To improve the performance of the blockchain system, write-ahead logging (WAL) files and database indexes can be used instead of the block data stored in the BlockDB to facilitate block data querying. Thus, the BlockDB stores index information for transaction processing data and block index information.

[0080] State Database (StateDB): The state database is used to store world state data updated during transaction processing, as well as block metadata. World state data refers to the read / write key values ​​and some key data (such as block height and hash) generated during a transaction.

[0081] As business data increases, new blocks are continuously generated and added to the blockchain system during operation. After a period of operation, the amount of data on the blockchain gradually accumulates, and the number of databases in the blockchain system also increases. At this time, the data processing performance of the blockchain system will also be affected. For example, the efficiency of writing transaction data or the speed of querying historical transaction data will decrease. Therefore, the blockchain system hopes to prove through testing that it can support large-scale data, that is, under the condition of large-scale business data, the blockchain system can normally provide storage and query services while maintaining good processing performance.

[0082] For current blockchain systems, large-scale data is generally understood to be petabyte (PB) level data. Related technologies demonstrate that blockchain systems can support various storage methods such as cloud file systems and distributed databases to prove their ability to support large-scale data. However, this is merely a theoretical proof and does not provide a real-world large-scale data model to verify whether a blockchain system can truly support large-scale data. This is because building a large-scale data model requires a considerable amount of time. One blockchain data generation method involves continuously sending transaction processing data to a transaction processing environment to build large-scale data. This process requires sending transaction processing data to nodes, nodes receiving data and performing transaction processing, transaction verification, reaching consensus, and finally writing the transaction processing data into a database. However, this method's data processing is extremely cumbersome and complex, resulting in low data generation efficiency.

[0083] Another approach is to build a transaction data builder and write transaction data block by block. Please refer to [link / reference needed]. Figure 1 , Figure 1This is a schematic diagram of a blockchain data processing method in related technologies. This method improves the blockchain data writing process based on the characteristics of blockchain. Compared with directly writing transaction processing data, the transaction processing data construction procedure does not include writing steps such as node consensus, data scheduling, and smart contract execution. The transaction processing data construction program is run repeatedly, writing data into blocks one by one through a single disk. The specific writing process is as follows: Each time the transaction processing data construction program is run, step ① is executed to construct the original transaction processing data, package the transaction processing data and store it in the block file database, generating the block body data of the block. Then, the hash value of the current block is calculated based on the transaction processing data. If the current block is the genesis block, the calculated hash value is filled into the block header. If the current block is not the genesis block, the hash value PreHash of the previous block and the hash value Hash of the current block are filled into the block header. Further, step ② is executed to construct index information based on the block file in the block file database and store the generated index information in the block database. Finally, step ③ is executed to update the world state data based on the data in the block database and store the generated world state data in the state database. Each time a block needs to be built, the above steps must be followed. The I / O capacity of a single disk is limited. Taking the sequential data writing speed of a single disk as an example, if the speed is 80MB / s, without considering other data processing logic, it would take 155 days to write 1PB of data. The whole process takes a long time, resulting in low efficiency in generating large-scale data, which slows down the process of performance testing of the blockchain system.

[0084] In order to address the aforementioned problem of low efficiency in generating large-scale data, this disclosure provides a blockchain data processing method to improve the efficiency of generating large-scale blockchain data, thereby accelerating the performance testing of blockchain systems under large-scale data models.

[0085] System architecture and scenario description of the embodiments disclosed herein

[0086] Figure 2 This is a system architecture diagram of the blockchain data processing method applied according to embodiments of the present disclosure. It includes a terminal 240, an internet connection 230, a gateway 220, a server 210, etc.

[0087] Terminal 240 includes various forms such as desktop computers, laptops, PDAs (personal digital assistants), mobile phones, in-vehicle terminals, home theater terminals, and dedicated terminals. Furthermore, it can be a single device or a collection of multiple devices. Terminal 240 can communicate with the Internet 230 via wired or wireless means to exchange data.

[0088] Server 210 refers to a computer system that can provide certain services to terminal 240. Compared to ordinary terminal 240, server 210 has higher requirements in terms of stability, security, and performance. Server 210 can be a single high-performance computer in a network platform, a cluster of multiple high-performance computers, a portion of a single high-performance computer (e.g., a virtual machine), or a combination of portions of multiple high-performance computers (e.g., virtual machines).

[0089] Gateway 220, also known as an internetwork connector or protocol converter, is a computer system or device that acts as a translator, enabling network interconnection at the transport layer. It bridges the gap between two systems using different communication protocols, data formats, languages, or even completely different architectures. Gateways can also provide filtering and security functions. Messages sent from terminal 240 to server 210 are forwarded to the corresponding server 210 via gateway 220. Messages sent from server 210 to terminal 240 are also forwarded to the corresponding terminal 240 via gateway 220.

[0090] The blockchain data processing method provided in this embodiment can be implemented alone in the aforementioned terminal 240, alone in the aforementioned server 210, or partially in the terminal 240 and partially in the server 210.

[0091] When the blockchain data processing method provided in this embodiment is implemented in terminal 240, terminal 240 can obtain a first number of sets of blockchain transaction data constructed in parallel by multiple threads; terminal 240 generates a first number of block data sets based on the first number of sets of blockchain transaction data; terminal 240 merges the first number of block data sets and writes them to the corresponding disks to obtain a first number of first block files; terminal 240 serially generates hash data corresponding to each block data in the first number of block data sets based on the target order relationship, and writes the hash data to the corresponding first block files to obtain a first number of second block files; terminal 240 constructs index data and blockchain state data based on the first number of second block files; terminal 240 determines the blockchain data to be generated based on the second block files, index data, and blockchain state data.

[0092] When the blockchain data processing method provided in this embodiment is implemented in server 210, server 210 can obtain a first number of sets of blockchain transaction data constructed in parallel by multiple threads; server 210 generates a first number of block data sets based on the first number of sets of blockchain transaction data; server 210 merges the first number of block data sets and writes them to the corresponding disks to obtain a first number of first block files; server 210 serially generates hash data corresponding to each block data in the first number of block data sets based on the target order relationship, and writes the hash data to the corresponding first block files to obtain a first number of second block files; server 210 constructs index data and blockchain state data based on the first number of second block files; server 210 determines the blockchain data to be generated based on the second block files, index data, and blockchain state data.

[0093] When the blockchain data processing method provided in this embodiment is partially implemented in server 210 and partially implemented in terminal 240, terminal 240 can acquire a first number of sets of blockchain transaction data constructed in parallel by multiple threads; then terminal 240 sends the acquired first number of sets of blockchain transaction data to server 210 to generate blockchain data. Server 210 generates a first number of block data sets based on the first number of sets of blockchain transaction data; server 210 merges the first number of block data sets and writes them to the corresponding disks to obtain a first number of first block files; server 210 serially generates hash data corresponding to each block data in the first number of block data sets based on the target order relationship, and writes the hash data to the corresponding first block files to obtain a first number of second block files; server 210 constructs index data and blockchain state data based on the first number of second block files; server 210 determines the blockchain data to be generated based on the second block files, index data, and blockchain state data.

[0094] The blockchain data processing method disclosed herein can generate blockchain data models of any type, such as public chains, private chains, or consortium chains, specifically the Chang'an Chain. The generated large-scale blockchain data model can be applied to the development of underlying software based on blockchain technology, for example, to verify whether an operating system can provide a stable operating environment for upper-layer blockchain applications and support corresponding blockchain services under large-scale blockchain data conditions. When the blockchain data processing method disclosed herein is applied to the development of underlying blockchain software, it can acquire a first number of sets of blockchain transaction data constructed in parallel by multiple threads; generate a first number of block data sets based on the first number of sets of blockchain transaction data; merge the first number of block data sets and write them to the corresponding disks to obtain a first number of first block files; serially generate hash data corresponding to each block data in the first number of block data sets based on a target order relationship, and write the hash data to the corresponding first block files to obtain a first number of second block files; construct index data and blockchain state data based on the first number of second block files; and determine the blockchain data based on the second block files, index data, and blockchain state data. After constructing a large-scale blockchain data model, performance testing of the underlying blockchain software can be performed based on the large-scale blockchain data model.

[0095] The above examples do not limit the scope of protection in this case.

[0096] General Description of Embodiments in this Disclosure

[0097] According to one embodiment of this disclosure, a blockchain data processing method is provided that can improve the efficiency of generating large-scale blockchain data. Then, based on the generated large-scale blockchain data model, various aspects of the blockchain system's performance can be tested. Specifically, it can verify the blockchain system's transaction data query efficiency, transaction data write speed, and smart contract execution efficiency under a large-scale data model, thereby improving the blockchain system's performance in processing large-scale data and ultimately providing a better user experience. Figure 3 The diagram shown is a flowchart illustrating a blockchain data processing method provided in this disclosure. This method can be applied to a blockchain data processing device, which can be integrated into a computer device, which can be a terminal or a server. The blockchain data processing method may include:

[0098] Step 310: Obtain the first number of sets of blockchain transaction data constructed in parallel by multiple threads.

[0099] This disclosure embodiment can generate blockchain data corresponding to any type of blockchain, such as public chains, private chains, or consortium chains, specifically the Chang'an Chain. Blockchain transaction data can be transaction processing data of the blockchain system in different transaction processing scenarios. For example, in commodity logistics, blockchain transaction data can be commodity processing data. Goods go through multiple stages from manufacturer to consumer, and the process is even more complex in cross-border shopping. Problems often occur in the intermediate stages of commodity logistics, making it easy for consumers to buy counterfeit goods. Therefore, tracing the origin of goods is particularly important. Blockchain can store commodity processing data (such as place of origin, production date, logistics transit point, handler, etc.) for all nodes in the logistics chain, making the goods traceable from manufacturer to consumer, forming a complete chain. For example, in public welfare undertakings, blockchain transaction data can also be data such as donation projects, fundraising details, and fund flows.

[0100] This disclosure provides multiple blockchain transaction data building programs, which can run simultaneously in an operating system to construct block data written to multiple block file databases. An operating system (OS) is a built-in program used to coordinate various computer hardware components, performing functions such as file management and storage management, for example, managing storage hardware, specifically disks. This disclosure can be implemented using any operating system, such as Windows and open-source Linux. The first quantity in this embodiment can be the number of blockchain transaction data building programs running in parallel. For example, if ten blockchain transaction data building programs are running simultaneously, then the first quantity is ten. Please refer to... Figure 4 , Figure 4This is a schematic diagram illustrating the multi-threaded construction of blockchain transaction data provided in this embodiment. As shown, a first number of blockchain transaction data construction programs can be run simultaneously to construct a first number of sets of blockchain transaction data in parallel. The first number is n. A block file database (FileDB) can be used to store the original block data. The FileDB includes multiple block files to store the block data in the corresponding block files. Blockchain transaction data construction program 1 corresponds to disk 1, blockchain transaction data construction program 2 corresponds to disk 2, and blockchain transaction data construction program n corresponds to disk n. The blockchain transaction data construction program 1 can be run repeatedly to build blockchain transaction data for disk 1 and write the first set of blockchain transaction data into the block file database 1 (FileDB1) in disk 1. The blockchain transaction data construction program 2 can be run repeatedly to build blockchain transaction data for disk 2 and write the second set of blockchain transaction data into the block file database 2 (FileDB2) in disk 2. The blockchain transaction data construction program n can be run repeatedly to build blockchain transaction data for disk n and write the nth set of blockchain transaction data into the block file database n (FileDBn) in disk n, for a total of n sets of blockchain transaction data.

[0101] Step 320: Generate a first number of block data sets based on the first number of blockchain transaction data sets.

[0102] After constructing the first number of sets of blockchain transaction data in parallel using multiple threads, a block data set corresponding to each FileDB can be generated based on each set of blockchain transaction data. The number of block data sets is equal to the number of sets of blockchain transaction data, both being the first number. Each block file database can store block data for multiple blocks, and a block data set can represent the collection of block data stored in all blocks within the corresponding block file database. For example, a block data set can represent the block data of all blocks stored in a FileDB.

[0103] In this embodiment of the disclosure, the block data of each block may include block body data and blockchain transaction attribute data. The block body data may include blockchain transaction data and the hash value corresponding to each blockchain transaction data. The blockchain transaction attribute data may include data in the block header data other than the hash data. The hash data in the block header may include the hash data (Hash) corresponding to each block and the hash data (PreHash) of the preceding block of each block.

[0104] In some embodiments, generating a first number of block data sets based on a first number of sets of blockchain transaction data may include the following steps:

[0105] Determine the second number of block data corresponding to each group of blockchain transaction data and the target data structure of the block data;

[0106] Generate a first set of block data based on the second and first sets of blockchain transaction data and the target data structure.

[0107] In this embodiment, the number of blocks stored in each FileDB can be preset to determine the second number of block data corresponding to each group of blockchain transaction data. That is, the second number can represent the number of blocks stored in each FileDB, and the second number of block data corresponding to each group of blockchain transaction data can be equal or unequal. For example, if FileDB1 can store 100 blocks, then the second number of block data corresponding to the first group of blockchain transaction data is 100; as another example, if FileDB2 can store 50 blocks, then the second number of block data corresponding to the second group of blockchain transaction data is 50, and so on. Please refer to... Figure 5 , Figure 5 This is a schematic diagram of the data structure of the block file database provided in this embodiment of the disclosure. As shown in the figure, n sets of block data in the block file database are generated based on n sets of blockchain transaction data. Block file database 1 stores 100 blocks, from block 1 to block 100, where 1 to 100 can represent the block height. Block file database 2 stores 50 blocks, from block 101 to block 150. The block heights of blocks in each adjacent pair of block file databases are continuous. For example, if the height of the last block in block file database 1 is 100, then the initial block height in the block file database is 101. This continuity is maintained up to block file database n. The block heights corresponding to the blocks stored in block file database n are x, x+1, x+2, and so on up to n.

[0108] In other embodiments, in addition to determining a second number of block data corresponding to each group of blockchain transaction data, a target data structure for the block data can also be determined. This target data structure can be predefined. The target data structure can be used to characterize the block data, including block body data and blockchain transaction attribute data. See also... Figure 6 , Figure 6This is a schematic diagram of the data structure of block data provided in this embodiment of the disclosure. As shown in the figure, each block data 600 may include block header data 610, block body data 620, and additional data. The block header data 610 may include blockchain transaction attribute data 611 and hash data 612. The block body data 620 may include blockchain transaction data. The additional data may include block proofs, such as Proof-of-Work (PoW) and Proof-of-Stake (PoS). Blockchain transaction data can be divided into blocks in each FileDB according to the second number of block data corresponding to each group of blockchain transaction data, and the determined blockchain transaction data can be filled into the block according to the target data structure corresponding to the block data of each block.

[0109] In some embodiments, generating a first number of block data sets based on a second number, a first number of sets of blockchain transaction data, and a target data structure includes the following steps:

[0110] Based on the second quantity, each group of blockchain transaction data is divided to obtain the second quantity of blockchain transaction data sets corresponding to each group of blockchain transaction data.

[0111] Based on each blockchain transaction data set, corresponding block data is constructed to obtain the block data set corresponding to each group of blockchain transaction data.

[0112] Specifically, in this embodiment of the disclosure, the blockchain transaction data can be divided according to a second number of blocks corresponding to each group of blockchain transaction data, resulting in a second number of blockchain transaction data sets. For example, if FileDB1 stores 100 blocks, then the first group of blockchain transaction data corresponding to FileDB1 can be divided into 100 blockchain transaction data sets. Similarly, if FileDB2 stores 50 blocks, then the second group of blockchain transaction data corresponding to FileDB2 can be divided into 50 blockchain transaction data sets. The number of blockchain transaction data sets can be equal to the number of blocks. In this embodiment of the disclosure, the number of blockchain transaction data items in each blockchain transaction data set can be equal or unequal. For example, for any two blockchain transaction data sets corresponding to each group of blockchain transaction data, one blockchain transaction data set can contain 10 blockchain transaction data items, and the other blockchain transaction data set can contain either 10 or 20 blockchain transaction data items.

[0113] Furthermore, block data corresponding to each block can be constructed based on each blockchain transaction data set, resulting in a block data set corresponding to each group of blockchain transaction data. Here, the block data set represents the collection of block data from all blocks in each FileDB. For example, if FileDB1 stores 100 blocks, the block data set corresponding to the first group of blockchain transaction data is the collection of block data from the 100 blocks in FileDB1. Each block data set may include a second number of block data sets. For example, if FileDB1 has 100 blocks, the first group of blockchain transaction data is divided into 100 blockchain transaction data sets. Then, based on each blockchain transaction data set, the block data corresponding to each block in FileDB1 is constructed. After the block data for all blocks in FileDB1 is constructed, the block data set corresponding to the first group of blockchain transaction data is obtained. In this example, the block data set corresponding to the first group of blockchain transaction data includes the block data corresponding to the 100 blocks.

[0114] In some embodiments, constructing corresponding block data based on each blockchain transaction data set specifically includes the following process:

[0115] Each blockchain transaction data set is packaged to obtain the block body data corresponding to each blockchain transaction data set;

[0116] The corresponding blockchain transaction attribute data is calculated based on the block body data, and the block data corresponding to each blockchain transaction data set is determined based on the block body data and the corresponding blockchain transaction attribute data.

[0117] In this embodiment of the disclosure, the blockchain transaction data in the divided blockchain transaction data set can be packaged. Packaging refers to the process of combining multiple blockchain transaction data sets into block data in a single block. Specifically, each blockchain transaction data set can be packaged to obtain the block body data corresponding to each blockchain transaction data set. Then, the packaged blockchain transaction data can be filled into the corresponding block based on the target data structure of the block data. For example... Figure 6 As shown, each block body data 620 may include blockchain transaction data from each blockchain transaction data set.

[0118] Furthermore, blockchain transaction attribute data can be calculated based on the block body data of each block. For example... Figure 6As shown, the blockchain transaction attribute data 611 may include block height, the number of blockchain transaction data, the blockchain transaction tree root hash value, the read / write set root, and other data. Specifically, the block height represents the number of each block in the blockchain; the number of blockchain transaction data represents the number of blockchain transaction data stored in a block; the blockchain transaction tree root hash value represents the Merkle tree root of the block, and is composed of the hash values ​​corresponding to each blockchain transaction data in the block; the read / write set root is generated after each blockchain transaction data is executed by a node in the blockchain, and can include all key-value pairs read and modified during the transaction processing, generally represented by the hash values ​​in the Merkle tree of each block. In addition, the blockchain transaction attribute data 611 may also include other data, such as timestamps, difficulty values, and random numbers. After determining the block body data to be filled in each block and the blockchain transaction attribute data, the block data of each block can be further determined.

[0119] Step 330: The first number of block datasets are merged and written to the corresponding disks to obtain the first number of first block files.

[0120] In this embodiment of the disclosure, the aforementioned steps have already constructed a block data set corresponding to the block data of all blocks in each FileDB. Then, the block dataset corresponding to each FileDB can be merged and written to the disk corresponding to each FileDB. For example, if FileDB1 corresponds to disk 1, the block dataset corresponding to FileDB1 can be merged and written to disk 1. Further, a first block file with the same number of FileDBs can be obtained. The first block file can store the block body data of each block and the blockchain transaction attribute data, and retains blank fields corresponding to the hash data to be filled.

[0121] Parallel writing of block data can utilize multiple disks. Generally, increasing the number of disks is beneficial for improving the overall data writing speed. However, since the operating system requires certain computing resources when running programs, multi-threaded program execution may make system bus scheduling difficult. Disk write performance is affected by multiple factors, and simply increasing the number of disks does not guarantee a continuous improvement in overall disk write performance. When the number of disks reaches a certain point, a maximum write speed is reached, typically 2-3 Gbps. Further increasing the number of disks at this point may actually decrease overall write performance. Therefore, the number of disks can be set to 10 to 20. Thus, in this embodiment, the first quantity can be the number of disks; for example, if the number of disks is 15, then the first quantity is 15. The number of disks can be equal to the number of blockchain transaction data construction programs mentioned above. One blockchain transaction data construction program corresponds to one disk, and each program can loop multiple times to construct blockchain transaction data for the corresponding disk. Each disk corresponds to a set of blockchain transaction data. It should be noted that the disk written in this embodiment is a physical disk, not a disk partition, to ensure that the writing of block data to each block file database is performed in parallel, thereby improving the writing efficiency of block data.

[0122] In some embodiments, merging rows of a first number of block datasets and writing them to the corresponding disks to obtain a first number of first block files specifically includes the following steps:

[0123] Obtain the mount paths corresponding to the first number of disks;

[0124] Based on the mount path, the first number of block datasets are merged and written to the corresponding disk to obtain the first number of first block files.

[0125] As mentioned in the preceding steps, the number of disks is equal to the number of block file databases. In this embodiment, since the block file databases need to store the original blockchain transaction data, the amount of data stored is relatively large. There are multiple block file databases, generally 10 to 20, and correspondingly, the number of disks can also be 10 to 20. The storage path of each block file database in the file system can be preset. For example, for block file database FileDB1, its storage path in the file system managed by the operating system can be " / data / filedb1", and for block file database FileDB2, its storage path in the file system managed by the operating system can be " / data / filedb2". Since the amount of data stored in the block database BlockDB and the state database StateDB is relatively small, each block database and state database only needs to set up a disk for writing block data. For example, for the block database BlockDB, its storage path in the file system managed by the operating system can be " / data / blockdb", and for the state database StateDB, its storage path in the file system managed by the operating system can be " / data / statedb". After setting the storage path, you can access the block file data in each block file database through the storage path of each block file database.

[0126] Furthermore, the configured database access paths can be mapped to the disks corresponding to each database to determine the mount path for each disk. Please refer to [link to relevant documentation]. Figure 7 , Figure 7 This is a schematic diagram of the disk and database path mapping provided in this embodiment of the disclosure. As shown in the figure, the disk corresponding to the block file database FileDB1 is disk 1, and the mount path of disk 1 is " / data / filedb1 / vd1". For the block database BlockDB, if its corresponding disk is disk a, then the mount path of disk a is " / data / blockdb / vda". For the state database StateDB, if its corresponding disk is disk b, then the mount path of disk b is " / data / statedb / vdb". Block data sets can be written to multiple disks in parallel according to multiple pre-set disk mount paths. After the block data sets are written, the corresponding first block file is obtained, and the first block file in the disk can be accessed through the database storage path.

[0127] In some embodiments, the first number of block datasets are merged and written to the corresponding disk according to the mount path to obtain the first number of first block files, specifically including the following steps:

[0128] The writing order of block data in each block data set is determined based on the block height of the block data in each block data set.

[0129] Based on the writing order of block data in each block data set, multiple data writing threads write the first number of block data sets to the corresponding disks in parallel according to the corresponding mount paths, resulting in the first number of first block files.

[0130] In this embodiment, block data can be written to the corresponding block file database according to the block height of each block in each block data set. For example, if the block height of the block data in the block data set corresponding to block file database FileDB1 is 0 to 100, then when writing block data to FileDB1, it can be written in order of block height from 0 to 100. Similarly, if the block height of the block data in the block data set corresponding to block file database FileDB2 is 101 to 150, then when writing block data to FileDB2, it can be written in order of block height from 101 to 150. It should be noted that the block height of the first block can be either 1 or 0. In multiple threads that write block data in parallel, each thread writes according to the block height of the block data.

[0131] Furthermore, based on the write order of the blocks in each block data set, multiple threads can write the block data sets to the corresponding disks in parallel according to their mount paths. For example, to write block data from a block data set to FileDB1, the block data in the corresponding block data set of FileDB1 can be written to FileDB1 in order of block height from 1 to 100, based on the mount path " / data / filedb1 / vd1". Similarly, to write block data from a block data set to FileDB2, the block data in the corresponding block data set of FileDB2 can be written to FileDB2 in order of block height from 101 to 150, based on the mount path " / data / filedb2 / vd2".

[0132] In some embodiments, based on the writing order of block data in each block data set, a first number of block data sets are written to the corresponding disks in parallel according to the corresponding mount paths through multiple data writing threads to obtain a first number of first block files. Specifically, this may include the following steps:

[0133] Configure multiple block file paths on each disk and determine the correspondence between block data and block file paths in each block data set;

[0134] Based on the mount path corresponding to each block data set, the block data is written to the corresponding disk in parallel by the corresponding write thread according to the corresponding relationship and writing order, resulting in a first number of first block files.

[0135] In this embodiment of the disclosure, multiple block file paths can be configured on each disk. A block file path can represent the storage directory of a block file in a block file database, and block data within a block file in the block file database can be accessed through the block file path. A block file database can contain multiple parallel block file paths, or multiple sub-block file paths under a single block file path. For example, on disk 1 corresponding to the block file database FileDB1, multiple block file paths can be configured. These multiple block file paths can be parallel. For instance, if file1.fdb and file2.fdb belong to the same level of block file path, then the corresponding block file paths would be " / data / filedb1 / file1.fdb" and " / data / filedb1 / file2.fdb". Alternatively, multiple block file paths can also be multiple sub-block file paths under a single block file path. Under the block file path " / data / filedb1 / file1.fdb", there can be sub-paths such as / data / filedb1 / file1.fdb / file11.fdb and " / data / filedb1 / file1.fdb / file12.fdb", etc.

[0136] Furthermore, after configuring the block file paths on each disk, the block file path corresponding to each block in each block data set can be determined. Block data can be stored under any block file path, and the block data stored under each block file path can also be customized. For example, in the block file database FileDB1, block data corresponding to block heights 1 to 5 can be stored under the path " / data / filedb1 / file1.fdb", and block data from block height 6 to 8 can be stored under the path " / data / filedb1 / file2.fdb". Figure 8 As shown, Figure 8This is a schematic diagram of block data in the block file database provided in this embodiment. Block data corresponding to blocks with heights of 1 to 5 are stored in the block file file1.fdb of block file database 1 (FileDB1), and block data corresponding to blocks with heights of 6 to 8 are stored in the block file file2.fdb. Furthermore, in addition to limiting the number of blocks stored in each block file, the size of the data stored in each block file can also be limited, regardless of the number of blocks stored within it. For example, if the storage size of a block file is limited to 1024MB, there is no limit to the number of blocks stored within it, as long as it does not exceed the file's storage limit.

[0137] After determining the mount path corresponding to each block data set through the aforementioned steps, each block data set can be written to the corresponding disk in parallel by the write thread corresponding to each block data set, according to the aforementioned correspondence between the block file path and the block data and the writing order of the block data, to obtain the first block file in each block file database.

[0138] Step 340: Based on the target order relationship, serially generate hash data corresponding to each block data in the first number of block data sets, and write the hash data into the corresponding first block file to obtain the first number of second block files.

[0139] In this process, multiple block data sets are written to their corresponding disks using multi-threading to obtain the first block file. The written block data includes block body data and blockchain transaction attribute data. During parallel writing, fields corresponding to the hash data in the block data are reserved. Since the field length of the hash data is fixed, blank fields can be reserved. After parallel filling is completed, the hash data is written to the disk serially to ensure the rationality of the block data and the integrity of the blockchain data. In this embodiment, the target order relationship can represent the generation order of the hash data in the block data, or the order of the block file database (FileDB), such as block file database 1, block file database 2, up to block file database n. It can also represent the order of the disks corresponding to the block file databases, such as disk 1, disk 2, up to disk n. It should be noted that the target order relationship does not include the order relationship between the block database (BlockDB) and the state database (StateDB), nor does it include the order relationship between the disks corresponding to BlockDB and StateDB.

[0140] Hash data padding is performed on the block data of a first number of first block files to obtain a first number of second block files, which store the complete block data. For example, hash data padding is performed on the block data of 10 first block files to obtain 10 second block files, which have the same storage path as the first block files.

[0141] In some embodiments, hash data corresponding to each block data in a first number of block data sets is generated serially based on a target order relationship, and the hash data is written into the corresponding first block file to obtain a first number of second block files. Specifically, this includes the following steps:

[0142] The target order of hash data generation is determined based on the block height of each block of data.

[0143] Generate hash data for each block of data one by one according to the target order relationship;

[0144] Write the hash data into the corresponding first block file to obtain the first number of second block files.

[0145] As described above, the block height of each block in the block file database is predetermined, and the block heights of block data in different block file databases are continuous to form complete blockchain data. Since the hash data of each block is determined by the blockchain transaction data within the block data and the hash data of the preceding blocks, the target order for generating the hash data of each block can be determined based on the determined block height. Then, the hash data of each block can be generated one by one according to the target order. For example, the hash data of block 1 is generated, then the hash data of block 2 is generated, and so on, block by block, until the hash data of all blocks is generated. After the hash data of each block is generated, it can be written to the block file database according to the block height.

[0146] In some embodiments, hash data for each block of data is generated sequentially according to the target order relationship, specifically including the following steps:

[0147] When the target block data is the genesis block data, the hash data of the target block data is generated based on the blockchain transaction data of the target block data;

[0148] When the target block data is not the genesis block data, the first hash data of the target block data is determined based on the hash data of the preceding block data.

[0149] The target block data is hashed based on the blockchain transaction data to obtain the blockchain transaction tree root hash value. The second hash data of the target block data is then generated based on the blockchain transaction tree root hash value and the first hash data.

[0150] The hash data of the target block is determined based on the first hash data and the second hash data.

[0151] In this embodiment of the disclosure, the target block data represents the block data written to the block file database. When generating the hash data of each block data, if the target block is the genesis block and there is no preceding block, then the target block data is the genesis block data. In this case, the hash data of the target block data includes the hash data of the target block itself. This hash data can be generated by hashing the blockchain transaction data in the target block data. That is, when the target block is the genesis block, the hash data of the block only includes the hash data of the target block itself, which is the hash value of the blockchain transaction tree root obtained by hashing the blockchain transaction data. The hash value of the blockchain transaction tree root is the Merkle root of the blockchain transaction data.

[0152] In other embodiments, if the target block is not the genesis block but just a regular block, that is, the target block data is not the genesis block data but just regular block data, the hash value of the target block data may include the hash data of the target block and the hash data of the preceding blocks. For example... Figure 6 As shown, the hash data 612 in the block header data 610 may include first hash data and second hash data. The first hash data may be the hash data of the preceding block of the target block, and the second hash data may be the final hash data of the target block calculated based on the first hash data and the root hash data of the blockchain transaction tree of the target block.

[0153] Please see Figure 9 , Figure 9This diagram illustrates the generation of hash data provided in an embodiment of this disclosure. A pre-written block filling program can be run to sequentially fill the hash data of blocks in each block file database according to the order of the database. The hash data of blocks in block file database 1 can be filled first, followed by the hash data of blocks in block file database 2. When filling the hash data of blocks in block file database 1, block 1 is filled first. Block 1 is the genesis block, and its second hash data can be calculated based on the blockchain transaction data in block 1. Then, the hash data of block 2 can be filled. Block 1 is the preceding block of block 2, and the PreHash of block 2 is the second hash data of block 1. The second hash data of block 2 can be calculated using the formula Hash = hash(PreHash, Merkle Root, ...). Here, PreHash represents the first hash data. For example, the PreHash of block 2 is the hash of block 1, and the Merkle Root hash value of the blockchain transaction tree of block 2 is obtained by hashing the blockchain transaction data of block 2. Further, based on the PreHash in the block header data of block 2, the blockchain transaction tree root hash value, and other data such as the read / write set root, hash calculations are performed to obtain the second hash data of block 2, which represents the actual hash data of block 2. Then, the second hash data of block 2 can be used as the first hash data PreHash of block 3, and the second hash data of block 3 can be calculated according to the method described above. After the hash data of all blocks in block file database 1 has been calculated, since the block heights of blocks in block file database 1 and block file database 2 are continuous, the hash data of blocks in block file database 2 can be calculated one by one until the hash data of each block in the block file database is generated.

[0154] After calculating the first hash data and the second hash data for each block, the first hash data and the second hash data can be sequentially filled into the block header of each block to ensure the integrity of the block data. In some embodiments, writing the hash data into the corresponding first block file to obtain a first number of second block files specifically includes the following steps:

[0155] The order in which hash data is filled is determined based on the block height of each block in the entire block data set;

[0156] The first hash data and the second hash data are sequentially filled into the block header data of each block data according to the filling order, resulting in a first number of second block files.

[0157] In this embodiment of the disclosure, the filling order of the hash data for each block can be determined based on the block height of each block in all block data sets. As described above, for example, the block height range of the block data in the block data set corresponding to block file database 1 is 1 to 100, and the block height range of the block data in the block data set corresponding to block file database 2 is 101 to 150. The filling order of the hash data for each block can be determined according to the block height of the block data in each block data set, for example, filling in the order from block height 1 to block height 100.

[0158] Furthermore, according to the filling order determined in the aforementioned steps, the generated first hash data and second hash data can be sequentially filled into the block header data of each block data in each first block file to obtain a second block file. The second block file represents a block file where the block data is completely filled, and the number of second block files is equal to the number of first block files, both being the first quantity.

[0159] Step 350: Construct index data and blockchain state data based on a first number of second block files.

[0160] When the FileDB blockchain database is used to store raw block data, file indexes in different FileDB databases may be duplicated, making blockchain data queries inconvenient. Furthermore, when querying information about a specific blockchain transaction, if no index is found, the entire FileDB must be traversed to find the transaction data. This is extremely complex with large datasets, resulting in very low query efficiency and a poor user experience. Therefore, this disclosure supplements the FileDB and BlockDB models by adding FileDB index information to BlockDB, thereby facilitating blockchain transaction data queries. Specifically, index data can be constructed by filling each BlockDB database with a complete second block file. Then, the index information from each BlockDB database can be written in parallel to the BlockDB database, and the block data in FileDB can be queried using the index data in BlockDB.

[0161] In this embodiment, blockchain state data can also be constructed based on the second block file. This blockchain state data represents the world state of the blockchain and is used to record and trace the state information of all accounts in the blockchain system. This information includes, but is not limited to, account balances, smart contract states, contract-stored data, and contract execution results. The constructed blockchain state data can then be written to the StateDB state database. Business adjustments can be made to the blockchain state data, using simpler contract processing logic (such as notarization) to control the amount of blockchain state data to a smaller scale, thus reducing the time spent writing the blockchain state data to the StateDB.

[0162] In some embodiments, please refer to Figure 10 , Figure 10 This diagram illustrates the writing of index data to BlockDB according to an embodiment of this disclosure. Multiple pre-written path index state data construction programs can be run simultaneously to write the index data of the second block file in the block file database FileDB to the block database BlockDB in parallel. As shown in the diagram, running path index state data construction program 1 writes the index data constructed based on the second block file in block file database 1 to the block database; running path index state data construction program 2 writes the index data constructed based on the second block file in block file database 2 to the block database; and running multiple path index state data construction programs in parallel writes the index data of all block file databases to the block database.

[0163] In some embodiments, constructing index data based on a first number of second block files specifically includes the following steps:

[0164] Obtain the first index information of the block data in each block data set within multiple second block files;

[0165] Obtain the second index information of the blockchain transaction data in the corresponding block data set;

[0166] Multiple index data are generated in parallel based on the first index information and the second index information.

[0167] In this embodiment of the disclosure, first index information of block data in multiple second block files within each block data set and second index information of each blockchain transaction data within the corresponding block data set can be obtained. The first index information may include the relative block file path of block data at a certain block height in the block file database, and may also include the index position of a block data within the file of the block file database. The second index information may include the position index information of the blockchain transaction data within the block data. Furthermore, multiple index data can be generated in parallel based on the first and second index information, and the generated index data can be written to the block database.

[0168] In some embodiments, please refer to Figure 11 , Figure 11 This is a schematic diagram of the index data provided in this embodiment of the disclosure. As shown in the figure, the block file file1.fdb in the block file database stores the starting block height of the block corresponding to block 101. The block body data of block 101 includes blockchain transaction data 1, blockchain transaction data 2, up to blockchain data n, and additional data. Furthermore, the block file file1.fdb can also store the block data of block 102 and more block data. Further, the index data can be stored in the block database BlockDB in the form of key-value pairs. As shown in Table 1 below, Table 1 provides... Figure 11 Example of index data for Block B in the example.

[0169] Table 1. Example of Block B's index data

[0170]

[0171] Here, `key` represents the key used to store the index data, and `value` represents the actual value of the index data. The key `blockheight_101_f` corresponds to the actual value ` / data / file1.fdb`, indicating that the relative file storage path of block 101 (block height 101) in the block file database is ` / data / file1.fdb`; the key `blockheight_101_i` corresponds to the value 0, indicating that block 101 (block height 101) starts at position 0 in the block file; and the key `tx1_h` corresponds to the actual value 100, indicating that blockchain transaction data 1... The block height corresponding to the block containing (tx1) is 100; the actual value corresponding to the key tx1_i is 1024, which can indicate that the position of blockchain transaction data 1 (tx1) in the block file is 1024; the actual value corresponding to the key tx2_h is 100, which can indicate that the block height corresponding to the block containing blockchain transaction data 2 (tx2) is 100; the actual value corresponding to the key tx2_i is 1350, which can indicate that the position of blockchain transaction data 2 (tx2) in the block file is 1350.

[0172] The aforementioned steps involve simultaneously populating the block data and file path index information from FileDB into the BlockDB block database, storing the index data as key-value pairs. This allows access to block data in the file database by querying the index data in BlockDB, improving query speed. Furthermore, the blockchain state data and block metadata are updated based on the block data in the file database, ensuring the integrity of the blockchain data.

[0173] Step 360: Determine the blockchain data to be generated based on the second block file, index data, and blockchain state data.

[0174] As previously described, the generated blockchain transaction data can be sequentially written into multiple block file databases (FileDB) to obtain multiple second block files. Then, corresponding index data can be generated based on the block data in the block file databases, and the index data from each block file database is populated into the block database (BlockDB) in parallel. This allows querying the original block data stored in FileDB using the index data in the block database. Furthermore, blockchain state data and block metadata can be updated based on pre-set smart contracts and the block data in the block file databases. Finally, the blockchain data can be determined based on the original block data in FileDB, the generated index data in BlockDB, and the blockchain state data in StateDB.

[0175] In summary, the blockchain data processing method provided in this disclosure involves: acquiring a first number of sets of blockchain transaction data constructed in parallel by multiple threads; generating a first number of block data sets based on the first number of sets of blockchain transaction data; merging the first number of block data sets and writing them to the corresponding disks to obtain a first number of first block files; serially generating hash data corresponding to each block data in the first number of block data sets based on a target order relationship, and writing the hash data to the corresponding first block files to obtain a first number of second block files; constructing index data and blockchain state data based on the first number of second block files; and determining the blockchain data to be generated based on the second block files, index data, and blockchain state data.

[0176] Therefore, multiple sets of blockchain transaction data can be constructed using multi-threading, and the hash data of each block can be generated serially based on the target order relationship and block height. After the block data is constructed, blockchain transaction data can be written to multiple disks in parallel using multi-threading to significantly improve the overall disk write performance and accelerate the writing speed of blockchain data, thereby greatly improving the efficiency of blockchain data generation. Then, the parallel-written block data can be supplemented by serially filling hash data to ensure the integrity and rationality of the generated blockchain data. Finally, index data is built based on the written block data to facilitate block data querying. The blockchain state data can then be updated based on the written block data, and the final large-scale blockchain data is generated based on the original block data, index data, and updated blockchain state data.

[0177] This disclosure provides a detailed description of embodiments in conjunction with specific application scenarios.

[0178] like Figure 12 The diagram shown is another flowchart illustrating the blockchain data processing method provided in this disclosure. This method will be described in detail using the application of blockchain data processing methods in blockchain underlying software development as an example. The method specifically includes the following steps:

[0179] Step 1201: The computer device acquires the first number of sets of blockchain transaction data constructed in parallel by multiple blockchain transaction data construction programs.

[0180] In this embodiment of the disclosure, the generated blockchain transaction data can be written to the database according to the pre-set size and corresponding storage location of the blockchain transaction data, following the writing method provided in this embodiment. Therefore, the blockchain data generation method provided in this embodiment can be described from two aspects: blockchain transaction data generation and blockchain transaction data writing to the database.

[0181] Specifically, blockchain transaction data can be divided into block file data and database data. Block file data mainly includes state data and block file index data, while the database data mainly includes block data and read / write set data. When new blockchain transaction data is generated, it can be written to the block file database to generate the corresponding block file data.

[0182] Block files in a block file database can be named as follows: filename followed by the block file database extension (.fdb). For example, a block file named xxx001.fdb can be referred to as xxx.fdb from now on. The xxx.fdb filename is derived from the block file database number and the height of the first block stored in that file, converted according to the file naming rules. This setting allows objects to directly see the xxx.fdb file containing each block's data. Furthermore, the number of blocks stored in each block file can be defined, for example, storing blocks with heights ranging from 1 to 5 in file xxx001.fdb, and blocks with heights ranging from 6 to 8 in file xxx002.fdb, etc. Alternatively, the storage size of each block file can be limited, without limiting the specific number of blocks stored within it.

[0183] In this embodiment of the disclosure, a computer device can construct multiple sets of blockchain transaction data in parallel by running multiple pre-set blockchain transaction data construction programs. The number of sets of blockchain transaction data can be defined according to the predefined number of disks for writing block data, specifically 10 to 20 disks, and correspondingly, 10 to 20 sets of blockchain transaction data can be constructed. While acquiring multiple sets of blockchain transaction data, the computer device can write the constructed blockchain transaction data to a block file database according to the predefined block data size and file storage location. The following will describe a detailed method for generating the block data stored in the block file database based on the constructed blockchain transaction data.

[0184] Step 1202: The computer device divides each group of blockchain transaction data according to the second number of block data corresponding to each group of blockchain transaction data, and obtains a second number of blockchain transaction data sets corresponding to each group of blockchain transaction data.

[0185] Specifically, the computer device can determine the second number of blocks corresponding to each group of blockchain transaction data based on the number of blocks stored in each block file database. The computer device can pre-set the number of blocks to be divided for each group of blockchain transaction data. For example, if a group of blockchain transaction data is to be divided into 10 blocks, and this group includes 1000 blockchain transaction data, the computer device can divide these 1000 blockchain transaction data into 10 blockchain transaction data sets. It should be noted that the number of blockchain transaction data in each blockchain transaction data set can be unequal; for example, one blockchain transaction data set may include 100 blockchain transaction data, while another may include 120. In addition to setting the number of blockchain transaction data included in each blockchain transaction data set, the size of the blockchain transaction data included in each blockchain transaction data set can also be set.

[0186] Step 1203: The computer device packages the data of each blockchain transaction data set to obtain the block body data corresponding to each blockchain transaction data set, and calculates the corresponding blockchain transaction attribute data based on the block body data.

[0187] In this embodiment of the disclosure, after the computer device divides each group of blockchain transaction data into a predetermined number of blockchain transaction data sets, it can package the block data in each blockchain transaction data set to obtain the block body data corresponding to each blockchain transaction data set. For example, for a blockchain transaction data set containing 100 blockchain transaction data sets, the computer device can package these 100 blockchain transaction data sets to generate the block body data in the block corresponding to this blockchain transaction data set. Similarly, for a blockchain transaction data set containing 120 blockchain transaction data sets, the computer device can package these 120 blockchain transaction data sets to generate the block body data in the block corresponding to this blockchain transaction data set. In this way, the block body data in the block corresponding to each blockchain transaction data set can be generated. Further, after generating the block body data of each block in the blockchain, the computer device can perform hash calculations based on the block body data of each block to obtain the blockchain transaction attribute data in each block. The specific composition of the blockchain transaction data has been described in the aforementioned steps and will not be repeated here.

[0188] Step 1204: The computer device determines the block data corresponding to each blockchain transaction data set based on the block body data and the corresponding blockchain transaction attribute data, thus obtaining the block data set corresponding to each group of blockchain transaction data.

[0189] After generating block body data and blockchain transaction attribute data in the aforementioned steps, the computer device can generate multiple block data corresponding to each set of blockchain transaction data based on the two sets of data, and determine a second set of block data corresponding to each set of blockchain transaction data based on the multiple block data. Each block data set contains block data from multiple blocks, and each block data set includes the multiple block data to be written to each block file database.

[0190] Step 1205: The computer device determines the target order relationship for generating the hash data of each block data based on the block height of each block data, and generates the hash data of each block data sequentially according to the target order relationship.

[0191] The block data obtained in the preceding steps lacks hash data. To ensure the integrity and rationality of the block data, hash data can be generated for each block. Due to the structural characteristics of hash data in block data, a serial generation method can be used to generate the hash data in the block data. Specifically, the computer device can determine the target order of hash data generation for each block based on the block height of each block. For example, if the block height range of the block data stored in the block file database is 1 to 100, the hash data for each block can be generated sequentially according to block heights 1 to 100.

[0192] Step 1206: The computer device writes the block data in each block data set to the corresponding disk according to the disk mount path and the correspondence between the block data and the block file path through multiple threads in parallel, thereby obtaining a first number of first block files.

[0193] The aforementioned steps have generated the block data required to construct large-scale blockchain data. In this embodiment, the generated block data can be written to the block file database according to a pre-defined block file path and disk mount path. The detailed method for writing blockchain data is described below. Specifically, the operating system's runtime environment can be configured in advance to control multiple physical disks to write block data. Further, the computer device can use multiple threads to write the block data of each block data set in a determined writing order, based on the disk mount path. The writing order can be determined by the block height of each block data in each writing thread. Then, according to the pre-defined correspondence between each block data and the block file path, the block data is written to the corresponding disk, resulting in multiple first block files in the block file database corresponding to each block data set. This embodiment uses the operating system to control multiple disks to write block data to the corresponding block file database in parallel, thereby greatly improving the writing speed of large-scale data.

[0194] Step 1207: The computer device determines the filling order of the hash data of each block data into the block file database based on the block height of each block data, and fills the hash data into the block header data of each first block file in sequence according to the filling order, to obtain a first number of second block files.

[0195] Specifically, the computer device can determine the filling order of the hash data of each block into the block file database based on the block height corresponding to all block data, and then fill the hash data into the block header data of each first block file in sequence according to the determined filling order to obtain the second block file. The blocks in the second block file contain complete block data to ensure the rationality of the generated block data.

[0196] Step 1208: The computer device constructs index data and updates blockchain state data based on a first number of second block files.

[0197] In this embodiment of the disclosure, the computer device can parse the block file path of each second block file and the storage location of the block data in the block file, and construct index data for the second block file and index data for the block data based on the parsing results. The constructed index data can then be written to BlockDB to query the second block files and block data in FileDB based on the index data in BlockDB. Furthermore, the computer device can update the blockchain state data and block metadata based on the second block files and pre-defined smart contracts, and write the updated blockchain state data and block metadata to StateDB.

[0198] Step 1209: The computer device generates blockchain data to be determined based on the second block file, index data, and blockchain state data.

[0199] Once the second block file, along with its corresponding index data and blockchain state data, is generated, the final large-scale blockchain data model can be determined. The final generated blockchain data model includes the second block file storing the original block data in the block file database, the block data in the block database, the index data of the second block file, and the updated blockchain state data in the state database, thus yielding a complete blockchain data model.

[0200] Description of apparatus and devices according to embodiments of this disclosure

[0201] It is understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this embodiment, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.

[0202] It should be noted that in the various specific embodiments of this disclosure, when processing is required based on data related to the characteristics of the target object, such as target object attribute information or a set of attribute information, the permission or consent of the target object will be obtained first. Furthermore, the collection, use, and processing of this data will comply with the relevant laws, regulations, and standards of the relevant regions. In addition, when this application embodiment needs to obtain target object attribute information, separate permission or consent from the target object will be obtained through pop-up windows or redirection to a confirmation page. Only after obtaining the target object's separate permission or consent will the necessary target object-related data for the normal operation of this application embodiment be obtained.

[0203] Figure 13 This is a schematic diagram of the structure of a blockchain data processing device 1300 provided in an embodiment of this disclosure. The device includes:

[0204] Acquisition unit 1310 is used to acquire the first number of sets of blockchain transaction data constructed in parallel by multiple threads;

[0205] The generation unit 1320 is configured to generate a first number of block data sets based on the first number of sets of blockchain transaction data. Each block data set includes block body data and blockchain transaction attribute data. The blockchain transaction attribute data includes data in the block header data excluding hash data.

[0206] The first writing unit 1330 is used to write the first number of block datasets merged into the corresponding disk to obtain the first number of first block files;

[0207] The second writing unit 1340 serially generates hash data corresponding to each block data in the first number of block data sets based on the target order relationship, and writes the hash data into the corresponding first block file to obtain the first number of second block files;

[0208] Construction unit 1350 is used to construct index data and blockchain state data based on the first number of second block files;

[0209] The determining unit 1360 is used to determine the blockchain data to be generated based on the second block file, the index data, and the blockchain state data.

[0210] Optionally, in some embodiments, the generation unit includes:

[0211] The first determining subunit is used to determine the second number of block data corresponding to each group of blockchain transaction data and the target data structure of the block data, wherein the target data structure indicates that the block data includes block body data and blockchain transaction attribute data;

[0212] The first generation subunit is used to generate a first number of block data sets based on the second quantity, the first quantity of blockchain transaction data, and the target data structure.

[0213] Optionally, in some embodiments, the first generating subunit includes:

[0214] The partitioning module is used to partition each group of blockchain transaction data according to the second quantity, so as to obtain a second quantity of blockchain transaction data sets corresponding to each group of blockchain transaction data.

[0215] The construction module is used to construct corresponding block data based on each set of blockchain transaction data, thereby obtaining a set of block data corresponding to each set of blockchain transaction data, wherein the set of block data includes a second number of block data.

[0216] Optionally, in some embodiments, the building module includes:

[0217] The packaging submodule is used to package the data of each blockchain transaction data set to obtain the block body data corresponding to each blockchain transaction data set.

[0218] The first determining submodule is used to calculate the corresponding blockchain transaction attribute data based on the block body data, and to determine the block data corresponding to each blockchain transaction data set based on the block body data and the corresponding blockchain transaction attribute data.

[0219] Optionally, in some embodiments, the first writing unit includes:

[0220] The first acquisition subunit is used to acquire the mount paths corresponding to the first number of disks respectively;

[0221] The first writing subunit is used to merge the first number of block datasets into rows and write them to the corresponding disk according to the mount path, so as to obtain the first number of first block files.

[0222] Optionally, in some embodiments, the first write subunit includes:

[0223] The first determining module is used to determine the writing order of block data in each block data set based on the block height of the block data in each block data set;

[0224] The writing module is used to write the first number of block data sets to the corresponding disks in parallel according to the corresponding mount paths through multiple data writing threads, based on the writing order of the block data in each block data set, to obtain the first number of first block files.

[0225] Optionally, in some embodiments, the writing module includes:

[0226] The second determining submodule is used to configure multiple block file paths in each disk and determine the correspondence between block data and block file paths in each block data set;

[0227] The write submodule is used to write the block data to the corresponding disk in parallel according to the corresponding relationship and the write order based on the mount path corresponding to each block data set and the corresponding write thread, so as to obtain a first number of first block files.

[0228] Optionally, in some embodiments, the second writing unit includes:

[0229] The second determining subunit is used to determine the target order relationship for hash data generation based on the block height of each block data;

[0230] The second generation subunit is used to generate hash data for each block of data one by one according to the target order relationship;

[0231] The second writing subunit is used to write the hash data into the corresponding first block file to obtain a first number of second block files.

[0232] Optionally, in some embodiments, the second generating subunit includes:

[0233] The generation module is used to generate hash data of the target block data based on the blockchain transaction data of the target block data when the target block data is the genesis block data;

[0234] The second determining module is used to determine the first hash data of the target block data based on the hash data of the preceding block data when the target block data is not the genesis block data.

[0235] The calculation module is used to perform hash calculations on the blockchain transaction data of the target block data to obtain the blockchain transaction tree root hash value of the target block data, and generate the second hash data of the target block data based on the blockchain transaction tree root hash value and the first hash data.

[0236] The third determining module is used to determine the hash data of the target block data based on the first hash data and the second hash data.

[0237] Optionally, in some embodiments, the second write subunit includes:

[0238] The fourth determining module is used to determine the filling order of the hash data based on the block height of each block data in all block data sets;

[0239] The filling module is used to sequentially fill the first hash data and the second hash data into the block header data of each block data according to the filling order, so as to obtain a first number of second block files.

[0240] Optionally, in some embodiments, the building unit includes:

[0241] The second acquisition subunit is used to acquire the first index information of the block data in each of the block data sets in the plurality of second block files;

[0242] The third acquisition subunit is used to acquire the second index information of the blockchain transaction data in the corresponding block data set;

[0243] The third generation subunit is used to generate multiple index data in parallel based on the first index information and the second index information.

[0244] Reference Figure 14 , Figure 14 To implement the structural block diagram of a portion of the terminal 240 of the blockchain data processing method according to this embodiment, the terminal 240 includes: a radio frequency (RF) circuit 1410, a memory 1415, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a wireless fidelity (WiFi) module 1470, a processor 1480, and a power supply 1490, etc. Those skilled in the art will understand that... Figure 14The terminal 240 structure shown does not constitute a limitation on a mobile phone or computer, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0245] The RF circuit 1410 can be used to receive and transmit signals during information transmission or calls. In particular, it receives downlink information from the base station and processes it with the processor 1480; in addition, it transmits uplink data to the base station.

[0246] The memory 1415 can be used to store software programs and modules. The processor 1480 executes various functional applications of the terminal and blockchain node data synchronization by running the software programs and modules stored in the memory 1415.

[0247] The input unit 1430 can be used to receive input numeric or character information, and to generate key signal inputs related to the terminal's settings and function control. Specifically, the input unit 1430 may include a touch panel 1431 and other input devices 1432.

[0248] Display unit 1440 can be used to display input or provided information, as well as various menus of the terminal. Display unit 1440 may include display panel 1441.

[0249] Audio circuitry 1460, speaker 1461, and microphone 1462 provide an audio interface.

[0250] In this embodiment, the processor 1480 included in the terminal 240 can execute the blockchain data processing method of the previous embodiment.

[0251] The terminal 240 in this disclosure includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc.

[0252] Figure 15This is a partial structural block diagram of a server 210 for implementing the blockchain data processing method of this disclosure. The server 210 can vary significantly due to different configurations or performance, and may include one or more central processing units (CPUs) 1522 (e.g., one or more processors) and storage devices 1532, and one or more storage media 1530 (e.g., one or more mass storage devices) for storing application programs 1542 or data 1544. The storage devices 1532 and storage media 1530 can be temporary or persistent storage. The program stored in the storage media 1530 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server 210. Furthermore, the central processing unit 1522 may be configured to communicate with the storage media 1530 and execute the series of instruction operations in the storage media 1530 on the server 210.

[0253] Server 210 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input / output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0254] The central processing unit 1522 in server 210 can be used to execute the blockchain data processing method of the present disclosure embodiments.

[0255] This disclosure also provides a storage medium for storing program code, which is used to execute the blockchain data processing methods of the foregoing embodiments.

[0256] This disclosure also provides a computer program product comprising a computer program. A processor of a computer device reads and executes the computer program, causing the computer device to perform the blockchain data processing method described above.

[0257] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “including,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatuses.

[0258] It should be understood that in this disclosure, "at least one item" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0259] It should be understood that in the description of the embodiments disclosed herein, "multiple" means two or more, "greater than", "less than", "exceeding" etc. are understood to exclude the number itself, and "above", "below", "within" etc. are understood to include the number itself.

[0260] In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, 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 through some interfaces, indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0261] 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.

[0262] Furthermore, the functional units in the various embodiments of this disclosure 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 as a software functional unit.

[0263] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this disclosure, 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 includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0264] It should also be understood that the various implementation methods provided in this disclosure can be combined arbitrarily to achieve different technical effects.

[0265] The above is a detailed description of the embodiments of this disclosure. However, this disclosure is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this disclosure. All such equivalent modifications or substitutions are included within the scope defined by the claims of this disclosure.

Claims

1. A blockchain data processing method, characterized in that, The method includes: Obtain the first number of sets of blockchain transaction data constructed in parallel by multiple threads; A first number of block data sets are generated based on the first number of sets of blockchain transaction data. Each block data set includes block body data and blockchain transaction attribute data. The blockchain transaction attribute data includes data in the block header data excluding hash data. The first number of block datasets are merged and written to the corresponding disks to obtain the first number of first block files; Hash data corresponding to each block data in the first number of block data sets is generated serially based on the target order relationship, and the hash data is written into the corresponding first block file to obtain the first number of second block files; Based on the first number of second block files, construct index data and blockchain state data; The blockchain data to be generated is determined based on the second block file, the index data, and the blockchain state data.

2. The method according to claim 1, characterized in that, The step of generating a first number of block data sets based on the first number of groups of blockchain transaction data includes: Determine the second number of block data corresponding to each group of blockchain transaction data and the target data structure of the block data, wherein the target data structure indicates that the block data includes block body data and blockchain transaction attribute data; A first number of block data sets are generated based on the second number, the first number of blockchain transaction data sets, and the target data structure.

3. The method according to claim 2, characterized in that, The step of generating a first number of block data sets based on the second number, the first number of sets of blockchain transaction data, and the target data structure includes: Based on the second quantity, each group of blockchain transaction data is divided to obtain a second quantity of blockchain transaction data sets corresponding to each group of blockchain transaction data; Based on each set of blockchain transaction data, corresponding block data is constructed to obtain a set of block data corresponding to each set of blockchain transaction data, wherein the set of block data includes a second number of block data.

4. The method according to claim 3, characterized in that, The construction of corresponding block data based on each of the blockchain transaction data sets includes: Each blockchain transaction data set is packaged to obtain the block body data corresponding to each blockchain transaction data set. The corresponding blockchain transaction attribute data is calculated based on the block body data, and the block data corresponding to each blockchain transaction data set is determined based on the block body data and the corresponding blockchain transaction attribute data.

5. The method according to claim 1, characterized in that, The step of merging the first number of block datasets and writing them to the corresponding disks to obtain the first number of first block files includes: Obtain the mount paths corresponding to the first number of disks; The first number of block datasets are merged and written to the corresponding disk according to the mount path to obtain the first number of first block files.

6. The method according to claim 5, characterized in that, The step of merging the first number of block datasets and writing them to the corresponding disk according to the mount path to obtain the first number of first block files includes: The writing order of block data in each block data set is determined based on the block height of the block data in each block data set; Based on the writing order of block data in each block data set, the first number of block data sets are written to the corresponding disks in parallel according to the corresponding mount paths by multiple data writing threads to obtain the first number of first block files.

7. The method according to claim 6, characterized in that, Based on the writing order of block data in each block data set, the first number of block data sets are written to the corresponding disks in parallel according to the corresponding mount paths by multiple data writing threads to obtain a first number of first block files, including: Configure multiple block file paths in each disk, and determine the correspondence between block data and block file paths in each block data set; Based on the mount path corresponding to each block data set, the block data is written to the corresponding disk in parallel by the corresponding write thread according to the correspondence and the write order, to obtain a first number of first block files.

8. The method according to claim 1, characterized in that, The step of serially generating hash data corresponding to each block data in the first number of block data sets based on the target order relationship, and writing the hash data into the corresponding first block file to obtain the first number of second block files includes: The target order of hash data generation is determined based on the block height of each block of data. Hash data for each block of data is generated sequentially according to the target order relationship; The hash data is written into the corresponding first block file to obtain a first number of second block files.

9. The method according to claim 8, characterized in that, The step of generating hash data for each block of data sequentially according to the target order relationship includes: When the target block data is the genesis block data, the hash data of the target block data is generated based on the blockchain transaction data of the target block data; When the target block data is not the genesis block data, the first hash data of the target block data is determined based on the hash data of the preceding block data of the target block data; Hash calculations are performed on the blockchain transaction data of the target block data to obtain the blockchain transaction tree root hash value of the target block data, and the second hash data of the target block data is generated based on the blockchain transaction tree root hash value and the first hash data. The hash data of the target block data is determined based on the first hash data and the second hash data.

10. The method according to claim 9, characterized in that, The step of writing the hash data into the corresponding first block file to obtain a first number of second block files includes: The filling order of the hash data is determined based on the block height of each block in the entire block data set; The first hash data and the second hash data are sequentially filled into the block header data of each block data according to the filling order, to obtain a first number of second block files.

11. The method according to claim 1, characterized in that, The construction of index data based on the first number of second block files includes: Obtain the first index information of the block data in each of the block data sets in the plurality of second block files; Obtain the second index information of the blockchain transaction data in the corresponding block data set; Multiple index data are generated in parallel based on the first index information and the second index information.

12. A blockchain data processing device, characterized in that, The device includes: The acquisition unit is used to acquire the first number of sets of blockchain transaction data constructed in parallel by multiple threads. The generation unit is configured to generate a first number of block data sets based on the first number of sets of blockchain transaction data. Each block data set includes block body data and blockchain transaction attribute data. The blockchain transaction attribute data includes data in the block header data excluding hash data. The first writing unit is used to write the first number of block datasets merged into rows and written to the corresponding disk to obtain the first number of first block files; The second writing unit serially generates hash data corresponding to each block data in the first number of block data sets based on the target order relationship, and writes the hash data into the corresponding first block file to obtain a first number of second block files; The construction unit is used to construct index data and blockchain state data based on the first number of second block files; The determining unit is used to determine the blockchain data to be generated based on the second block file, the index data, and the blockchain state data.

13. A storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the blockchain data processing method according to any one of claims 1 to 11.

14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the blockchain data processing method according to any one of claims 1 to 11.

15. A computer program product comprising a computer program that is read and executed by a processor of a computer device, causing the computer device to perform the blockchain data processing method according to any one of claims 1 to 11.