WO2020048054A1 - Data storage method, computer-readable storage medium, server, and apparatus - Google Patents

Data storage method, computer-readable storage medium, server, and apparatus Download PDF

Info

Publication number
WO2020048054A1
WO2020048054A1 PCT/CN2018/123786 CN2018123786W WO2020048054A1 WO 2020048054 A1 WO2020048054 A1 WO 2020048054A1 CN 2018123786 W CN2018123786 W CN 2018123786W WO 2020048054 A1 WO2020048054 A1 WO 2020048054A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
block
verification
value
data set
Prior art date
Application number
PCT/CN2018/123786
Other languages
French (fr)
Chinese (zh)
Inventor
宦鹏飞
张文明
陈飞
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2020048054A1 publication Critical patent/WO2020048054A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the present application belongs to the field of computer technology, and particularly relates to a data storage method, a computer-readable storage medium, a server, and a device.
  • the data writing of the existing blockchain system uses a write request to initiate a write operation, and there is more interaction with the blockchain system, which not only causes greater pressure on the blockchain system, but also does not satisfy Some batch business scenarios. Because some business scenarios need to write a batch of data, but if there is a problem in the middle of a piece of data, the entire batch of data needs to be rolled back. However, existing blockchain writing solutions cannot roll back data that has been successfully written before. Therefore, the consistency of this batch of data in the blockchain system cannot be guaranteed.
  • embodiments of the present application provide a data storage method, a computer-readable storage medium, a server, and a device to solve the interaction with the blockchain system when writing data to the blockchain system in the prior art in batches. Many, it has caused greater pressure on the blockchain system, and cannot guarantee the consistency of data in the blockchain system.
  • a first aspect of the embodiments of the present application provides a data storage method, which may include:
  • the request type of the data operation request is a batch on-chain request
  • a preset total data field is extracted from the batch on-chain request, and the total data field is used to identify a total number of data to be stored ;
  • the data set passes the data verification, the data set is stored in batches into a preset blockchain system.
  • a second aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, implement the steps of the foregoing data storage method. .
  • a third aspect of the embodiments of the present application provides a server including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, where the processor executes the computer-readable The steps of the above data storage method are implemented when the instruction is read.
  • a fourth aspect of the embodiments of the present application provides a data storage device, which may include a module for implementing the steps of the foregoing data storage method.
  • the entire data set will be stored into the blockchain system in batches only after the entire data set has passed the data verification, thereby ensuring the consistency of this batch of data in the blockchain system, and only You can perform batch data operations through a batch access request without having to initiate a separate access request for each data, which greatly reduces the interaction process with the blockchain system and improves the efficiency of data storage.
  • FIG. 1 is a flowchart of an embodiment of a data storage method according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of a frame structure of a batch connection request
  • FIG. 3 is a schematic flowchart of performing data verification on a data set using a target data verification rule
  • FIG. 4 is a schematic diagram of a generation process of each block in a block segment
  • FIG. 5 is a structural diagram of a data storage device according to an embodiment of the present application.
  • FIG. 6 is a schematic block diagram of a server according to an embodiment of the present application.
  • an embodiment of a data storage method in an embodiment of the present application may include:
  • Step S101 Receive a data operation request, and extract a preset request type field from the data operation request.
  • a business system When a business system needs to perform data operations on a preset blockchain system, it first sends a data operation request to any node server in the blockchain system, and the node server that receives the data operation request is an embodiment of this application. Implementation subject.
  • the request type field can be set at the start position of the data operation request, or at the end position of the data operation request or at another position.
  • the request type field occupies a fixed number of bytes, for example , 4 bytes, 8 bytes or other values and so on.
  • Step S102 Determine a request type of the data operation request according to a value of the request type field.
  • the value of the request type field is 0x0001, it indicates that the request type of the data operation request is a batch on-chain request, and if the value of the request type field is When 0x0000, it indicates that the request type of the data operation request is a single data on-chain request.
  • the values of the fields corresponding to various request types can be set according to specific situations.
  • Step S103 Determine whether the request type of the data operation request is a batch on-chain request.
  • step S104 is performed; if the request type of the data operation request is a batch on-chain request, step S105 and subsequent steps are performed.
  • Step S104 Store a single piece of data in the single data in-chain request into a preset blockchain system.
  • Step S105 Extract a preset data amount field from the batch on-chain request.
  • Figure 2 shows a specific frame structure of the batch incoming chain request, where:
  • MSG_TYPE is a request type field.
  • SYS_ID is a system identification field, and its value is the business system identifier of the target business system.
  • the target business system is the business system that sends the data operation request. This field can be used to determine the specific one of the batch on-chain requests. This field sent by the service system occupies a fixed number of bytes, for example, 4 bytes, 8 bytes, or other values.
  • DATA_NUM is the total data field, which is used to identify the total number of data to be stored, that is, how many pieces of data need to be linked into the operation at the same time. This field occupies a fixed number of bytes, for example, 4 bytes, 8 Byte or other values and so on.
  • DATA_BODY is the data body field, that is, the specific data to perform the inbound operation this time, is composed of multiple data frames (FRAME), each frame is composed of a data body DATA and a data termination flag END.
  • FIG. 2 shows only one possible frame structure of the batch connection request. In actual applications, other frame structures may be set according to specific situations.
  • Step S106 Extract the data set to be stored from the batch on-chain request according to the value of the total data field.
  • the data set is composed of various pieces of data to be stored. Specifically, the data in the data body field is read in order.
  • the termination flag When the termination flag is read, it indicates that the first data has been read, and the data is added to the data set, and then the data body is continued to be read.
  • the termination flag For the data in the field, when the termination flag is read, it indicates that the second data has been read, and the data is added to the data set, and so on, and so on, until the Nth data is read ( When N is the termination flag of the total amount of data field, it indicates that the Nth data (that is, the last data) has been read, and the data is added to the data set.
  • Step S107 Perform data verification on the data set by using a preset data verification rule.
  • the data verification rule may be set according to an actual situation.
  • a data verification rule library as shown below is set in advance in this solution, and corresponding data verification rules are configured for various business systems:
  • a business system identifier of a target business system is first extracted from the data operation request, and then a target verification rule is found in the data verification rule database, and the target verification rule is the same as the The data verification rule corresponding to the business system identification. For example, if the target business system is business system 3, by querying the data verification rule database, it can be determined that the corresponding data verification rule is data verification rule C, and the data is corrected. The verification rule C is determined as the target verification rule.
  • target data verification rule is used to perform data verification on the data set through the process shown in FIG. 3:
  • Step S1071 an arbitrary piece of candidate data is selected from the data set as the current verification data.
  • the candidate data is data with a preset check identification bit being a first bit value.
  • a check identification bit may be set for each piece of data in the data set to identify whether the data is Data verification has been performed.
  • the check flag of a certain data is the first value, it means that the data has not been checked for data.
  • the check flag of a certain data is the second value, it means that the data has been checked.
  • Data validation The specific values of the first digit value and the second digit value can be set according to the actual situation. In this embodiment, it is preferable to set the first digit value to 0 and the second digit value to 1.
  • the values of the check identification bits of all the data in the data set are the first value.
  • Step S1072 it is determined whether the current verification data meets the target data verification rule.
  • step S1073 is performed, and if the current verification data meets the target data verification rule, step S1074 and subsequent steps are performed.
  • Step S1073 Determine that the data set fails the data check.
  • Step S1074 Set the verification identification bit of the current verification data to a second value, and increase the preset count value by one count unit.
  • the count value may be COUNT, and the count value is used to count the number of data with successful data verification. In the initial state, its value is initialized to 0.
  • Step S1075 Determine whether the count value is equal to the value of the total data field.
  • step S1076 If the count value is smaller than the value of the total data field, return to step S1071 and subsequent steps, and if the count value is equal to the value of the total data field, perform step S1076.
  • Step S1076 Determine that the data set passes data verification.
  • Step S108 Determine whether the data set passes data verification.
  • step S109 is performed, and if the data set passes the data check, step S110 is performed.
  • Step S109 Send an incoming chain failure message to the target service system.
  • the incoming chain failure message may carry verification failure data.
  • the target business system may re-initiate a new batch incoming chain request after correcting the data.
  • Step S110 Store the data set into the blockchain system in batches.
  • a block segment corresponding to the data set is first generated, the block segment includes a block equal to the amount of data in the data set, and each block in the block segment is Generated from a piece of data in the data set.
  • the generation process of each block in the block segment includes: determining whether the block to be generated is the first block in the block segment, and if the block to be generated is in the block segment The first block of, the block newly added to the local block chain is determined as the end of the chain, if the block to be generated is not the first block in the block segment, Then the newly added block in the block segment is determined as a chain tail block, and a feature operation is performed on the block header of the chain tail block to obtain a first feature value. A feature operation is performed on the data corresponding to the block to be generated to obtain a second feature value. A block header of the block to be generated is generated according to the first feature value and the second feature value, and based on the data set and the The data corresponding to the block to be generated generates a block body of the block to be generated, thereby generating the block.
  • the block segment is composed of sequential block connections.
  • Each block records a piece of data in the data set.
  • a corresponding storage space is created in the server for the new block.
  • the space occupied by each block is divided into two parts, one is the block header, and the content stored in the block header is fixed (including the block header feature value, block body feature value, version number, difficulty value, time stamp, etc. ), The space it occupies is also fixed.
  • the other part is the block body.
  • the content stored in the block body is the data to be written, and its length is variable. Therefore, first obtain the length of the data to be written, and then add the length of the fixed block header to determine the storage space required for the new block.
  • open up storage space for the new block It should be noted that the storage location of the new block does not need to be immediately adjacent to the previous block, but any piece of unused storage space can be opened up. After the space, the pointer of the previous block points to the storage space address of the new block.
  • the eigenvalue (that is, the second eigenvalue) is stored in the block header of the new block; the data to be written is stored in the block body of the new block, thereby generating a new block so that the new block and the previous block pass the previous block
  • the feature value of the block header is related, so the purpose of connecting the blocks in the blockchain is achieved, so that any information in the block can be tampered with through the previous block stored in the block's block header.
  • the block header characteristic value is detected retrospectively, thereby ensuring the security of the information.
  • the block segment is stored in a local blockchain, and the block segment is broadcasted in the blockchain system, so that each node server in the blockchain system will store the block Segments are stored in their respective local blockchains.
  • the first node server sends the block segment to a first-level broadcast node server
  • the first node server is a node server receiving the data operation request
  • the first-level broadcast node server is a The node server connected to the first node server; after receiving the block segment, the first-level broadcast node server sends the block segment to the second-level broadcast node server, and the second-level broadcast node
  • the server is a node server connected to the first-level broadcast node server; after receiving the block segment, the second-level broadcast node server sends the block segment to the third-level broadcast node server.
  • the third-level broadcast node server is a node server connected to the second-level broadcast node server; ...; and so on, after receiving the block segment, the m-th broadcast node server will The block segment is sent to the m + 1 level broadcast node server until each node server in the blockchain system receives the block segment and stores it in their respective local blockchains, Said first stage m + 1 to the broadcast server node server node connected to the m-th stage broadcast server node, m is an integer equal to or greater than 1.
  • the embodiments of the present application only store the entire data set into the blockchain system in batches after the entire data set has passed the data verification, thereby ensuring that this batch of data is stored in the blockchain system. Consistency, and batch data can be operated through only one batch request, instead of initiating a separate request for each data, greatly reducing the interaction process with the blockchain system and improving the data storage effectiveness.
  • FIG. 5 shows a structural diagram of an embodiment of a data storage device provided by an embodiment of the present application.
  • a data storage device may include:
  • the request receiving module 501 is configured to receive a data operation request and extract a preset request type field from the data operation request;
  • a request type determining module 502 configured to determine a request type of the data operation request according to a value of the request type field
  • the data total amount field extraction module 503 is configured to extract a preset data total amount field from the batch link input request if the request type of the data operation request is a batch link input request, and the data total field is used for For identifying the total number of pieces of data to be stored;
  • a data set extraction module 504 configured to extract a data set to be stored from the batch on-chain request according to a value of the data total amount field, where the data set is composed of each piece of data to be stored;
  • a data verification module 505, configured to perform data verification on the data set using a preset data verification rule
  • a batch storage module 506 is configured to batch store the data set into a preset blockchain system if the data set passes data verification.
  • the data verification module may include:
  • a service system identifier extraction unit configured to extract a service system identifier of a target service system from the data operation request, where the target service system is a service system that sends the data operation request;
  • a target verification rule searching unit configured to find a target verification rule in a preset data verification rule database, where the target verification rule is a data verification rule corresponding to the business system identifier;
  • a data verification unit is configured to perform data verification on the data set using the target data verification rule.
  • the data verification unit may include:
  • a current verification data selection subunit configured to arbitrarily select a candidate data from the data set as the current verification data, where the candidate data is data with a preset verification identification bit being a first value;
  • a first judging subunit configured to judge whether the current verification data meets the target data verification rule
  • a first determining subunit configured to determine that the data set fails the data verification if the current verification data does not satisfy the target data verification rule
  • a first processing subunit configured to set a verification flag bit of the current verification data to a second value if the current verification data meets the target data verification rule, and set a preset count Increment the value by one count;
  • a second determination subunit configured to determine whether the count value is equal to a value of the total data field
  • a second determining subunit is configured to determine that the data set passes data verification if the count value is equal to a value of the data total amount field.
  • the batch storage module may include:
  • a block segment generating unit is configured to generate a block segment corresponding to the data set, where the block segment includes a block equal to the amount of data in the data set, and each of the block segments Each block is generated according to one piece of data in the data set;
  • a block segment storage unit configured to store the block segment in a local blockchain, and broadcast the block segment in the blockchain system, so that each node in the blockchain system
  • the server stores the block segments into their respective local blockchains.
  • block segment generating unit may include:
  • a block judging subunit configured to determine whether a block to be generated is the first block in the block segment
  • a first chain tail determination subunit configured to determine, if the block to be generated is the first block in the block segment, a block newly added to the local blockchain as a chain tail Block
  • a second chain tail determining subunit configured to determine, if the block to be generated is not the first block in the block segment, the block newly added to the block segment as the chain tail region Piece;
  • a first eigenvalue calculation subunit configured to perform a feature operation on a block header of the chain tail block to obtain a first eigenvalue
  • a second eigenvalue calculation subunit configured to perform a feature operation on data corresponding to the block to be generated in the data set to obtain a second eigenvalue
  • a block generation subunit configured to generate a block header of the block to be generated according to the first characteristic value and the second characteristic value, and according to data in the data set corresponding to the block to be generated Generate a block body of the block to be generated.
  • FIG. 6 shows a schematic block diagram of a server provided by an embodiment of the present application. For ease of description, only a part related to the embodiment of the present application is shown.
  • the server 6 may include: a processor 60, a memory 61, and computer-readable instructions 62 stored in the memory 61 and executable on the processor 60, for example, to execute the foregoing data storage.
  • Computer-readable instructions of the method When the processor 60 executes the computer-readable instructions 62, the steps in the foregoing data storage method embodiments are implemented.
  • each functional unit in each embodiment of the present application When each functional unit in each embodiment of the present application is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium.
  • Including computer-readable instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), and a random access memory (RAM, Random Access) Memory), magnetic disks, or optical discs, which can store computer-readable instructions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A blockchain-based data storage method, a computer-readable storage medium, a server (6), and an apparatus. The method comprises: receiving a data operation request and extracting a preset request type field from the data operation request (S101); determining the request type of the data operation request according to the value of the request type field (S102); if the request type of the data operation request is a chain batch write request, extracting a preset total data amount field from the chain batch write request (S105); extracting, according to the value of the total data amount field, the set of data to be stored from the chain batch write request (S106), the set being constituted by difference pieces of data; using a data verification rule to perform data verification on the data set (S107); and if the data set passes the data verification, storing the data set into a preset blockchain system in batch (S110). The method ensures the consistency of the same batch of data in the blockchain system, and improves the data storage efficiency.

