CN112307010B - Data storage method, device and equipment - Google Patents

Data storage method, device and equipment Download PDF

Info

Publication number
CN112307010B
CN112307010B CN201910689299.9A CN201910689299A CN112307010B CN 112307010 B CN112307010 B CN 112307010B CN 201910689299 A CN201910689299 A CN 201910689299A CN 112307010 B CN112307010 B CN 112307010B
Authority
CN
China
Prior art keywords
data
stored
block
user
configuration parameters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910689299.9A
Other languages
Chinese (zh)
Other versions
CN112307010A (en
Inventor
杨新颖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Original Assignee
Advanced New Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Advanced New Technologies Co Ltd filed Critical Advanced New Technologies Co Ltd
Priority to CN201910689299.9A priority Critical patent/CN112307010B/en
Publication of CN112307010A publication Critical patent/CN112307010A/en
Application granted granted Critical
Publication of CN112307010B publication Critical patent/CN112307010B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • 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

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)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A data storage method, apparatus and device are disclosed. Through the scheme provided by the embodiment of the specification, a user can set corresponding data structure configuration parameters according to own needs when creating an account book, so that when the database server receives data to be stored of the user, the database server can generate and store spliced data with a specific data structure by combining the service attribute determined by the configuration parameters. In the process, the database server does not need to know the specific content and business meaning of the user data, the configuration parameters and the business attributes are obtained by the user in combination with the actual requirements, and more flexible data storage is realized when the data is stored in the centralized block chain type account book.

Description

