Data storage method and device based on block chain and related equipment

By recording the reference identification of field data in the global reference mapping table of the blockchain node, the problem of repeated storage of the same field data in the blockchain is solved, and the effect of reducing storage space is achieved.

CN120066381APending Publication Date: 2025-05-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311615707.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In blockchain, the same field data may be repeatedly stored in multiple transactions, resulting in wasted storage space.

Method used

Optimize data storage by recording the reference identifier of field data in the global reference mapping table of the blockchain node and storing only the reference identifier in the transaction, rather than the actual field data.

Benefits of technology

It reduces the storage space of transaction data on blockchain nodes and optimizes the storage capacity of blockchain nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066381A_ABST
    Figure CN120066381A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data storage method and device based on a block chain and related equipment, and can be applied to the technical field of block chains. The method comprises the steps of receiving a to-be-processed transaction, and determining a field data volume of field data of the to-be-processed transaction; if first field data of which the field data volume is greater than a field data volume threshold value is found in the field data, determining a field optimization position; obtaining a field reference identifier of the first field data, optimizing the field data at the field optimization position from the first field data into the field reference identifier, and obtaining a business transaction based on the field reference identifier at the field optimization position; updating the global reference mapping table to obtain an updated global reference mapping table; and packaging the business transaction to the second block, and when the second block is linked to the block chain, updating the field reference frequency corresponding to the field reference identifier. By adopting the embodiment of the invention, the storage capacity of the block chain node can be optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular to a data storage method, device, and related equipment based on blockchain. Background Art

[0002] Currently, when storing transaction data in a blockchain, the original data of the transaction data can be stored in a block to chain the transaction data.

[0003] However, the inventor found in the practice process that on the blockchain, there may be multiple transactions containing the same field data, which is equivalent to the same field data being stored repeatedly in blockchain nodes. For example, in a bill processing scenario, the data of bill D1 will be carried in the invoicing transaction TX1, and the data of the same bill D1 can also be carried in subsequent bill transfer transactions TX2, bill transfer transactions TX3, etc. Therefore, the data of the same bill will be stored repeatedly in multiple transactions. Thus, once the amount of the repeatedly stored field data is large, it will occupy more storage space of the blockchain nodes, resulting in waste of the storage space of the blockchain nodes. Based on this, how to reduce the waste of the storage space of the blockchain nodes by transaction data is an urgent problem to be solved. Summary of the Invention

[0004] The embodiments of this application provide a data storage method, device, and related equipment based on blockchain, which can optimize the field data with a field data amount greater than a threshold in a transaction through a reference identifier, helping to reduce the waste of the storage space of the blockchain nodes by transaction data and optimizing the storage capacity of the blockchain nodes.

[0005] On the one hand, the embodiments of this application provide a data storage method based on blockchain, which is executed by a blockchain node; a global reference mapping table is stored in the node memory of the blockchain node; the global reference mapping table is used to optimize the field data of the transactions chained on the blockchain; the transaction chained is a transaction in the first block chained on the blockchain; the method includes:

[0006] Receiving a to-be-processed transaction submitted by a service terminal for a terminal service, and determining the field data amount of the field data of the to-be-processed transaction;

[0007] If field data with a field data amount greater than a field data amount threshold is found in the field data of the to-be-processed transaction, when determining the found field data as the first field data, determining the field position of the first field data in the to-be-processed transaction as the field optimization position corresponding to the first field data;

[0008] Obtain the field reference identifier of the first field data. When the amount of data of the field reference identifier is less than the amount of field data of the first field data, optimize the field data at the field optimization position from the first field data to the field reference identifier, and determine the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position;

[0009] Update the global reference mapping table based on the first field data and the field reference identifier in the business transaction to obtain an updated global reference mapping table;

[0010] Package the business transaction into the second block. When the second block is chained to the blockchain, update the field reference count corresponding to the field reference identifier in the updated global reference mapping table; the field reference count is used to indicate the number of times the first field data is optimized on the blockchain.

[0011] Among them, the global reference mapping table includes a list column, and one list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier;

[0012] Update the global reference mapping table based on the first field data and the field reference identifier in the business transaction to obtain an updated global reference mapping table, including:

[0013] Find the mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0014] When the mapping reference identifier that matches the field reference identifier is not found, determine the field reference identifier as the first mapping reference identifier, determine the first field data as the first mapping field data, and determine the reference count of the first mapping reference identifier based on the initial reference count;

[0015] Construct a first list column based on the first mapping reference identifier, the first mapping field data, and the reference count of the first mapping reference identifier, and determine the global reference mapping table containing the first list column as the updated global reference mapping table.

[0016] Among them, the global reference mapping table includes a list column, and one list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier;

[0017] Update the global reference mapping table based on the first field data and the field reference identifier in the business transaction to obtain an updated global reference mapping table, including:

[0018] Find the mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0019] When a mapping reference identifier matching the field reference identifier is found, the mapping reference identifier matching the field reference identifier is determined as the second mapping reference identifier, and the list column corresponding to the second mapping reference identifier is determined as the second list column;

[0020] Based on the second mapping reference identifier, the second list column is updated to obtain an updated global reference mapping table.

[0021] Among them, the global reference mapping table is used to record the reference times of the mapping reference identifier;

[0022] The method further includes:

[0023] The updated global reference mapping table where the field reference times corresponding to the updated field reference identifier are located is used as the globally updated reference mapping table;

[0024] Obtain a block data migration request for migrating block data on the blockchain; the block data migration request carries a range of block heights to be migrated; the range of block heights to be migrated is determined based on the first block height corresponding to the first migration block to the second block height corresponding to the second migration block; the blocks within the range of block heights to be migrated include target blocks; the target block is any block from the first migration block to the second migration block, and the target transaction list corresponding to the target block includes target transactions;

[0025] If a reference identifier is found in the target transaction, the found reference identifier is determined as the first reference identifier;

[0026] When migrating the target transaction to the backup device indicated by the blockchain migration request, determine the reference times of the first reference identifier in the globally updated reference mapping table, and perform a reduction process on the reference times of the first reference identifier.

[0027] Among them, the method further includes:

[0028] The reference times obtained after performing the reduction process on the reference times of the first reference identifier are determined as the reference update times;

[0029] When the reference update times reach the reference times threshold, perform a clearing process on the data in the list column where the mapping reference identifier matching the first reference identifier is located in the globally updated reference mapping table.

[0030] Among them, migrating the target transaction to the backup device indicated by the blockchain migration request includes:

[0031] Search for a mapping reference identifier matching the first reference identifier in the globally updated reference mapping table, and determine the mapping field data corresponding to the found mapping reference identifier as the first restored field data;

[0032] In the target transaction, update the field data at the field position where the first reference identifier is located from the first reference identifier to the first restored field data, and determine the first restored transaction corresponding to the target transaction based on the first restored field data at the field position where the first reference identifier is located;

[0033] Send the first restored transaction to the backup device indicated by the block data migration request.

[0034] Among them, the method further includes:

[0035] Use the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global updated reference mapping table;

[0036] Obtain a transaction query request from the query service terminal for the business transaction to be queried; the transaction query request carries the transaction hash data of the business transaction to be queried;

[0037] Based on the transaction hash data, search for the business transaction to be queried from the on-chain transactions on the blockchain. When the business transaction to be queried is found, search for the reference identifier from the business transaction to be queried;

[0038] If a reference identifier is found in the business transaction to be queried, determine the found reference identifier as the second reference identifier, search for the mapped reference identifier that matches the second reference identifier in the global updated reference mapping table, and determine the mapped field data corresponding to the found mapped reference identifier as the second restored field data;

[0039] In the business transaction to be queried, update the field data at the field position where the second reference identifier is located from the second reference identifier to the second restored field data, determine the second restored transaction corresponding to the business transaction to be queried based on the second restored field data at the field position where the second reference identifier is located, and send the second restored transaction back to the query service terminal.

[0040] Among them, the first block on the blockchain includes a first target block; the transaction list corresponding to the first target block is the first transaction list; the first target block is the first block with the maximum block height in the first block on the blockchain;

[0041] Based on the transaction hash data, searching for the business transaction to be queried from the on-chain transactions on the blockchain includes:

[0042] Search for the business transaction to be queried in the first transaction list based on the transaction hash data;

[0043] When the business transaction to be queried is found in the first transaction list, it is determined that the business transaction to be queried is found from the on-chain transactions on the blockchain.

[0044] Among them, the method further includes:

[0045] When the business transaction to be queried is not found in the first transaction list, determine a second target block from the first block on the blockchain; the transaction list corresponding to the second target block is the second transaction list; the second target block is the previous first block of the first target block on the blockchain.

[0046] Search for the business transaction to be queried in the second transaction list based on the transaction hash data.

[0047] When the business transaction to be queried is found in the second transaction list, it is determined that the business transaction to be queried is found from the on-chain transactions on the blockchain.

[0048] Wherein, the method further includes:

[0049] Determine the field data in the transaction to be processed whose field data volume is less than or equal to the field data volume threshold as the second field data, and determine the field position of the second field data in the transaction to be processed as the field retention position corresponding to the second field data.

[0050] Wherein, determining the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position includes:

[0051] Maintain the field data at the field retention position as the second field data.

[0052] Determine the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position and the second field data at the field retention position.

[0053] Wherein, updating the field reference times corresponding to the field reference identifier in the updated global reference mapping table includes:

[0054] In the updated global reference mapping table, search for the mapping reference identifier that matches the field reference identifier, and determine the reference times corresponding to the found mapping reference identifier as the first field reference times corresponding to the field reference identifier.

[0055] Perform an update process on the first field reference times corresponding to the field reference identifier to obtain the second field reference times corresponding to the field reference identifier; the second field reference times are greater than the first field reference times.

[0056] Wherein, the global reference mapping table is used to record the mapping reference identifier and the mapping field data corresponding to the mapping reference identifier.

[0057] Optimize the field data at the field optimization position from the first field data to the field reference identifier, and determine the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position, including:

[0058] Obtain the global reference mapping table, and search for the mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0059] When a mapping reference identifier that matches the field reference identifier is found, optimize the field data at the field optimization position from the first field data to the field reference identifier;

[0060] Based on the field reference identifier at the field optimization position, determine the first business transaction corresponding to the transaction to be processed; the field data of the first business transaction is the same as the mapped field data in the global mapping list;

[0061] Determine the first business transaction as the business transaction.

[0062] Wherein, the method further includes:

[0063] When a mapping reference identifier that matches the field reference identifier is not found, determine the transaction to be processed as the second business transaction; the field data of the second business transaction is different from the mapped field data in the global mapping list;

[0064] Determine the second business transaction as the business transaction.

[0065] An embodiment of the present application provides a blockchain-based data storage device on the one hand. The device is run by a blockchain node; a global reference mapping table is stored in the node memory of the blockchain node; the global reference mapping table is used to optimize the field data of the transactions on the blockchain; the transaction on the chain is a transaction in the first block on the blockchain; the device includes:

[0066] The data volume determination module is used to receive the transaction to be processed submitted by the business terminal for the terminal business, and determine the data volume of the field data of the transaction to be processed;

[0067] The optimized data determination module is used to, if field data with a data volume greater than the field data volume threshold is found in the field data of the transaction to be processed, when determining the found field data as the first field data, determine the field position of the first field data in the transaction to be processed as the field optimization position corresponding to the first field data;

[0068] The business transaction determination module is used to obtain the field reference identifier of the first field data, and when the data volume of the field reference identifier is less than the data volume of the first field data, optimize the field data at the field optimization position from the first field data to the field reference identifier, and determine the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position;

[0069] A mapping table update module, which is used to update the global reference mapping table based on the first field data and the field reference identifier in the business transaction, so as to obtain an updated global reference mapping table;

[0070] A reference count update module, which is used to package the business transaction into a second block, and when the second block is chained to the blockchain, update the field reference count corresponding to the field reference identifier in the updated global reference mapping table; the field reference count is used to indicate the number of times of optimizing the first field data on the blockchain.

[0071] Among them, the global reference mapping table includes a list column, and one list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier;

[0072] Among them, the mapping table update module includes: an identifier search unit, a data determination unit, and a data writing unit;

[0073] The identifier search unit is used to find a mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0074] The data determination unit is used to, when no mapping reference identifier that matches the field reference identifier is found, determine the field reference identifier as the first mapping reference identifier, determine the first field data as the first mapping field data, and determine the reference count of the first mapping reference identifier based on the initial reference count;

[0075] The data writing unit is used to construct a first list column based on the first mapping reference identifier, the first mapping field data, and the reference count of the first mapping reference identifier, and determine the global reference mapping table including the first list column as the updated global reference mapping table.

[0076] Among them, the global reference mapping table includes a list column, and one list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier;

[0077] Among them, the identifier search unit is also used to find a mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0078] The data determination unit is also used to, when a mapping reference identifier that matches the field reference identifier is found, determine the mapping reference identifier that matches the field reference identifier as the second mapping reference identifier, and determine the list column corresponding to the second mapping reference identifier as the second list column;

[0079] The data writing unit is also used to update the second list column based on the second mapping reference identifier to obtain an updated global reference mapping table.

[0080] Among them, the global reference mapping table is used to record the reference times of the mapping reference identifiers;