Description

一种数据存储方法、计算机可读存储介质、服务器及装置Data storage method, computer-readable storage medium, server and device
本申请要求于2018年9月3日提交中国专利局、申请号为201811022476.X、发明名称为“一种数据存储方法、计算机可读存储介质及服务器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed on September 3, 2018 with the Chinese Patent Office, application number 201811022476.X, and the invention name "a data storage method, computer-readable storage medium, and server", all of which The contents are incorporated herein by reference.
技术领域Technical field
本申请属于计算机技术领域,尤其涉及一种数据存储方法、计算机可读存储介质、服务器及装置。The present application belongs to the field of computer technology, and particularly relates to a data storage method, a computer-readable storage medium, a server, and a device.
背景技术Background technique
现有区块链系统的数据写入均采用有一条写请求便发起一次写入操作,与区块链系统的交互较多,这样不仅对区块链系统造成了较大的压力,而且不满足一些批量的业务场景。因为有些业务场景需要批量写入一批数据,但中间如果有一条数据有问题,是需要将整批数据回滚的。但现有的区块链写入方案并不能将之前已经写入成功的数据进行回滚。从而不能保证这一批数据在区块链系统的一致性。The data writing of the existing blockchain system uses a write request to initiate a write operation, and there is more interaction with the blockchain system, which not only causes greater pressure on the blockchain system, but also does not satisfy Some batch business scenarios. Because some business scenarios need to write a batch of data, but if there is a problem in the middle of a piece of data, the entire batch of data needs to be rolled back. However, existing blockchain writing solutions cannot roll back data that has been successfully written before. Therefore, the consistency of this batch of data in the blockchain system cannot be guaranteed.
技术问题technical problem
有鉴于此,本申请实施例提供了一种数据存储方法、计算机可读存储介质、服务器及装置,以解决现有技术往区块链系统中批量写入数据时与区块链系统的交互较多,对区块链系统造成了较大的压力,且不能保证数据在区块链系统的一致性的问题。In view of this, embodiments of the present application provide a data storage method, a computer-readable storage medium, a server, and a device to solve the interaction with the blockchain system when writing data to the blockchain system in the prior art in batches. Many, it has caused greater pressure on the blockchain system, and cannot guarantee the consistency of data in the blockchain system.
技术解决方案Technical solutions
本申请实施例的第一方面提供了一种数据存储方法,可以包括:A first aspect of the embodiments of the present application provides a data storage method, which may include:
接收数据操作请求,并从所述数据操作请求中提取预设的请求类型字段;Receiving a data operation request, and extracting a preset request type field from the data operation request;
根据所述请求类型字段的取值确定所述数据操作请求的请求类型;Determining a request type of the data operation request according to a value of the request type field;
若所述数据操作请求的请求类型为批量入链请求,则从所述批量入链请求中提取预设的数据总量字段,所述数据总量字段用于标识待存储的数据的总条数;If the request type of the data operation request is a batch on-chain request, a preset total data field is extracted from the batch on-chain request, and the total data field is used to identify a total number of data to be stored ;
根据所述数据总量字段的取值从所述批量入链请求中提取待存储的数据集合,所述数据集合由各条待存储的数据组成;Extracting a data set to be stored from the batch on-chain request according to the value of the total data field, the data set is composed of each piece of data to be stored;
使用预设的数据校验规则对所述数据集合进行数据校验;Perform data verification on the data set using a preset data verification rule;
若所述数据集合通过数据校验,则将所述数据集合批量存储入预设的区块链系统中。If the data set passes the data verification, the data set is stored in batches into a preset blockchain system.
本申请实施例的第二方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述数据存储方法的步骤。A second aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, implement the steps of the foregoing data storage method. .
本申请实施例的第三方面提供了一种服务器,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述数据存储方法的步骤。A third aspect of the embodiments of the present application provides a server including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, where the processor executes the computer-readable The steps of the above data storage method are implemented when the instruction is read.
本申请实施例的第四方面提供了一种数据存储装置,可以包括用于实现上述数据存储方法的步骤的模块。A fourth aspect of the embodiments of the present application provides a data storage device, which may include a module for implementing the steps of the foregoing data storage method.
有益效果Beneficial effect
本申请实施例只有当整个数据集合都通过了数据校验后,才会将整个数据集合批量存储入区块链系统中,从而保证了这一批数据在区块链系统的一致性,而且只通过一条批量入链请求即可进行批量数据的操作,而不用为每条数据单独发起一条入链请求,大大减少了与区块链系统间的交互过程,提升了数据存储的效率。In the embodiment of the present application, the entire data set will be stored into the blockchain system in batches only after the entire data set has passed the data verification, thereby ensuring the consistency of this batch of data in the blockchain system, and only You can perform batch data operations through a batch access request without having to initiate a separate access request for each data, which greatly reduces the interaction process with the blockchain system and improves the efficiency of data storage.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请实施例中一种数据存储方法的一个实施例流程图;FIG. 1 is a flowchart of an embodiment of a data storage method according to an embodiment of the present application;
图2为批量入链请求的帧结构示意图;FIG. 2 is a schematic diagram of a frame structure of a batch connection request;
图3为使用目标数据校验规则对数据集合进行数据校验的示意流程图;FIG. 3 is a schematic flowchart of performing data verification on a data set using a target data verification rule;
图4为区块段中的每个区块的生成过程的示意图;4 is a schematic diagram of a generation process of each block in a block segment;
图5为本申请实施例中一种数据存储装置的一个实施例结构图;5 is a structural diagram of a data storage device according to an embodiment of the present application;
图6为本申请实施例中一种服务器的示意框图。FIG. 6 is a schematic block diagram of a server according to an embodiment of the present application.
本发明的实施方式Embodiments of the invention
请参阅图1,本申请实施例中一种数据存储方法的一个实施例可以包括:Referring to FIG. 1, an embodiment of a data storage method in an embodiment of the present application may include:
步骤S101、接收数据操作请求,并从所述数据操作请求中提取预设的请求类型字段。Step S101: Receive a data operation request, and extract a preset request type field from the data operation request.
业务系统在需要对预设的区块链系统进行数据操作时,首先向所述区块链系统中的任意一个节点服务器发送数据操作请求,接收该数据操作请求的节点服务器即为本申请实施例的实施主体。When a business system needs to perform data operations on a preset blockchain system, it first sends a data operation request to any node server in the blockchain system, and the node server that receives the data operation request is an embodiment of this application. Implementation subject.
一般地,所述请求类型字段可以设置在所述数据操作请求的起始位置,也可以设置在所述数据操作请求的末尾位置或者其它位置,所述请求类型字段占用固定的字节数,例如,4字节、8字节或者其它取值等等。Generally, the request type field can be set at the start position of the data operation request, or at the end position of the data operation request or at another position. The request type field occupies a fixed number of bytes, for example , 4 bytes, 8 bytes or other values and so on.
步骤S102、根据所述请求类型字段的取值确定所述数据操作请求的请求类型。Step S102: Determine a request type of the data operation request according to a value of the request type field.
在本实施例的一种具体实现中,若所述请求类型字段的取值为0x0001时,则表示所述数据操作请求的请求类型为批量入链请求,若所述请求类型字段的取值为0x0000时,则表示所述数据操作请求的请求类型为单数据入链请求。当然,这仅仅只是一个示例,实际应用中,可以根据具体情况设置各种请求类型对应的字段取值。In a specific implementation of this embodiment, if the value of the request type field is 0x0001, it indicates that the request type of the data operation request is a batch on-chain request, and if the value of the request type field is When 0x0000, it indicates that the request type of the data operation request is a single data on-chain request. Of course, this is just an example. In actual applications, the values of the fields corresponding to various request types can be set according to specific situations.
步骤S103、判断所述数据操作请求的请求类型是否为批量入链请求。Step S103: Determine whether the request type of the data operation request is a batch on-chain request.
若所述数据操作请求的请求类型为单数据入链请求,则执行步骤S104,若所述数据操作请求的请求类型为批量入链请求,则执行步骤S105及其后续步骤。If the request type of the data operation request is a single data on-chain request, step S104 is performed; if the request type of the data operation request is a batch on-chain request, step S105 and subsequent steps are performed.
步骤S104、将所述单数据入链请求中的单条数据存储入预设的区块链系统中。Step S104: Store a single piece of data in the single data in-chain request into a preset blockchain system.
单条数据存储入区块链系统为现有技术中的常用方式,本实施例在此不再赘述。The storage of a single piece of data into a blockchain system is a common way in the prior art, which is not repeated in this embodiment.
步骤S105、从所述批量入链请求中提取预设的数据总量字段。Step S105: Extract a preset data amount field from the batch on-chain request.
图2所示即为所述批量入链请求的一种具体帧结构,其中:Figure 2 shows a specific frame structure of the batch incoming chain request, where:
MSG_TYPE为请求类型字段。MSG_TYPE is a request type field.
SYS_ID为系统标识字段,其取值为目标业务系统的业务系统标识,所述目标业务系统为发送所述数据操作请求的业务系统,通过该字段可以确定出该批量入链请求具体是由哪一个业务系统发送的,该字段占用固定的字节数,例如,4字节、8字节或者其它取值等等。SYS_ID is a system identification field, and its value is the business system identifier of the target business system. The target business system is the business system that sends the data operation request. This field can be used to determine the specific one of the batch on-chain requests. This field sent by the service system occupies a fixed number of bytes, for example, 4 bytes, 8 bytes, or other values.
DATA_NUM为数据总量字段,用于标识待存储的数据的总条数,即本次操作需要对多少条数据同时进行入链操作,该字段占用固定的字节数,例如,4字节、8字节或者其它取值等等。DATA_NUM is the total data field, which is used to identify the total number of data to be stored, that is, how many pieces of data need to be linked into the operation at the same time. This field occupies a fixed number of bytes, for example, 4 bytes, 8 Byte or other values and so on.
DATA_BODY为数据主体字段,即本次执行入链操作的具体数据,由多个数据帧(FRAME)组成,每个FRAME均由一条数据正文DATA以及一条数据终止标志END构成。DATA_BODY is the data body field, that is, the specific data to perform the inbound operation this time, is composed of multiple data frames (FRAME), each frame is composed of a data body DATA and a data termination flag END.
需要注意的是,图2所示仅为所述批量入链请求的一种可能的帧结构,实际应用中,还可以根据具体情况设置其它的帧结构。It should be noted that FIG. 2 shows only one possible frame structure of the batch connection request. In actual applications, other frame structures may be set according to specific situations.
步骤S106、根据所述数据总量字段的取值从所述批量入链请求中提取待存储的数据集合。Step S106: Extract the data set to be stored from the batch on-chain request according to the value of the total data field.
所述数据集合由各条待存储的数据组成。具体的,按顺序读取数据主体字段的数据,当读取到终止标志时,则表明第1条数据已经读取完毕,将该数据加入到所述数据集合中,然后再继续读取数据主体字段的数据,当读取到终止标志时,则表明第2条数据已经读取完毕,将该数据加入到所述数据集合中,……,以此类推,直至读取到第N个数据(N为所述数据总量字段的取值)的终止标志时,则表明第N个数据(即最后一个数据)已经读取完毕,将该数据加入到所述数据集合中。The data set is composed of various pieces of data to be stored. Specifically, the data in the data body field is read in order. When the termination flag is read, it indicates that the first data has been read, and the data is added to the data set, and then the data body is continued to be read. For the data in the field, when the termination flag is read, it indicates that the second data has been read, and the data is added to the data set, and so on, and so on, until the Nth data is read ( When N is the termination flag of the total amount of data field, it indicates that the Nth data (that is, the last data) has been read, and the data is added to the data set.
步骤S107、使用预设的数据校验规则对所述数据集合进行数据校验。Step S107: Perform data verification on the data set by using a preset data verification rule.
其中,所述数据校验规则可以根据实际情况进行设置。优选地,考虑到不同的业务系统可能存在各不相同的数据校验规则,本方案中预先设置了如下所示的数据校验规则库,为各种业务系统配置对应的数据校验规则:The data verification rule may be set according to an actual situation. Preferably, considering that different business systems may have different data verification rules, a data verification rule library as shown below is set in advance in this solution, and corresponding data verification rules are configured for various business systems:
业务系统1-----数据校验规则A;Business system 1 ----- data verification rule A;
业务系统2-----数据校验规则B;Business System 2 ----- Data Verification Rule B;
业务系统3-----数据校验规则C;Business System 3 ----- Data Verification Rule C;
……...
当进行数据校验时,首先从所述数据操作请求中提取目标业务系统的业务系统标识,然后在所述数据校验规则库中查找目标校验规则,所述目标校验规则为与所述业务系统标识对应的数据校验规则,例如,若目标业务系统为业务系统3,则通过查询数据校验规则库,可以确定与之对应的数据校验规则为数据校验规则C,将数据校验规则C确定为所述目标校验规则。When data verification is performed, a business system identifier of a target business system is first extracted from the data operation request, and then a target verification rule is found in the data verification rule database, and the target verification rule is the same as the The data verification rule corresponding to the business system identification. For example, if the target business system is business system 3, by querying the data verification rule database, it can be determined that the corresponding data verification rule is data verification rule C, and the data is corrected. The verification rule C is determined as the target verification rule.
最后,通过如图3所示的过程使用所述目标数据校验规则对所述数据集合进行数据校验:Finally, the target data verification rule is used to perform data verification on the data set through the process shown in FIG. 3:
步骤S1071、从所述数据集合中任意选取一条候选数据作为当前校验数据。Step S1071, an arbitrary piece of candidate data is selected from the data set as the current verification data.
所述候选数据为预设的校验标识位为第一位值的数据,在本实施例中,可以为所述数据集合中每一条数据均设置一个校验标识位,用以标识该数据是否已经进行过数据校验。当某一数据的校验标识位为第一位值时,则说明该数据尚未进行过数据校验,当某一数据的校验标识位为第二位值时,则说明该数据已经进行过数据校验。第一位值和第二位值的具体取值可以根据实际情况进行设置,在本实施例中,优选将第一位值设置为0,将第二位值设置为1。The candidate data is data with a preset check identification bit being a first bit value. In this embodiment, a check identification bit may be set for each piece of data in the data set to identify whether the data is Data verification has been performed. When the check flag of a certain data is the first value, it means that the data has not been checked for data. When the check flag of a certain data is the second value, it means that the data has been checked. Data validation. The specific values of the first digit value and the second digit value can be set according to the actual situation. In this embodiment, it is preferable to set the first digit value to 0 and the second digit value to 1.
在初始状态下,所述数据集合中的所有数据的校验标识位的取值均为第一位值。In the initial state, the values of the check identification bits of all the data in the data set are the first value.
步骤S1072、判断所述当前校验数据是否满足所述目标数据校验规则。Step S1072, it is determined whether the current verification data meets the target data verification rule.
若所述当前校验数据不满足所述目标数据校验规则,则执行步骤S1073,若所述当前校验数据满足所述目标数据校验规则,则执行步骤S1074及其后续步骤。If the current verification data does not satisfy the target data verification rule, step S1073 is performed, and if the current verification data meets the target data verification rule, step S1074 and subsequent steps are performed.
步骤S1073、判定所述数据集合未通过数据校验。Step S1073: Determine that the data set fails the data check.
也即只要所述数据集合中存在任意一条数据不满足所述目标数据校验规则,则判定所述数据集合未通过数据校验。That is, as long as any data in the data set does not satisfy the target data check rule, it is determined that the data set fails the data check.
步骤S1074、将所述当前校验数据的校验标识位设置为第二位值,并将预设的计数值增加一个计数单位。Step S1074: Set the verification identification bit of the current verification data to a second value, and increase the preset count value by one count unit.
在本实施例中,可以将所述计数值即为COUNT,该计数值用于统计数据校验成功的数据的数目,在初始状态下,其取值被初始化为0。In this embodiment, the count value may be COUNT, and the count value is used to count the number of data with successful data verification. In the initial state, its value is initialized to 0.
当完成一条数据的校验后,则将其增加一个计数单位,即:When the verification of a piece of data is completed, it is incremented by one count unit, that is:
COUNT=COUNT+1COUNT = COUNT + 1
步骤S1075、判断所述计数值是否等于所述数据总量字段的取值。Step S1075: Determine whether the count value is equal to the value of the total data field.
若所述计数值小于所述数据总量字段的取值,则返回执行步骤S1071及其后续步骤,若所述计数值等于所述数据总量字段的取值,则执行步骤S1076。If the count value is smaller than the value of the total data field, return to step S1071 and subsequent steps, and if the count value is equal to the value of the total data field, perform step S1076.
步骤S1076、判定所述数据集合通过数据校验。Step S1076: Determine that the data set passes data verification.
也即只有在所述数据集合中的所有数据均满足所述目标数据校验规则时,才判定所述数据集合通过数据校验。That is, it is determined that the data set passes the data check only when all the data in the data set meets the target data check rule.
步骤S108、判断所述数据集合是否通过数据校验。Step S108: Determine whether the data set passes data verification.
若所述数据集合未通过数据校验,则执行步骤S109,若所述数据集合通过数据校验,则执行步骤S110。If the data set fails the data check, step S109 is performed, and if the data set passes the data check, step S110 is performed.
步骤S109、向目标业务系统发送入链失败消息。Step S109: Send an incoming chain failure message to the target service system.
在所述入链失败消息中可以携带校验失败的数据,所述目标业务系统在接收到所述入链失败消息后,可以在对数据进行修正后重新发起一条新的批量入链请求。The incoming chain failure message may carry verification failure data. After receiving the incoming chain failure message, the target business system may re-initiate a new batch incoming chain request after correcting the data.
步骤S110、将所述数据集合批量存储入所述区块链系统中。Step S110: Store the data set into the blockchain system in batches.
具体地,首先生成与所述数据集合对应的区块段,所述区块段中包括与所述数据集合中的数据数量相等的区块,且所述区块段中的每个区块均根据所述数据集合中的一条数据生成。Specifically, a block segment corresponding to the data set is first generated, the block segment includes a block equal to the amount of data in the data set, and each block in the block segment is Generated from a piece of data in the data set.
所述区块段中的每个区块的生成过程包括:判断待生成区块是否为所述区块段中的第一个区块,若所述待生成区块为所述区块段中的第一个区块,则将最新添加入所述本地区块链中的区块确定为链尾区块,若所述待生成区块不是所述区块段中的第一个区块,则将最新添加入所述区块段中的区块确定为链尾区块,对所述链尾区块的区块头进行特征运算,得到第一特征值,对所述数据集合中与所述待生成区块对应的数据进行特征运算,得到第二特征值,根据所述第一特征值和所述第二特征值生成所述待生成区块的区块头,并根据所述数据集合中与所述待生成区块对应的数据生成所述待生成区块的区块主体,从而生成该区块。The generation process of each block in the block segment includes: determining whether the block to be generated is the first block in the block segment, and if the block to be generated is in the block segment The first block of, the block newly added to the local block chain is determined as the end of the chain, if the block to be generated is not the first block in the block segment, Then the newly added block in the block segment is determined as a chain tail block, and a feature operation is performed on the block header of the chain tail block to obtain a first feature value. A feature operation is performed on the data corresponding to the block to be generated to obtain a second feature value. A block header of the block to be generated is generated according to the first feature value and the second feature value, and based on the data set and the The data corresponding to the block to be generated generates a block body of the block to be generated, thereby generating the block.
如图4所示,所述区块段是由一个个的区块顺序连接组成的,每个区块记录所述数据集合中的一条数据,首先在服务器中为新区块开辟出对应的存储空间,每个区块所占用的空间分为两部分,一部分是区块头,区块头中存储的内容是固定的(包括区块头特征值、区块主体特征值、版本号、难度值和时间戳等),则其占据的空间也是固定的,另一部分是区块主体,区块主体中存储的内容即为需写入的数据,其长度是可变的。因此首先获取需写入的数据的长度,然后加上固定的区块头的长度,则可确定出新区块所需占用的存储空间。在服务器中,为其开辟出存储空间存储该新区块,需要注意的是,新区块的存储位置无需紧邻着上一区块,而是任意一块未使用的存储空间即可,在开辟了新的空间后,将上一区块的指针指向新区块的存储空间地址。As shown in FIG. 4, the block segment is composed of sequential block connections. Each block records a piece of data in the data set. First, a corresponding storage space is created in the server for the new block. The space occupied by each block is divided into two parts, one is the block header, and the content stored in the block header is fixed (including the block header feature value, block body feature value, version number, difficulty value, time stamp, etc. ), The space it occupies is also fixed. The other part is the block body. The content stored in the block body is the data to be written, and its length is variable. Therefore, first obtain the length of the data to be written, and then add the length of the fixed block header to determine the storage space required for the new block. In the server, open up storage space for the new block. It should be noted that the storage location of the new block does not need to be immediately adjacent to the previous block, but any piece of unused storage space can be opened up. After the space, the pointer of the previous block points to the storage space address of the new block.
从区块链中获取前一区块的区块头中的所有信息,并基于该前一区块的区块头中的所有信息得到新区块的区块头特征值,并对将要存入新区块的区块主体中的数据进行特征值计算,得到新区块的区块主体特征值(HASH值),进而,将前一区块的区块头特征值(即第一特征值)、新区块的区块主体特征值(即第二特征值)存储至新区块的区块头;将需写入的数据存储至新区块的区块主体,从而生成新区块,使得新区块与前一区块通过前一区块的区块头特征值相关,因而实现了将区块链中的区块串联起来的目的,使得对区块中任何信息的篡改,均能够通过区块的区块头中所存储的上一个区块的区块头特征值的追溯而检测到,从而使得保证了信息的安全性。Obtain all the information in the block header of the previous block from the blockchain, and obtain the block header feature values of the new block based on all the information in the block header of the previous block, and the area to be stored in the new block The data in the block body is subjected to feature value calculation to obtain the block body feature value (HASH value) of the new block. Furthermore, the block header feature value (that is, the first feature value) of the previous block and the block body of the new block are obtained. The eigenvalue (that is, the second eigenvalue) is stored in the block header of the new block; the data to be written is stored in the block body of the new block, thereby generating a new block so that the new block and the previous block pass the previous block The feature value of the block header is related, so the purpose of connecting the blocks in the blockchain is achieved, so that any information in the block can be tampered with through the previous block stored in the block's block header. The block header characteristic value is detected retrospectively, thereby ensuring the security of the information.
最后,将所述区块段存储入本地区块链中,并在所述区块链系统中广播所述区块段,以使所述区块链系统中的各个节点服务器将所述区块段存储入各自的本地区块链中。Finally, the block segment is stored in a local blockchain, and the block segment is broadcasted in the blockchain system, so that each node server in the blockchain system will store the block Segments are stored in their respective local blockchains.
具体地,第一节点服务器将所述区块段发送至第1级广播节点服务器,所述第一节点服务器为接收所述数据操作请求的节点服务器,所述第1级广播节点服务器为与所述第一节点服务器连接的节点服务器;所述第1级广播节点服务器在接收到所述区块段后,将所述区块段发送至第2级广播节点服务器,所述第2级广播节点服务器为与所述第1级广播节点服务器连接的节点服务器;所述第2级广播节点服务器在接收到所述区块段后,将所述区块段发送至第3级广播节点服务器,所述第3级广播节点服务器为与所述第2级广播节点服务器连接的节点服务器;......;以此类推,第m级广播节点服务器在接收到所述区块段后,将所述区块段发送至第m+1级广播节点服务器,直至所述区块链系统中的各个节点服务器均接收到所述区块段并将其存储入各自的本地区块链中为止,所述第m+1级广播节点服务器为与所述第m级广播节点服务器连接的节点服务器,m为大于或等于1的整数。Specifically, the first node server sends the block segment to a first-level broadcast node server, the first node server is a node server receiving the data operation request, and the first-level broadcast node server is a The node server connected to the first node server; after receiving the block segment, the first-level broadcast node server sends the block segment to the second-level broadcast node server, and the second-level broadcast node The server is a node server connected to the first-level broadcast node server; after receiving the block segment, the second-level broadcast node server sends the block segment to the third-level broadcast node server. The third-level broadcast node server is a node server connected to the second-level broadcast node server; ...; and so on, after receiving the block segment, the m-th broadcast node server will The block segment is sent to the m + 1 level broadcast node server until each node server in the blockchain system receives the block segment and stores it in their respective local blockchains, Said first stage m + 1 to the broadcast server node server node connected to the m-th stage broadcast server node, m is an integer equal to or greater than 1.
综上所述,本申请实施例只有当整个数据集合都通过了数据校验后,才会将整个数据集合批量存储入区块链系统中,从而保证了这一批数据在区块链系统的一致性,而且只通过一条批量入链请求即可进行批量数据的操作,而不用为每条数据单独发起一条入链请求,大大减少了与区块链系统间的交互过程,提升了数据存储的效率。In summary, the embodiments of the present application only store the entire data set into the blockchain system in batches after the entire data set has passed the data verification, thereby ensuring that this batch of data is stored in the blockchain system. Consistency, and batch data can be operated through only one batch request, instead of initiating a separate request for each data, greatly reducing the interaction process with the blockchain system and improving the data storage effectiveness.
对应于上文实施例所述的一种数据存储方法,图5示出了本申请实施例提供的一种数据存储装置的一个实施例结构图。Corresponding to a data storage method described in the above embodiment, FIG. 5 shows a structural diagram of an embodiment of a data storage device provided by an embodiment of the present application.
本实施例中,一种数据存储装置可以包括:In this embodiment, a data storage device may include:
请求接收模块501,用于接收数据操作请求,并从所述数据操作请求中提取预设的请求类型字段;The request receiving module 501 is configured to receive a data operation request and extract a preset request type field from the data operation request;
请求类型确定模块502,用于根据所述请求类型字段的取值确定所述数据操作请求的请求类型;A request type determining module 502, configured to determine a request type of the data operation request according to a value of the request type field;
数据总量字段提取模块503,用于若所述数据操作请求的请求类型为批量入链请求,则从所述批量入链请求中提取预设的数据总量字段,所述数据总量字段用于标识待存储的数据的总条数;The data total amount field extraction module 503 is configured to extract a preset data total amount field from the batch link input request if the request type of the data operation request is a batch link input request, and the data total field is used for For identifying the total number of pieces of data to be stored;
数据集合提取模块504,用于根据所述数据总量字段的取值从所述批量入链请求中提取待存储的数据集合,所述数据集合由各条待存储的数据组成;A data set extraction module 504, configured to extract a data set to be stored from the batch on-chain request according to a value of the data total amount field, where the data set is composed of each piece of data to be stored;
数据校验模块505,用于使用预设的数据校验规则对所述数据集合进行数据校验;A data verification module 505, configured to perform data verification on the data set using a preset data verification rule;
批量存储模块506,用于若所述数据集合通过数据校验,则将所述数据集合批量存储入预设的区块链系统中。A batch storage module 506 is configured to batch store the data set into a preset blockchain system if the data set passes data verification.
进一步地,所述数据校验模块可以包括:Further, the data verification module may include:
业务系统标识提取单元,用于从所述数据操作请求中提取目标业务系统的业务系统标识,所述目标业务系统为发送所述数据操作请求的业务系统;A service system identifier extraction unit, configured to extract a service system identifier of a target service system from the data operation request, where the target service system is a service system that sends the data operation request;
目标校验规则查找单元,用于在预设的数据校验规则库中查找目标校验规则,所述目标校验规则为与所述业务系统标识对应的数据校验规则;A target verification rule searching unit, configured to find a target verification rule in a preset data verification rule database, where the target verification rule is a data verification rule corresponding to the business system identifier;
数据校验单元,用于使用所述目标数据校验规则对所述数据集合进行数据校验。A data verification unit is configured to perform data verification on the data set using the target data verification rule.
进一步地,所述数据校验单元可以包括:Further, the data verification unit may include:
当前校验数据选取子单元,用于从所述数据集合中任意选取一条候选数据作为当前校验数据,所述候选数据为预设的校验标识位为第一位值的数据;A current verification data selection subunit, configured to arbitrarily select a candidate data from the data set as the current verification data, where the candidate data is data with a preset verification identification bit being a first value;
第一判断子单元,用于判断所述当前校验数据是否满足所述目标数据校验规则;A first judging subunit, configured to judge whether the current verification data meets the target data verification rule;
第一判定子单元,用于若所述当前校验数据不满足所述目标数据校验规则,则判定所述数据集合未通过数据校验;A first determining subunit, configured to determine that the data set fails the data verification if the current verification data does not satisfy the target data verification rule;
第一处理子单元,用于若所述当前校验数据满足所述目标数据校验规则,则将所述当前校验数据的校验标识位设置为第二位值,并将预设的计数值增加一个计数单位;A first processing subunit, configured to set a verification flag bit of the current verification data to a second value if the current verification data meets the target data verification rule, and set a preset count Increment the value by one count;
第二判断子单元,用于判断所述计数值是否等于所述数据总量字段的取值;A second determination subunit, configured to determine whether the count value is equal to a value of the total data field;
第二判定子单元,用于若所述计数值等于所述数据总量字段的取值,则判定所述数据集合通过数据校验。A second determining subunit is configured to determine that the data set passes data verification if the count value is equal to a value of the data total amount field.
进一步地,所述批量存储模块可以包括:Further, the batch storage module may include:
区块段生成单元,用于生成与所述数据集合对应的区块段,所述区块段中包括与所述数据集合中的数据数量相等的区块,且所述区块段中的每个区块均根据所述数据集合中的一条数据生成;A block segment generating unit is configured to generate a block segment corresponding to the data set, where the block segment includes a block equal to the amount of data in the data set, and each of the block segments Each block is generated according to one piece of data in the data set;
区块段存储单元,用于将所述区块段存储入本地区块链中,并在所述区块链系统中广播所述区块段,以使所述区块链系统中的各个节点服务器将所述区块段存储入各自的本地区块链中。A block segment storage unit, configured to store the block segment in a local blockchain, and broadcast the block segment in the blockchain system, so that each node in the blockchain system The server stores the block segments into their respective local blockchains.
进一步地,所述区块段生成单元可以包括:Further, the block segment generating unit may include:
区块判断子单元,用于判断待生成区块是否为所述区块段中的第一个区块;A block judging subunit, configured to determine whether a block to be generated is the first block in the block segment;
第一链尾确定子单元,用于若所述待生成区块为所述区块段中的第一个区块,则将最新添加入所述本地区块链中的区块确定为链尾区块;A first chain tail determination subunit, configured to determine, if the block to be generated is the first block in the block segment, a block newly added to the local blockchain as a chain tail Block
第二链尾确定子单元,用于若所述待生成区块不是所述区块段中的第一个区块,则将最新添加入所述区块段中的区块确定为链尾区块;A second chain tail determining subunit, configured to determine, if the block to be generated is not the first block in the block segment, the block newly added to the block segment as the chain tail region Piece;
第一特征值计算子单元,用于对所述链尾区块的区块头进行特征运算,得到第一特征值;A first eigenvalue calculation subunit, configured to perform a feature operation on a block header of the chain tail block to obtain a first eigenvalue;
第二特征值计算子单元,用于对所述数据集合中与所述待生成区块对应的数据进行特征运算,得到第二特征值;A second eigenvalue calculation subunit, configured to perform a feature operation on data corresponding to the block to be generated in the data set to obtain a second eigenvalue;
区块生成子单元,用于根据所述第一特征值和所述第二特征值生成所述待生成区块的区块头,并根据所述数据集合中与所述待生成区块对应的数据生成所述待生成区块的区块主体。A block generation subunit, configured to generate a block header of the block to be generated according to the first characteristic value and the second characteristic value, and according to data in the data set corresponding to the block to be generated Generate a block body of the block to be generated.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置,模块和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the devices, modules, and units described above can refer to the corresponding processes in the foregoing method embodiments, and are not repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For a part that is not detailed or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
图6示出了本申请实施例提供的一种服务器的示意框图,为了便于说明,仅示出了与本申请实施例相关的部分。FIG. 6 shows a schematic block diagram of a server provided by an embodiment of the present application. For ease of description, only a part related to the embodiment of the present application is shown.
在本实施例中,所述服务器6可包括:处理器60、存储器61以及存储在所述存储器61中并可在所述处理器60上运行的计算机可读指令62,例如执行上述的数据存储方法的计算机可读指令。所述处理器60执行所述计算机可读指令62时实现上述各个数据存储方法实施例中的步骤。In this embodiment, the server 6 may include: a processor 60, a memory 61, and computer-readable instructions 62 stored in the memory 61 and executable on the processor 60, for example, to execute the foregoing data storage. Computer-readable instructions of the method. When the processor 60 executes the computer-readable instructions 62, the steps in the foregoing data storage method embodiments are implemented.
在本申请各个实施例中的各功能单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干计算机可读指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储计算机可读指令的介质。When each functional unit in each embodiment of the present application is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium. Including computer-readable instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), and a random access memory (RAM, Random Access) Memory), magnetic disks, or optical discs, which can store computer-readable instructions.