Data storage method, device and equipment
Technical Field
Embodiments of the present disclosure relate to the field of information technologies, and in particular, to a data storage method, apparatus, and device.
Background
When data is stored in a centralized block chain ledger, the data record structure and specific business meaning are not involved because the database server side generally stores the data record in an integral way. In practical application, the user needs to directly associate the stored data with the own business, so that the user can conveniently operate the database according to the own needs, and the business fields related to the data of each user are often different.
Based on this, a more flexible data storage scheme in a block chained ledger is needed.
Disclosure of Invention
An object of an embodiment of the present application is to provide a more flexible data storage method in a block chained ledger.
In order to solve the technical problems, the embodiment of the application is realized as follows:
a data storage method, comprising:
receiving data to be stored sent by a user, and acquiring data structure configuration parameters related to an account book, wherein the configuration parameters comprise service attributes;
determining a character string corresponding to the service attribute, wherein the character string represents the service attribute of the data to be stored of the user;
splicing the character string and the data to be stored to generate spliced data containing service attributes;
determining the hash value of the spliced data, and generating the hash value containing the data block and the Nth data block of the spliced data when a preset blocking condition is reached, wherein the method specifically comprises the following steps of:
when n=1, the hash value and the block height of the initial data block are given based on a preset manner;
when N >1, determining the hash value of the N data block according to the hash value of each spliced data and the N-1 data block in the data block to be written, and generating the N data block containing the hash value of the N data block and the spliced data, wherein the block heights of the data blocks are monotonically increased based on the sequence of the block forming time.
Correspondingly, the embodiment of the present specification further provides a data storage device, including:
the acquisition module is used for receiving data to be stored sent by a user and acquiring data structure configuration parameters related to an account book, wherein the configuration parameters comprise service attributes;
the determining module is used for determining a character string corresponding to the service attribute, wherein the character string represents the service attribute of the data to be stored of the user;
the splicing module splices the character strings and the data to be stored to generate spliced data containing service attributes;
the data block generation module determines the hash value of the spliced data, and generates the hash value containing the data block and the Nth data block of the spliced data when a preset blocking condition is reached, and specifically comprises the following steps:
when n=1, the hash value and the block height of the initial data block are given based on a preset manner;
when N >1, determining the hash value of the N data block according to the hash value of each spliced data and the N-1 data block in the data block to be written, and generating the N data block containing the hash value of the N data block and the spliced data, wherein the block heights of the data blocks are monotonically increased based on the sequence of the block forming time.
Through the scheme provided by the embodiment of the specification, a user can set corresponding data structure configuration parameters according to own needs when creating an account book, so that when the database server receives data to be stored of the user, the database server can generate and store spliced data with a specific data structure by combining the service attribute determined by the configuration parameters. In the process, the database server does not need to know the specific content and business meaning of the user data, the configuration parameters and the business attributes are obtained by the user in combination with the actual requirements, and more flexible data storage is realized when the data is stored in the centralized block chain type account book.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the embodiments of the disclosure.
Further, not all of the effects described above need be achieved in any of the embodiments of the present specification.
Drawings
In order to more clearly illustrate the embodiments of the present description or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present description, and other drawings may be obtained according to these drawings for a person having ordinary skill in the art.
FIG. 1 is a schematic diagram of a system architecture according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart of a data storage method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a block header of a data block according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a data storage device according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of an apparatus for configuring the method of the embodiments of the present specification.
Detailed Description
In order for those skilled in the art to better understand the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described in detail below with reference to the drawings in the embodiments of the present specification, and it is apparent that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification shall fall within the scope of protection.
In this specification, the database server provides the database service with the centralized block chain account, and the service object includes the organization and also includes the individual, as shown in fig. 1, and fig. 1 is a schematic diagram of a system architecture according to an embodiment of the present specification. In this architecture, the database server does not need to know the structure, specific content and business meaning of the data sent by the user, but directly uses the user data as a whole to carry out integral untampered certificate, so that the user can inquire and verify the data in the account book, and the specific storage mode will be described later.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings. As shown in fig. 2, fig. 2 is a schematic flow chart of a data storage method according to an embodiment of the present disclosure, where the flow chart specifically includes the following steps:
s201, receiving data to be stored sent by a user, and acquiring data structure configuration parameters related to an account book, wherein the configuration parameters comprise service attributes.
The data record to be stored can be various consumption records of individual users of the client, or can be business results, intermediate states, operation records and the like generated by the application server when executing business logic based on instructions of the users. Specific business scenarios may include consumption records, audit logs, supply chains, government regulatory records, medical records, financial transaction records, and the like.
The data structure configuration parameters are used to indicate the specific data structure configuration in the blockchain ledger. In other words, there is a corresponding data structure configuration parameter in each ledger, but the data structure configuration parameters of each ledger are independent.
For example, the data structure configuration parameters include business attributes. The business attributes characterize the business characteristics of the data records and may include user name, user identification number, institution name, transaction category, data record category, and the like. For example, in a data record containing a report uploaded by a financial institution, the business attribute may be a report number "G01" that characterizes the report category, i.e., a statistical table of liability items; alternatively, the data record may be an item number or the like to which the report belongs.
In addition, the data structure configuration parameters may further include a byte LENGTH of the service attribute to indicate a legal LENGTH of the service attribute, a sequence number parameter "SEQ" to indicate a number of the acquired data record in the ledger, and so on.
The service attributes may be characterized by some preset field, such as "CLUE", which the user may assign, such as "CLUE: ID ", a specific value characterizing the service attribute under the user, or" clie: g01″ or the like, the specific value of this field may be stored in some designated storage location, for example, in the block header of the original data block of the ledger, or in a data structure configuration file of the ledger. Thus, the database server can obtain the service attribute from the specified storage location.
Specifically, the user can create the account book through the creation instruction, and the data structure configuration parameters of the account book are contained in the creation instruction, so that the database server side can acquire the configuration parameters of the account book from the instruction, write the configuration parameters into the block head of the initial data block of the created account book, and meanwhile, generate the data record containing the creation instruction, and write the data record into the block of the initial data block. The initial data block can be queried at any time later to obtain how the user creates the account book.
Meanwhile, when the account book is created, a data structure parameter configuration file of the account book can be generated, wherein parameter values in the data structure parameter configuration file are parameter values in a creation instruction, and the data structure parameter configuration file is used for configuring the type of configuration parameters of the account book and the specific parameter values of each parameter. In other words, after the parameter values are initially set, the user may also implement the modification of the configuration parameters by modifying the configuration file.
For example, the user may initiate an instruction createLedger (LedgerID, CLUE: ID) to the database server, where "LedgerID" is a ledger ID, "CLUE: the ID' is characterized in that the business attribute of the account book is set as a user ID; or, the user may initiate an instruction createLedger (LedgerID, CLUE: G01) to the database server, CLUE: g01 "is characterized by modifying the value of the business attribute of the account book to" G01".
Based on the foregoing, the database server may obtain the data structure configuration parameters from the data structure parameter configuration file of the ledger; or acquiring the data structure configuration parameters from the initial data block in the account book. And when the two are inconsistent, the data structure parameter configuration file is subject to control.
S203, determining a character string corresponding to the service attribute, wherein the character string represents the service attribute of the data to be stored of the user.
As previously mentioned, the business attributes may be characterized by specific strings. For example, for the field "CLUE", the user may perform a generic assignment "CLUE" on some specified legal characters (i.e., characters whose meaning can be recognized by the data server): the ID ", so that the database server may determine the ID of the user (generally, the digital ID when the user logs in to the client, or the login name, the mobile phone number, etc.) as the character string corresponding to the service attribute. The legal characters can be predefined in advance by the data service end, the number of the legal characters can be multiple, and one legal character is used for representing one characteristic of a user or data to be stored. For example, the ID characterizes the user identification.
For example, if users a and B both define IDs as business attributes of their respective ledgers. If the ID of the user a is "UID2019", the character string corresponding to the service attribute of the user a is "UID2019"; if the ID of the user B is "UID2020", the character string corresponding to the service attribute is "UID2020" for the user B.
Alternatively, the user may customize the string to perform a personality assignment, such as "CLUE: g01", the database server cannot recognize the meaning of G01, but still uses G01 as the business attribute of the account. Thus, the character string "G01" is determined as the character string corresponding to the service attribute.
And S205, splicing the character strings and the data to be stored to generate spliced data containing service attributes.
Specifically, the manner of stitching may include placing the string in the head, or placing the string in the tail. Alternatively, the head and tail may be allocated a specified space to distinguish the head and tail of the data record from the data to be stored contained therein.
Without limiting the length of the head or tail in the splice data, the strings will be completely spliced. Special identification characters may need to be used for identifying the character string, e.g. with "OE" as the beginning identification character, with "OF" as the ending identification character, etc.
For example, if the DATA to be stored uploaded by the user a is "DATA", the spliced DATA including the service attribute obtained by splicing is "UID2019DAT"; or when the identification character exists, the generated spliced data is 'OEUID 2019 OFDATA'.
For another example, when the occupation space of the head and tail is designated, the following form is also possible: the [ UID2019] [ DATA ], wherein the "[ UID2019]" occupies a specified space length, and the insufficient part can be complemented by invalid characters, so that the head part and the DATA can be effectively identified in the mode, and the business attribute and the DATA text contained in the DATA record can be conveniently identified.
In one embodiment, the configuration parameters may also define the byte length of the service attributes. For example, the data structure configuration parameters are identified by the instruction CreateLedger (LedgerID, CLUE: ID, 20): the user's ID is taken as a service attribute while the legal byte length is no more than 20.
In this embodiment, if the character string of the service attribute exceeds the predefined subsection length, the excess part is removed, the first 20 characters (i.e., the predefined byte length) in the character string are directly taken as the intercepted character string, and the intercepted character string and the data to be stored are spliced to generate spliced data.
S207, determining the hash value of the spliced data, and generating the hash value containing the data block and the Nth data block of the spliced data when a preset blocking condition is reached.
The preset blocking conditions include: the number of spliced data to be stored reaches a number threshold, for example, each time one thousand spliced data are received, a new data block is generated, and one thousand spliced data are written into the block; alternatively, the time interval from the last block forming time reaches a time threshold, for example, every 5 minutes, a new data block is generated, and the spliced data received within the 5 minutes is written into the block.
Here, N refers to the sequence number of the data block, in other words, in the embodiment of the present specification, the data blocks are in the form of a block chain, and are arranged in sequence based on the sequence of the block forming time, which has a strong timing characteristic. Wherein the block heights of the data blocks monotonically increase based on the order of the block times. The block height may be a sequence number, and at this time, the block height of the nth data block is N; the block heights may also be generated in other ways, for example, by transforming a block-wise time-symmetric encryption of a block of data into monotonically increasing large integer data as block heights.
When n=1, that is, the data block at this time is the initial data block. The hash value and block height of the initial data block are given based on a preset manner. For example, the initial data block does not include splice data, the hash value is any given hash value, and the block height blknum=0; for another example, the generation trigger condition of the initial data block is identical to the trigger condition of the other data blocks, but the hash value of the initial data block is determined by hashing all the contents in the initial data block.
In the embodiment of the present disclosure, the user may write the configuration parameters of the data structure into the initial data block, and write the related instructions when creating the ledger into the data block in the form of a data record for later querying.
When N >1, since the content and hash value of the previous data block have been determined, at this time, the hash value of the current data block (nth data block) may be generated based on the hash value of the previous data block (i.e., nth-1 data block), for example, in a feasible manner, the hash value of each piece of spliced data to be written into the nth block is determined, a merck tree is generated according to the arrangement order in the block, the root hash value of the merck tree and the hash value of the previous data block are spliced together, and the hash algorithm is again adopted to generate the hash value of the current block. For example, the hash value of the whole data record in the same data block can be obtained by splicing the sequence of the data records in the block and taking the hash, the hash value of the previous data block and the hash value of the whole data record are spliced, and the hash operation is performed on the word strings obtained by splicing to generate the hash value of the data block.
After the user successfully uploads the data, the hash value of the corresponding data record and the hash value of the data block can be obtained and stored, and the integrity verification can be initiated based on the hash value. The specific verification method is to recalculate the hash value of the data record and the hash value of the data block in the database, and compare the hash value with the hash value stored locally.
The data block generated in the above manner may include a block header and a block body. The block can be used for storing plaintext of spliced data or hash value of spliced data and the like; the block header may be used to store metadata about the present data block, such as a version number of an account book, a hash value of a previous data block, a root hash value of a merck tree formed by spliced data in the own data block, a hash value of the own data block, a state array for recording an operated state of the spliced data, and the like. For example, the data structure configuration parameters may be written in a block header in the initial data block. As shown in fig. 3, fig. 3 is a schematic diagram of a block header of a data block according to an embodiment of the present disclosure. In the initial data block, the part_hash may be null and may also include other data structure configuration parameters such as CLUE and LENGTH. In practical applications, each field will have an actual assignment (e.g., a specific value of part_hash is a character string of 256 lengths, a specific value of CLUE is "ID", etc.), and the specific assignment is not shown in the diagram.
By the foregoing generation method of the data blocks, each data block is determined by a hash value, and the hash value of the data block is determined by the content and sequence of the spliced data in the data block and the hash value of the previous data block. The user can initiate verification based on the hash value of the data block at any time, and the modification of any content in the data block (including modification of the content or sequence of the data record in the data block) can cause inconsistency between the hash value of the data block calculated during verification and the hash value generated during data block generation, so that verification failure is caused, and therefore, the tamper-proof effect under centralization is realized.
Through the scheme provided by the embodiment of the specification, a user can set corresponding data structure configuration parameters according to own needs when creating an account book, so that when the database server receives data to be stored of the user, the database server can combine the service attribute determined by the configuration parameters to generate spliced data with a specific data structure. In the process, the database server side does not need to know the specific content and business meaning of the user data, the configuration parameters and the business attributes are obtained by the user according to the actual requirements, and more flexible data storage is realized when the data are stored in the centralized block chain type account book.
In one embodiment, the configuration parameters further include a sequence number parameter, where the sequence number parameter is used to indicate a sequence number for acquiring the data to be stored. In other words, when the database server receives the data record to be stored of the user, the database server can judge whether the data record to be stored needs sequential numbering through the sequence number parameter. If the value of the sequence number parameter in the configuration parameter of the user account is the sequence number to be acquired, the database server needs to determine the sequence number for each piece of data to be stored in the account, otherwise, the sequence number is not needed.
For example, the user may modify the value of the sequence number parameter in the configuration parameters by an instruction, for example, when creating an account book, input the instruction createLedger (LedgerID, CLUE, NULL), set the value of the sequence number parameter to "NULL", indicating that no sequential numbering is required; or inputting an instruction CreateLedger (LedgerID, CLUE, SEQ-NUM) which indicates that sequence numbers appointed by a user are acquired from a data record to be stored; or, an input instruction createLedger (LedgerID, CLUE, SEQ-TIME) indicates that the database server determines the sequence number according to the TIME of the received data.
Correspondingly, when generating the advanced data, the character string, the sequence number and the data to be stored need to be spliced, and spliced data containing the service attribute and the sequence number are generated. The manner of stitching is similar to that described previously. The sequence number may be concatenated before the data to be stored or after the data to be stored and identified using special characters.
Specifically, for any data record to be stored, the manner of acquiring the sequence number may be as follows:
first, the sequence number is specified by the user, i.e. the user carries the corresponding sequence number when sending the data to be stored. In this way a protocol data format between the database server and the user is required. So that the database server can extract the corresponding sequence number from the data to be stored.
Second, the sequence number is determined by the database server, that is, the database server allocates a sequence number to the data record to be stored in the account according to the received timestamp of the data record to be stored. It will be readily appreciated that the order numbers maintained by each ledger are independent of each other. When the frequency of the data to be stored, which is sent by the user, is not high, the method can be accurately allocated to the corresponding sequence of each data record.
For example, the order number corresponding to the service attribute "ID" may be "100" for data uploaded by the same user in the same ledger, and if the service attribute is "G01", the order number thereof may be "50". Specifically, for each service attribute, a sequence number of 1 may be assigned at the time of the initial data block, and then 1 may be added to each value of the same service attribute.
As the spliced data stored in the data block cannot actually see the sequence relation of each other on the service, the sequence relation of each spliced data in the account book can be defined by assigning sequence numbers to the spliced data, and the method is beneficial to the later inquiry and verification of users.
Correspondingly, the embodiment of the present disclosure further provides a data storage device, as shown in fig. 4, fig. 4 is a schematic structural diagram of the data storage device provided in the embodiment of the present disclosure, including:
the acquisition module 401 receives data to be stored sent by a user, and acquires data structure configuration parameters related to an account book, wherein the configuration parameters comprise service attributes;
a determining module 403, configured to determine a string corresponding to the service attribute, where the string represents a service attribute of the data to be stored of the user;
a splicing module 405 for splicing the character string and the data to be stored to generate spliced data containing service attributes;
the data block generating module 407 determines a hash value of the spliced data, and generates a hash value including a data block and an nth data block of the spliced data when a preset blocking condition is reached, where the method specifically includes:
when n=1, the hash value and the block height of the initial data block are given based on a preset manner;
when N >1, determining the hash value of the N data block according to the hash value of each spliced data and the N-1 data block in the data block to be written, and generating the N data block containing the hash value of the N data block and the spliced data, wherein the block heights of the data blocks are monotonically increased based on the sequence of the block forming time.
Further, the configuration parameters further include a byte length of the service attribute, and the device further includes a string interception module 409, configured to remove a character exceeding the byte length from the string if the length of the obtained string corresponding to the service attribute of the user exceeds the byte length, and generate an intercepted string; correspondingly, the splicing module 405 splices the intercepted character string and the data to be stored.
Further, the configuration parameters further include a sequence number parameter, where the sequence number parameter is used to indicate a sequence number for acquiring the data to be stored, and the apparatus further includes a sequence number determining module 411 for determining the sequence number of the data to be stored; correspondingly, the splicing module 405 splices the character string, the sequence number and the data to be stored, and generates spliced data including the service attribute and the sequence number.
Further, the sequence number determining module 411 obtains a sequence number determined by a user in the data to be stored; or determining the receiving time stamp of the data to be stored, and sequentially determining the sequence number of the data to be stored according to the receiving time stamp.
Further, before receiving the data to be stored sent by the user, the device further includes an instruction receiving module 413, and receives a creation instruction for creating the ledger sent by the user, where the creation instruction includes a data structure configuration parameter;
a writing module 415 for writing the data structure configuration parameters into a block header of an initial data block of the created ledger; and generating a data record containing the creation instruction, writing the data record into a block of an initial data block; the configuration file generating module 417 generates a data structure parameter configuration file of the ledger, where the data structure parameter configuration file is used to configure service attributes of data to be stored in the ledger.
Further, the obtaining module 401 obtains the data structure configuration parameters from the configuration file of the account book; or acquiring the data structure configuration parameters from the initial data block in the account book.
Further, in the apparatus, the preset blocking condition includes: the quantity of the data to be stored reaches a quantity threshold; alternatively, the time interval from the last time of blocking reaches a time threshold.
The embodiments of the present disclosure also provide a computer device at least including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the data storage method shown in fig. 2 when executing the program.
FIG. 5 illustrates a more specific hardware architecture diagram of a computing device provided by embodiments of the present description, which may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 implement communication connections therebetween within the device via a bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit ), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing relevant programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), static storage device, dynamic storage device, or the like. Memory 1020 may store an operating system and other application programs, and when the embodiments of the present specification are implemented in software or firmware, the associated program code is stored in memory 1020 and executed by processor 1010.
The input/output interface 1030 is used to connect with an input/output module for inputting and outputting information. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide corresponding functionality. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various types of sensors, etc., and the output devices may include a display, speaker, vibrator, indicator lights, etc.
Communication interface 1040 is used to connect communication modules (not shown) to enable communication interactions of the present device with other devices. The communication module may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
Bus 1050 includes a path for transferring information between components of the device (e.g., processor 1010, memory 1020, input/output interface 1030, and communication interface 1040).
It should be noted that although the above-described device only shows processor 1010, memory 1020, input/output interface 1030, communication interface 1040, and bus 1050, in an implementation, the device may include other components necessary to achieve proper operation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
The present description also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the data storage method shown in fig. 2.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
From the foregoing description of embodiments, it will be apparent to those skilled in the art that the present embodiments may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present specification.
The system, method, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the method embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points. The above-described method embodiments are merely illustrative, in that the modules illustrated as separate components may or may not be physically separate, and the functions of the modules may be implemented in the same piece or pieces of software and/or hardware when implementing the embodiments of the present disclosure. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing is merely a specific implementation of the embodiments of this disclosure, and it should be noted that, for a person skilled in the art, several improvements and modifications may be made without departing from the principles of the embodiments of this disclosure, and these improvements and modifications should also be considered as protective scope of the embodiments of this disclosure.