[0081] Among them, the blockchain-based data storage device further includes: a data migration module;

[0082] Among them, the data migration module is used for:

[0083] Taking the updated global reference mapping table where the reference times of the field reference identifiers corresponding to the updated field reference identifiers are located as the global updated reference mapping table;

[0084] Obtaining a block data migration request for migrating block data on the blockchain; the block data migration request carries a range of block heights to be migrated; the range of block heights to be migrated is determined based on the first block height corresponding to the first migration block to the second block height corresponding to the second migration block; the blocks within the range of block heights to be migrated include target blocks; the target block is any block from the first migration block to the second migration block, and the transaction list corresponding to the target block includes target transactions;

[0085] If a reference identifier is found in the target transaction, determining the found reference identifier as the first reference identifier;

[0086] When migrating the target transaction to the backup device indicated by the blockchain migration request, determining the reference times of the first reference identifier in the global updated reference mapping table and performing a reduction process on the reference times of the first reference identifier.

[0087] Among them, the blockchain-based data storage device further includes: a data clearing module;

[0088] Among them, the data clearing module is used for:

[0089] Determining the reference times obtained after performing a reduction process on the reference times of the first reference identifier as the reference update times;

[0090] When the reference update times reach the reference times threshold, clearing the data in the list column where the mapping reference identifier matching the first reference identifier is located in the global updated reference mapping table.

[0091] Among them, the data migration module is specifically used for:

[0092] Searching for a mapping reference identifier matching the first reference identifier in the global updated reference mapping table and determining the mapping field data corresponding to the found mapping reference identifier as the first restored field data;

[0093] In the target transaction, update the field data at the field position where the first reference identifier is located from the first reference identifier to the first restored field data, and determine the first restored transaction corresponding to the target transaction based on the first restored field data at the field position where the first reference identifier is located;

[0094] Send the first restored transaction to the backup device indicated by the block data migration request.

[0095] Among them, the data storage device based on the blockchain further includes: an update table determination module, a query request acquisition module, an identifier search module, a restored data determination module, and a data feedback module;

[0096] The update table determination module is used to use the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global update reference mapping table;

[0097] The query request acquisition module is used to obtain a transaction query request of the query service terminal for the to-be-query business transaction; the transaction query request carries the transaction hash data of the to-be-query business transaction;

[0098] The identifier search module is used to search for the to-be-query business transaction from the on-chain transactions on the blockchain based on the transaction hash data, and when the to-be-query business transaction is found, search for the reference identifier from the to-be-query business transaction;

[0099] The restored data determination module is used to, if a reference identifier is found in the to-be-query business transaction, determine the found reference identifier as the second reference identifier, search for the mapped reference identifier that matches the second reference identifier in the global update reference mapping table, and determine the mapped field data corresponding to the found mapped reference identifier as the second restored field data;

[0100] The data feedback module is used to, in the to-be-query business transaction, update the field data at the field position where the second reference identifier is located from the second reference identifier to the second restored field data, determine the second restored transaction corresponding to the to-be-query business transaction based on the second restored field data at the field position where the second reference identifier is located, and send the second restored transaction back to the query service terminal.

[0101] Among them, the first block on the blockchain includes a first target block; the transaction list corresponding to the first target block is the first transaction list; the first target block is the first block with the largest block height in the first block on the blockchain;

[0102] Among them, the data storage device based on the blockchain further includes: a transaction query module;

[0103] The transaction query module is specifically used for:

[0104] Search for the business transaction to be queried in the first transaction list based on the transaction hash data;

[0105] When the business transaction to be queried is found in the first transaction list, it is determined that the business transaction to be queried is found from the on-chain transactions on the blockchain.

[0106] Among them, the transaction query module is also used for:

[0107] When the business transaction to be queried is not found in the first transaction list, determine the second target block from the first block on the blockchain; the transaction list corresponding to the second target block is the second transaction list; the second target block is the previous first block of the first target block on the blockchain;

[0108] Search for the business transaction to be queried in the second transaction list based on the transaction hash data;

[0109] When the business transaction to be queried is found in the second transaction list, it is determined that the business transaction to be queried is found from the on-chain transactions on the blockchain.

[0110] Among them, the data storage device based on the blockchain further includes: a retained data determination module;

[0111] The retained data determination module is specifically used for:

[0112] Determine the field data in the transaction to be processed whose field data volume is less than or equal to the field data volume threshold as the second field data, and determine the field position of the second field data in the transaction to be processed as the field retention position corresponding to the second field data.

[0113] Among them, the business transaction determination module is also used for:

[0114] Maintain the field data at the field retention position as the second field data;

[0115] Based on the field reference identifier at the field optimization position and the second field data at the field retention position, determine the business transaction corresponding to the transaction to be processed.

[0116] Among them, the reference count update module is also used for:

[0117] In the updated global reference mapping table, search for the mapping reference identifier that matches the field reference identifier, and determine the reference count corresponding to the found mapping reference identifier as the first field reference count corresponding to the field reference identifier;

[0118] Perform an update process on the first field reference count corresponding to the field reference identifier to obtain the second field reference count corresponding to the field reference identifier; the second field reference count is greater than the first field reference count.

[0119] Among them, the global reference mapping table is used to record the mapping reference identifier and the mapping field data corresponding to the mapping reference identifier;

[0120] Among them, the business transaction determination module is further configured to:

[0121] Obtain the global reference mapping table, and search for the mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0122] When the mapping reference identifier that matches the field reference identifier is found, optimize the field data at the field optimization position from the first field data to the field reference identifier;

[0123] Based on the field reference identifier at the field optimization position, determine the first business transaction corresponding to the transaction to be processed; the field data of the first business transaction is the same as the mapping field data in the global mapping list;

[0124] Determine the first business transaction as the business transaction.

[0125] Among them, the business transaction determination module is further configured to:

[0126] When the mapping reference identifier that matches the field reference identifier is not found, determine the transaction to be processed as the second business transaction; the field data of the second business transaction is different from the mapping field data in the global mapping list;

[0127] Determine the second business transaction as the business transaction.

[0128] On the one hand, an embodiment of the present application provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method provided by the embodiment of the present application.

[0129] On the one hand, an embodiment of the present application provides a computer program product or a computer program, and the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided by the embodiment of the present application.

[0130] In the embodiments of the present application, it is possible to determine, from a transaction to be processed, field data (i.e., first field data) whose field data volume is greater than a threshold value (i.e., the field data volume threshold). Furthermore, the field data at the field position where the first field data is located is updated from the first field data to a reference identifier of the first field data (i.e., the field reference identifier), and the data volume of this field reference identifier is smaller than the field data volume of the first field data. Thus, the data volume of the transaction to be processed can be reduced. Moreover, the first field data in the transaction to be processed can be stored in the global reference mapping table. By recording the reference count in the global reference mapping table, the number of times the same field data is used for optimizing field data on the blockchain is recorded, and the same field data only needs to be stored in the global reference mapping table once, without repeatedly storing field data with a large data volume, avoiding waste of the storage space of blockchain nodes caused by repeatedly storing the same field data. Based on this, adopting the embodiments of the present application helps to reduce the waste of the storage space of blockchain nodes by transaction data and optimize the storage capacity of blockchain nodes. BRIEF DESCRIPTION OF THE DRAWINGS

[0131] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0132] Figure 1 is a schematic structural diagram of a blockchain-based data processing system provided by the embodiments of the present application;

[0133] Figure 2 is a schematic diagram of a data interaction scenario provided by the embodiments of the present application;

[0134] Figure 3 is a schematic flowchart of a blockchain-based data storage method provided by the embodiments of the present application;

[0135] Figure 4 is a schematic diagram of the effect of transaction data volume processing provided by the embodiments of the present application;

[0136] Figure 5 is a schematic flowchart of a business transaction determination method provided by the embodiments of the present application;

[0137] Figure 6 is a schematic flowchart of a business transaction determination provided by the embodiments of the present application;

[0138] Figure 7 is a schematic diagram of the effect of a global reference mapping table provided by the embodiments of the present application;

[0139] Figure 8 It is a schematic diagram of a data migration process provided by an embodiment of the present application;

[0140] Figure 9 It is a schematic flowchart of a data storage method based on a blockchain provided by an embodiment of the present application;

[0141] Figure 10 It is a schematic flowchart of a data query process provided by an embodiment of the present application;

[0142] Figure 11 It is a schematic structural diagram of a data storage device based on a blockchain provided by an embodiment of the present application;

[0143] Figure 12 It is a schematic structural diagram of a computer device provided by an embodiment of the present application. Specific embodiments

[0144] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0145] Please refer to Figure 1 , Figure 1 It is a schematic structural diagram of a data processing system based on a blockchain provided by an embodiment of the present application. The data processing system may include a terminal device cluster and a blockchain network. As Figure 1 shown, the terminal device cluster here may be the terminal device cluster 100a as shown in Figure 1 , and the blockchain network here may be the blockchain network 200a as shown in Figure 1 .

[0146] Among them, it can be understood that Figure 1 the terminal device cluster 100a shown may include one or more terminal devices. The number of terminal devices in the terminal device cluster 100a will not be limited here. As Figure 1As shown, the terminal devices in the terminal device cluster 100a may include terminal device 110a, terminal device 110b, …, terminal device 110n, etc. A resource management client, also known as a resource client, may be running on any terminal device. The resource management client may be a tool responsible for managing digital resources, and can be used to store the private key information of a business object (which can also be simply referred to as the private key) in an encrypted file. Then, based on the private key information stored by the resource management client, it signs a transaction to be signed (such as a transaction for transferring digital resources to another account), obtaining a signed transaction, and then the signed transaction can be sent to the blockchain to achieve the transfer of digital resources on the blockchain, the transfer of resources on the blockchain, etc. The resource client can be a hardware device or a software program. It can be understood that one or more resource management clients may be running on a terminal device, and the number of resource management clients running on a terminal device will not be limited here. It can be understood that a single business object may correspond to one or more resource management clients, and the multiple resource management clients corresponding to the same business object may run on the same terminal device or on different terminal devices, without any restrictions here.

[0147] It can be understood that, as Figure 1 shown, the blockchain network 200a may include multiple blockchain nodes, and the number of blockchain nodes in the blockchain network 200a will not be limited here. As Figure 1 shown, the multiple blockchain nodes in the blockchain network 200a may specifically include blockchain node 11a, blockchain node 11b, blockchain node 11c, blockchain node 11d, etc. The blockchain nodes in this blockchain network can be used to jointly maintain the blockchain. For example, the blockchain stored on each node in the blockchain network 200a (such as blockchain nodes like blockchain node 11a, blockchain node 11b, blockchain node 11c, and blockchain node 11d) is blockchain 11e.

[0148] As Figure 1 shown, the terminal devices in the terminal device cluster 100a (such as terminal device 110a) may be network-connected to blockchain nodes such as blockchain node 11a, blockchain node 11b, blockchain node 11c, and blockchain node 11d, so that when the terminal devices in the terminal device cluster 100a access the blockchain network 200a, they can perform data interaction with the blockchain nodes in the blockchain network 200a. For example, terminal device 110a can be used as a business terminal, and then a business object can send a data query request to the blockchain network through this business terminal. Then, the blockchain nodes in the blockchain network can determine the request result based on the data query request and return the request result to the corresponding business terminal.

[0149] It should be understood that the blockchain involved in the embodiments of this application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. It is mainly used to sort data in chronological order, encrypt it into a ledger to make it unforgeable and tamper-proof, and at the same time, data verification, storage, and update can be carried out. Essentially, the blockchain is a decentralized database, a series of data blocks associated by cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer. The blockchain includes a series of blocks (Block) that are sequentially connected in the order of generation. The blocks record the block data packaged and submitted by the blockchain nodes in the blockchain system. The blockchain underlying platform can include processing modules such as object management, basic services, smart contracts, and operation management. Among them, the object management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the correspondence between the user's real identity and the blockchain address (permission management). And under authorization, it supervises and audits the transaction situations of certain real identities, and provides the rule configuration for risk control (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and after reaching a consensus on valid requests, record them in storage. For a new business request, the basic service first performs interface adaptation parsing and authentication processing (interface adaptation), then encrypts the business information through the consensus algorithm (consensus management), transmits it intact and consistently to the shared ledger after encryption (network communication), and records and stores it; the smart contract module is responsible for the registration and issuance of contracts, contract triggering, and contract execution. Development members can define contract logic through a certain programming language, publish it to the blockchain (contract registration), trigger the execution according to the logic of the contract terms by calling keys or other events, complete the contract logic, and at the same time, it also provides functions for contract upgrade and cancellation; the operation management module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation during the product release process, and the visual output of the real-time state during product operation, such as: alarming, managing network conditions, managing the health status of node devices, etc. The platform product service layer provides the basic capabilities and implementation frameworks of typical applications. Development members can superimpose the characteristics of the business based on these basic capabilities to complete the blockchain implementation of the business logic. The application service layer provides application services based on the blockchain solution for business participants to use.

