CN112765280B - Block data storage method and device, computer readable medium and electronic equipment - Google Patents

Block data storage method and device, computer readable medium and electronic equipment Download PDF

Info

Publication number
CN112765280B
CN112765280B CN202110151754.7A CN202110151754A CN112765280B CN 112765280 B CN112765280 B CN 112765280B CN 202110151754 A CN202110151754 A CN 202110151754A CN 112765280 B CN112765280 B CN 112765280B
Authority
CN
China
Prior art keywords
data
target
block
type
serialization processing
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
CN202110151754.7A
Other languages
Chinese (zh)
Other versions
CN112765280A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110151754.7A priority Critical patent/CN112765280B/en
Publication of CN112765280A publication Critical patent/CN112765280A/en
Application granted granted Critical
Publication of CN112765280B publication Critical patent/CN112765280B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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

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

Abstract

The embodiment of the application provides a block data storage method and device, a computer readable medium and electronic equipment. The block data storage method comprises the following steps: acquiring block data to be stored; generating a structure body example corresponding to each type of data in the plurality of types according to the plurality of types of data contained in the block data to be stored; carrying out serialization processing on the structure body examples respectively corresponding to the multiple types of data to obtain serialization processing results corresponding to the structure body examples; and storing the serialization processing result corresponding to each structure body example. According to the technical scheme of the embodiment of the application, the time consumption of serialization processing is greatly reduced, and the writing storage of block data is accelerated.

Description