Claims (20)

  1. 一种数据存储方法,其特征在于,包括:A data storage method, comprising:
    接收数据操作请求,并从所述数据操作请求中提取预设的请求类型字段;Receiving a data operation request, and extracting a preset request type field from the data operation request;
    根据所述请求类型字段的取值确定所述数据操作请求的请求类型;Determining a request type of the data operation request according to a value of the request type field;
    若所述数据操作请求的请求类型为批量入链请求,则从所述批量入链请求中提取预设的数据总量字段,所述数据总量字段用于标识待存储的数据的总条数;If the request type of the data operation request is a batch on-chain request, a preset total data field is extracted from the batch on-chain request, and the total data field is used to identify a total number of data to be stored ;
    根据所述数据总量字段的取值从所述批量入链请求中提取待存储的数据集合,所述数据集合由各条待存储的数据组成;Extracting a data set to be stored from the batch on-chain request according to the value of the total data field, the data set is composed of each piece of data to be stored;
    使用预设的数据校验规则对所述数据集合进行数据校验;Perform data verification on the data set using a preset data verification rule;
    若所述数据集合通过数据校验,则将所述数据集合批量存储入预设的区块链系统中。If the data set passes the data verification, the data set is stored in batches into a preset blockchain system.
  2. 根据权利要求1所述的数据存储方法,其特征在于,所述使用预设的数据校验规则对所述数据集合进行数据校验包括:The data storage method according to claim 1, wherein the performing data verification on the data set using a preset data verification rule comprises:
    从所述数据操作请求中提取目标业务系统的业务系统标识,所述目标业务系统为发送所述数据操作请求的业务系统;Extracting a business system identifier of a target business system from the data operation request, where the target business system is a business system that sends the data operation request;
    在预设的数据校验规则库中查找目标校验规则,所述目标校验规则为与所述业务系统标识对应的数据校验规则;Searching a preset data verification rule database for a target verification rule, where the target verification rule is a data verification rule corresponding to the business system identifier;
    使用所述目标数据校验规则对所述数据集合进行数据校验。Perform data verification on the data set using the target data verification rule.
  3. 根据权利要求2所述的数据存储方法,其特征在于,所述使用所述目标数据校验规则对所述数据集合进行数据校验包括:The data storage method according to claim 2, wherein the performing data verification on the data set using the target data verification rule comprises:
    从所述数据集合中任意选取一条候选数据作为当前校验数据,所述候选数据为预设的校验标识位为第一位值的数据;Arbitrarily select a candidate data from the data set as current verification data, the candidate data is data with a preset verification identification bit being a first bit value;
    判断所述当前校验数据是否满足所述目标数据校验规则;Determining whether the current verification data meets the target data verification rule;
    若所述当前校验数据不满足所述目标数据校验规则,则判定所述数据集合未通过数据校验;If the current verification data does not satisfy the target data verification rule, determining that the data set fails the data verification;
    若所述当前校验数据满足所述目标数据校验规则,则将所述当前校验数据的校验标识位设置为第二位值,并将预设的计数值增加一个计数单位;If the current verification data meets the target data verification rule, setting a verification identification bit of the current verification data to a second bit value, and increasing a preset count value by one count unit;
    判断所述计数值是否等于所述数据总量字段的取值;Determining whether the count value is equal to the value of the total data field;
    若所述计数值小于所述数据总量字段的取值,则返回执行所述从所述数据集合中任意选取一条候选数据作为当前校验数据的步骤,直至所述计数值等于于所述数据总量字段的取值为止;If the count value is less than the value of the total data field, return to and execute the step of randomly selecting a candidate data from the data set as the current verification data until the count value is equal to the data Up to the value of the total field;
    若所述计数值等于所述数据总量字段的取值,则判定所述数据集合通过数据校验。If the count value is equal to the value of the total data field, it is determined that the data set passes the data check.
  4. 根据权利要求1至3任一项所述的数据存储方法,其特征在于,所述将所述数据集合批量存储入预设的区块链系统中包括:The data storage method according to any one of claims 1 to 3, wherein the batch storing the data set into a preset blockchain system comprises:
    生成与所述数据集合对应的区块段,所述区块段中包括与所述数据集合中的数据数量相等的区块,且所述区块段中的每个区块均根据所述数据集合中的一条数据生成;Generate a block segment corresponding to the data set, the block segment including a block equal to the amount of data in the data set, and each block in the block segment is based on the data Generate a piece of data in the collection;
    将所述区块段存储入本地区块链中,并在所述区块链系统中广播所述区块段,以使所述区块链系统中的各个节点服务器将所述区块段存储入各自的本地区块链中。Storing the block segment into a local blockchain, and broadcasting the block segment in the blockchain system, so that each node server in the blockchain system stores the block segment Into their respective local blockchains.
  5. 根据权利要求4所述的数据存储方法,其特征在于,所述区块段中的每个区块的生成过程包括:The data storage method according to claim 4, wherein the generation process of each block in the block segment comprises:
    判断待生成区块是否为所述区块段中的第一个区块;Determining whether the block to be generated is the first block in the block segment;
    若所述待生成区块为所述区块段中的第一个区块,则将最新添加入所述本地区块链中的区块确定为链尾区块;If the block to be generated is the first block in the block segment, determining a block newly added to the local block chain as a chain tail block;
    若所述待生成区块不是所述区块段中的第一个区块,则将最新添加入所述区块段中的区块确定为链尾区块;If the block to be generated is not the first block in the block segment, determining the most recently added block in the block segment as a chain tail block;
    对所述链尾区块的区块头进行特征运算,得到第一特征值;Performing a characteristic operation on a block header of the chain tail block to obtain a first characteristic value;
    对所述数据集合中与所述待生成区块对应的数据进行特征运算,得到第二特征值;Performing a feature operation on data corresponding to the block to be generated in the data set to obtain a second feature value;
    根据所述第一特征值和所述第二特征值生成所述待生成区块的区块头,并根据所述数据集合中与所述待生成区块对应的数据生成所述待生成区块的区块主体。Generate a block header of the block to be generated according to the first characteristic value and the second characteristic value, and generate a block of the block to be generated according to data in the data set corresponding to the block to be generated Block body.
  6. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:A computer-readable storage medium storing computer-readable instructions, wherein the computer-readable instructions implement the following steps when executed by a processor:
    接收数据操作请求,并从所述数据操作请求中提取预设的请求类型字段;Receiving a data operation request, and extracting a preset request type field from the data operation request;
    根据所述请求类型字段的取值确定所述数据操作请求的请求类型;Determining a request type of the data operation request according to a value of the request type field;
    若所述数据操作请求的请求类型为批量入链请求,则从所述批量入链请求中提取预设的数据总量字段,所述数据总量字段用于标识待存储的数据的总条数;If the request type of the data operation request is a batch on-chain request, a preset total data field is extracted from the batch on-chain request, and the total data field is used to identify a total number of data to be stored ;
    根据所述数据总量字段的取值从所述批量入链请求中提取待存储的数据集合,所述数据集合由各条待存储的数据组成;Extracting a data set to be stored from the batch on-chain request according to the value of the total data field, the data set is composed of each piece of data to be stored;
    使用预设的数据校验规则对所述数据集合进行数据校验;Perform data verification on the data set using a preset data verification rule;
    若所述数据集合通过数据校验,则将所述数据集合批量存储入预设的区块链系统中。If the data set passes the data verification, the data set is stored in batches into a preset blockchain system.
  7. 根据权利要求6所述的计算机可读存储介质,其特征在于,所述使用预设的数据校验规则对所述数据集合进行数据校验包括:The computer-readable storage medium according to claim 6, wherein the performing data verification on the data set using a preset data verification rule comprises:
    从所述数据操作请求中提取目标业务系统的业务系统标识,所述目标业务系统为发送所述数据操作请求的业务系统;Extracting a business system identifier of a target business system from the data operation request, where the target business system is a business system that sends the data operation request;
    在预设的数据校验规则库中查找目标校验规则,所述目标校验规则为与所述业务系统标识对应的数据校验规则;Searching a preset data verification rule database for a target verification rule, where the target verification rule is a data verification rule corresponding to the business system identifier;
    使用所述目标数据校验规则对所述数据集合进行数据校验。Perform data verification on the data set using the target data verification rule.
  8. 根据权利要求7所述的计算机可读存储介质,其特征在于,所述使用所述目标数据校验规则对所述数据集合进行数据校验包括:The computer-readable storage medium according to claim 7, wherein the performing data verification on the data set using the target data verification rule comprises:
    从所述数据集合中任意选取一条候选数据作为当前校验数据,所述候选数据为预设的校验标识位为第一位值的数据;Arbitrarily select a candidate data from the data set as current verification data, the candidate data is data with a preset verification identification bit being a first bit value;
    判断所述当前校验数据是否满足所述目标数据校验规则;Determining whether the current verification data meets the target data verification rule;
    若所述当前校验数据不满足所述目标数据校验规则,则判定所述数据集合未通过数据校验;If the current verification data does not satisfy the target data verification rule, determining that the data set fails the data verification;
    若所述当前校验数据满足所述目标数据校验规则,则将所述当前校验数据的校验标识位设置为第二位值,并将预设的计数值增加一个计数单位;If the current verification data meets the target data verification rule, setting a verification identification bit of the current verification data to a second bit value, and increasing a preset count value by one count unit;
    判断所述计数值是否等于所述数据总量字段的取值;Determining whether the count value is equal to the value of the total data field;
    若所述计数值小于所述数据总量字段的取值,则返回执行所述从所述数据集合中任意选取一条候选数据作为当前校验数据的步骤,直至所述计数值等于于所述数据总量字段的取值为止;If the count value is less than the value of the total data field, return to and execute the step of randomly selecting a candidate data from the data set as the current verification data until the count value is equal to the data Up to the value of the total field;
    若所述计数值等于所述数据总量字段的取值,则判定所述数据集合通过数据校验。If the count value is equal to the value of the total data field, it is determined that the data set passes the data check.
  9. 根据权利要求6至8任一项所述的计算机可读存储介质,其特征在于,所述将所述数据集合批量存储入预设的区块链系统中包括:The computer-readable storage medium according to any one of claims 6 to 8, wherein the batch storing the data set into a preset blockchain system comprises:
    生成与所述数据集合对应的区块段,所述区块段中包括与所述数据集合中的数据数量相等的区块,且所述区块段中的每个区块均根据所述数据集合中的一条数据生成;Generate a block segment corresponding to the data set, the block segment including a block equal to the amount of data in the data set, and each block in the block segment is based on the data Generate a piece of data in the collection;
    将所述区块段存储入本地区块链中,并在所述区块链系统中广播所述区块段,以使所述区块链系统中的各个节点服务器将所述区块段存储入各自的本地区块链中。Storing the block segment into a local blockchain, and broadcasting the block segment in the blockchain system, so that each node server in the blockchain system stores the block segment Into their respective local blockchains.
  10. 根据权利要求9所述的计算机可读存储介质,其特征在于,所述区块段中的每个区块的生成过程包括:The computer-readable storage medium according to claim 9, wherein the generation process of each block in the block segment comprises:
    判断待生成区块是否为所述区块段中的第一个区块;Determining whether the block to be generated is the first block in the block segment;
    若所述待生成区块为所述区块段中的第一个区块,则将最新添加入所述本地区块链中的区块确定为链尾区块;If the block to be generated is the first block in the block segment, determining a block newly added to the local block chain as a chain tail block;
    若所述待生成区块不是所述区块段中的第一个区块,则将最新添加入所述区块段中的区块确定为链尾区块;If the block to be generated is not the first block in the block segment, determining the most recently added block in the block segment as a chain tail block;
    对所述链尾区块的区块头进行特征运算,得到第一特征值;Performing a characteristic operation on a block header of the chain tail block to obtain a first characteristic value;
    对所述数据集合中与所述待生成区块对应的数据进行特征运算,得到第二特征值;Performing a feature operation on data corresponding to the block to be generated in the data set to obtain a second feature value;
    根据所述第一特征值和所述第二特征值生成所述待生成区块的区块头,并根据所述数据集合中与所述待生成区块对应的数据生成所述待生成区块的区块主体。Generate a block header of the block to be generated according to the first characteristic value and the second characteristic value, and generate a block of the block to be generated according to data in the data set corresponding to the block to be generated Block body.
  11. 一种服务器,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:A server includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and is characterized in that, when the processor executes the computer-readable instructions, the following steps are implemented: :
    接收数据操作请求,并从所述数据操作请求中提取预设的请求类型字段;Receiving a data operation request, and extracting a preset request type field from the data operation request;
    根据所述请求类型字段的取值确定所述数据操作请求的请求类型;Determining a request type of the data operation request according to a value of the request type field;
    若所述数据操作请求的请求类型为批量入链请求,则从所述批量入链请求中提取预设的数据总量字段,所述数据总量字段用于标识待存储的数据的总条数;If the request type of the data operation request is a batch on-chain request, a preset total data field is extracted from the batch on-chain request, and the total data field is used to identify a total number of data to be stored ;
    根据所述数据总量字段的取值从所述批量入链请求中提取待存储的数据集合,所述数据集合由各条待存储的数据组成;Extracting a data set to be stored from the batch on-chain request according to the value of the total data field, the data set is composed of each piece of data to be stored;
    使用预设的数据校验规则对所述数据集合进行数据校验;Perform data verification on the data set using a preset data verification rule;
    若所述数据集合通过数据校验,则将所述数据集合批量存储入预设的区块链系统中。If the data set passes the data verification, the data set is stored in batches into a preset blockchain system.
  12. 根据权利要求11所述的服务器,其特征在于,所述使用预设的数据校验规则对所述数据集合进行数据校验包括:The server according to claim 11, wherein the performing data verification on the data set using a preset data verification rule comprises:
    从所述数据操作请求中提取目标业务系统的业务系统标识,所述目标业务系统为发送所述数据操作请求的业务系统;Extracting a business system identifier of a target business system from the data operation request, where the target business system is a business system that sends the data operation request;
    在预设的数据校验规则库中查找目标校验规则,所述目标校验规则为与所述业务系统标识对应的数据校验规则;Searching a preset data verification rule database for a target verification rule, where the target verification rule is a data verification rule corresponding to the business system identifier;
    使用所述目标数据校验规则对所述数据集合进行数据校验。Perform data verification on the data set using the target data verification rule.
  13. 根据权利要求12所述的服务器,其特征在于,所述使用所述目标数据校验规则对所述数据集合进行数据校验包括:The server according to claim 12, wherein the performing data verification on the data set using the target data verification rule comprises:
    从所述数据集合中任意选取一条候选数据作为当前校验数据,所述候选数据为预设的校验标识位为第一位值的数据;Arbitrarily select a candidate data from the data set as current verification data, the candidate data is data with a preset verification identification bit being a first bit value;
    判断所述当前校验数据是否满足所述目标数据校验规则;Determining whether the current verification data meets the target data verification rule;
    若所述当前校验数据不满足所述目标数据校验规则,则判定所述数据集合未通过数据校验;If the current verification data does not satisfy the target data verification rule, determining that the data set fails the data verification;
    若所述当前校验数据满足所述目标数据校验规则,则将所述当前校验数据的校验标识位设置为第二位值,并将预设的计数值增加一个计数单位;If the current verification data meets the target data verification rule, setting a verification identification bit of the current verification data to a second bit value, and increasing a preset count value by one count unit;
    判断所述计数值是否等于所述数据总量字段的取值;Determining whether the count value is equal to the value of the total data field;
    若所述计数值小于所述数据总量字段的取值,则返回执行所述从所述数据集合中任意选取一条候选数据作为当前校验数据的步骤,直至所述计数值等于于所述数据总量字段的取值为止;If the count value is less than the value of the total data field, return to and execute the step of randomly selecting a candidate data from the data set as the current verification data until the count value is equal to the data Up to the value of the total field;
    若所述计数值等于所述数据总量字段的取值,则判定所述数据集合通过数据校验。If the count value is equal to the value of the total data field, it is determined that the data set passes the data check.
  14. 根据权利要求11至13中任一项所述的服务器,其特征在于,所述将所述数据集合批量存储入预设的区块链系统中包括:The server according to any one of claims 11 to 13, wherein the batch storing the data sets into a preset blockchain system comprises:
    生成与所述数据集合对应的区块段,所述区块段中包括与所述数据集合中的数据数量相等的区块,且所述区块段中的每个区块均根据所述数据集合中的一条数据生成;Generate a block segment corresponding to the data set, the block segment including a block equal to the amount of data in the data set, and each block in the block segment is based on the data Generate a piece of data in the collection;
    将所述区块段存储入本地区块链中,并在所述区块链系统中广播所述区块段,以使所述区块链系统中的各个节点服务器将所述区块段存储入各自的本地区块链中。Storing the block segment into a local blockchain, and broadcasting the block segment in the blockchain system, so that each node server in the blockchain system stores the block segment Into their respective local blockchains.
  15. 根据权利要求14所述的服务器,其特征在于,所述区块段中的每个区块的生成过程包括:The server according to claim 14, wherein the generation process of each block in the block segment comprises:
    判断待生成区块是否为所述区块段中的第一个区块;Determining whether the block to be generated is the first block in the block segment;
    若所述待生成区块为所述区块段中的第一个区块,则将最新添加入所述本地区块链中的区块确定为链尾区块;If the block to be generated is the first block in the block segment, determining a block newly added to the local block chain as a chain tail block;
    若所述待生成区块不是所述区块段中的第一个区块,则将最新添加入所述区块段中的区块确定为链尾区块;If the block to be generated is not the first block in the block segment, determining the most recently added block in the block segment as a chain tail block;
    对所述链尾区块的区块头进行特征运算,得到第一特征值;Performing a characteristic operation on a block header of the chain tail block to obtain a first characteristic value;
    对所述数据集合中与所述待生成区块对应的数据进行特征运算,得到第二特征值;Performing a feature operation on data corresponding to the block to be generated in the data set to obtain a second feature value;
    根据所述第一特征值和所述第二特征值生成所述待生成区块的区块头,并根据所述数据集合中与所述待生成区块对应的数据生成所述待生成区块的区块主体。Generate a block header of the block to be generated according to the first characteristic value and the second characteristic value, and generate a block of the block to be generated according to data in the data set corresponding to the block to be generated Block body.
  16. 一种数据存储装置,其特征在于,包括:A data storage device, comprising:
    请求接收模块,用于接收数据操作请求,并从所述数据操作请求中提取预设的请求类型字段;A request receiving module, configured to receive a data operation request and extract a preset request type field from the data operation request;
    请求类型确定模块,用于根据所述请求类型字段的取值确定所述数据操作请求的请求类型;A request type determining module, configured to determine a request type of the data operation request according to a value of the request type field;
    数据总量字段提取模块,用于若所述数据操作请求的请求类型为批量入链请求,则从所述批量入链请求中提取预设的数据总量字段,所述数据总量字段用于标识待存储的数据的总条数;The data total amount field extracting module is configured to extract a preset data total amount field from the batch link input request if the request type of the data operation request is a batch input link request, and the data total amount field is used for Identifies the total number of data to be stored;
    数据集合提取模块,用于根据所述数据总量字段的取值从所述批量入链请求中提取待存储的数据集合,所述数据集合由各条待存储的数据组成;A data set extraction module, configured to extract a data set to be stored from the batch on-chain request according to a value of the data total amount field, where the data set is composed of each piece of data to be stored;
    数据校验模块,用于使用预设的数据校验规则对所述数据集合进行数据校验;A data verification module, configured to perform data verification on the data set using a preset data verification rule;
    批量存储模块,用于若所述数据集合通过数据校验,则将所述数据集合批量存储入预设的区块链系统中。A batch storage module is configured to batch store the data set into a preset blockchain system if the data set passes data verification.
  17. 根据权利要求16所述的数据存储装置,其特征在于,所述数据校验模块包括:The data storage device according to claim 16, wherein the data verification module comprises:
    业务系统标识提取单元,用于从所述数据操作请求中提取目标业务系统的业务系统标识,所述目标业务系统为发送所述数据操作请求的业务系统;A service system identifier extraction unit, configured to extract a service system identifier of a target service system from the data operation request, where the target service system is a service system that sends the data operation request;
    目标校验规则查找单元,用于在预设的数据校验规则库中查找目标校验规则,所述目标校验规则为与所述业务系统标识对应的数据校验规则;A target verification rule searching unit, configured to find a target verification rule in a preset data verification rule database, where the target verification rule is a data verification rule corresponding to the business system identifier;
    数据校验单元,用于使用所述目标数据校验规则对所述数据集合进行数据校验。A data verification unit is configured to perform data verification on the data set using the target data verification rule.
  18. 根据权利要求17所述的数据存储装置,其特征在于,所述数据校验单元包括:The data storage device according to claim 17, wherein the data verification unit comprises:
    当前校验数据选取子单元,用于从所述数据集合中任意选取一条候选数据作为当前校验数据,所述候选数据为预设的校验标识位为第一位值的数据;A current verification data selection subunit, configured to arbitrarily select a candidate data from the data set as the current verification data, where the candidate data is data with a preset verification identification bit being a first value;
    第一判断子单元,用于判断所述当前校验数据是否满足所述目标数据校验规则;A first judging subunit, configured to judge whether the current verification data meets the target data verification rule;
    第一判定子单元,用于若所述当前校验数据不满足所述目标数据校验规则,则判定所述数据集合未通过数据校验;A first determining subunit, configured to determine that the data set fails the data verification if the current verification data does not satisfy the target data verification rule;
    第一处理子单元,用于若所述当前校验数据满足所述目标数据校验规则,则将所述当前校验数据的校验标识位设置为第二位值,并将预设的计数值增加一个计数单位;A first processing subunit, configured to set a verification flag bit of the current verification data to a second value if the current verification data meets the target data verification rule, and set a preset count Increment the value by one count;
    第二判断子单元,用于判断所述计数值是否等于所述数据总量字段的取值;A second determination subunit, configured to determine whether the count value is equal to a value of the total data field;
    第二判定子单元,用于若所述计数值等于所述数据总量字段的取值,则判定所述数据集合通过数据校验。A second determining subunit is configured to determine that the data set passes data verification if the count value is equal to a value of the data total amount field.
  19. 根据权利要求16至18中任一项所述的数据存储装置,其特征在于,所述批量存储模块包括:The data storage device according to any one of claims 16 to 18, wherein the batch storage module comprises:
    区块段生成单元,用于生成与所述数据集合对应的区块段,所述区块段中包括与所述数据集合中的数据数量相等的区块,且所述区块段中的每个区块均根据所述数据集合中的一条数据生成;A block segment generating unit is configured to generate a block segment corresponding to the data set, where the block segment includes a block equal to the amount of data in the data set, and each of the block segments Each block is generated according to one piece of data in the data set;
    区块段存储单元,用于将所述区块段存储入本地区块链中,并在所述区块链系统中广播所述区块段,以使所述区块链系统中的各个节点服务器将所述区块段存储入各自的本地区块链中。A block segment storage unit, configured to store the block segment in a local blockchain, and broadcast the block segment in the blockchain system, so that each node in the blockchain system The server stores the block segments into their respective local blockchains.
  20. 根据权利要求19所述的数据存储装置,其特征在于,所述区块段生成单元包括:The data storage device according to claim 19, wherein the block segment generating unit comprises:
    区块判断子单元,用于判断待生成区块是否为所述区块段中的第一个区块;A block judging subunit, configured to determine whether a block to be generated is the first block in the block segment;
    第一链尾确定子单元,用于若所述待生成区块为所述区块段中的第一个区块,则将最新添加入所述本地区块链中的区块确定为链尾区块;A first chain tail determination subunit, configured to determine, if the block to be generated is the first block in the block segment, a block newly added to the local blockchain as a chain tail Block
    第二链尾确定子单元,用于若所述待生成区块不是所述区块段中的第一个区块,则将最新添加入所述区块段中的区块确定为链尾区块;A second chain tail determining subunit, configured to determine, if the block to be generated is not the first block in the block segment, the block newly added to the block segment as the chain tail region Piece;
    第一特征值计算子单元,用于对所述链尾区块的区块头进行特征运算,得到第一特征值;A first eigenvalue calculation subunit, configured to perform a feature operation on a block header of the chain tail block to obtain a first eigenvalue;
    第二特征值计算子单元,用于对所述数据集合中与所述待生成区块对应的数据进行特征运算,得到第二特征值;A second eigenvalue calculation subunit, configured to perform a feature operation on data corresponding to the block to be generated in the data set to obtain a second eigenvalue;
    区块生成子单元,用于根据所述第一特征值和所述第二特征值生成所述待生成区块的区块头,并根据所述数据集合中与所述待生成区块对应的数据生成所述待生成区块的区块主体。A block generation subunit, configured to generate a block header of the block to be generated according to the first characteristic value and the second characteristic value, and according to data in the data set corresponding to the block to be generated Generate a block body of the block to be generated.