[0150] It can be understood that a blockchain (such as blockchain 11e) can be composed of multiple blocks. The genesis block (also known as the creation block, i.e., the first block in the blockchain) includes a block header and a block body. The block header stores the input information feature value, version number, timestamp, and difficulty value, and the block body stores the input information. The next block after the genesis block takes the genesis block as its parent block. Similarly, the next block also includes a block header and a block body. The block header stores the input information feature value of the current block, the block header feature value of the parent block, version number, timestamp, and difficulty value, and so on. This ensures that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, guaranteeing the security of the input information in the block. It can be understood that each block in the blockchain can correspond to a block height. The block height of a block refers to the number of blocks between this block and the genesis block in the blockchain. It should be noted that the block height of the genesis block is 0, and the block height of the next block after the genesis block is 1.

[0151] It should be understood that one or more smart contracts (which can also be simply referred to as contracts) can be deployed on the blockchain (such as the above-mentioned blockchain 11e) of the above-mentioned blockchain network (such as the above-mentioned blockchain network 200a). These smart contracts can be distinguished by contract identifiers, and the contract identifiers can include one or more of the following: contract call address (which can also be simply referred to as contract address), contract identification number (Identity document, ID), or contract name. In the business transactions initiated by the user client, the contract call address or contract identification number or contract name of the smart contract can also be carried to specify the smart contract that needs to be run. In the embodiments of the present application, the smart contracts deployed on the blockchain can be used for business processing contracts, such as contracts for lottery business, contracts for invoice business processing, contracts for bill circulation business, contracts for virtual resource conversion in game scenarios, etc., which are not limited here.

[0152] For the sake of easy understanding, further, please refer to Figure 2 , Figure 2 which is a schematic diagram of a data interaction scenario provided by the embodiments of the present application. As Figure 2 shown, the terminal device 20a can be any terminal device in the terminal device cluster corresponding to the above-mentioned Figure 1 embodiment (such as the above-mentioned terminal device 110a, terminal device 110b, etc.). The business object A can initiate a transaction to be processed TX1. Then, the terminal device 20a can send the transaction to be processed TX1 to the blockchain network 200a. It can be understood that here, taking the blockchain node 11c in the blockchain network 200a as an example, the processing process of the blockchain node for the transaction to be processed TX1 is described.

[0153] It should be understood that a global reference mapping table is deployed in the blockchain node 11c, as shown by the global reference mapping table 206a in Figure 2 . The global reference mapping table 206a can be composed of multiple list columns. Among them, one list column can be used to record the reference record of a reference identifier. A list record can include information such as a reference identifier, the field data corresponding to the reference identifier, and the corresponding reference count. In other words, each list column is used to store information such as a reference identifier, the field data corresponding to the reference identifier, and the corresponding reference count. The reference count here is used to indicate the number of times the field data in the on-chain transaction is optimized through the reference identifier. The on-chain transaction can be a transaction written into the block on the blockchain. For the convenience of description, the reference identifier in the global reference mapping table can be called the mapping reference identifier, and the field data can be called the mapping field data.

[0154] For example, in the global reference mapping table 206a to be processed, it can include the list column where the reference identifier B1, the field data S4, and the reference count C1 are located, the list column where the reference identifier B2, the field data S5, and the reference count C2 are located, the list column where the reference identifier B3, the field data S6, and the reference count C3 are located, and so on. There is no limitation here.

[0155] Furthermore, the blockchain node 11c can obtain the transaction to be processed TX1 (as shown by 201a in Figure 2 ). In the transaction to be processed TX1, it can include the field data at multiple field positions. For example, referring to what is shown in 2101a in Figure 2 China, the transaction to be processed TX1 can include: the field data S1 at the field position W1, the field data S3 at the field position W2, and the field data S3 at the field position W3. Further, it is possible to search for the field data in the transaction to be processed TX1 whose field data volume is greater than the threshold Y1 (step S22), so that the field data S2 whose field data volume is greater than the threshold Y1 can be found (as shown by 202a in Figure 2 ). Further, the found field data S2 can be optimized. It should be understood that the optimization here can be understood as reducing the field data volume at the field position corresponding to the field data. In the embodiment of the present application, the optimization can be performed by replacing the original field data with the corresponding field reference identifier.

[0156] Furthermore, it is possible to obtain the reference identifier B4 of the field data S2 (as shown by 203a in Figure 2 ), and update the transaction to be processed TX1 based on the reference identifier B4 (step S23). The updated transaction to be processed TX1 can be determined as the business transaction TX2 (as shown by 203a in Figure 2as shown by 204a therein). Among them, when updating the to-be-processed transaction TX1, the field data (i.e., field data S2) at the field position W2 in the to-be-processed transaction TX1 can be updated to the reference identifier B4. For example, as Figure 2 shown by 2401a therein, in the business transaction TX2, the field data at the field position W2 is the reference identifier B4.

[0157] In addition, the global reference mapping table 206a can be updated according to the field data S2 (as Figure 2 shown by 202a therein) and the reference identifier B4 of the field data S2 (as Figure 2 shown by 203a therein). For example, if the reference identifier B4 is not found in the global reference mapping table 206a, when determining the reference count C4 corresponding to the reference identifier B4 (which can be 0, for example), the reference identifier B4, the field data S2, and the reference count C4 can be added to the global reference mapping table 206a to obtain the global reference mapping table shown by 207a. As Figure 2 shown by 2701a therein is the list column composed of the reference identifier B4, the field data S2, and the reference count C4 added in the global reference mapping table.

[0158] Furthermore, the blockchain node 11c can perform transaction packaging (S25) based on the business transaction TX2, and then a block Q1 containing the business transaction TX2 can be obtained (as Figure 2 shown by 205a therein). When uploading the block Q1 to the blockchain, the reference count is updated (step S26). Specifically, the updated reference count here can be to update the reference count C4 corresponding to the reference identifier B4 in the global reference mapping table 207a. Specifically, it can be to increase the actual reference count of the reference identifier B4 in the block Q1 to the reference count C4, for example, increment the reference count by 1. The updated global reference mapping table 207a can be referred to as shown by the global reference mapping table 208a, and the updated reference count C4 becomes the reference count C5 (as Figure 2 shown by 2801a therein).

[0159] By adopting the embodiments of the present application, it is possible to determine, from the transaction to be processed, the field data (i.e., the first field data) whose field data volume is greater than a threshold (i.e., the field data volume threshold), and then update the field data at the field position where the first field data is located to the reference identifier of the first field data (i.e., the field reference identifier). Moreover, the data volume of the field reference identifier is less than the field data volume of the first field data. Thus, the data volume of the transaction to be processed can be reduced. Also, the first field data in the transaction to be processed can be stored in the global reference mapping table, and by recording the reference count in the global reference mapping table, the number of times the same field data is used for optimizing field data on the blockchain can be recorded. And the same field data only needs to be stored once in the global reference mapping table, without repeatedly storing the field data with a large data volume, avoiding the waste of the storage space of the blockchain node caused by repeatedly storing the same field data. Based on this, adopting the embodiments of the present application helps to reduce the waste of the storage space of the blockchain node by transaction data and optimize the storage capacity of the blockchain node.

[0160] It should be understood that, in the embodiments of the present application, large field data (i.e., field data whose field data volume is greater than the threshold) can be placed in a centralized location (i.e., in the global reference mapping table, which is essentially a database on the chain), and only a keyword (i.e., the reference identifier) that can be used to query this large field data needs to be stored at the field position where the large field data in the transaction of the block is located. For example, a hash calculation (such as MD5) can be performed on a 10K large field data, and then the data obtained from the hash calculation such as MD5 can be used as the keyword (i.e., the reference identifier) of the large field data with a field of 10K and stored in the global reference mapping table of the database on the chain.

[0161] The advantage of doing this is that for some data for which evidence is stored, in the original text of a transaction (such as an evidence storage transaction), we include a document, for example, an invoice. For an invoice, if the list of the invoice is very large, the field value of the transaction field in the transaction corresponding to the invoice will also be very large. Then, when this invoice needs to be uploaded to the blockchain, a blockchain upload request needs to be sent for this invoice, and such a list document will be carried in this blockchain upload request. This list document is actually in the transaction corresponding to this invoice. Therefore, when the invoice in this transaction is stored by the blockchain, this transaction will be placed in the block, and at the same time, some data information of this transaction (such as the transaction receipt of this transaction, the block header of the block where the current transaction is located, etc.) will also be stored in the transaction list corresponding to the block. However, when this invoice is issued to Company A, then this invoice belongs to Company A, and the owner will be recorded in this invoice issuance transaction, that is, the information of this invoice will be stored again, which is equivalent to a very large thing being recorded twice on the blockchain (that is, the list document of the invoice is recorded once in the invoice issuance transaction when it is issued to Company A, and the list document will be recorded again when the user requests to upload the issued invoice to the blockchain for evidence storage). Then, when further bill transfer or bill reimbursement is needed later, for example, Company A transfers the invoice to Company B or Company A reimburses the invoice to the tax bureau, the same information of this invoice will be repeatedly recorded during subsequent transfer and modification. Based on this, if the bill information of this invoice is stored as a whole in another table (i.e., the global reference mapping table), only a ticket number keyword or MD5 (i.e., the reference identifier) needs to be left in the transaction. Then, for some of the above bill transfers or circulations, we can store the above bill information only once instead of repeatedly storing these large field data. Therefore, in view of the situation that some large fields of this bill are repeatedly recorded during the process of bill issuance, bill circulation, bill modification, and bill reimbursement, through the embodiments of this application, the waste of storage space during the bill circulation process can be greatly reduced.

[0162] Optionally, during the first on-chain transaction and when storing the transaction, large fields with field values greater than a specified value can be searched for in the transaction. These large fields in the transaction (data such as the information of the bills in the above bill list file) can be stored as a whole in another table on the chain (i.e., the global reference mapping table). Then, only a bill number keyword or file MD5 (i.e., the reference identifier) needs to be left at the field positions where these large fields in the transaction are located. Subsequently, in some business scenarios of bill transfer or bill circulation, when it is determined that the bill in the transaction received from a certain user or enterprise is the same as the previously stored bill, the same bill in the transaction can be replaced with the corresponding reference identifier, without the need to repeatedly store the same bill received currently. In other words, the embodiments of the present application can achieve one-time storage of the same bill in different transactions through reference, rather than repeatedly storing these same large fields in different transactions. Through this reference method, we can effectively save the storage capacity inside the node, especially for blocks containing a large number of repeated large fields. This method can improve the storage efficiency of the blockchain and reduce the storage cost of the node.

[0163] For example, in a transaction sent by a user, there are field 1, field 2, field 3, and a 10K large field. Then, when storing the transaction fields of this transaction in the transaction list corresponding to the block, the transaction fields with smaller data volume in the front can remain unchanged, and the storage is still carried out according to field 1, field 2, field 3. However, at the field position where the subsequent 10K large field (i.e., the transaction field with larger data volume) is located, the reference identifier corresponding to the 10K large field needs to be stored. Here, the reference identifier directly points to the 10K large field in the global reference mapping table. For the same large field in subsequent transactions, the reference identifier corresponding to the 10K large field is also directly stored (at this time, the original text of the 10K large field is stored in the global reference mapping table on the chain), without the need to repeatedly store the original text of the 10K large field in the same node memory (or the same transaction list).

[0164] It can be understood that any blockchain node involved in the embodiments of the present application (such as any blockchain node in the above-mentioned blockchain network 200a) can be a computer device, which can be a server, a terminal device, or other devices for data processing, without limitation here. Among them, the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, without limitation here. The terminal device can include, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, smart speakers, smart home appliances, etc.

[0165] Any terminal device involved in the embodiments of the present application (such as any terminal device in the above-mentioned terminal device cluster 100a) can be a computer device, which can be a server, a terminal device, or other devices for data processing, without limitation here. Among them, the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, without limitation here. The terminal device can include, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, smart speakers, smart home appliances, etc.

[0166] It should be noted that before and during the collection of relevant data of the business object (such as the object information required to be provided when the business object initiates a transaction to be processed), a prompt interface, a pop-up window or a voice prompt message can be displayed, and the prompt interface, the pop-up window or the voice prompt message is used to prompt the user that their relevant data is being collected currently, so that the present application only starts to execute the relevant steps of obtaining the user's relevant data after obtaining the confirmation operation of the user on the prompt interface or the pop-up window. Otherwise (that is, when the confirmation operation of the user on the prompt interface or the pop-up window is not obtained), the relevant steps of obtaining the user's relevant data are ended, that is, the relevant data of the user is not obtained. In other words, all user data collected by the present application is collected with the consent and authorization of the user, and the collection, use and processing of the relevant user data need to comply with the relevant laws, regulations and standards of the relevant regions.

[0167] It can be understood that the above scenarios are only examples and do not constitute limitations on the application scenarios of the technical solutions provided by the embodiments of this application. The technical solutions of this application can also be applied to other scenarios. For example, as is known to those of ordinary skill in the art, with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems.

[0168] Further, please refer to Figure 3 , Figure 3 which is a schematic flowchart of a data storage method based on blockchain provided by an embodiment of this application. The method is executed by a blockchain node; a global reference mapping table is stored in the node memory of the blockchain node; the global reference mapping table is used to optimize the field data of the on-chain transactions on the blockchain; the on-chain transactions are transactions in the first block on the blockchain. The first block can be a block that has been on the chain. The method can at least include the following steps S101 to S105.

[0169] S101. Receive a to-be-processed transaction submitted by a service terminal for terminal services, and determine the amount of field data of the to-be-processed transaction.

[0170] Among them, the to-be-processed transaction can be a transaction to be processed sent by the service terminal. Terminal services can refer to the services that the service terminal can provide, such as invoicing services, lottery services, bill transfer services, and so on.

[0171] Among them, the field data can refer to the field value corresponding to the field in the to-be-processed transaction. For example, in the to-be-processed transaction sent by the service terminal through account address 1, for the field of the source address, the corresponding field data can be account address 1. The amount of field data can refer to the size of the data stored, transmitted, and processed by the field data in the computer. The size of the data amount is usually expressed in bytes (Byte), kilobytes (KB), megabytes (MB), etc. For example, the amount of field data of a field data is 10 KB.

[0172] It should be understood that a to-be-processed transaction can include multiple field data. In other words, it can include the data corresponding to multiple fields. The size of the amount of field data of each field data can be determined according to the actual situation and is not limited here.

[0173] It should be understood that in the to-be-processed transaction, each field can have a corresponding field position. In other words, in the transaction sent to the blockchain, the fields in the transaction are arranged in a certain format, and each field can have a corresponding field position. For example, the field position of the destination address field in the to-be-processed transaction is the first field position, and the field position of the transaction fee field in the to-be-processed transaction is the second field position, etc., which are not limited here.

[0174] S102. If field data with a field data volume greater than the field data volume threshold is found in the field data of the transaction to be processed, when determining the found field data as the first field data, the field position of the first field data in the field data is determined as the field optimization position corresponding to the first field data.

[0175] Among them, the field data volume threshold can be the minimum value of the field data volume that the field data to be optimized needs to satisfy. For example, the data volume threshold can be 300KB. Field data with a field data volume greater than 300KB is searched for in the field data of the transaction to be processed, and then the field data with a field data volume greater than 300KB can be determined as the first field data.

[0176] It can be understood that the first field data can be the field data to be optimized. The first field data can refer to the field data with a field data volume greater than the field data volume threshold. The field optimization position can be the field position of the first field data in the field data, that is, the field position where the field data to be optimized is located. For example, the field data volume of the field data at the 5th field position in the transaction to be processed is greater than the field data volume threshold, that is, the field data at the 5th field position is the first field data, then the 5th field position in the transaction to be processed is the field optimization position.

[0177] It can be understood that the embodiment of the present application may further include the following steps: determining the field data with a field data volume less than or equal to the field data volume threshold in the transaction to be processed as the second field data, and determining the field position of the second field data in the transaction to be processed as the field retention position corresponding to the second field data.

[0178] Among them, the second field data can refer to the field data with a field data volume less than or equal to the field data volume threshold. The second field data can be understood as the field data that does not need to be optimized. The field retention position can be the field position of the second field data in the field data, that is, the field position where the field data that does not need to be optimized is located. For example, the field data volume of the field data at the 1st field position in the transaction to be processed is less than the field data volume threshold, that is, the field data at the 1st field position is the second field data, then the 1st field position in the transaction to be processed is the field retention position.

[0179] It can be understood that in the transaction to be processed, all fields can be the first field data, or all can be the second field data, or there can be both the first field data and the second field data at the same time, which is not limited here.

[0180] For example, the determination process of the first field data and the second field data in the second field data is described here in combination with the drawings. Please refer toFigure 4 , Figure 4 is a schematic diagram showing the effect of processing transaction data volume provided by an embodiment of the present application. As Figure 4 shown, in transaction TX1, it may include multiple field positions, such as field position W1, field position W2,......, field position W3, etc. Further, the field data volume L1 of the field data S1 at field position W1 can be obtained, and then the field data volume L1 is compared with the field data volume threshold K1, and it is obtained that the field data volume L1 is less than the field data volume threshold K1. Then, the field data S1 can be determined as the second field data, and the field position W1 can be determined as the field retention position. Then, the field data volume L2 of the field data S2 at field position W2 can be obtained, and then the field data volume L2 is compared with the field data volume threshold K1, and it is obtained that the field data volume L2 is greater than the field data volume threshold K1. Then, the field data S2 can be determined as the first field data, and the field position W2 can be determined as the field optimization position. And so on, it can be detected whether the field transaction data at each field position in transaction TX1 is greater than the field data volume threshold K1, so as to determine the first field data and the second field data in transaction TX1, as well as the field optimization position and the field retention position.

[0181] It should be understood that in the process of finding a large field (i.e., the first field data) as a reference, there is no need to analyze the specific content of the field data. For example, for a transaction, the specific content in the transaction will not be analyzed. There are many fields in a transaction, such as transaction hash, transaction timestamp, user data, etc. The user data can be further divided into some fields, such as file name, file value, etc. (it should be understood that the data stored in different contracts is different). At this time, instead of analyzing the field content of these field data, the size of the field data volume of these fields is determined. In other words, we can determine the field data volume (i.e., the data value of these fields) of these fields. If the field data volume is greater than the preset threshold (i.e., the field data volume threshold), the field data can be optimized, that is, such a reference is made. Subsequently, after the transaction is uploaded to the chain, the reference count of the field with a field data volume greater than the preset threshold can be incremented in the global reference mapping table. In other words, we can call the field corresponding to the field data volume greater than the preset threshold a large field, and then each of these found large fields can be used as a field to be optimized.

[0182] S103. Obtain the field reference identifier of the first field data. When the data volume of the field reference identifier is less than the field data volume of the first field data, optimize the field data at the field optimization position from the first field data to the field reference identifier, and determine the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position.

[0183] It can be understood that the field reference identifier can be the reference identifier of the first field data. The field reference identifier can be the hash value of the first field data, such as the MD5 value (a hash calculation method), which is not limited here. It should be understood that when optimizing the field data, the purpose is to reduce the data volume of the transaction. Therefore, when the data volume of the field reference identifier is less than the field data volume of the first field data, the first field data is replaced (i.e., replaced by the field reference identifier), and if the data volume of the field reference identifier is greater than or equal to the field data volume of the first field data, the first field data may not be optimized.

[0184] Among them, the business transaction can be the transaction corresponding to the transaction to be processed for being uploaded to the blockchain. It can be understood that when determining the business transaction, the field data at the field optimization position can be optimized from the first field data to the field reference identifier, and the field data at the field retention position is maintained as the second field data. In other words, the field data at the field optimization position in the transaction to be processed can be replaced by the field reference identifier (i.e., the field data with a data volume greater than the threshold in the transaction to be processed is replaced by the field reference identifier), and the business transaction is determined based on the transaction to be processed with the field reference identifier replaced at the field optimization position.

[0185] Specifically, determining the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position may include the following steps: maintaining the field data at the field retention position as the second field data; determining the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position and the second field data at the field retention position.

[0186] Among them, maintaining the field data at the field retention position as the second field data means that the field data at the field retention position remains unchanged.

[0187] For example, please refer to Figure 5 , Figure 5It is a schematic flowchart of a business transaction determination method provided by an embodiment of the present application. In transaction TX1, it may include multiple field positions, such as field position W1, field position W2,......, field position W3, etc. When comparing the transaction data at the field position with the field data volume threshold K1, the field data volume L1 of the field data S1 at field position W1 is less than the field data volume threshold K1 (i.e., field position W1 is a field retention position), the field data volume L2 of the field data S2 at field position W2 is greater than the field data volume threshold K1 (i.e., field position W1 is a field optimization position), and the field data volume L3 of the field data S3 at field position W3 is less than the field data volume threshold K1 (i.e., field position W1 is a field retention position). Further, the field data at field position W1 can be maintained as field data S1, the field data at field position W2 can be updated from field data S2 to reference identifier B4, and the field data at field position W3 can be maintained as field data S3, and so on, to determine business transaction TX2. Among them, the reference identifier B4 can be the reference identifier corresponding to the field data S2.

[0188] It can be understood that when determining a business transaction, the first field data in the transaction to be processed can be directly optimized based on the reference identifier. Or, when determining a business transaction, it can also be queried whether the reference identifier of the first field data appears in the global reference mapping table, that is, whether it has been referenced (i.e., whether it is used to optimize the field data). If it has not been referenced, the transaction to be processed can be directly determined as a business transaction, that is, the original transaction to be processed is directly chained. If it has been referenced, the first field data in the transaction to be processed is optimized based on the reference identifier. Thus, when the first field data appears for the first time, it can be written in the transaction in the form of the field original text, and the transaction retaining the field original text is chained, thereby improving the reliability and security of the first field data.

[0189] Specifically, the global reference mapping table is used to record the mapping reference identifier and the mapping field data corresponding to the mapping reference identifier. Then, optimizing the field data at the field optimization position from the first field data to the field reference identifier and determining the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position may include the following steps: obtaining the global reference mapping table, and searching for the mapping reference identifier matching the field reference identifier in the global reference mapping table; when the mapping reference identifier matching the field reference identifier is found, optimizing the field data at the field optimization position from the first field data to the field reference identifier; determining the first business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position; there is the same field data between the field data of the first business transaction and the mapping field data in the global mapping list; and determining the first business transaction as the business transaction.

[0190] Among them, the mapping reference identifier can be the reference identifier recorded in the global reference mapping table. It should be understood that the mapping reference identifier in the global reference mapping table can be determined based on the reference identifier of the field data whose field data volume in the historical transaction to be processed is greater than the field data volume threshold when obtaining the historical transaction to be processed. Among them, the mapped field data can be the field data recorded in the global reference mapping table, that is, the field data optimized by the mapping reference identifier. It should be understood that the mapped field data in the global reference mapping table can be determined based on the field data whose field data volume in the historical transaction to be processed is greater than the field data volume threshold when obtaining the historical transaction to be processed. Finding a mapping reference identifier that matches the field reference identifier in the global reference mapping table indicates that the field reference identifier was previously used for field optimization.

[0191] The first business transaction can refer to the business transaction that optimizes the field data at the field optimization position from the first field data to the field data determined by the field reference identifier. It should be understood that the field data of the first business transaction is the same as the mapped field data in the global mapping list. The process of determining the first business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position can refer to the relevant description of determining the business transaction corresponding to the transaction to be processed based on the field reference identifier at the field optimization position above, which will not be elaborated here.

[0192] Optionally, when no mapping reference identifier that matches the field reference identifier is found, the transaction to be processed is determined as the second business transaction; the field data of the second business transaction is different from the mapped field data in the global mapping list; the second business transaction is determined as the business transaction.

[0193] Among them, the second business transaction can be the business transaction directly determined by the transaction to be processed. It should be understood that the field data of the second business transaction is different from the mapped field data in the global mapping list.

[0194] For example, please refer to Figure 6 , Figure 6It is a schematic flowchart of a business transaction determination provided by an embodiment of the present application. When a transaction to be processed is obtained, field data S2 with a field data volume greater than the field data volume threshold is determined from the transaction to be processed, and the field position where the field data S2 is located is determined as the field optimization position (step S601). When the reference identifier B1 of the field data S2 is obtained, the global reference mapping table is obtained, and the reference identifier B1 is searched for in the global reference mapping table (step S602), and it is determined whether the reference identifier B1 is found in the global reference mapping table (step S603). When the reference identifier B1 is found in the global reference mapping table, the field data at the field optimization position is optimized from the field data S2 to the field reference identifier (step S604), and based on the field reference identifier at the field optimization position, the business transaction is determined (step S605), that is, the transaction to be processed with the field data at the field optimization position replaced by the field reference identifier is determined as the business transaction. When the reference identifier B1 is not found in the global reference mapping table, the transaction to be processed is determined as the business transaction (step S606).

[0195] S104. Update the global reference mapping table based on the first field data and the field reference identifier in the business transaction to obtain an updated global reference mapping table.

[0196] Among them, it can be understood that if the global reference mapping table does not include a mapping reference identifier that matches the field reference identifier during the process, a list column for recording the field reference identifier can be newly added to add the first field data and the field reference identifier in the business transaction to the global reference mapping table and determine its corresponding reference count (such as determining it as 0). If the global reference mapping table includes a mapping reference identifier that matches the field reference identifier during the process, the record can be updated based on the existing list column for recording the reference record of the field reference identifier.

[0197] Optionally, the global reference mapping table includes a list column, and a list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier; then, updating the global reference mapping table based on the first field data and the field reference identifier in the business transaction to obtain an updated global reference mapping table may include the following steps: finding a mapping reference identifier that matches the field reference identifier in the global reference mapping table; when a mapping reference identifier that matches the field reference identifier is not found, determining the field reference identifier as the first mapping reference identifier, determining the first field data as the first mapping field data, and determining the reference count of the first mapping reference identifier based on the initial reference count; constructing a first list column based on the first mapping reference identifier, the first mapping field data, and the reference count of the first mapping reference identifier, and determining the global reference mapping table including the first list column as the updated global reference mapping table.

[0198] Among them, if no mapping reference identifier matching the field reference identifier is found in the global reference mapping table, it means that when the to-be-processed transaction is obtained, no transaction containing the same field data as the field data corresponding to the field reference identifier is stored on the blockchain node. Therefore, a new list column needs to be created to record the reference record corresponding to the field reference identifier.

[0199] The reference count of the mapping reference identifier can be used to indicate the number of times the mapping reference identifier is used to optimize the field data in the on-chain transaction. It should be understood that before a transaction optimized by the mapping reference identifier is on the chain, the number of times the mapping reference identifier optimizes the unchained transaction is not counted in the reference count of the mapping reference identifier.