Block data storage method and device, computer readable medium and electronic equipment
Technical Field
The present application relates to the field of computer and communication technologies, and in particular, to a block data storage method and apparatus, a computer-readable medium, and an electronic device.
Background
With the development of computer technology, a blockchain technology appears, which is also called a distributed book technology and is characterized by decentralization, openness and transparency, no tampering and trusty. A network constructed based on the blockchain technology is called a blockchain network, and the blockchain network includes network nodes, and each network node in the blockchain network not only needs to perform a large amount of calculations to obtain the accounting right of a block, but also needs to store block data in the blockchain network.
However, the conventional block data storage method consumes less time and has less influence on performance when the size of the block data is small, but the time consumption is correspondingly increased when the block data is gradually increased, and the influence on the performance is more and more obvious.
Disclosure of Invention
Embodiments of the present application provide a block data storage method, an apparatus, a computer-readable medium, and an electronic device, so that time consumption of serialization processing is greatly reduced at least to a certain extent, and writing storage of block data is accelerated.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided a block data storage method, including: acquiring block data to be stored; generating a structure body example corresponding to each type of data in the plurality of types according to the plurality of types of data contained in the block data to be stored; carrying out serialization processing on the structure body examples respectively corresponding to the multiple types of data to obtain serialization processing results corresponding to the structure body examples; and storing the serialization processing result corresponding to each structure body example.
According to an aspect of an embodiment of the present application, there is provided a block data storage device including: an acquisition unit configured to acquire block data to be stored; the generating unit is configured to generate a structure body example corresponding to each type of data in the multiple types according to the multiple types of data contained in the block data to be stored; the processing unit is configured to perform serialization processing on the structure instances corresponding to the multiple types of data respectively to obtain serialization processing results corresponding to the structure instances; and the storage unit is configured to store the serialization processing results corresponding to the structure body examples.
In some embodiments of the present application, based on the foregoing solution, the processing unit is configured to: and according to an asynchronous processing mode, carrying out serialization processing on the structure body examples respectively corresponding to the multiple types of data to obtain serialization processing results corresponding to the structure body examples.
In some embodiments of the present application, based on the foregoing scheme, the generating unit includes: the fragmentation subunit is configured to perform fragmentation processing on the data of the target type in the data of the multiple types to obtain multiple data fragments corresponding to the data of the target type; a first generating subunit, configured to generate, for the data of the target type, structure body instances corresponding to the plurality of data fragments, respectively; and the second generation subunit is configured to generate a structure instance corresponding to the other types of data according to the other types of data except the target type of data in the plurality of types of data.
In some embodiments of the present application, based on the foregoing solution, the fragmentation sub-unit is configured to: calculating hash codes corresponding to all data contained in the target type data; and carrying out fragmentation processing on the data of the target type according to the hash code and the target fragmentation number to obtain a plurality of data fragments corresponding to the data of the target type.
In some embodiments of the present application, based on the foregoing solution, the fragmentation sub-unit is further configured to: calculating the remainder of the hash code corresponding to each data contained in the target type data and the target fragment number to obtain the remainder corresponding to each data; and taking the data with the same remainder as one data fragment to obtain a plurality of data fragments corresponding to the data of the target type.
In some embodiments of the present application, based on the foregoing solution, the storage unit includes: a third generating subunit, configured to generate, for the serialization processing result corresponding to each structure instance, index information for indexing the serialization processing result corresponding to each structure instance; and the association subunit is configured to associate and store the index information and the serialization processing result corresponding to each structure instance.
In some embodiments of the present application, based on the foregoing scheme, the third generating subunit is configured to: and determining fields related to the types of the data according to the types of the data corresponding to the serialization processing results corresponding to the structure body examples, and taking the fields as the index information.
In some embodiments of the present application, based on the foregoing solution, the apparatus further includes: a result acquisition unit configured to acquire a plurality of target serialization processing results; the deserializing unit is configured to deserialize each target serialization processing result in the target serialization processing results to obtain a plurality of target structure instances, and each target structure instance in the target structure instances correspondingly stores each type of data contained in the target block data; and the data generation unit is configured to generate the target block data according to the plurality of target structure body examples.
In some embodiments of the present application, based on the foregoing solution, the respective target serialization processing results are stored in association with fields related to types of data corresponding to the respective target serialization processing results; the result acquisition unit is configured to: acquiring fields related to the types of the data according to the types of the data corresponding to the target serialization processing results; and determining the serialization processing result associated with each field according to each field, and taking the serialization processing result associated with each field as each target serialization processing result.
In some embodiments of the present application, based on the foregoing solution, each target structure body instance is obtained by combining each type of data included in the target block data with an instance structure after creating the instance structure that is the same as the block structure of the target block data; the data generation unit is configured to: acquiring various types of data stored in the target structure body examples, and splicing the acquired various types of data to obtain target data; and creating a block structure which is the same as the example structure according to the example structure of each target structure body example, and combining the target data with the block structure to generate the target block data.
In some embodiments of the present application, based on the foregoing scheme, the obtaining unit is configured to: acquiring newly generated block data in the block chain network; and if the newly generated block data is the block data which is subjected to consensus operation by the consensus nodes in the block chain network and passes the consensus, taking the newly generated block data as the block data to be stored.
In some embodiments of the present application, based on the foregoing scheme, the generating unit is configured to: according to the block structure of the block data to be stored, creating an example structure which is the same as the block structure, wherein the block structure comprises a plurality of parts, and each part in the plurality of parts corresponds to each type of data; and combining the data of each type and the example structure to generate a structure body example corresponding to the data of each type, wherein the structure body example corresponding to the data of each type is used for storing the data of each type.
According to an aspect of the embodiments of the present application, there is provided a computer readable medium on which a computer program is stored, the computer program, when executed by a processor, implementing the block data storage method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the block data storage method as described in the above embodiments.
According to an aspect of embodiments herein, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the block data storage method provided in the above-mentioned various optional embodiments.
In the technical solutions provided in some embodiments of the present application, the block data to be stored is split according to the data type to generate the structure instances corresponding to each type of data, and after the structure instances corresponding to each type of data are obtained, the structure instances corresponding to multiple types of data are further serialized concurrently, and the storage of the block data to be stored is achieved by storing the serialization processing results corresponding to each structure instance, in comparison with the conventional way of processing and storing the block data as a whole, the embodiment of the present application does not perform the serialization processing on the entire block data, but performs the serialization processing on the structure instances corresponding to each type of data included in the block data to be stored concurrently, thereby greatly reducing the time consumption of the serialization processing and speeding up the writing and storing of the block data, thereby improving the overall performance of the block chain network and the response speed to external services.
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 application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 shows a block chain network;
FIG. 2 is a block chain structure diagram;
FIG. 3 is a diagram illustrating the generation of new blocks in a blockchain;
FIG. 4 illustrates a flow diagram of a block data storage method according to an embodiment of the present application;
FIG. 5 shows a flow diagram of a block data storage method according to an embodiment of the present application;
FIG. 6 shows a flow diagram of a block data storage method according to an embodiment of the present application;
FIG. 7 illustrates a flow diagram of a block data storage method according to an embodiment of the present application;
FIG. 8 shows a flow diagram of a block data storage method according to an embodiment of the present application;
FIG. 9 shows a flow diagram of a block data storage method according to an embodiment of the present application;
FIG. 10 shows a block diagram of a block data storage device according to an embodiment of the present application;
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
It is to be noted that the terms used in the specification and claims of the present application and the above-described drawings are only for describing the embodiments and are not intended to limit the scope of the present application. It will be understood that the terms "comprises," "comprising," "includes," "including," "has," "having," and the like, when used herein, specify the presence of stated features, integers, steps, operations, elements, components, and/or groups thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It will be further understood that, although the terms first, second, third, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element could be termed a second element without departing from the scope of the present invention. Similarly, a second element may be termed a first element. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It should be noted that: reference herein to "a plurality" means two or more. "and/or" describe the association relationship of the associated objects, meaning that there may be three relationships, e.g., A and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Before further detailed description of the embodiments of the present application, terms and expressions referred to in the embodiments of the present application will be described, and the terms and expressions referred to in the embodiments of the present application will be used for the following explanation.
Block chain network: the method is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like, is essentially a decentralized database, is a string of data blocks which are associated by using a cryptography method, and each data block contains information for verifying the validity (anti-counterfeiting) of the information and generating a next block.
Ledger (hedger): is a general term for blockchains (also known as ledger data), and state databases that are synchronized with blockchains. Wherein, the blockchain records the transaction in the form of a file in a file system; the state database records the transactions in the blockchain in the form of different types of Key (Key) Value pairs for supporting fast query of the transactions in the blockchain.
Consensus (Consensus): is a process in a blockchain network for agreeing on transactions in a block between the nodes involved, the agreed block to be appended to the end of the blockchain.
Transaction (Transaction): equivalent to the computer term "transaction," a transaction includes an operation that needs to be committed to a blockchain network for execution and does not refer solely to a transaction in the business context, which is followed by embodiments of the present application in view of the convention of colloquially using the term "transaction" in blockchain technology.
Fig. 1 shows a schematic structural diagram of a blockchain network.
Referring to the blockchain network 101 shown in fig. 1, the blockchain network 101 refers to a system for performing data sharing between nodes, each node a can receive input information during normal operation, and maintain shared data in the blockchain network 101 based on the received input information. In order to ensure information interworking in the blockchain network 101, an information connection may exist between each node a in the blockchain network 101, and information transmission may be performed between the nodes a through the information connection. For example, when an arbitrary node a in the blockchain network 101 receives input information, other nodes a in the blockchain network 101 acquire the input information according to the consensus algorithm, and store the input information as data in shared data, so that the data stored on all nodes a in the blockchain network 101 are consistent.
Each node a in the blockchain network 101 has a node identifier corresponding thereto, and each node a in the blockchain network 101 may store node identifiers of other nodes a in the blockchain network 101, so that the generated block is broadcast to other nodes a in the blockchain network 101 according to the node identifiers of other nodes a in the blockchain network 101. Each node a may maintain a node identifier list as shown in the following table, and store the node name and the node identifier in the node identifier list correspondingly. The node identifier may be an IP (Internet Protocol) address and any other information that can be used to identify the node, and table 1 only illustrates the IP address as an example.
Node name Node identification
Node 1 117.114.151.174
Node 2 117.116.189.145
... ...
Node N 119.123.789.258
TABLE 1
Each node in the blockchain network 101 shown in fig. 1 stores one identical blockchain. The block chain is composed of a plurality of blocks, referring to fig. 2, the block chain is composed of a plurality of blocks, the starting block includes a block header and a block main body, the block header stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a parent block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the parent block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain is associated with the block data stored in the parent block, and the safety of the input information in the block is ensured.
When each block in the block chain is generated, referring to fig. 3, when the node where the block chain is located receives the input information, the input information is verified, after the verification is completed, the input information is stored in the memory pool, and the hash tree for recording the input information is updated; and then, updating the updating time stamp to the time when the input information is received, trying different random numbers, and calculating the characteristic value for multiple times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
wherein, SHA256 is a characteristic value algorithm used for calculating a characteristic value; version is version information of the relevant block protocol in the block chain; prev _ hash is a block head characteristic value of a parent block of the current block; merkle _ root is a characteristic value of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, is a fixed value within a period of time, and is determined again after exceeding a fixed time period; x is a random number; TARGET is a feature threshold, which can be determined from nbits.
Therefore, when the random number meeting the formula is obtained through calculation, the information can be correspondingly stored, and the block head and the block main body are generated to obtain the current block. Then, the node where the block chain is located sends the newly generated blocks to other nodes a in the block chain network 101 respectively according to the node identifiers of the other nodes a in the block chain network 101, the other nodes a check the newly generated blocks, and add the newly generated blocks to the block chain stored in the newly generated blocks after the check is completed.
The block data storage method provided by the embodiment of the application can be widely applied to nodes in a block chain network. In the block data storage method in the embodiment of the application, the block data to be stored is split according to the data types to generate the structure body examples corresponding to the data of each type, after the structure body examples corresponding to the data of each type are obtained, the structure body examples corresponding to the data of a plurality of types are further subjected to serialization processing respectively and concurrently, and the storage of the block data to be stored is realized by storing the serialization processing results corresponding to the structure body examples, compared with the traditional mode of processing the whole block data and then storing the block data, the block data storage method in the embodiment of the application does not perform the serialization processing on the whole block data, but performs the serialization processing on the structure body examples corresponding to the data of each type contained in the block data to be stored concurrently, thereby greatly reducing the time consumption of the serialization processing and quickening the writing storage of the block data, thereby improving the overall performance of the block chain network and the response speed to external services.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
fig. 4 shows a flowchart of a block data storage method according to an embodiment of the present application, which is described in the embodiment of the present application by taking the method as an example applied to a node in the above block chain network. The block data storage method at least comprises the following steps:
step S410, obtaining block data to be stored;
step S420, generating a structural body example corresponding to each type of data in the plurality of types according to the plurality of types of data contained in the block data to be stored;
step S430, carrying out serialization processing on the structure examples respectively corresponding to the data of the multiple types to obtain serialization processing results corresponding to the structure examples;
and step S440, storing the serialization processing result corresponding to each structure body example.
These steps are described in detail below.
In step S410, block data to be stored is acquired.
The execution main body of this embodiment may be any node in a block chain network (hereinafter referred to as a block chain node), and the block chain node may be a terminal, a server, or the like, which is not limited in this embodiment of the present application.
The block data may be generated based on transaction data in a blockchain network, and the block data to be stored refers to block data that needs to be locally stored at a blockchain link point, and is stored in a local account book and a local log file. It should be noted that, in order to prevent restart due to failure of a block link point, before block data is written into a local account book, the block link node needs to write the block data into a local log file first, so as to ensure consistency and persistence of the block data.
In an embodiment of the present application, the obtaining of the block data to be stored by the block link point may specifically include: the blockchain node first obtains newly generated blocky data in the blockchain network, for example, a node in the blockchain network may detect locally newly generated blocky data in real time, and if the newly generated blocky data is the blocky data which is commonly identified by the commonly identified node in the blockchain network and passes through the commonly identified node, the newly generated blocky data may be used as the blocky data to be stored.
In this embodiment, after detecting newly generated tile data, the tile link node may generate a proposal containing the newly generated tile data and broadcast the proposal to consensus nodes in the tile link network, such that the consensus nodes perform consensus operations on the proposal. The consensus node may be a node predetermined from a plurality of nodes included in the blockchain network based on a consensus mechanism of the blockchain network, or may be any node in the blockchain network specified by a user, for example, the consensus node may be all check nodes included in the blockchain network. The consensus node may perform a consensus operation based on a consensus mechanism, including but not limited to: proof of Work (PoW), Proof of rights (PoS), a mixture of Proof of Work and Proof of rights (PoW + PoS), Proof of equity authorization (Delegated Proof of stamp, DPoS), a Practical Byzantine Fault Tolerance algorithm (PBFT), and a Rayleigh Consensus Protocol (RCP).
If the consensus node performs the consensus operation and the consensus passes, the block data passing the consensus can be used as the block data to be stored. In the embodiment, the consensus is achieved on the newly generated block data through the consensus nodes, which may be more than a preset number.
In step S420, a structure instance corresponding to each type of data in the multiple types is generated according to the multiple types of data included in the block data to be stored.
Because the traditional storage method of the block data is to directly serialize the complete block data and write the serialization processing result into the storage, the serialization can write the state information of an instance object into a byte stream, so that the instance object can be transmitted or stored into a database or a file system in a persistent mode. The traditional storage method has the advantages that the time consumption is low under the condition that the block data is small, and the influence on the performance of a block chain network is small. However, when the block data becomes larger, the serialization time consumption is increased correspondingly, and accordingly, the influence on the performance of the blockchain network is more and more obvious.
Based on this, the present embodiment proposes a scheme that the block data to be stored can be split according to the type of the data, that is, the block data to be stored is not processed for the complete block data to be stored, but processed for each type of data included in the block data to be stored. Illustratively, the respective types of data included in the tile data to be stored may be, for example, tile header data, tile extension portion data, transaction list data, transaction result set data, and read/write set data.
The block header data refers to header information of a block, and the header information of the block comprises a version number, a hash value of a previous block, a mining difficulty value, a block timestamp, a nonce string and a merkel root; the block extension part data is data of an extension block, and the transaction list data, the transaction result set data, and the read-write set data are data related to transactions in the blockchain network.
It should be noted that serialization is a process of converting the state of a data object into a format that can be maintained or transmitted, that is, a process of converting structured data into a specified format according to a certain encoding specification (i.e., a serialization rule). Therefore, for each type of data, before the serialization processing, the structure instance corresponding to each type of data may be generated according to each type of data, and the serialization processing may be executed after the corresponding structure instance is generated.
In step S430, the structure instances corresponding to the multiple types of data are serialized concurrently, and a serialization result corresponding to each structure instance is obtained.
After generating the structure instances corresponding to the types of data, the structure instances corresponding to the types of data may be further serialized. In specific implementation, the serialization processing can be carried out in a concurrent mode. The concurrency means that several tasks in a time period are between the start and the finish of the operation, and the tasks are operated on the same processor, but only one program is operated on the processor at any time point. It is easy to understand that the time consumption caused by the serialization processing can be greatly reduced by performing the serialization processing on the structure body instances corresponding to the multiple types of data respectively.
In some embodiments, the process of serialization processing may specifically include: the block chain link point receives the serialization instruction firstly, and then calls the corresponding serialization interface function to carry out serialization processing according to the object type information included in the serialization instruction, so that the serialization processing result corresponding to each structural body instance is generated.
Here, the Object type information is used to indicate a storage manner of the serialized data, and the Object type information may be any one of a lightweight data exchange Language (JavaScript Object notification Json) format, an Extensible Markup Language (Xml) format, a binary format, or the like, which is not limited herein. It should be understood that, in the embodiment of the present application, serialization rules corresponding to different serialization interface functions have been defined in advance, so that based on object type information included in a received serialization instruction, a corresponding serialization interface function may be called according to the object type information, and a serialization rule is further determined, so that subsequent concurrent serialization processing may be performed on structure body instances corresponding to the above-mentioned types of data according to the serialization rule to generate a serialization processing result.
In an embodiment of the present application, the block link points may perform serialization processing on the structure instances corresponding to the multiple types of data respectively according to an asynchronous processing manner, so as to obtain serialization processing results corresponding to each structure instance.
It should be noted that the asynchronous processing mode is a mode opposite to the synchronous processing mode, that is, when a function call is issued, the call does not return until a result is not obtained, that is, one thing must be done, and the next thing can be done until the previous thing is done, and the asynchronous processing mode is that when an asynchronous procedure call is issued, a caller cannot obtain a result immediately, and a component actually processing the call notifies the caller through a state, a notification and a callback after the call is completed.
In this embodiment, by using an asynchronous concurrent processing manner, serialization processing for structure instances corresponding to each type of data can be performed alternately, and it is not necessary to wait for completion of any serialization processing before performing the next serialization processing. Therefore, the scheme of the embodiment can greatly reduce the time consumption of the serialization processing and improve the processing speed.
In step S440, the serialization processing results corresponding to the respective structure instances are stored.
In this embodiment, after each structure instance is serialized, the serialization processing result corresponding to each structure instance may be stored.
In order to prevent restarting due to a fault of a block chain node, before writing the serialization processing results corresponding to each structure body instance into the local account book, the serialization results corresponding to each structure body instance may be written into the local log file, and after the local log file is written, the serialization results corresponding to each structure body instance may be written into the local account book, so as to complete storage of the block data to be stored.
In an embodiment of the present application, when storing the serialization processing results corresponding to each structure instance, the block chain node may first generate, for the serialization processing results corresponding to each structure instance, index information for indexing the serialization processing results corresponding to each structure instance, and then store the index information in association with the serialization processing results corresponding to each structure instance. Specifically, the block link point may record a mapping relationship between the index information and the serialization processing result, the index information may indicate a reading position of the serialization processing result, and the associated serialization processing result may be found through the reading position indicated by the index information, so that subsequent finding of the serialization processing result is facilitated.
In one embodiment, the block chain node may store the mapping relationship between the index information and the serialized processing result in a Key-Value manner, where Key is the index information and Value is the serialized processing result.
In an embodiment, for the serialization processing result corresponding to each structure instance, generating the index information for indexing the serialization processing result corresponding to each structure instance may specifically include: and determining fields related to the types of the data according to the types of the data corresponding to the serialization processing results corresponding to the structure instances, and taking the fields as index information. Taking the type of data as a block header as an example for explanation, during storage, the block header field may be determined as index information, that is, the block header field and the corresponding serialization processing result are stored in an associated manner.
Therefore, compared with the traditional mode of integrally processing and then storing the block data, the embodiment of the application does not perform serialization processing on the whole block data, but performs serialization processing on the structure body examples corresponding to various types of data contained in the block data to be stored, so that the time consumption of the serialization processing is greatly reduced, the writing storage of the block data is accelerated, and the integral performance of the block chain network and the response speed of external services are further improved.
In an embodiment of the present application, considering that some types of data in the block data to be stored may still include a larger data amount and cause an increase in time consumption of the serialization processing, in order to increase the processing speed, in this embodiment, for this type of data, a data fragmentation mode may be first adopted to perform fragmentation processing, and then, for the structure instances corresponding to the multiple data fragments obtained by the fragmentation processing, the serialization processing is performed in parallel, as shown in fig. 5, step S420 may specifically include step S510-step S530, which is described in detail as follows:
step S510, performing fragmentation processing on the target type data in the multiple types of data to obtain multiple data fragments corresponding to the target type data.
In order to perform the serialization processing more quickly and reduce the time consumption of the serialization processing, in this embodiment, the fragmentation processing may be performed on the target type data in the multiple types of data, that is, one or more data in the target type data are used as one data fragment, so as to obtain multiple data fragments corresponding to the target type data.
The target type data may be data of a type in which the amount of data contained in the block data to be stored is large, for example, data of types such as a transaction list, a transaction result set, and a read-write set in the block data to be stored.
In an embodiment of the present application, as shown in fig. 6, the slicing processing on the data of the target type may specifically include steps S610 to S620, which are described as follows:
step S610 is to calculate hash codes corresponding to the respective data included in the target type data.
In an embodiment, after obtaining the characteristic attribute of each piece of data included in the target type of data, the blockchain network node may calculate a hash corresponding to each piece of data. Illustratively, each data may be transaction data, and the characteristic attribute of each data may include account information of both parties of the transaction, transaction content, transaction result, and the like. Then, the first hash value of each feature attribute may be weighted according to the weight of each feature attribute, so as to obtain a second hash value of each feature attribute. Then, the network device may merge the second hash values of all the feature attributes, and perform binarization processing on the merged second hash values of all the feature attributes to obtain a hash code.
Step S620, performing fragmentation processing on the data of the target type according to the hash code and the target fragmentation number to obtain a plurality of data fragments corresponding to the data of the target type.
After the hash code is obtained in step S610, the data of the target type may be sliced according to the hash code and the target number of slices, so as to obtain a plurality of data slices.
In another embodiment, the data fragmentation processing of the target type may further calculate a remainder of the hash code corresponding to each data and the target fragmentation number first to obtain a remainder corresponding to each data, and then use the metering data with the same remainder as one data fragmentation to obtain a plurality of data fragmentation.
With continued reference to fig. 5, in step S520, for the target type of data, structure instances corresponding to the plurality of data fragments are generated.
Specifically, after the target type data is sliced in step S510 to obtain a plurality of data slices, the structure instances corresponding to the plurality of data slices can be directly generated for subsequent serialization processing.
Step S530, generating a structure instance corresponding to the other types of data according to the other types of data except the target type of data in the plurality of types of data.
In this embodiment, since the target type data is a type of data having a large data amount, in order to reduce the time consumption of the subsequent serialization processing, data fragmentation may be performed on the target type data first, and then structure body instances corresponding to a plurality of data fragmentation are generated.
On the contrary, compared with the target type data, the data of other types except the target type data contains relatively small data amount, so that for the data of other types, the data fragmentation is not performed, and the structure body examples corresponding to the data of other types can be directly generated.
In this embodiment, the data of the target type having a large data volume may be subjected to the slicing processing, so as to generate structure instances corresponding to the multiple data slices, respectively, and for the data of other types, the structure instances corresponding to the data of other types are directly generated. Obviously, compared with the data of the whole target type, the time consumption for the serialization processing of the structure body instance corresponding to each data fragment can be greatly reduced, so that the time consumption for the whole subsequent serialization processing can be reduced.
It can be understood that the structure instance represents and stores data in a fixed structure mode, and thus, in an embodiment of the present application, the structure instance corresponding to each type of data may be obtained by combining each type of data with a corresponding structure, as shown in fig. 7, in this embodiment, step S420 may specifically include steps S710 to step S720, which are described in detail as follows:
step S710, creating an example structure identical to the block structure according to the block structure of the block data to be stored, where the block structure includes a plurality of portions, and each of the plurality of portions corresponds to each type of data.
It is easily understood that the block data has a corresponding block structure, and the block structure includes a plurality of portions, each corresponding to each type of data. In this embodiment, an instance structure that is the same as the block structure may be created in advance according to the block structure of the block data to be stored, and the created instance structure may be used to generate structure body instances corresponding to each type of data.
Step S720, combining the data of each type and the instance structure to generate a structure instance corresponding to the data of each type, where the structure instance corresponding to the data of each type is used for storing the data of each type.
After the instance structure identical to the block structure is created, the data of each type and the instance structure may be combined to generate a structure instance corresponding to the data of each type, where the structure instance corresponding to the data of each type is used to store the data of each type.
It should be noted that, since the structure example corresponding to each type of data has the same structure as the block structure, the structure example also includes multiple parts, but only one of the parts corresponds to data, and the other parts are empty, for example, each type of data is block header data, block extension part data, transaction list data, transaction result set data, and read/write set data, respectively, so that only block header data exists in the structure example corresponding to the block header data, the other parts are empty, only block extension part data exists in the structure example corresponding to the block extension part data, and the other parts are empty, only transaction list data exists in the structure example corresponding to the transaction list data, and only transaction result set data exists in the structure example corresponding to the transaction result set data, the other parts are empty, only the read-write set data exists in the structural body example corresponding to the read-write set data, and the other parts are empty.
In an embodiment of the present application, after storing the serialization processing result, if the block data needs to be read, the deserialization processing result needs to be further performed, as shown in fig. 8, the block data storage method may further specifically include steps S810 to S830, which are described as follows:
step S810, a plurality of target serialization processing results are acquired.
For the block data to be stored, the block link points may generate structure instances corresponding to the data of each type according to the data of the plurality of types included in the block data to be stored, and store the serialization processing results corresponding to the structure instances after performing the serialization processing on the structure instances corresponding to the data of the plurality of types respectively.
Thus, after the block link point pair performs the above storage operation on the block data, if the block link point needs to acquire the target block data, a plurality of target serialization processing results may be acquired first, for example, the block link point may acquire a plurality of target serialization processing results from a local log file. The target serialization processing results are the serialization processing results corresponding to the target block data.
In an embodiment of the present application, each target serialization processing result may be stored in association with a field related to a type of data corresponding to each target serialization processing result, and therefore, the acquiring a plurality of target serialization processing results in step S810 may specifically include: firstly, according to the type of the data corresponding to each target serialization processing result, acquiring the field relevant to the type of the data, then, according to each field, determining the serialization processing result relevant to each field, and taking the serialization processing result relevant to each field as each target serialization processing result.
Step S820, performing deserialization on each target serialization processing result in the plurality of target serialization processing results to obtain a plurality of target structure instances, wherein each target structure instance in the plurality of target structure instances correspondingly stores each type of data included in the target block data.
The deserialization process can convert the byte stream into a data object, i.e. a process of parsing the converted data into a specified format into original structured data. In this step, the deserialization process is performed on each target serialization processing result, so that a plurality of target structure instances can be obtained, and each target structure instance stores each type of data included in the target block data correspondingly.
Step S830 generates target block data according to the plurality of target structure instances.
In an embodiment of the present application, each target structure instance is obtained by combining each type of data included in the target block data with an instance structure after creating an instance structure that is the same as the block structure of the target block data, and therefore, the block structure of the target block data may be created according to the instance structure of each target structure instance, so as to generate the target block data, as shown in fig. 9, step S830 may specifically include steps S910 to S920, which are described in detail as follows:
step S910, obtaining each type of data stored in each target structure body example, and splicing the obtained data of each type to obtain target data.
Each target structure body instance stores each type of data included in the target block data correspondingly, so in order to generate the target block data, each type of data stored in each target structure body instance may be obtained in advance, and then, the obtained types of data are spliced to obtain the target data.
Step S920, creating a block structure identical to the example structure according to the example structure of each target structure example, and combining the acquired data of each type with the block structure to generate target block data.
In this embodiment, in order to generate the target tile data, a tile structure identical to the instance structure may be further created according to the instance structure of each target structure instance. Then, by combining the target data with the tile structure, the target tile data can be obtained.
The following describes embodiments of the apparatus of the present application, which can be used to perform the block data storage method in the above embodiments of the present application. For details that are not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the block data storage method described above in the present application.
FIG. 10 shows a block diagram of a block data storage device according to one embodiment of the present application.
Referring to fig. 10, a block data storage device 1000 according to an embodiment of the present application includes: an acquisition unit 1002, a generation unit 1004, a processing unit 1006, and a storage unit 1008.
The obtaining unit 1002 is configured to obtain block data to be stored; the generating unit 1004 is configured to generate a structure instance corresponding to each type of data in the multiple types according to the multiple types of data included in the to-be-stored block data; the processing unit 1006 is configured to perform serialization processing on the structure instances corresponding to the multiple types of data respectively, so as to obtain serialization processing results corresponding to each structure instance; the storage unit 1008 is configured to store the serialization processing results corresponding to the respective structure instances.
In some embodiments of the present application, the processing unit 1006 is configured to: and according to an asynchronous processing mode, carrying out serialization processing on the structure body examples respectively corresponding to the multiple types of data to obtain serialization processing results corresponding to the structure body examples.
In some embodiments of the present application, the generating unit 1004 includes: the fragmentation subunit is configured to perform fragmentation processing on the data of the target type in the data of the multiple types to obtain multiple data fragments corresponding to the data of the target type; a first generating subunit, configured to generate, for the data of the target type, structure body instances corresponding to the plurality of data fragments, respectively; and the second generation subunit is configured to generate a structure instance corresponding to the other types of data according to the other types of data except the target type of data in the plurality of types of data.
In some embodiments of the present application, the sharding subunit is configured to: calculating hash codes corresponding to all data contained in the target type data; and carrying out fragmentation processing on the data of the target type according to the hash code and the target fragmentation number to obtain a plurality of data fragments corresponding to the data of the target type.
In some embodiments of the present application, the sharding subunit is further configured to: calculating the remainder of the hash code corresponding to each data contained in the target type data and the target fragment number to obtain the remainder corresponding to each data; and taking the data with the same remainder as one data fragment to obtain a plurality of data fragments corresponding to the data of the target type.
In some embodiments of the present application, the storage unit 1008 includes: a third generating subunit, configured to generate, for the serialization processing result corresponding to each structure instance, index information for indexing the serialization processing result corresponding to each structure instance; and the association subunit is configured to associate and store the index information and the serialization processing result corresponding to each structure instance.
In some embodiments of the present application, the third generating subunit is configured to: and determining fields related to the types of the data according to the types of the data corresponding to the serialization processing results corresponding to the structure body examples, and taking the fields as the index information.
In some embodiments of the present application, the apparatus further comprises: a result acquisition unit configured to acquire a plurality of target serialization processing results; the deserializing unit is configured to deserialize each target serialization processing result in the target serialization processing results to obtain a plurality of target structure instances, and each target structure instance in the target structure instances correspondingly stores each type of data contained in the target block data; and the data generation unit is configured to generate the target block data according to the plurality of target structure body examples.
In some embodiments of the present application, each target serialization processing result is stored in association with a field related to a type of data corresponding to the target serialization processing result; the result acquisition unit is configured to: acquiring fields related to the types of the data according to the types of the data corresponding to the target serialization processing results; and determining the serialization processing result associated with each field according to each field, and taking the serialization processing result associated with each field as each target serialization processing result.
In some embodiments of the present application, each target structure instance is obtained by combining each type of data included in the target block data with an instance structure after creating the instance structure that is the same as the block structure of the target block data; the data generation unit is configured to: acquiring various types of data stored in the target structure body examples, and splicing the acquired various types of data to obtain target data; and creating a block structure which is the same as the example structure according to the example structure of each target structure body example, and combining the target data with the block structure to generate the target block data.
In some embodiments of the present application, the obtaining unit 1002 is configured to: acquiring newly generated block data in the block chain network; and if the newly generated block data is the block data which is subjected to consensus operation by the consensus nodes in the block chain network and passes the consensus, taking the newly generated block data as the block data to be stored.
In some embodiments of the present application, the generating unit 1004 is configured to: according to the block structure of the block data to be stored, creating an example structure which is the same as the block structure, wherein the block structure comprises a plurality of parts, and each part in the plurality of parts corresponds to each type of data; and combining the data of each type and the example structure to generate a structure body example corresponding to the data of each type, wherein the structure body example corresponding to the data of each type is used for storing the data of each type.
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 1100 of the electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 11, a computer system 1100 includes a Central Processing Unit (CPU)1101, which can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data necessary for system operation are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An Input/Output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output section 1107 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the removable medium 1111. When the computer program is executed by a Central Processing Unit (CPU)1101, various functions defined in the system of the present application are executed.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with a computer program embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (14)