Claims (11)

1. A data storage method, comprising:
receiving a creation instruction for creating an account book sent by a user, wherein the creation instruction comprises data structure configuration parameters;
writing the data structure configuration parameters into the block head of the initial data block of the created account book; the method comprises the steps of,
generating a data record containing the creation instruction, and writing the data record into a block of an initial data block;
generating a data structure parameter configuration file of the account book, wherein the data structure parameter configuration file is used for configuring service attributes of data to be stored of the account book;
receiving data to be stored sent by a user, and acquiring the data structure configuration parameters from a structure parameter configuration file of the account book; or acquiring the data structure configuration parameters from the initial data block in the account book; the configuration parameters comprise service attributes;
determining a character string corresponding to the service attribute, wherein the character string represents the service attribute of the data to be stored of the user;
splicing the character string and the data to be stored to generate spliced data containing service attributes;
determining the hash value of the spliced data, and generating the hash value containing the data block and the Nth data block of the spliced data when a preset blocking condition is reached, wherein the method specifically comprises the following steps of:
when n=1, the hash value and the block height of the initial data block are given based on a preset manner;
when N >1, determining the hash value of the N data block according to the hash value of each spliced data and the N-1 data block in the data block to be written, and generating the N data block containing the hash value of the N data block and the spliced data, wherein the block heights of the data blocks are monotonically increased based on the sequence of the block forming time.
2. The method of claim 1, the configuration parameters further comprising a byte length of a traffic attribute, the method further comprising:
if the length of the character string corresponding to the obtained service attribute of the user exceeds the byte length, removing the characters exceeding the byte length from the character string, and generating a intercepted character string;
correspondingly, splicing the character string and the data to be stored comprises the following steps: and splicing the intercepted character string and the data to be stored.
3. The method of claim 1, the configuration parameters further comprising a sequence number parameter indicating a sequence number for acquiring data to be stored, the method further comprising:
determining the sequence number of the data to be stored;
correspondingly, splicing the character string and the data to be stored to generate spliced data containing service attributes, including: and splicing the character strings, the sequence numbers and the data to be stored to generate spliced data containing service attributes and the sequence numbers.
4. A method as claimed in claim 3, determining the sequential numbering of the data to be stored, comprising:
acquiring a sequence number determined by a user in the data to be stored; or,
and determining a receiving time stamp of the data to be stored, and sequentially determining sequence numbers of the data to be stored according to the receiving time stamp.
5. The method of claim 1, the preset blocking condition comprising:
the quantity of the data to be stored reaches a quantity threshold; alternatively, the time interval from the last time of blocking reaches a time threshold.
6. A data storage device, comprising:
the instruction receiving module is used for receiving a creation instruction for creating the account book, which is sent by a user, wherein the creation instruction comprises data structure configuration parameters;
the writing module is used for writing the data structure configuration parameters into the block head of the initial data block of the created account book; and generating a data record containing the creation instruction, writing the data record into a block of an initial data block;
the configuration file generation module is used for generating a data structure parameter configuration file of the account book, wherein the data structure parameter configuration file is used for configuring service attributes of data to be stored of the account book;
the acquisition module is used for receiving data to be stored sent by a user and acquiring the data structure configuration parameters from the structure parameter configuration file of the account book; or acquiring the data structure configuration parameters from the initial data block in the account book; the configuration parameters comprise service attributes;
the determining module is used for determining a character string corresponding to the service attribute, wherein the character string represents the service attribute of the data to be stored of the user;
the splicing module splices the character strings and the data to be stored to generate spliced data containing service attributes;
the data block generation module determines the hash value of the spliced data, and generates the hash value containing the data block and the Nth data block of the spliced data when a preset blocking condition is reached, and specifically comprises the following steps:
when n=1, the hash value and the block height of the initial data block are given based on a preset manner;
when N >1, determining the hash value of the N data block according to the hash value of each spliced data and the N-1 data block in the data block to be written, and generating the N data block containing the hash value of the N data block and the spliced data, wherein the block heights of the data blocks are monotonically increased based on the sequence of the block forming time.
7. The device of claim 6, wherein the configuration parameters further comprise byte lengths of service attributes, and the device further comprises a character string interception module, configured to, if the obtained length of a character string corresponding to the service attributes of the user exceeds the byte lengths, remove characters exceeding the byte lengths from the character string, and generate an intercepted character string; correspondingly, the splicing module splices the intercepted character string and the data to be stored.
8. The apparatus of claim 6, the configuration parameters further comprising a sequence number parameter indicating a sequence number for acquiring data to be stored, the apparatus further comprising a sequence number determination module determining the sequence number of the data to be stored; correspondingly, the splicing module splices the character strings, the sequence numbers and the data to be stored to generate splicing data containing service attributes and the sequence numbers.
9. The apparatus of claim 8, the sequence number determination module to obtain a sequence number determined by a user in the data to be stored; or determining the receiving time stamp of the data to be stored, and sequentially determining the sequence number of the data to be stored according to the receiving time stamp.
10. The apparatus of claim 6, the preset blocking condition comprising:
the quantity of the data to be stored reaches a quantity threshold; alternatively, the time interval from the last time of blocking reaches a time threshold.
11. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 5 when the program is executed by the processor.
CN201910689299.9A 2019-07-29 2019-07-29 Data storage method, device and equipment Active CN112307010B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910689299.9A CN112307010B (en) 2019-07-29 2019-07-29 Data storage method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910689299.9A CN112307010B (en) 2019-07-29 2019-07-29 Data storage method, device and equipment