[0200] Among them, the first mapping reference identifier is the mapping reference identifier determined based on the field reference identifier. The first mapped field data can be the mapped field data determined based on the first field data.

[0201] Among them, the initial reference count can be a preset value for initializing the reference count of the mapping reference identifier. For example, the value of the initial reference count can be 0. Based on this, when the first mapping reference identifier optimizes the field data for the first time and the transaction used for optimization by the first mapping reference identifier is not on the chain, the reference count of the first mapping reference identifier can be 0.

[0202] Among them, the first list column can be a newly created list column for recording the reference record of the field reference identifier. In other words, the first list column can be used to record the field reference identifier (i.e., the first mapping reference identifier), the field data corresponding to the field reference identifier (i.e., the first mapped field data), and the reference count corresponding to the field reference identifier (i.e., the reference count of the first mapping reference identifier). Thus, the updated global reference mapping table can be determined based on the global reference mapping table after writing to the first list column.

[0203] Optionally, the global reference mapping table includes a list column, where each list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier. Then, based on the first field data and the field reference identifier in the business transaction, the global reference mapping table is updated to obtain an updated global reference mapping table, which may include the following steps: finding a mapping reference identifier that matches the field reference identifier in the global reference mapping table; when a mapping reference identifier that matches the field reference identifier is found, determining the mapping reference identifier that matches the field reference identifier as the second mapping reference identifier, and determining the list column corresponding to the second mapping reference identifier as the second list column; updating the second list column based on the second mapping reference identifier to obtain an updated global reference mapping table.

[0204] Among them, it means that when the to-be-processed transaction is obtained, there is already a transaction stored on the blockchain node that contains the same field data as the field data corresponding to the field reference identifier. Therefore, there is no need to newly create a list column to record the reference record corresponding to the field reference identifier, but instead directly update the record based on the existing list column that records the reference record corresponding to the field reference identifier.

[0205] Among them, the second mapping reference identifier is the mapping reference identifier found in the global reference mapping table based on the field reference identifier. The second mapping field data may be the mapping field data corresponding to the second mapping reference identifier in the global reference mapping table.

[0206] Among them, the second list column may be the list column found in the global reference mapping table that records the reference record corresponding to the field reference identifier.

[0207] It can be understood that updating the second list column based on the second mapping reference identifier to obtain an updated global reference mapping table may be to overwrite the mapping reference identifier in the second list column based on the second mapping reference identifier. This is equivalent to adding a modification record for the second list column, but the content itself remains unchanged because the second mapping reference identifier is the same as the mapping reference identifier in the second list column. Optionally, if the global reference mapping table records the most recent update time, the most recent update time of the global reference mapping table may be updated when overwriting the mapping reference identifier in the second list column based on the second mapping reference identifier. Similarly, when creating the first list column in the global reference mapping list, the most recent update time of the global reference mapping table may also be updated.

[0208] Optionally, in the global reference mapping table, the transaction hash data of the transaction optimized by the mapping reference identifier may also be recorded. Optionally, in the global reference mapping table, the field optimization position of the mapping reference identifier in the transaction optimized thereby (i.e., the field position used for optimization in the transaction) may also be recorded. Based on this, the transaction optimized by the reference identifier and the field data of the field in the transaction used for optimization can be directly determined by querying the global reference mapping table.

[0209] For example, please refer to Figure 7 , Figure 7 which is a schematic diagram of the effect of a global reference mapping table provided by an embodiment of the present application. As Figure 7 shown, in the global reference mapping table 701a, it may include a list column corresponding to the reference identifier B1, a list column corresponding to the reference identifier B2, a list column corresponding to the reference identifier B3, and so on. In each list column, in addition to the reference identifier, transaction field data, and reference count that may be recorded, the transaction optimized by the reference identifier and the field position used for optimization in the transaction may also be recorded. For example, in the list column where the reference identifier B1 is located, the transaction 1 optimized by the reference identifier B1 and the optimized position W1, and the transaction 2 optimized by the reference identifier B1 and the optimized position W2 may be recorded. In other words, the reference identifier B1 is used to optimize the field data (i.e., field data S4) at the position W1 in the transaction 1, and the field data (i.e., field data S4) at the position W2 in the transaction 2, and the reference count of the reference identifier B1 is C1. Similarly, in the list column where the reference identifier B2 is located, the transaction 3 optimized by the reference identifier B2 and the optimized position W3 may be recorded. In other words, the reference identifier B2 is used to optimize the field data (i.e., field data S5) at the position W3 in the transaction 3, and the reference count of the reference identifier B2 is C2. Similarly, in the list column where the reference identifier B3 is located, the transaction 4 optimized by the reference identifier B3 and the optimized position W4, and the transaction 5 optimized by the reference identifier B3 and the optimized position W5 may be recorded. In other words, the reference identifier B3 is used to optimize the field data (i.e., field data S6) at the position W4 in the transaction 4, and the field data (i.e., field data S6) at the position W5 in the transaction 5, and the reference count of the reference identifier B3 is C3.

[0210] Further, a blockchain node can obtain an optimization information query request for target field data of a business object whose field data volume on the blockchain is greater than a field data volume threshold; the optimization information query request carries a target reference identifier of the target field data to be queried; query a mapping reference identifier that matches the target reference identifier carried in the optimization information query request in the global reference mapping table, and determine the request response information corresponding to the optimization information query request based on the transaction and the field optimization position corresponding to the found mapping reference identifier. It should be understood that the optimization information query request can be a request for querying the optimization record of the target field data, and the target field data can be any mapped field data in the global reference mapping table. Thus, the optimization record of the reference identifier used to optimize the field data can be queried through the global reference mapping table. Here, the optimization record can be understood as the record of the transaction optimized by the reference identifier, the record of the field position used for optimization in the transaction, etc. In addition, since the global reference mapping table stores the optimization record of the reference identifier, all transactions optimized by the reference identifier can be queried from the global reference mapping table through the reference identifier, that is, the transaction data of transactions containing the same reference identifier can be batch queried, thereby improving the query efficiency of transaction queries. And, by batch querying the transaction data of transactions containing the same reference identifier, the whole process of transactions for the same field data can be quickly understood, which helps to improve the efficiency of transaction traceability for field data.

[0211] S105. Package the business transaction into the second block. When the second block is chained to the blockchain, update the field reference count corresponding to the field reference identifier in the updated global reference mapping table; the field reference count is used to indicate the number of times of optimizing the first field data on the blockchain.

[0212] Among them, the second block can refer to the block to which the business transaction is packaged. It should be understood that the transaction packaging time of the second block is later than the transaction packaging time of the above-mentioned first block. Chaining the second block to the blockchain can be used to indicate writing the second block into the blockchain. Further, when writing the second block into the blockchain, the second block can be determined as the first block, that is, the second block is used as the chained block.

[0213] Among them, the field reference count can be the reference count of the field reference identifier. Updating the field reference count corresponding to the field reference identifier in the updated global reference mapping table can include: in the business transactions of the transaction list corresponding to the second block, counting the reference count of the field reference identifier, determining the counted reference count as the updated reference count, and increasing the field reference count corresponding to the field reference identifier in the updated global reference mapping table by the updated reference count to obtain the updated field reference count. Among them, the updated reference count can be the reference count of the field reference identifier in the second block, and the value of the updated reference count can be greater than or equal to 1. For example, the field reference count of the field reference identifier in the updated global reference mapping table is 1, and the number of times the field reference identifier is referenced in the transaction list corresponding to the second block is 2 (for example, it is referenced once in transaction 1 in the transaction list and once in transaction 2), then the updated field reference count is 3.

[0214] Specifically, updating the field reference count corresponding to the field reference identifier in the updated global reference mapping table includes: in the updated global reference mapping table, searching for the mapped reference identifier that matches the field reference identifier, and determining the reference count corresponding to the found mapped reference identifier as the first field reference count corresponding to the field reference identifier; performing an update process on the first field reference count corresponding to the field reference identifier to obtain the second field reference count corresponding to the field reference identifier; the second field reference count is greater than the first field reference count.

[0215] Among them, the first field reference count can be the reference count of the field reference identifier before the second block is chained, and the second field reference count can be the updated reference count of the field reference identifier after the second block is chained. Among them, performing an update process on the first field reference count corresponding to the field reference identifier to obtain the second field reference count corresponding to the field reference identifier can refer to the above relevant description, that is, in the business transactions of the transaction list corresponding to the second block, counting the reference count of the field reference identifier, determining the counted reference count as the updated reference count, and increasing the first field reference count by the updated reference count to obtain the second field reference count. It should be understood that the second field reference count is greater than the first field reference count.

[0216] It should be understood that the reference count can be the number of times the field data is optimized through the reference identifier in the chained transactions. Before the second block is chained, the number of times the field data in the transactions included in the second block is optimized to the field reference identifier is not included in the counting of the reference count.

[0217] It can be understood that in the embodiments of the present application, cold backup can also be performed on blocks with a relatively long time for uploading to the chain, that is, blocks within a certain block height range can be migrated to other devices. After the migration, the reference count of the reference identifier in the global reference mapping table for the optimized transactions can be reduced.

[0218] Specifically, the global reference mapping table is used to record the reference count of the mapped reference identifier; then, the embodiments of the present application may further include the following steps: using the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global updated reference mapping table; obtaining a block data migration request for migrating the block data on the blockchain; the block data migration request carries the range of block heights to be migrated; the range of block heights to be migrated is determined based on the first block height corresponding to the first migration block to the second block height corresponding to the second migration block; the blocks within the range of block heights to be migrated include target blocks; the target block is any block from the first migration block to the second migration block, and the transaction list corresponding to the target block includes target transactions; if a reference identifier is found in the target transaction, the found reference identifier is determined as the first reference identifier; when migrating the target transaction to the backup device indicated by the blockchain migration request, determine the reference count of the first reference identifier in the global updated reference mapping table, and perform a reduction process on the reference count of the first reference identifier.

[0219] Among them, the global updated reference mapping table may refer to the global reference mapping table after updating the field reference count in the updated global reference mapping table.

[0220] The block data migration request may be a request for instructing to migrate the block data in the blockchain node to the backup device. The backup device may be a device for storing the migrated block data. Among them, the range of block heights to be migrated may be the range corresponding to the block heights of the block data to be migrated. The range of block heights to be migrated is determined based on the first block height corresponding to the first migration block to the second block height corresponding to the second migration block. Among them, the first migration block may be the first block in the range of block heights to be migrated, and the second migration block may be the last block in the range of block heights to be migrated. The first block height is the block height of the first migration block, that is, the starting block height of the range of block heights to be migrated; the second block height is the block height of the second migration block, that is, the ending block height of the range of block heights to be migrated. For example, if the range of block heights to be migrated is 50 - 100, then the first migration block is the block with a block height of 50, that is, the first block height is 50, and the second migration block is the block with a block height of 100, that is, the second block height is 100. Furthermore, the block data migration request is used to instruct to migrate the block data of the blocks with block heights of 50 - 100 to the backup device.

[0221] The target block can be any block within the block height range of the blocks to be migrated, that is, any block from the first migration block to the second migration block. The target transaction refers to any transaction in the transaction list corresponding to the target block.

[0222] Among them, the first reference identifier can be the reference identifier in the target transaction. Among them, by searching for the reference identifier in the target transaction, the field data at each field position in the target transaction can be determined. When the field data at the field position is found to be the reference identifier, it can be determined that the reference identifier is found in the target transaction. It can be understood that the reference identifier can include a string used to indicate that the data is a reference identifier. Thus, when obtaining the field data in the transaction, based on this string, it can be quickly identified whether the field data is a reference identifier.

[0223] Among them, when migrating the target transaction to the backup device, the reference times corresponding to the first reference identifier can be reduced. The number of reference times reduced by this reduction process is the number of times the first reference identifier appears in the target transaction. It should be understood that when performing migration processing on the block data, the transaction data of each transaction in the block can be migrated in sequence, so that the transaction data of each transaction in each block within the block height range to be migrated can be migrated in sequence. When migrating each transaction, the reference times of the reference identifier in the transaction are reduced. For example, if the block height range to be migrated is 50 - 100, the transaction data of the first transaction in the block with a block height of 50 can be migrated to the backup device first, and the reference times of the reference identifier in this transaction are reduced. Then, the transaction data of the second transaction in the block with a block height of 50 can be migrated to the backup device, and the reference times of the reference identifier in this transaction are reduced. And so on, until all the block data of the block with a block height of 50 are migrated to the backup device. Then, the transaction data of the first transaction in the block with a block height of 51 can be migrated to the backup device, and the reference times of the reference identifier in this transaction are reduced. The transaction data of the second transaction in the block with a block height of 51 can be migrated to the backup device, and the reference times of the reference identifier in this transaction are reduced. And so on, until the block data of the block with a block height of 51 are migrated to the backup device. Similarly, the block data of all the blocks within the block height range to be migrated can be migrated to the backup device.