1. A method for storing block data, the method comprising:
acquiring block data to be stored;
generating a structure body example corresponding to each type of data in the plurality of types according to the plurality of types of data contained in the block data to be stored;
carrying out serialization processing on the structure body examples respectively corresponding to the multiple types of data to obtain serialization processing results corresponding to the structure body examples;
storing the serialization processing result corresponding to each structure body example;
generating a structure body example corresponding to each type of data in the multiple types according to the multiple types of data included in the block data to be stored, including:
carrying out fragmentation processing on data of a target type in the data of the multiple types to obtain multiple data fragments corresponding to the data of the target type;
generating structure body examples respectively corresponding to the plurality of data fragments for the data of the target type; and
and generating a structure body example corresponding to the other types of data according to the other types of data except the target type of data in the plurality of types of data.
2. The method according to claim 1, wherein performing serialization processing on the structure instances respectively corresponding to the multiple types of data concurrently to obtain serialization processing results corresponding to each structure instance comprises:
and according to an asynchronous processing mode, carrying out serialization processing on the structure body examples respectively corresponding to the multiple types of data to obtain serialization processing results corresponding to the structure body examples.
3. The method according to claim 1, wherein performing fragmentation processing on target type data in the multiple types of data to obtain multiple data fragments corresponding to the target type of data comprises:
calculating hash codes corresponding to all data contained in the target type data;
and carrying out fragmentation processing on the data of the target type according to the hash code and the target fragmentation number to obtain a plurality of data fragments corresponding to the data of the target type.
4. The method of claim 3, wherein performing fragmentation processing on the data of the target type according to the hash code and the target fragmentation number to obtain a plurality of data fragments corresponding to the data of the target type comprises:
calculating the remainder of the hash code corresponding to each data contained in the target type data and the target fragment number to obtain the remainder corresponding to each data;
and taking the data with the same remainder as one data fragment to obtain a plurality of data fragments corresponding to the data of the target type.
5. The method according to claim 1, wherein storing the serialized processing results corresponding to the respective structure instances comprises:
generating index information for indexing the serialization processing result corresponding to each structure instance according to the serialization processing result corresponding to each structure instance;
and storing the index information and the serialization processing result corresponding to each structure body example in an associated manner.
6. The method according to claim 5, wherein generating, for the serialization processing result corresponding to each structure instance, index information for indexing the serialization processing result corresponding to each structure instance comprises:
and determining fields related to the types of the data according to the types of the data corresponding to the serialization processing results corresponding to the structure body examples, and taking the fields as the index information.
7. The method of claim 1, further comprising:
obtaining a plurality of target serialization processing results;
performing deserialization processing on each target serialization processing result in the plurality of target serialization processing results to obtain a plurality of target structure body examples, wherein each target structure body example in the plurality of target structure body examples correspondingly stores each type of data contained in the target block data;
and generating the target block data according to the plurality of target structure body examples.
8. The method according to claim 7, wherein each target serialization processing result is stored in association with a field related to the type of data corresponding to the each target serialization processing result;
obtaining a plurality of target serialization processing results, comprising: acquiring fields related to the types of the data according to the types of the data corresponding to the target serialization processing results;
and determining the serialization processing result associated with each field according to each field, and taking the serialization processing result associated with each field as each target serialization processing result.
9. The method according to claim 7, wherein each target structure instance is obtained by combining each type of data included in the target block data with an instance structure after creating the instance structure identical to the block structure of the target block data;
generating the target block data according to the plurality of target structure instances, including: acquiring various types of data stored in the target structure body examples, and splicing the acquired various types of data to obtain target data;
and creating a block structure which is the same as the example structure according to the example structure of each target structure body example, and combining the target data with the block structure to generate the target block data.
10. The method of claim 1, wherein the obtaining block data to be stored in the blockchain network comprises:
acquiring newly generated block data in the block chain network;
and if the newly generated block data is the block data which is subjected to consensus operation by the consensus nodes in the block chain network and passes the consensus, taking the newly generated block data as the block data to be stored.
11. The method according to any one of claims 1 to 10, wherein generating, according to a plurality of types of data included in the block data to be stored, a structure instance corresponding to each type of data in the plurality of types includes:
according to the block structure of the block data to be stored, creating an example structure which is the same as the block structure, wherein the block structure comprises a plurality of parts, and each part in the plurality of parts corresponds to each type of data;
and combining the data of each type and the example structure to generate a structure body example corresponding to the data of each type, wherein the structure body example corresponding to the data of each type is used for storing the data of each type.
12. A block data storage device, the device comprising:
an acquisition unit configured to acquire block data to be stored;
the generating unit is configured to generate a structure body example corresponding to each type of data in the multiple types according to the multiple types of data contained in the block data to be stored;
the processing unit is configured to perform serialization processing on the structure instances corresponding to the multiple types of data respectively to obtain serialization processing results corresponding to the structure instances;
the storage unit is configured to store the serialization processing results corresponding to the structure body examples;
wherein the generating unit includes:
the fragmentation subunit is configured to perform fragmentation processing on the data of the target type in the data of the multiple types to obtain multiple data fragments corresponding to the data of the target type;
a first generating subunit, configured to generate, for the data of the target type, structure body instances corresponding to the plurality of data fragments, respectively; and
and the second generation subunit is configured to generate a structure instance corresponding to the other types of data according to the other types of data except the target type of data in the plurality of types of data.
13. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the block data storage method according to any one of claims 1 to 11.
14. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the block data storage method of any one of claims 1 to 11.
CN202110151754.7A 2021-02-03 2021-02-03 Block data storage method and device, computer readable medium and electronic equipment Active CN112765280B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110151754.7A CN112765280B (en) 2021-02-03 2021-02-03 Block data storage method and device, computer readable medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110151754.7A CN112765280B (en) 2021-02-03 2021-02-03 Block data storage method and device, computer readable medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112765280A CN112765280A (en) 2021-05-07
CN112765280B true CN112765280B (en) 2021-09-24