Publications (2)

Publication Number Publication Date
CN112307010A CN112307010A (en) 2021-02-02
CN112307010B true CN112307010B (en) 2024-04-16

Family

ID=74329247

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910689299.9A Active CN112307010B (en) 2019-07-29 2019-07-29 Data storage method, device and equipment

Country Status (1)

Country Link
CN (1) CN112307010B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103488617A (en) * 2012-06-11 2014-01-01 北京新媒传信科技有限公司 Data interception method and device
CN104063362A (en) * 2013-07-18 2014-09-24 腾讯科技(深圳)有限公司 Character string truncation method and device
CN106600403A (en) * 2016-11-07 2017-04-26 北京金股链科技有限公司 Asset management method, device and system
CN106709851A (en) * 2016-11-30 2017-05-24 中体彩科技发展有限公司 Big data retrieval method and apparatus
CN107239479A (en) * 2017-03-28 2017-10-10 阿里巴巴集团控股有限公司 A kind of method and device of data storage and inquiry based on block chain
CN108595720A (en) * 2018-07-12 2018-09-28 中国科学院深圳先进技术研究院 A kind of block chain spatiotemporal data warehouse method, system and electronic equipment
CN109242500A (en) * 2018-09-20 2019-01-18 百度在线网络技术(北京)有限公司 Block chain transaction validation verification method, apparatus and storage medium
CN109690519A (en) * 2017-06-16 2019-04-26 华为技术有限公司 A kind of document handling method and mobile terminal
CN110008743A (en) * 2019-03-26 2019-07-12 阿里巴巴集团控股有限公司 Data attribute identification method, device and equipment in a kind of piece of chain type account book
CN110059088A (en) * 2019-03-26 2019-07-26 阿里巴巴集团控股有限公司 Data attribute identification method, device and equipment in a kind of piece of chain type account book
CN110059087A (en) * 2019-03-26 2019-07-26 阿里巴巴集团控股有限公司 Data attribute identification method, device and equipment in a kind of piece of chain type account book
CN110059084A (en) * 2019-01-31 2019-07-26 阿里巴巴集团控股有限公司 A kind of date storage method, device and equipment
CN113439415A (en) * 2018-12-12 2021-09-24 约克大学 Workload attestation of blockchain applications

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103488617A (en) * 2012-06-11 2014-01-01 北京新媒传信科技有限公司 Data interception method and device
CN104063362A (en) * 2013-07-18 2014-09-24 腾讯科技(深圳)有限公司 Character string truncation method and device
CN106600403A (en) * 2016-11-07 2017-04-26 北京金股链科技有限公司 Asset management method, device and system
CN106709851A (en) * 2016-11-30 2017-05-24 中体彩科技发展有限公司 Big data retrieval method and apparatus
CN107239479A (en) * 2017-03-28 2017-10-10 阿里巴巴集团控股有限公司 A kind of method and device of data storage and inquiry based on block chain
CN109690519A (en) * 2017-06-16 2019-04-26 华为技术有限公司 A kind of document handling method and mobile terminal
CN108595720A (en) * 2018-07-12 2018-09-28 中国科学院深圳先进技术研究院 A kind of block chain spatiotemporal data warehouse method, system and electronic equipment
CN109242500A (en) * 2018-09-20 2019-01-18 百度在线网络技术(北京)有限公司 Block chain transaction validation verification method, apparatus and storage medium
CN113439415A (en) * 2018-12-12 2021-09-24 约克大学 Workload attestation of blockchain applications
CN110059084A (en) * 2019-01-31 2019-07-26 阿里巴巴集团控股有限公司 A kind of date storage method, device and equipment
CN110008743A (en) * 2019-03-26 2019-07-12 阿里巴巴集团控股有限公司 Data attribute identification method, device and equipment in a kind of piece of chain type account book
CN110059088A (en) * 2019-03-26 2019-07-26 阿里巴巴集团控股有限公司 Data attribute identification method, device and equipment in a kind of piece of chain type account book
CN110059087A (en) * 2019-03-26 2019-07-26 阿里巴巴集团控股有限公司 Data attribute identification method, device and equipment in a kind of piece of chain type account book

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《一种面向医疗大数据安全共享的新型区块链技术》;佘维 等;《小型微型计算机系统》;20190715;全文 *