[0224] Optionally, when migrating the target transaction to the backup device, it can be migrated in units of blocks, that is, migrating the target block to the backup device, and then the reference identifier in all transactions in the target block and the number of occurrences of the reference identifier in the target block can be counted. Then, when migrating the target block to the backup device, the reference count of the reference identifier in the target block is reduced. It should be understood that when migrating each block within the height range of the block to be migrated, the reference count of the reference identifier is reduced once until all blocks within the height range of the block to be migrated are migrated. For example, if the height range of the block to be migrated is 50-100, the block data of the block with a height of 50 can be migrated to the backup device first, and the number of occurrences of the reference identifier in the block with a height of 50 is counted. Based on the number of occurrences of the reference identifier in the block with a height of 50, the reference count of the reference identifier is updated. Similarly, the block data of the block with a height of 51 is migrated to the backup device, and the number of occurrences of the reference identifier in the block with a height of 51 is counted. Based on the number of occurrences of the reference identifier in the block with a height of 51, the reference count of the reference identifier is updated, and so on. The block data of all blocks within the height range of the block to be migrated can be migrated to the backup device.

[0225] Optionally, the reference count obtained after reducing the reference count of the first reference identifier is determined as the reference update count. When the reference update count reaches the reference count threshold, the data in the list column where the mapped reference identifier matching the first reference identifier in the global update reference mapping table is cleared.

[0226] Among them, the reference update count can be the reference count obtained after reducing the reference count of the first reference identifier. The reference count threshold can be the threshold that the reference update count needs to reach when clearing the data in the list column where the reference identifier is located. For example, the reference count threshold can be 0. It should be understood that when the reference update count reaches the reference count threshold (such as the reference update count is 0), it means that the reference count of this reference identifier in the on-chain transactions on the current blockchain is 0. Therefore, the global reference mapping table no longer needs to store relevant data (such as reference identifier, field data corresponding to the reference identifier, reference count, etc.). Thus, the data in the list column where the mapped reference identifier matching the first reference identifier is located can be cleared.

[0227] It can be understood that when migrating data (such as the transaction data of the target transaction or the block data of the block where the target transaction is located) to the backup device, the data can be copied to the backup device first, and then the data in the blockchain node can be deleted, which can avoid data loss and improve the security and reliability of data migration.

[0228] It can be understood that when the target transaction is migrated to the backup device, the field data optimized by the reference identifier can also be restored to the original field data, so that the transaction migrated to the backup device is the original transaction text.

[0229] Specifically, migrating the target transaction to the backup device indicated by the blockchain migration request may include the following steps: searching for a mapped reference identifier that matches the first reference identifier in the global update reference mapping table, and determining the mapped field data corresponding to the found mapped reference identifier as the first restored field data; in the target transaction, updating the field data at the field position where the first reference identifier is located from the first reference identifier to the first restored field data, and determining the first restored transaction corresponding to the target transaction based on the first restored field data at the field position where the first reference identifier is located; sending the first restored transaction to the backup device indicated by the block data migration request.

[0230] Among them, the first restored field data may be the field data used to restore the target transaction, and the first restored field data is the mapped field data corresponding to the mapped reference identifier that matches the first reference identifier. Further, the field data at the field position where the first reference identifier is located in the target transaction can be restored from the first reference identifier to the first restored field data, so as to obtain the transaction obtained by restoring the target transaction.

[0231] The first restored transaction may be a transaction in which the reference identifier in the target transaction is restored to the original field data. Further, the first restored transaction can be sent to the backup device, so that the data backed up in the backup device is the original text data of the transaction.

[0232] Optionally, when migrating the target transaction to the backup device, it is also possible not to perform restoration, but to migrate the target transaction and the mapped field data corresponding to the first reference identifier in the global update reference mapping table to the backup device, and create a backup reference mapping table for the backed-up block data in the backup device. The backup reference mapping table can be used to record the reference identifier in the backed-up transaction, the field data corresponding to the reference identifier, and the number of occurrences of the reference identifier in the backed-up transaction. Thus, the waste of storage space caused by large field data in the transaction can also be reduced in the backup device.

[0233] Please refer to Figure 8 , Figure 8 which is a schematic diagram of a data migration process provided by an embodiment of the present application. As Figure 8As shown, in blockchain node 80a, a blockchain 801a and a global reference mapping table 802a can be stored. In blockchain 801a, it can include blocks such as block P1, block P2, block P3, block P4,......, block PN, etc. When a block data migration request is obtained, if the block data migration request is used to indicate migrating block P1 to block P100 (the block height of PN is higher than 100 of block P100), then block P1 to block P100 can be migrated to a backup device. Here, the migration of block P1 is taken as an example for elaboration. In the transaction list of block P1, it can include transactions such as transaction TX1, transaction TX2,......, transaction TX3, etc. In transaction TX1, it can include field data at positions such as field position W1, field position W2, field position W3, etc., where the field data at field position W2 is a reference identifier Ba. And in the global reference mapping table 802a, it can include the reference identifier Ba, and the reference count of the reference identifier Ba is the reference count Ca.

[0234] When migrating block P1 where transaction TX1 is located to a backup device, block P1 may no longer be included in the blockchain, as Figure 8 shown in blockchain 803a in. And the reference count Cb of the reference identifier Ba in the global reference mapping table can be updated to obtain an updated global reference mapping table 804a. As Figure 8 shown in the global reference mapping table 804a in, the reference count of the reference identifier Ba is updated to the reference count Cb.

[0235] For example, for a blockchain node, when the node memory used for data storage reaches a certain storage threshold, the block data within a certain height range in the blockchain (e.g., block height from 0 to 1000) (e.g., 1000 blocks, each block's every transaction and the field data in each transaction, etc.) can be moved to another machine in the node memory. Then, the reference count of the large field data (i.e., the field data with a field data volume greater than the field data volume threshold) moved to another machine can be decremented. When the reference count of a certain large field data decreases to a certain threshold (e.g., 0), this large field data with a reference count reduced to 0 can be deleted in the global reference mapping table until all the large field data before height 1000 are deleted, thus achieving the migration of all the block data (e.g., 1000 blocks, each block's every transaction and the field data in each transaction, etc.) before height 1000 to another machine. By analogy, for the method of sharding or taking snapshots of the block data within a certain height range (e.g., block height from 0 to 1000) (e.g., 1000 blocks, each block's every transaction and the field data in each transaction, etc.), it is the same data migration processing method. It should be understood that after the process of data migration for the block data (e.g., 1000 blocks, each block's every transaction and the field data in each transaction, etc.) before height 1000, if some large field data are still referenced by the reference identifiers at the corresponding field positions in the transactions after height 1000, these large field data with reduced reference counts can continue to be retained in the global reference mapping table.

[0236] Among them, it should be understood that when viewing a transaction, the values of hashes such as MD5 in the transaction (i.e., reference identifiers) can be specified to reference the original data in the global reference mapping table. However, when the transaction is migrated to a backup device, the reference identifiers in the transaction migrated to the backup device no longer reference the field data in the blockchain node. Therefore, a reference count needs to be maintained in the global reference mapping table. So, after the transaction is moved away, cold backup processing can be performed on the data in the global reference mapping table, which involves a reduction in the reference count. Until the reference count is reduced to 0, this means that at this time, the data after cold backup processing no longer provides the external data query function.

[0237] Among them, it should be understood that an additional reference count (i.e., the number of references) needs to be maintained in the global reference mapping table, so that it can be used during subsequent processes such as sharding or taking snapshots of the blockchain database, or cold-backing up the transactions in these blocks at a specific height on the blockchain. This means that this process can perform a decrement operation based on the reference count (e.g., decrement by one), and when it reaches 0, the cold backup of the entire data is achieved. It should be noted that both the above-mentioned transaction list and the global reference mapping table for storing the mapping relationship between the original text and the index are in the on-chain database in the memory of the same node. The global reference mapping table needs to maintain a reference count, which is used to represent the number of times the same large-field data has been optimized. When this large-field data is no longer optimized, it needs to be recycled.

[0238] In the embodiment of the present application, it is possible to determine, from the to-be-processed transaction, field data (i.e., the first field data) whose field data volume is greater than a threshold (i.e., the field data volume threshold), and then update the field data at the field position where the first field data is located to the reference identifier of the first field data (i.e., the field reference identifier). Moreover, the data volume of the field reference identifier is less than the field data volume of the first field data, thereby reducing the data volume of the to-be-processed transaction. Additionally, the first field data in the to-be-processed transaction can be stored in the global reference mapping table. By recording the number of references in the global reference mapping table, the number of times the same field data is used for optimizing field data on the blockchain can be recorded, and the same field data only needs to be stored once in the global reference mapping table, without the need to repeatedly store field data with a large data volume, avoiding waste of storage space of the blockchain node caused by repeatedly storing the same field data. Based on this, adopting the embodiment of the present application helps to reduce the waste of storage space of the blockchain node by transaction data and optimize the storage capacity of the blockchain node.

[0239] Further, please refer to Figure 9 , Figure 9 is a schematic flowchart of a data storage method based on blockchain provided by the embodiment of the present application. This method is executed by a blockchain node; a global reference mapping table is stored in the memory of the blockchain node; the global reference mapping table is used to optimize the field data of the on-chain transactions on the blockchain; the on-chain transaction is a transaction in the first block on the blockchain. This method can at least include the following steps S201 - step S210.

[0240] S201. Receive a to-be-processed transaction submitted by a service terminal for terminal services, and determine the field data volume of the field data of the to-be-processed transaction.

[0241] S202. If field data with a field data volume greater than the field data volume threshold is found in the field data of the transaction to be processed, when the found field data is determined as the first field data, the field position of the first field data in the transaction to be processed is determined as the field optimization position corresponding to the first field data.

[0242] S203. Obtain the field reference identifier of the first field data. When the data volume of the field reference identifier is less than the field data volume of the first field data, the field data at the field optimization position is optimized from the first field data to the field reference identifier, and based on the field reference identifier at the field optimization position, the business transaction corresponding to the transaction to be processed is determined.

[0243] S204. Based on the first field data and the field reference identifier in the business transaction, perform an update process on the global reference mapping table to obtain an updated global reference mapping table.

[0244] S205. Package the business transaction into the second block. When the second block is chained to the blockchain, update the field reference count corresponding to the field reference identifier in the updated global reference mapping table; the field reference count is used to indicate the number of times the first field data is optimized on the blockchain.

[0245] Among them, the processing procedures of steps S201 - S205 can refer to the relevant descriptions of the above steps S101 - S105, and will not be elaborated here.

[0246] S206. Use the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global updated reference mapping table.

[0247] Among them, the global updated reference mapping table is obtained after updating the field reference count corresponding to the field reference identifier in the updated global reference mapping table.

[0248] S207. Obtain the transaction query request of the query business terminal for the business transaction to be queried; the transaction query request carries the transaction hash data of the business transaction to be queried.

[0249] Among them, the query business terminal can be the business terminal that sends the transaction query request. This query business terminal and the above first business terminal can be the same business terminal or different business terminals, which is not limited here. For example, this query business terminal can be any terminal device in the above Figure 1 terminal device cluster.

[0250] The transaction query request may be a request for querying the original transaction data of a transaction. It should be understood that the transaction query request may carry the transaction hash data of the business transaction to be queried. The business transaction to be queried may be the business transaction to be queried. The business transaction to be queried may be the hash data obtained by performing a hash calculation on the business transaction to be queried. It should be understood that if the business transaction to be queried is a transaction obtained by optimizing field data through a reference identifier, the transaction hash data of the business transaction to be queried is the hash data of the transaction obtained by optimizing field data through a reference identifier; if the business transaction to be queried is a transaction that has not optimized field data through a reference identifier (that is, the amount of field data in the business transaction to be queried does not exceed the field data amount threshold), the transaction hash data of the business transaction to be queried is the hash data of the original transaction of the business transaction to be queried.

[0251] S208. Search for the business transaction to be queried from the on-chain transactions on the blockchain based on the transaction hash data. When the business transaction to be queried is found, search for the reference identifier from the business transaction to be queried.

[0252] It can be understood that when searching for the business transaction to be queried from the on-chain transactions on the blockchain, the business transaction to be queried can be sequentially queried from the blocks according to the order of decreasing block height.

[0253] Specifically, the first block on the blockchain includes a first target block; the transaction list corresponding to the first target block is the first transaction list; the first target block is the first block with the maximum block height in the first block on the blockchain; then, searching for the business transaction to be queried from the on-chain transactions on the blockchain based on the transaction hash data may include the following steps: searching for the business transaction to be queried in the first transaction list based on the transaction hash data; when the business transaction to be queried is found in the first transaction list, it is determined that the business transaction to be queried is found from the on-chain transactions on the blockchain.

[0254] Among them, the first target block is the first block with the maximum block height on the blockchain. The first block is the block that has been on the chain on the blockchain. The first transaction list is the transaction list corresponding to the first target block. It should be understood that the transaction list corresponding to a block may be the transaction list corresponding to the transactions packaged in the block. In the transaction list, the transaction hash data of each transaction can be recorded, and thus the search can be performed through the transaction hash data.

[0255] It should be understood that finding the business transaction to be queried in the first transaction list based on the transaction hash data, that is, finding the transaction hash data in the first transaction list that matches the transaction hash data of the business transaction to be queried. If the transaction hash data that matches the transaction hash data of the business transaction to be queried is found, it is determined that the business transaction to be queried is found in the first transaction list. Alternatively, when finding the business transaction to be queried in the first transaction list based on the transaction hash data, the Merkle tree of the first target block can be obtained based on the Merkle root in the block header of the first target block, and then it can be queried whether the first target block contains the business transaction to be queried according to the transaction hash data of the business transaction to be queried and the Merkle path of the business transaction to be queried.

[0256] Further, when the business transaction to be queried is not found in the first transaction list, determine the second target block from the first block on the blockchain; the transaction list corresponding to the second target block is the second transaction list; the second target block is the previous first block of the first target block on the blockchain; find the business transaction to be queried in the second transaction list based on the transaction hash data; when the business transaction to be queried is found in the second transaction list, it is determined that the business transaction to be queried is found from the on-chain transactions on the blockchain.

[0257] Among them, the second target block is the previous first block of the first target block on the blockchain. For example, if the block height of the first target block is 200, then the second target block is the first block with a block height of 199. It should be understood that the second transaction list is the transaction list corresponding to the second target block.

[0258] It should be understood that the process of finding the business transaction to be queried in the second transaction list based on the transaction hash data can refer to the relevant description of finding the business transaction to be queried in the first transaction list above, and will not be elaborated here.

[0259] Further, if the business transaction to be queried is still not found in the second transaction list, the transaction list of the previous first block of the second target block can also be queried, and so on, until the business transaction to be queried is found on the blockchain.

[0260] S209. If a reference identifier is found in the business transaction to be queried, determine the found reference identifier as the second reference identifier, find the mapped reference identifier that matches the second reference identifier in the global update reference mapping table, and determine the mapped field data corresponding to the found mapped reference identifier as the second restored field data.

[0261] Among them, the second restored field data can be the field data used to restore the business transaction to be queried. The second reference identifier can be the reference identifier found in the business transaction to be queried. The second restored field data can be the mapped field data corresponding to the mapped reference identifier that matches the second reference identifier in the global update reference mapping table.

[0262] Optionally, if no reference identifier is found in the business transaction to be queried, the obtained business transaction to be queried is directly returned to the query service terminal.

[0263] S210. In the business transaction to be queried, update the field data at the field position where the second reference identifier is located from the second reference identifier to the second restored field data. Based on the second restored field data at the field position where the second reference identifier is located, determine the second restored transaction corresponding to the business transaction to be queried, and send the second restored transaction to the query service terminal.

[0264] Among them, the second restored transaction can be a transaction that restores the reference identifier in the business transaction to be queried to the original field data, that is, restores the second reference identifier in the business transaction to be queried to the second restored field data. Further, the second restored transaction can be sent to the query service terminal to complete the query of the business transaction to be queried.

[0265] For example, here in combination with the drawings, the data query process is described. Please refer to Figure 10 , Figure 10 which is a schematic flowchart of a data query process provided by an embodiment of the present application. As Figure 10 shown, receive a transaction query request for transaction TX1 sent by the service terminal, and query the transaction list of the block with the largest block height (step S91); further, determine whether there is a transaction TX1 in the transaction list (step S92). If not, query the transaction list of the next block (step S921). When determining whether there is a transaction TX1 in the transaction list of the blocks on the blockchain, determine whether the field data at each field position of transaction TX1 is a reference identifier (step S93). When there is a field position in transaction TX1 where the field data is a reference identifier, search for the mapped reference identifier that matches the reference identifier in transaction TX1 in the global reference mapping table, and use the mapped field data corresponding to the found mapped reference identifier as the restored field data (step S94). In transaction TX1, replace the reference identifier with the restored field data, and return the obtained transaction after replacement to the service terminal (step S95). When there is no field position in transaction TX1 where the field data is a reference identifier, return transaction TX1 to the service terminal (step S96).

[0266] Please refer to Figure 11 , Figure 11It is a schematic structural diagram of a blockchain-based data storage device provided by an embodiment of the present application. As Figure 11 shown, the blockchain-based data storage device 1 may be a computer program (including program code) running on a blockchain node (for example, the above-mentioned blockchain node 11c). For example, the blockchain-based data storage device 1 is an application software; a global reference mapping table is stored in the node memory of the blockchain node; the global reference mapping table is used to optimize the field data of the on-chain transactions on the blockchain; the on-chain transaction is a transaction in the first block on the blockchain; the device includes: It can be understood that the blockchain-based data storage device 1 can be used to execute the corresponding steps in the data processing method provided by the embodiment of the present application. As Figure 11 shown, the blockchain-based data storage device 1 may include: a data volume determination module 11, an optimized data determination module 12, a service transaction determination module 13, a mapping table update module 14, and a reference count update module 15;

[0267] The data volume determination module 11 is configured to receive a to-be-processed transaction submitted by a service terminal for a terminal service, and determine the field data volume of the field data of the to-be-processed transaction;

[0268] The optimized data determination module 12 is configured to, if field data with a field data volume greater than a field data volume threshold is found in the field data of the to-be-processed transaction, when determining the found field data as the first field data, determine the field position of the first field data in the to-be-processed transaction as the field optimization position corresponding to the first field data;

[0269] The service transaction determination module 13 is configured to obtain the field reference identifier of the first field data, and when the data volume of the field reference identifier is less than the field data volume of the first field data, optimize the field data at the field optimization position from the first field data to the field reference identifier, and determine the service transaction corresponding to the to-be-processed transaction based on the field reference identifier at the field optimization position;

[0270] The mapping table update module 14 is configured to perform an update process on the global reference mapping table based on the first field data and the field reference identifier in the service transaction to obtain an updated global reference mapping table;

[0271] The reference count update module 15 is configured to pack the service transaction into a second block, and when the second block is uploaded to the blockchain, update the field reference count corresponding to the field reference identifier in the updated global reference mapping table; the field reference count is used to indicate the number of times of optimizing the first field data on the blockchain.

[0272] Among them, the global reference mapping table includes a list column, and one list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier;

[0273] Among them, the mapping table update module 14 includes: an identifier search unit 141, a data determination unit 142, and a data writing unit 143;

[0274] The identifier search unit 141 is used to find a mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0275] The data determination unit 142 is used to, when no mapping reference identifier that matches the field reference identifier is found, determine the field reference identifier as the first mapping reference identifier, determine the first field data as the first mapping field data, and determine the reference count of the first mapping reference identifier based on the initial reference count;

[0276] The data writing unit 143 is used to construct a first list column based on the first mapping reference identifier, the first mapping field data, and the reference count of the first mapping reference identifier, and determine the global reference mapping table containing the first list column as the updated global reference mapping table.

[0277] Among them, the processing procedures of the identifier search unit 141, the data determination unit 142, and the data writing unit 143 can refer to the relevant descriptions of the above Figure 3 embodiment, and will not be elaborated here.

[0278] Among them, the global reference mapping table includes a list column, and one list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier;

[0279] Among them, the identifier search unit 141 is further used to find a mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0280] The data determination unit 142 is further used to, when a mapping reference identifier that matches the field reference identifier is found, determine the mapping reference identifier that matches the field reference identifier as the second mapping reference identifier, and determine the list column corresponding to the second mapping reference identifier as the second list column;

[0281] The data writing unit 143 is further used to update the second list column based on the second mapping reference identifier to obtain the updated global reference mapping table.

[0282] Among them, the global reference mapping table is used to record the reference count of the mapping reference identifier;

[0283] Among them, the blockchain-based data storage device 1 further includes: a data migration module 16;

[0284] Among them, the data migration module 16 is used for:

[0285] Take the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global updated reference mapping table;

[0286] Obtain a block data migration request for migrating block data on the blockchain; the block data migration request carries a range of block heights to be migrated; the range of block heights to be migrated is determined based on the first block height corresponding to the first migration block to the second block height corresponding to the second migration block; the blocks within the range of block heights to be migrated include target blocks; the target block is any block from the first migration block to the second migration block, and the transaction list corresponding to the target block includes target transactions;

[0287] If a reference identifier is found in the target transaction, determine the found reference identifier as the first reference identifier;

[0288] When migrating the target transaction to the backup device indicated by the blockchain migration request, determine the reference count of the first reference identifier in the global updated reference mapping table, and perform a reduction process on the reference count of the first reference identifier.

[0289] Among them, the data migration module 16 is further used for:

[0290] Determine the reference count obtained after performing the reduction process on the reference count of the first reference identifier as the reference update count;

[0291] When the reference update count reaches the reference count threshold, perform a clearing process on the data in the list column where the mapped reference identifier matching the first reference identifier is located in the global updated reference mapping table.

[0292] Among them, the data migration module 16 is specifically used for:

[0293] Search for the mapped reference identifier matching the first reference identifier in the global updated reference mapping table, and determine the mapped field data corresponding to the found mapped reference identifier as the first restored field data;

[0294] In the target transaction, update the field data at the field position where the first reference identifier is located from the first reference identifier to the first restored field data, and determine the first restored transaction corresponding to the target transaction based on the first restored field data at the field position where the first reference identifier is located;

[0295] Send the first restored transaction to the backup device indicated by the block data migration request.

[0296] Among them, the blockchain-based data storage device 1 further includes: an update table determination module 17, a query request acquisition module 18, an identification search module 19, a restored data determination module 20, and a data feedback module 21;

[0297] The update table determination module 17 is configured to use the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global update reference mapping table;

[0298] The query request acquisition module 18 is configured to obtain a transaction query request of a query service terminal for a to-be-query business transaction; the transaction query request carries transaction hash data of the to-be-query business transaction;

[0299] The identification search module 19 is configured to search for the to-be-query business transaction from the on-chain transactions on the blockchain based on the transaction hash data, and when the to-be-query business transaction is found, search for the reference identifier from the to-be-query business transaction;

[0300] The restored data determination module 20 is configured to, if a reference identifier is found in the to-be-query business transaction, determine the found reference identifier as the second reference identifier, search for a mapped reference identifier matching the second reference identifier in the global update reference mapping table, and determine the mapped field data corresponding to the found mapped reference identifier as the second restored field data;

[0301] The data feedback module 21 is configured to, in the to-be-query business transaction, update the field data at the field position where the second reference identifier is located from the second reference identifier to the second restored field data, determine the second restored transaction corresponding to the to-be-query business transaction based on the second restored field data at the field position where the second reference identifier is located, and send the second restored transaction back to the query service terminal.

[0302] Among them, the first block on the blockchain includes a first target block; the transaction list corresponding to the first target block is the first transaction list; the first target block is the first block with the largest block height among the first blocks on the blockchain;

[0303] Among them, the blockchain-based data storage device 1 further includes: a transaction query module 22;

[0304] The transaction query module 22 is specifically configured to:

[0305] Search for the to-be-query business transaction in the first transaction list based on the transaction hash data;

[0306] When the to-be-query business transaction is found in the first transaction list, it is determined that the to-be-query business transaction is found from the on-chain transactions on the blockchain.

[0307] Among them, the transaction query module 22 is further configured to:

[0308] When the business transaction to be queried is not found in the first transaction list, determine a second target block from the first block on the blockchain; the transaction list corresponding to the second target block is the second transaction list; the second target block is the previous first block of the first target block on the blockchain.

[0309] Search for the business transaction to be queried in the second transaction list based on the transaction hash data.

[0310] When the business transaction to be queried is found in the second transaction list, it is determined that the business transaction to be queried is found from the on-chain transactions on the blockchain.

[0311] Among them, based on the data storage device 1 of the blockchain, it further includes: a retained data determination module 23;

[0312] The retained data determination module 23 is specifically used for:

[0313] Determine the field data in the transaction to be processed whose field data volume is less than or equal to the field data volume threshold as the second field data, and determine the field position of the second field data in the transaction to be processed as the field retention position corresponding to the second field data.

[0314] Among them, the business transaction determination module 13 is further used for:

[0315] Maintain the field data at the field retention position as the second field data;

[0316] Based on the field reference identifier at the field optimization position and the second field data at the field retention position, determine the business transaction corresponding to the transaction to be processed.

[0317] Among them, the reference count update module 15 is further used for:

[0318] In the updated global reference mapping table, search for the mapped reference identifier that matches the field reference identifier, and determine the reference count corresponding to the found mapped reference identifier as the first field reference count corresponding to the field reference identifier;

[0319] Perform an update process on the first field reference count corresponding to the field reference identifier to obtain the second field reference count corresponding to the field reference identifier; the second field reference count is greater than the first field reference count.

[0320] Among them, the global reference mapping table is used to record the mapped reference identifier and the mapped field data corresponding to the mapped reference identifier;

[0321] Among them, the business transaction determination module 13 is further used for:

[0322] Obtain the global reference mapping table, and search for the mapping reference identifier that matches the field reference identifier in the global reference mapping table;

[0323] When the mapping reference identifier that matches the field reference identifier is found, optimize the field data at the field optimization position from the first field data to the field reference identifier;

[0324] Based on the field reference identifier at the field optimization position, determine the first business transaction corresponding to the transaction to be processed; the field data of the first business transaction is the same as the mapped field data in the global mapping list;

[0325] Determine the first business transaction as the business transaction.

[0326] Among them, the business transaction determination module 13 is further used for:

[0327] When the mapping reference identifier that matches the field reference identifier is not found, determine the transaction to be processed as the second business transaction; the field data of the second business transaction is different from the mapped field data in the global mapping list;

[0328] Determine the second business transaction as the business transaction.