Family

ID=75704862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110151754.7A Active CN112765280B (en) 2021-02-03 2021-02-03 Block data storage method and device, computer readable medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112765280B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115905160B (en) * 2023-01-31 2023-06-23 天翼云科技有限公司 Verification method and device for data storage, electronic equipment and storage medium
CN116204593A (en) * 2023-03-17 2023-06-02 北京金和网络股份有限公司 Method, system, equipment and storage medium for real-time synchronization of data

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239479B (en) * 2017-03-28 2020-03-13 创新先进技术有限公司 Block chain based data storage and query method and device
EP3983922A1 (en) * 2019-06-14 2022-04-20 Ailia SA Method for the execution of an instance of a smart contract by means of a blockchain
CN111049902B (en) * 2019-09-16 2021-08-13 腾讯科技(深圳)有限公司 Data storage method, device, storage medium and equipment based on block chain network
CN112052370A (en) * 2020-09-02 2020-12-08 平安科技(深圳)有限公司 Message generation method and device, electronic equipment and computer readable storage medium
CN111984202A (en) * 2020-09-03 2020-11-24 深圳壹账通智能科技有限公司 Data processing method and device, electronic equipment and storage medium
CN112131236B (en) * 2020-09-21 2022-07-05 中国电子科技网络信息安全有限公司 Novel block chain parallel processing performance optimization method