PCT/CN2018/123786 2018-09-03 2018-12-26 Data storage method, computer-readable storage medium, server, and apparatus WO2020048054A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811022476.X 2018-09-03
CN201811022476.XA CN109446208A (en) 2018-09-03 2018-09-03 A kind of date storage method, computer readable storage medium and server

Publications (1)

Publication Number Publication Date
WO2020048054A1 true WO2020048054A1 (en) 2020-03-12

Family

ID=65533202

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/123786 WO2020048054A1 (en) 2018-09-03 2018-12-26 Data storage method, computer-readable storage medium, server, and apparatus

Country Status (2)

Country Link
CN (1) CN109446208A (en)
WO (1) WO2020048054A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4066139A4 (en) * 2020-11-25 2022-11-23 Alipay (Hangzhou) Information Technology Co., Ltd. Blockchain-based trusted platform

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109977089A (en) * 2019-03-13 2019-07-05 深圳壹账通智能科技有限公司 Blog management method, device, computer equipment and computer readable storage medium
CN110309160B (en) * 2019-05-22 2023-07-04 平安科技(深圳)有限公司 Data in-link transaction processing method, device, computer equipment and storage medium
CN110233842B (en) * 2019-06-10 2021-07-27 腾讯科技(深圳)有限公司 Request verification method and related device
CN110363663B (en) * 2019-07-12 2023-08-22 深圳前海微众银行股份有限公司 Block chain-based data batch processing method, device, equipment and storage medium
CN111274350B (en) * 2020-02-03 2023-06-23 广州极尚网络技术有限公司 Data processing method, device, computer equipment and storage medium
CN112579832B (en) * 2020-12-07 2024-06-07 中国民航信息网络股份有限公司 Grouping verification method and device for voyage transportation data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253980A (en) * 2011-06-23 2011-11-23 上海西本网络科技有限公司 Data processing method and data processing system
CN106326397A (en) * 2016-08-19 2017-01-11 东软集团股份有限公司 Method and device for generating index file
US20170236104A1 (en) * 2016-02-12 2017-08-17 D+H Usa Corporation Peer-to-Peer Financial Transactions Using A Private Distributed Ledger
CN107122682A (en) * 2017-04-20 2017-09-01 杭州铜板街互联网金融信息服务有限公司 The data processing method and system stored based on block chain
CN108389129A (en) * 2018-02-27 2018-08-10 阿里巴巴集团控股有限公司 Transaction based on block chain executes method and device, electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA3039031C (en) * 2016-10-06 2022-06-21 Mastercard International Incorporated Method and system for identity and credential protection and verification via blockchain
CN107888483A (en) * 2017-11-23 2018-04-06 上海勋立信息科技有限公司 A kind of Email content batch joining method and device
CN108446314B (en) * 2018-02-07 2021-08-13 平安科技(深圳)有限公司 Student information storage method, computer readable storage medium and terminal equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253980A (en) * 2011-06-23 2011-11-23 上海西本网络科技有限公司 Data processing method and data processing system
US20170236104A1 (en) * 2016-02-12 2017-08-17 D+H Usa Corporation Peer-to-Peer Financial Transactions Using A Private Distributed Ledger
CN106326397A (en) * 2016-08-19 2017-01-11 东软集团股份有限公司 Method and device for generating index file
CN107122682A (en) * 2017-04-20 2017-09-01 杭州铜板街互联网金融信息服务有限公司 The data processing method and system stored based on block chain
CN108389129A (en) * 2018-02-27 2018-08-10 阿里巴巴集团控股有限公司 Transaction based on block chain executes method and device, electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4066139A4 (en) * 2020-11-25 2022-11-23 Alipay (Hangzhou) Information Technology Co., Ltd. Blockchain-based trusted platform

Also Published As

Publication number Publication date
CN109446208A (en) 2019-03-08

Similar Documents

Publication Publication Date Title
WO2020048054A1 (en) Data storage method, computer-readable storage medium, server, and apparatus
CN109034809B (en) Block chain generation method and device, block chain node and storage medium
TWI694390B (en) Blockchain-based transaction processing method and device, and electronic equipment
CN108681572B (en) Data storage method and device of block chain and electronic equipment
US11823178B2 (en) Optimization of high volume transaction performance on a blockchain
TWI734088B (en) Block chain-based transaction processing method and device, and electronic equipment
EP3816910B1 (en) Blockchain-based transaction processing method and apparatus, and electronic device
CN110597825B (en) Data processing method and device based on block chain and node equipment
US8055633B2 (en) Method, system and computer program product for duplicate detection
US20170132260A1 (en) Data storage method and apparatus
CN111523890B (en) Block chain-based data processing method, device, storage medium and equipment
JP2020509445A5 (en)
US20230074102A1 (en) Method and apparatus for processing data based on block chain, device and readable storage medium
CN112907369B (en) Block chain-based data consensus method and device, electronic equipment and storage medium
CN110413650B (en) Method, device, equipment and storage medium for processing service data
CN110597918B (en) Account management method, account management device and computer readable storage medium
WO2019076102A1 (en) Data rollback method and system, device, and computer readable storage medium
CN108256870B (en) Method and device for generating description information, updating and processing data based on topological structure
WO2021012932A1 (en) Transaction rollback method and device, database, system, and computer storage medium
CN111698094A (en) Consensus method based on block chain system and block chain system
WO2021057482A1 (en) Method and device for generating bloom filter in blockchain
CN112769775B (en) Threat information association analysis method, system, equipment and computer medium
CN113596010B (en) Data processing method, device, node equipment and computer storage medium
WO2023011019A1 (en) Blockchain-based data processing method and apparatus, device, readable storage medium and computer program product
WO2021027612A1 (en) Method and apparatus for executing transaction in blockchain

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18932758

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 10.06.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18932758

Country of ref document: EP

Kind code of ref document: A1