[0329] In the embodiments of the present application, it is possible to determine, from the transaction to be processed, the field data (i.e., the first field data) whose field data volume is greater than the threshold (i.e., the field data volume threshold), and then update the field data at the field position where the first field data is located from the first field data to the reference identifier of the first field data (i.e., the field reference identifier), and the data volume of this field reference identifier is less than the number of fields of the first field data, thereby reducing the data volume of the transaction to be processed. Moreover, the first field data in the transaction to be processed can be stored in the global reference mapping table, and by recording the reference times in the global reference mapping table, the number of times the same field data is used to optimize the field data on the blockchain can be recorded, and the same field data only needs to be stored once in the global reference mapping table, without repeatedly storing the field data with a large field data volume, avoiding the waste of the storage space of the blockchain node caused by repeatedly storing the same field data. Based on this, adopting the embodiments of the present application helps to reduce the waste of the storage space of the blockchain node by transaction data and optimize the storage capacity of the blockchain node.

[0330] Please refer to Figure 12 , Figure 12 which is a schematic structural diagram of a computer device provided by the embodiments of the present application. As Figure 12As shown in the figure, the computer device 1000 may include: a processor 1001, a network interface 1004, and a memory 1005. In addition, the computer device 1000 may further include: a user interface 1003 and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display) and a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. Optionally, the memory 1005 may further be at least one storage device located far from the aforementioned processor 1001. As Figure 12 shown, the memory 1005, as a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.

[0331] In the computer device 1000 as Figure 12 shown, the network interface 1004 can provide network communication functions; while the user interface 1003 is mainly used to provide an input interface for users; and the processor 1001 can be used to call the device control application program stored in the memory 1005 to execute the description of the data processing method in any of the foregoing corresponding embodiments, which will not be elaborated here. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either.

[0332] In addition, it should be pointed out here that: The embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the aforementioned blockchain-based data storage device 1, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the data processing method in the foregoing embodiments, so it will not be elaborated here. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either. For the technical details not disclosed in the embodiment of the computer-readable storage medium involved in the present application, please refer to the description of the method embodiment of the present application.

[0333] The above computer-readable storage medium may be the data processing device provided in any of the foregoing embodiments or the internal storage unit of the above computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the internal storage unit and the external storage device of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store the data that has been output or is to be output.

[0334] In addition, it should be noted here that: The embodiments of the present application also provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in any of the foregoing corresponding embodiments. In addition, the description of the beneficial effects of using the same method will not be repeated. For the technical details not disclosed in the computer program product or the computer program embodiments involved in the present application, please refer to the description of the method embodiments of the present application.

[0335] In the embodiments of the present application, the terms "first", "second", etc. in the specification, claims and drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "including" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally further includes steps or modules not listed, or optionally further includes other step units inherent to these processes, methods, devices, products or equipment.

[0336] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.

[0337] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0338] The above-disclosed are only the preferred embodiments of this application, and of course, the scope of rights of this application cannot be limited thereby. Therefore, equivalent changes made according to the claims of this application still fall within the scope covered by this application.

Claims

1. A data storage method based on blockchain, characterized in that, the method is executed by a blockchain node; a global reference mapping table is stored in the node memory of the blockchain node; the global reference mapping table is used to optimize the field data of the on-chain transactions on the blockchain; the on-chain transaction is a transaction in the first block on the blockchain; the method includes: receiving a to-be-processed transaction submitted by a service terminal for terminal services, and determining the field data volume of the field data of the to-be-processed transaction; if field data with a field data volume greater than a field data volume threshold is found in the field data of the to-be-processed transaction, when the found field data is determined as the first field data, determining the field position of the first field data in the to-be-processed transaction as the field optimization position corresponding to the first field data; acquiring a field reference identifier of the first field data, when the data volume of the field reference identifier is less than the field data volume of the first field data, optimizing the field data at the field optimization position from the first field data to the field reference identifier, and determining the service transaction corresponding to the to-be-processed transaction based on the field reference identifier at the field optimization position; performing an update process on the global reference mapping table based on the first field data and the field reference identifier in the service transaction to obtain an updated global reference mapping table; packing the service transaction into a second block, and when the second block is uploaded to the blockchain, updating the field reference times corresponding to the field reference identifier in the updated global reference mapping table; the field reference times are used to indicate the number of times of optimizing the first field data on the blockchain.

2. The method according to claim 1, characterized in that, the global reference mapping table includes a list column, and one list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference times of the mapping reference identifier; the performing an update process on the global reference mapping table based on the first field data and the field reference identifier in the service transaction to obtain an updated global reference mapping table includes: finding a mapping reference identifier matching the field reference identifier in the global reference mapping table; when no mapping reference identifier matching the field reference identifier is found, determining the field reference identifier as the first mapping reference identifier, determining the first field data as the first mapping field data, and determining the reference times of the first mapping reference identifier based on the initial reference times; constructing a first list column based on the first mapping reference identifier, the first mapping field data, and the reference times of the first mapping reference identifier, and determining the global reference mapping table including the first list column as the updated global reference mapping table.

3. The method according to claim 1, characterized in that, The global reference mapping table includes a list column, where a list column records a mapping reference identifier, the mapping field data corresponding to the mapping reference identifier, and the reference count of the mapping reference identifier; Updating the global reference mapping table based on the first field data and the field reference identifier in the business transaction to obtain an updated global reference mapping table, including: Finding a mapping reference identifier in the global reference mapping table that matches the field reference identifier; When a mapping reference identifier that matches the field reference identifier is found, determining the mapping reference identifier that matches the field reference identifier as the second mapping reference identifier, and determining the list column corresponding to the second mapping reference identifier as the second list column; Updating the second list column based on the second mapping reference identifier to obtain an updated global reference mapping table.

4. The method according to claim 1, wherein, the global reference mapping table is used to record the reference count of the mapping reference identifier; the method further includes: Taking the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global updated reference mapping table; Obtaining a block data migration request for migrating the block data on the blockchain; the block data migration request carries a range of block heights to be migrated; the range of block heights to be migrated is determined based on the first block height corresponding to the first migration block to the second block height corresponding to the second migration block; the blocks within the range of block heights to be migrated include target blocks; the target block is any block from the first migration block to the second migration block, and the transaction list corresponding to the target block includes target transactions; If a reference identifier is found in the target transaction, determining the found reference identifier as the first reference identifier; When migrating the target transaction to the backup device indicated by the blockchain migration request, determining the reference count of the first reference identifier in the global updated reference mapping table and performing a reduction process on the reference count of the first reference identifier.

5. The method according to claim 4, wherein, the method further includes: Determining the reference count obtained after performing the reduction process on the reference count of the first reference identifier as the reference update count; When the reference update count reaches a reference count threshold, performing a clearing process on the data in the list column where the mapping reference identifier that matches the first reference identifier is located in the global updated reference mapping table.

6. The method according to claim 4, wherein, the migrating the target transaction to the backup device indicated by the blockchain migration request includes: Finding a mapping reference identifier in the global updated reference mapping table that matches the first reference identifier, and determining the mapping field data corresponding to the found mapping reference identifier as the first restored field data; In the target transaction, update the field data at the field position where the first reference identifier is located from the first reference identifier to the first restored field data, and determine a first restored transaction corresponding to the target transaction based on the first restored field data at the field position where the first reference identifier is located; Send the first restored transaction to a backup device indicated by the block data migration request.

7. The method according to claim 1, wherein, the method further includes: Use the updated global reference mapping table where the field reference count corresponding to the updated field reference identifier is located as the global updated reference mapping table; Obtain a transaction query request from a query service terminal for a to-be-query business transaction; the transaction query request carries transaction hash data of the to-be-query business transaction; Based on the transaction hash data, search for the to-be-query business transaction from the on-chain transactions on the blockchain. When the to-be-query business transaction is found, search for a reference identifier from the to-be-query business transaction; If a reference identifier is found in the to-be-query business transaction, determine the found reference identifier as a second reference identifier, search for a mapped reference identifier matching the second reference identifier in the global updated reference mapping table, and determine the mapped field data corresponding to the found mapped reference identifier as second restored field data; In the to-be-query business transaction, update the field data at the field position where the second reference identifier is located from the second reference identifier to the second restored field data, determine a second restored transaction corresponding to the to-be-query business transaction based on the second restored field data at the field position where the second reference identifier is located, and send the second restored transaction back to the query service terminal.

8. The method according to claim 7, wherein, A first target block is included in the first block on the blockchain; the transaction list corresponding to the first target block is a first transaction list; the first target block is the first block with the largest block height in the first block on the blockchain; The searching for the to-be-query business transaction from the on-chain transactions on the blockchain based on the transaction hash data includes: Search for the to-be-query business transaction in the first transaction list based on the transaction hash data; When the to-be-query business transaction is found in the first transaction list, determine that the to-be-query business transaction is found from the on-chain transactions on the blockchain.

9. The method according to claim 8, wherein, the method further includes: When the to-be-query business transaction is not found in the first transaction list, determine a second target block from the first block on the blockchain; the transaction list corresponding to the second target block is a second transaction list; the second target block is the previous first block of the first target block on the blockchain; Search for the to-be-query business transaction in the second transaction list based on the transaction hash data; When the to-be-query business transaction is found in the second transaction list, it is determined that the to-be-query business transaction is found from the on-chain transactions on the blockchain.

10. The method according to claim 1, wherein, the method further includes: Determine the field data in the to-be-processed transaction whose field data volume is less than or equal to the field data volume threshold as the second field data, and determine the field position of the second field data in the to-be-processed transaction as the field retention position corresponding to the second field data.

11. The method according to claim 10, wherein, the determining the business transaction corresponding to the to-be-processed transaction based on the field reference identifier at the field optimization position includes: Maintain the field data at the field retention position as the second field data; Based on the field reference identifier at the field optimization position and the second field data at the field retention position, determine the business transaction corresponding to the to-be-processed transaction.

12. The method according to claim 1, wherein, the updating the field reference times corresponding to the field reference identifier in the updated global reference mapping table includes: In the updated global reference mapping table, search for a mapping reference identifier that matches the field reference identifier, and determine the reference times corresponding to the found mapping reference identifier as the first field reference times corresponding to the field reference identifier; Perform an update process on the first field reference times corresponding to the field reference identifier to obtain the second field reference times corresponding to the field reference identifier; the second field reference times are greater than the first field reference times.

13. The method according to claim 1, wherein, the global reference mapping table is used to record the mapping reference identifier and the mapping field data corresponding to the mapping reference identifier; the optimizing the field data at the field optimization position from the first field data to the field reference identifier, and determining the business transaction corresponding to the to-be-processed transaction based on the field reference identifier at the field optimization position includes: Obtain the global reference mapping table, and search for a mapping reference identifier that matches the field reference identifier in the global reference mapping table; When a mapping reference identifier that matches the field reference identifier is found, optimize the field data at the field optimization position from the first field data to the field reference identifier; Based on the field reference identifier at the field optimization position, determine the first business transaction corresponding to the to-be-processed transaction; the field data of the first business transaction is the same as the mapping field data in the global mapping list; Determine the first business transaction as the business transaction.

14. The method according to claim 13, wherein, the method further includes: When a mapping reference identifier that matches the field reference identifier is not found, determine the to-be-processed transaction as the second business transaction; the field data of the second business transaction is different from the mapping field data in the global mapping list. Determine the second service transaction as the service transaction.

15. A blockchain-based data storage device, characterized in that the device is run by a blockchain node; a global reference mapping table is stored in the node memory of the blockchain node; the global reference mapping table is used to optimize the field data of the transactions on the blockchain; the transactions on the chain are transactions on the first block on the blockchain; the device includes: a data volume determination module, configured to receive a to-be-processed transaction submitted by a service terminal for a terminal service, and determine the field data volume of the field data of the to-be-processed transaction; an optimized data determination module, configured to, if field data with a field data volume greater than a field data volume threshold is found in the field data of the to-be-processed transaction, when determining the found field data as first field data, determine the field position of the first field data in the to-be-processed transaction as the field optimization position corresponding to the first field data; a service transaction determination module, configured to obtain the field reference identifier of the first field data, and when the data volume of the field reference identifier is less than the field data volume of the first field data, optimize the field data at the field optimization position from the first field data to the field reference identifier, and determine the service transaction corresponding to the to-be-processed transaction based on the field reference identifier at the field optimization position; a mapping table update module, configured to perform an update process on the global reference mapping table based on the first field data and the field reference identifier in the service transaction to obtain an updated global reference mapping table; a reference count update module, configured to pack the service transaction into a second block, and when the second block is uploaded to the blockchain, update the field reference count corresponding to the field reference identifier in the updated global reference mapping table; the field reference count is used to indicate the number of times of optimizing the first field data on the blockchain.

16. A computer device, characterized in that it includes a memory and a processor; the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1-14.

17. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and the computer program is suitable for being loaded and executed by a processor so that a computer device with the processor executes the method according to any one of claims 1-14.

18. A computer program product, characterized in that it includes a computer program / instructions, and when the computer program / instructions are executed by a processor, the method according to any one of claims 1-14 is implemented.

Citation Information

Cited By

  • Block chain data cloud storage method

    CN121478884A

  • Blockchain data cloud storage method

    CN121478884B