Also Published As

Publication number Publication date
CN112765280A (en) 2021-05-07

Similar Documents

Publication Publication Date Title
CN112765280B (en) Block data storage method and device, computer readable medium and electronic equipment
CN109491989B (en) Data processing method and device, electronic equipment and storage medium
CN112070608B (en) Information processing method, device, medium and electronic equipment
CN113193947B (en) Method, apparatus, medium, and program product for implementing distributed global ordering
CN111756779B (en) Data serialization processing method, device and computer system
CN111931220A (en) Consensus processing method, device, medium and electronic equipment for block chain network
CN112445866A (en) Data processing method and device, computer readable medium and electronic equipment
CN111553652B (en) Service processing method and device
CN112241437A (en) Loop control method, device and equipment for multi-master synchronization of database and storage medium
CN115757616A (en) Data consistency checking method, device and medium based on binary log
CN111835808B (en) Data storage method and device, data reading method and device, and storage medium
CN115599359A (en) Code generation method, device, equipment and medium
CN112907336A (en) Method and server for realizing order state synchronization based on mybatis interceptor
CN116701053A (en) Method, device, equipment and medium for restoring data backup of production environment database
CN116185389A (en) Code generation method and device, electronic equipment and medium
CN105975286B (en) Generate the method and system at the interface for human-computer interaction
CN113961632A (en) Message data processing method and device and electronic equipment
CN114218313A (en) Data management method, device, electronic equipment, storage medium and product
CN110309121B (en) Log processing method and device, computer readable medium and electronic equipment
CN115865898B (en) Method, device, equipment and medium for processing data information among multiple service systems
US10133758B2 (en) Cell-based database management system
CN116756460B (en) Combined data acquisition method and device and related equipment
CN117131071B (en) Data processing method, device, electronic equipment and computer readable medium
CN117010983A (en) Method and device for achieving commodity reservation order state synchronization based on mybatis interceptor
CN117689132A (en) Processing method and device of flow form, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40044603

Country of ref document: HK