Also Published As

Publication number Publication date
CN112307010A (en) 2021-02-02

Similar Documents

Publication Publication Date Title
CN110188096B (en) Index creating method, device and equipment for data record
CN110162662B (en) Verification method, device and equipment for data records in block chain type account book
CN110275916B (en) Data operation record storage method, system, device and equipment
CN111352935B (en) Index creating method, device and equipment in block chain type account book
CN113726751B (en) Weight management method, device and equipment in block chain type account book
CN110008743B (en) Data attribute identification method, device and equipment in block chain type account book
CN110147685B (en) Data verification method, system, device and equipment
CN110825737A (en) Index creation and data query method, device and equipment
CN110347679B (en) Data storage method, device and equipment based on receipt
CN110837502B (en) Data storage method, device and equipment in block chain type account book
US10999062B2 (en) Blockchain-type data storage
CN110147410B (en) Data verification method, system, device and equipment in block chain type account book
CN111046069B (en) Aggregation calculation method, device and equipment in block chain type account book
CN110716965A (en) Query method, device and equipment in block chain type account book
WO2021057127A1 (en) Method, device, and equipment for data storage based on multiple service attributes
CN110059088B (en) Data attribute identification method, device and equipment in block chain type account book
CN110362568B (en) Compression method, device and equipment for block chain type account book
CN110362570B (en) Data storage method, device and equipment
CN110059087B (en) Data attribute identification method, device and equipment in block chain type account book
CN112307010B (en) Data storage method, device and equipment
CN111444194B (en) Method, device and equipment for clearing indexes in block chain type account book
CN110636042B (en) Method, device and equipment for updating verified block height of server
CN111444215A (en) Blocking method, device and equipment in block chain type account book
CN111444195B (en) Method, device and equipment for clearing indexes in block chain type account book
CN110688664A (en) Authority management method, device and equipment in block chain type account book

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40045463

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant