CN111611321B - Data storage method, device and blockchain system - Google Patents

Data storage method, device and blockchain system Download PDF

Info

Publication number
CN111611321B
CN111611321B CN202010609784.3A CN202010609784A CN111611321B CN 111611321 B CN111611321 B CN 111611321B CN 202010609784 A CN202010609784 A CN 202010609784A CN 111611321 B CN111611321 B CN 111611321B
Authority
CN
China
Prior art keywords
user
node
data
transaction
user node
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
CN202010609784.3A
Other languages
Chinese (zh)
Other versions
CN111611321A (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.)
Du Xiaoman Technology Beijing Co Ltd
Original Assignee
Du Xiaoman Technology Beijing 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 Du Xiaoman Technology Beijing Co Ltd filed Critical Du Xiaoman Technology Beijing Co Ltd
Priority to CN202010609784.3A priority Critical patent/CN111611321B/en
Publication of CN111611321A publication Critical patent/CN111611321A/en
Application granted granted Critical
Publication of CN111611321B publication Critical patent/CN111611321B/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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/278Data partitioning, e.g. horizontal or vertical partitioning
    • 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
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a data storage method, a data storage device and a block chain system, wherein a service in the block chain system is divided into a plurality of service domains in advance, and at least one user chain corresponding to a user identifier of the user node is stored in a user node; each user chain corresponds to a different service domain, wherein the method comprises the following steps: determining a target service domain corresponding to the service type of the current transaction; and storing the data of the current transaction in the newly-built latest block of the user chain corresponding to the target service domain in the node, and realizing dynamic fragment storage of the transaction data from the service domain dimension and the user dimension. Meanwhile, the user node can realize transaction traceability by establishing transaction association between the latest block storing transaction data in the user node and blocks storing transaction data in other user nodes in the current transaction, namely, the physical storage pressure of the user node is reduced while the traceability of the transaction in the blockchain system is met, and the transaction speed is improved.

Description

Data storage method, device and blockchain system
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a data storage method, apparatus, and blockchain system.
Background
Since the birth of the bit coin, the blockchain technology is vigorously developed, and the technological layers of Ethernet, EOS and the like are endless, so that the development of the blockchain technology is greatly promoted.
At present, most blockchain systems adopt a ledger mode, namely, all nodes in the blockchain maintain the same ledger, all transactions are carried out on one chain, and the transaction speed is low; meanwhile, all data are stored on the same chain, the data amount of the account book is large, all nodes in the blockchain need to store the data on the chain, and great storage pressure is brought to the nodes.
It can be seen that the current blockchain system has the problems of high physical storage pressure and low transaction speed.
Disclosure of Invention
In view of the above, the present invention provides a data storage method, and a blockchain system with high scalability and high expansibility, which solves the problems of high physical storage pressure and slow transaction speed of the current blockchain system.
In order to achieve the above purpose, the specific technical scheme provided by the invention is as follows:
the data storage method is applied to user nodes in a block chain system, wherein the business in the block chain system is divided into a plurality of business domains in advance, and at least one user chain corresponding to the user identification of the user nodes is stored in the user nodes; each user chain corresponds to a different service domain, and the method comprises the following steps:
determining a target service domain corresponding to the service type of the current transaction;
storing the data of the current transaction in a newly-built latest block of a user chain corresponding to the target service domain in a node;
determining blocks storing data of the current transaction in other user nodes in the current transaction;
a transaction association is established between the latest block of nodes thereof storing the data of the current transaction and blocks of other user nodes in the current transaction storing the data of the current transaction.
Optionally, each user node corresponds to a resource identifier, the identifiers of the user nodes are processed to obtain an n-bit 01 sequence, corresponding resource identifiers are obtained, the identifiers of each user node are arranged according to the order in which the resource identifiers corresponding to each user node in the blockchain system are arranged clockwise from small to large, an annular hash table is formed, in the annular hash table, each user node corresponds to a neighbor node set, and the method further includes:
and periodically updating the ring hash table and the neighbor node set corresponding to the user node.
Optionally, the processing the identifier of the user node to obtain an n-bit 01 sequence, to obtain a corresponding resource identifier, includes:
according to a preset hash algorithm, calculating the identification of the user node;
and intercepting an n-bit 01 sequence from the calculated 01 sequence according to a preset rule to obtain a corresponding resource identifier.
Optionally, the method further comprises:
and synchronously storing the data of the user nodes corresponding to the neighbor node set where the data are located.
Optionally, the method further comprises:
and storing the data in the user chains corresponding to the target service domains in other nodes.
Optionally, the method further comprises:
and under the condition that the new user node is detected to join in the corresponding neighbor node set, notifying the new user node to synchronously store the data of the user node.
Optionally, the step of synchronously storing the data of the user node corresponding to the neighbor node set where the data is located includes:
under the condition that the user node update corresponding to the neighbor node set where the user node update is located is detected, a data synchronization request is sent to the updated user node;
and when receiving the response information of the updated user node, synchronously storing the data of the updated user node.
Optionally, the block in the user node includes a block header, consensus information and transaction data, where the block header includes a user chain identifier, a user identifier, a preamble block hash value and a current block hash value, and the user chain identifier is composed of a service domain identifier and a user identifier.
A data storage device, applied to a user node in a blockchain system, wherein a service in the blockchain system is divided into a plurality of service domains in advance, and at least one user chain corresponding to a user identification of the user node is stored in the user node; each user chain corresponds to a different service domain, and the device comprises:
a service domain determining unit, configured to determine a target service domain corresponding to a service type of a current transaction;
the data storage unit is used for storing the data of the current transaction in the newly-built latest block of the user chain corresponding to the target service domain in the node;
a block determining unit, configured to determine a block storing data of the current transaction in other user nodes in the current transaction;
and the association establishing unit is used for establishing transaction association between the latest block storing the data of the current transaction in the node and the blocks storing the data of the current transaction in other user nodes in the current transaction.
Optionally, each user node corresponds to a resource identifier, the identifiers of the user nodes are processed to obtain an n-bit 01 sequence, corresponding resource identifiers are obtained, the identifiers of each user node are arranged according to the order of clockwise arrangement of the resource identifiers corresponding to each user node in the blockchain system from small to large to form an annular hash table, in the annular hash table, each user node corresponds to a neighbor node set, and the device further comprises:
and the data updating unit is used for periodically updating the annular hash table and the neighbor node set corresponding to the user node.
Optionally, the apparatus further includes:
and the synchronous storage unit is used for synchronously storing the data of the user node corresponding to the neighbor node set where the synchronous storage unit is positioned.
Optionally, the synchronous storage unit is further configured to store data in a user chain corresponding to the target service domain in other nodes.
Optionally, the apparatus further includes:
and the notification unit is used for notifying the new user node to synchronously store the data of the user node under the condition that the new user node is detected to join in the corresponding neighbor node set.
Optionally, the synchronous storage unit is specifically configured to:
under the condition that the user node update corresponding to the neighbor node set where the user node update is located is detected, a data synchronization request is sent to the updated user node;
and when receiving the response information of the updated user node, synchronously storing the data of the updated user node.
Optionally, the block in the user node includes a block header, consensus information and transaction data, where the block header includes a user chain identifier, a user identifier, a preamble block hash value and a current block hash value, and the user chain identifier is composed of a service domain identifier and a user identifier.
A blockchain system includes a plurality of user nodes;
each of the user nodes being configured to perform a data storage method as claimed in any one of the preceding claims.
Compared with the prior art, the invention has the following beneficial effects:
the invention discloses a data storage method, wherein the business in a block chain is divided into a plurality of business domains, at least one user chain corresponding to the user identification is stored in a user node, and each user chain corresponds to different business domains respectively. Under the condition that a user node participates in a transaction, firstly, transaction data is stored in an latest block newly built by a user chain corresponding to a target service domain in the node by determining the target service domain corresponding to the service type of the transaction, and dynamic fragment storage of the transaction data from the service domain dimension and the user dimension is realized. Meanwhile, the user node establishes transaction association between the latest block storing transaction data in the user node and the block storing transaction data in other user nodes in the current transaction by determining the blocks storing transaction data in other user nodes in the current transaction, and the transaction can be traced through the transaction association, namely, the physical storage pressure of the user node is reduced while the traceability of the transaction in the blockchain system is met, and the transaction speed is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used 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 embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of storing users in different domains according to different service domains of a data storing method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a data storage method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of establishing a transaction association according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a circular hash table according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a data storage device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order to solve the problems of high physical storage pressure and low transaction speed in the existing blockchain system, the embodiment of the invention provides a data storage method which is applied to user nodes in a blockchain, wherein services in the blockchain are divided into a plurality of service domains, at least one user chain corresponding to user identifications of the user nodes is stored in the user nodes, each user chain corresponds to different service domains respectively, and particularly as shown in fig. 1, each user node can correspond to a plurality of service domains, and each service domain can correspond to a plurality of user nodes. In the transaction process, the user node stores transaction data in the latest block of the user chain corresponding to the target service domain in the node by determining the target service domain corresponding to the service type of the transaction, so that the dynamic fragmentation storage of the transaction data from the service domain dimension and the user dimension is realized, the physical storage pressure of the user node is reduced, and the transaction speed is improved.
Referring to fig. 2, fig. 2 is a flow chart of a data storage method disclosed in this embodiment, where a user node to which the data storage method is applied may be used as an initiator of a transaction or may be used as a receiver of the transaction, and specifically, the data storage method disclosed in this embodiment includes the following steps:
s101: determining a target service domain corresponding to the service type of the current transaction;
each node in the block chain system stores service domain configuration information in advance, and the service domain configuration information comprises a service type corresponding to each service domain.
The transaction information comprises a service type, and the target service domain corresponding to the service type of the current transaction can be determined by searching the service type in the service domain configuration information according to the service type.
S102: storing the data of the current transaction in a newly-built latest block of a user chain corresponding to the target service domain in a node;
the user chain identification consists of a service domain identification and a user identification, each user node corresponds to a unique user identification, and after the target service domain is determined, the user node can find the user chain which needs to store the data of the current transaction according to the user identification and the target service domain identification.
The user chain is composed of a plurality of blocks including block headers, consensus information, and transaction data.
The block header comprises a version number, a user chain identification, a height, a user identification, a preamble block hash value, a current block hash value and a creation time. The version number refers to the version number of the data element information, and in the evolution process of the code architecture, the information in the block is often different, and the program can perform different processing logic according to the version number; the height is the block height of the current block.
The consensus information is related consensus information submitted by the current block and is determined by a specific consensus strategy.
The transaction data includes data of initiator information, receiver information, specific transaction content, receiver signature, initiator signature and the like of the transaction.
S103: determining blocks storing data of the current transaction in other user nodes in the current transaction;
when the user node is an initiator node, determining a block of the current transaction, which is stored by the receiver node in the current transaction; when the user node is the receiver node, the block of the current transaction, in which the initiator node stores the data of the current transaction, needs to be determined.
S104: a transaction association is established between the latest block of nodes thereof storing the data of the current transaction and blocks of other user nodes in the current transaction storing the data of the current transaction.
Establishing the transaction association may be performed by the initiator node, by the receiver node, or by both the initiator node and the receiver node.
When the transaction association is performed by the initiator node, determining the block of the current transaction stored by the receiver node in the current transaction by actively requesting the receiver node for the identification of the block of the current transaction stored by the receiver node when the transaction is completed; the block of the current transaction in which the receiver node stores the data of the current transaction may also be determined by waiting to receive an identification of the block of the receiver node storing the data of the current transaction sent by the receiver node.
When the transaction association is executed by the receiver node, when the transaction is completed, the latest block of the data of the current transaction stored by the initiator node in the current transaction can be determined by actively requesting the identifier of the block of the data of the current transaction stored by the receiver node from the initiator node; the latest block of the current transaction in which the initiator node stores data of the current transaction may also be determined by waiting to receive an identification of the latest block of the data of the current transaction stored by the initiator node sent by the initiator node.
Wherein a transaction association between the latest block of the user node storing the data of the current transaction and the block of the other user nodes storing the data of the current transaction, which transaction association represents the direction from the initiator node to the receiver node, may be established by a transaction number.
In any service domain, independent chained accounts, i.e. user chains, between user nodes are related to each other through transactions. With the increasing number of transactions and the frequent occurrence of associated transactions in blockchain systems, the resulting global ledger forms a directed acyclic graph structure (DAG) that is interrelated, yet constrained and verifiable to each other.
The specific transaction flow is shown in fig. 3:
1. the user node B initiates a transaction to the user node A and initiates a transaction to the user node C at the same time, and firstly, the two transactions need to be registered in a user chain block t2 of the user node B;
2. as a party (often a receiver of interest) to the transaction, the user node a registers the transaction in its own user chain, records as s2 blocks, as credentials of participation (receipt of interest) to the transaction; similarly, the user node C registers the transaction in the user chain of the user node C and records the transaction as a u2 block;
3. establishing a transaction association between t2 and s2, directing t2 to s2, indicating that s2 is the receiving block of the t2 transaction; similarly u2 is the receiving block of the t2 block;
specific business transaction association is completed among the user chains through the directed expression, the DAG characteristic is finally presented in the whole business domain, and all historical transactions can be traced back through the association information.
According to the data storage method in the embodiment, different service domains are allocated to each service, so that the different service domains, namely, different services, can be kept independent of each other in terms of participants, data and operation, and account book isolation in service dimension is ensured. Only the user nodes participating in a service domain are displayed, and the authority of synchronizing the account book of the service domain is available. For example, in fig. 1, the user node 1 can synchronize information of the user node 2 under the service domain 1, and cannot synchronize information of the user node 1 under the service domain 2; the same user node participates in a plurality of domains simultaneously, and the user node synchronizes the data of a plurality of service domains simultaneously through one user node, and can synchronize the data of different service domains through different user nodes, so that a certain degree of isolation is realized at the angle of the user node.
Besides isolation on the service, each user node is further segmented, namely, on a certain service, each user node has a user chain belonging to the user node, on a specific storage, each user node preferably stores data belonging to the user node, and the user chain of interest can be freely selected for storage. The ledger is expressed in a chain, on which transaction data relating to the user node itself is stored. The data of the user chains of all user nodes on a certain service domain constitutes the whole data and transactions of this service domain.
The account book content becomes independent through the design, the volume of the account book is greatly reduced, the conflict of transactions is reduced, the problem of transaction performance caused by aggregation of the account book is avoided, meanwhile, the volume of the account book is reduced, the account book can be conveniently transmitted, loaded and used, and the expandability of the system is ensured.
For convenience of management, each user node corresponds to a resource identifier, and the identifier of the user node is processed to obtain an n-bit 01 sequence, so as to obtain a corresponding resource identifier, for example: according to a preset hash algorithm, the identification of the user node is calculated, and according to a preset rule, an n-bit 01 sequence is intercepted from the calculated 01 sequence, so that a corresponding resource identification is obtained. According to different node scales in the block chain system, a corresponding hash algorithm can be selected, for example, the calculated result of the MD5 algorithm is 128 bits, and the calculated result of the sha256 algorithm is 256 bits. The resource identifier can be obtained by intercepting an n-bit 01 sequence from the 01 sequence obtained by calculation from front to back.
According to the sequence of clockwise arrangement from small (all 0) to large (all 1) of the resource identifiers corresponding to each user node in the block chain system, the identifiers of each user node are arranged, all 0 resource identifiers are connected with all 1 resource identifiers to form an annular hash table, 2 n positions exist in the annular hash table, each user node corresponds to one position in the annular hash table, in fact, the user nodes in the annular hash table are often loose, and the vast majority of positions do not correspond to specific user nodes.
In the ring hash table, each user node corresponds to one neighbor node set, the neighbor node set comprises a preamble neighbor set and a follow-up neighbor set, and the user node periodically updates the ring hash table and the neighbor node set corresponding to the user node.
Referring to fig. 4, assuming that the sizes of the preamble neighbor set and the following neighbor node set are 2, the user nodes 5, 6, 8, and 9 are neighbor nodes of the user node 7, the data of the user node 7 will be backed up, the data of the user node with the number 9 will be backed up by the user nodes with the numbers 7, 8, and 10, and 11, and meanwhile, the data of the user nodes with the numbers 7 and 9 will be backed up except the self data stored in the user node with the number 8. The backups of neighbor nodes are mutual, in most cases, a is the neighbor of B, which is also the neighbor of a; to ensure relative equilibrium, the leading neighbor set and the following neighbor set are equal in size.
Wherein, the data backup mechanism: the data backup has two mechanisms of push and pull:
and (3) Push, namely notifying the new user node to synchronously store the data of the user node under the condition that the new user node is detected to join in the corresponding neighbor node set.
Pull, after the user node finds itself to be possible to be the neighbor node of a user node, actively initiates a synchronous data request to the user node, and starts to synchronize the data of the user node after the user node is verified.
The user node needs to maintain the information of the neighbor node set, including the preamble neighbor information and the successor neighbor information, in the operation process, and updates the neighbor node set periodically while maintaining the ring hash table.
When the user node exits from the ring hash table, the user node is removed from the neighbor node set; when the user node is added into the ring hash table, the user node is compared with the current neighbor node, if the distance is closer, the current neighbor node set is added, and the farthest user node is removed from the neighbor node set. In addition, a query request of neighbor node information needs to be periodically initiated to known nodes in the network so as to acquire and synchronously update own neighbor node information.
When the user node joins and exits, the data backup is dynamically adjusted according to the condition of the new ring hash table, through the mechanism, the stability of the node backup is ensured not to be lost, specifically, after the user node starts joining the network, the user node starts to backup the information of the adjacent node, and other user nodes adjust the own neighbor node set information according to the latest node distribution condition, for example, in fig. 4, if a new user node P joins between 6 and 7 user nodes, the P user node becomes a new neighbor of the user node 7 instead of the user node 5, and starts to backup the data information of the user node 7, and 5, 6, 7 and 8 start to backup the data information of the P. Due to the variability of the network situation, neighbor 5 may subsequently become a neighbor of 7 again, and thus does not actively delete the data information of user node 7.
After the user node exits, the surviving user node removes the heartbeat from the neighbor node set after the heartbeat sent by the exiting user node is not received for a certain time, the new neighbor node replaces the exiting user node backup data, and the backup node generally does not actively delete the data of the exiting user node in order to ensure that the data is not lost because most of the situations are only briefly offline after the user node exits.
On the basis, the user nodes can obtain rewards in the consensus process, and can participate in the consensus process only when the user nodes are neighbor nodes of other user nodes and save accounts of other nodes, so that the user can actively save data information of other user nodes through the excitation of a token, and meanwhile, the achievement of the transaction is promoted.
Based on the data storage method disclosed in the above embodiment, the present embodiment correspondingly discloses a data storage device, which is disposed at a user node in a blockchain system, where a service in the blockchain system is divided into a plurality of service domains in advance, and at least one user chain corresponding to a user identifier thereof is stored in the user node; referring to fig. 5, the apparatus includes:
a service domain determining unit 100, configured to determine a target service domain corresponding to a service type of a current transaction;
a data storage unit 200, configured to store the data of the current transaction in a newly-built latest block of a user chain corresponding to the target service domain in a node;
a block determining unit 300, configured to determine a block in other user nodes in the current transaction, where data of the current transaction is stored;
an association establishing unit 400, configured to establish a transaction association between the latest block storing the data of the current transaction in the node thereof and the block storing the data of the current transaction in other user nodes in the current transaction.
Optionally, each user node corresponds to a resource identifier, the identifiers of the user nodes are processed to obtain an n-bit 01 sequence, corresponding resource identifiers are obtained, the identifiers of each user node are arranged according to the order of clockwise arrangement of the resource identifiers corresponding to each user node in the blockchain system from small to large to form an annular hash table, in the annular hash table, each user node corresponds to a neighbor node set, and the device further comprises:
and the data updating unit is used for periodically updating the annular hash table and the neighbor node set corresponding to the user node.
Optionally, the apparatus further includes:
and the synchronous storage unit is used for synchronously storing the data of the user node corresponding to the neighbor node set where the synchronous storage unit is positioned.
Optionally, the synchronous storage unit is further configured to store data in a user chain corresponding to the target service domain in other nodes.
Optionally, the apparatus further includes:
and the notification unit is used for notifying the new user node to synchronously store the data of the user node under the condition that the new user node is detected to join in the corresponding neighbor node set.
Optionally, the synchronous storage unit is specifically configured to:
under the condition that the user node update corresponding to the neighbor node set where the user node update is located is detected, a data synchronization request is sent to the updated user node;
and when receiving the response information of the updated user node, synchronously storing the data of the updated user node.
Optionally, the block in the user node includes a block header, consensus information and transaction data, where the block header includes a user chain identifier, a user identifier, a preamble block hash value and a current block hash value, and the user chain identifier is composed of a service domain identifier and a user identifier.
A blockchain system includes a plurality of user nodes;
each of the user nodes is configured to perform the following data storage method:
determining a target service domain corresponding to the service type of the current transaction;
storing the data of the current transaction in the latest block of a user chain corresponding to the target service domain in a node;
determining the latest block for storing the data of the current transaction in other user nodes in the current transaction;
a transaction association is established between the latest block of nodes thereof storing the data of the current transaction and the latest block of other user nodes in the current transaction storing the data of the current transaction.
Further, each user node corresponds to a resource identifier, the identifiers of the user nodes are processed to obtain an n-bit 01 sequence, corresponding resource identifiers are obtained, the identifiers of each user node are arranged according to the order of clockwise arrangement of the resource identifiers corresponding to each user node in the blockchain system from small to large to form an annular hash table, in the annular hash table, each user node corresponds to a neighbor node set, and the method further comprises:
and periodically updating the ring hash table and the neighbor node set corresponding to the user node.
Further, the processing the identifier of the user node to obtain an n-bit 01 sequence, to obtain a corresponding resource identifier, includes:
according to a preset hash algorithm, calculating the identification of the user node;
and intercepting an n-bit 01 sequence from the calculated 01 sequence according to a preset rule to obtain a corresponding resource identifier.
Further, the method further comprises:
and synchronously storing the data of the user nodes corresponding to the neighbor node set where the data are located.
Further, the method further comprises:
and storing the data in the user chains corresponding to the target service domains in other nodes.
Further, the method further comprises:
and under the condition that the new user node is detected to join in the corresponding neighbor node set, notifying the new user node to synchronously store the data of the user node.
Further, the step of synchronously storing the data of the user node corresponding to the neighbor node set where the data is located includes:
under the condition that the user node update corresponding to the neighbor node set where the user node update is located is detected, a data synchronization request is sent to the updated user node;
and when receiving the response information of the updated user node, synchronously storing the data of the updated user node.
Further, the block in the user node comprises a block header, consensus information and transaction data, wherein the block header comprises a user chain identifier, a user identifier, a preamble block hash value and a current block hash value, and the user chain identifier consists of a service domain identifier and a user identifier.
The embodiment discloses a blockchain system, wherein services in a blockchain are divided into a plurality of service domains, at least one user chain corresponding to user identifications thereof is stored in user nodes, each user chain corresponds to a different service domain respectively, transaction data is dynamically stored in a fragmentation mode from service domain dimensions and user dimensions, and each user node only needs to store the transaction data in the user chain corresponding to the user identifications thereof, so that physical storage pressure of the user nodes is reduced. Meanwhile, the user chains are mutually related through the transaction, and the transaction can be traced through the transaction relationship, namely, the transaction traceability in the blockchain system is met, meanwhile, the physical storage pressure of the user nodes is reduced, and the transaction speed is improved.
In the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
It is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. The data storage method is characterized by being applied to user nodes in a block chain system, wherein services in the block chain system are divided into a plurality of service domains in advance, and at least one user chain corresponding to user identifications of the user nodes is stored in the user nodes; each user chain corresponds to a different service domain, and the method comprises the following steps:
determining a target service domain corresponding to the service type of the current transaction;
storing the data of the current transaction in a newly-built latest block of a user chain corresponding to the target service domain in a node;
determining blocks storing data of the current transaction in other user nodes in the current transaction;
a transaction association is established between the latest block of nodes thereof storing the data of the current transaction and blocks of other user nodes in the current transaction storing the data of the current transaction.
2. The method of claim 1, wherein each user node corresponds to a resource identifier, the identifiers of the user nodes are processed to obtain an n-bit 01 sequence, corresponding resource identifiers are obtained, the identifiers of each user node are arranged in a clockwise order from small to large according to the resource identifiers corresponding to each user node in the blockchain system, and a ring hash table is formed, in the ring hash table, each user node corresponds to a set of neighbor nodes, the method further comprises:
and periodically updating the ring hash table and the neighbor node set corresponding to the user node.
3. The method according to claim 2, wherein said processing the identity of the user node to obtain an n-bit 01 sequence, to obtain the corresponding resource identity, comprises:
according to a preset hash algorithm, calculating the identification of the user node;
and intercepting an n-bit 01 sequence from the calculated 01 sequence according to a preset rule to obtain a corresponding resource identifier.
4. The method according to claim 2, wherein the method further comprises:
and synchronously storing the data of the user nodes corresponding to the neighbor node set where the data are located.
5. The method according to claim 2, wherein the method further comprises:
and storing the data in the user chains corresponding to the target service domains in other nodes.
6. The method according to claim 2, wherein the method further comprises:
and under the condition that the new user node is detected to join in the corresponding neighbor node set, notifying the new user node to synchronously store the data of the user node.
7. The method of claim 4, wherein the step of synchronously storing data of the user node corresponding to the set of neighboring nodes in which the user node is located comprises:
under the condition that the user node update corresponding to the neighbor node set where the user node update is located is detected, a data synchronization request is sent to the updated user node;
and when receiving the response information of the updated user node, synchronously storing the data of the updated user node.
8. The method according to any of claims 1-7, wherein a chunk in a user node comprises a chunk header, consensus information and transaction data, wherein the chunk header comprises a user chain identity, a user identity, a preamble chunk hash value and a current chunk hash value, wherein the user chain identity consists of a traffic domain identity and a user identity.
9. A data storage device, characterized in that it is applied to a user node in a blockchain system, where a service in the blockchain system is divided into a plurality of service domains in advance, and at least one user chain corresponding to a user identifier of the user node is stored in the user node; each user chain corresponds to a different service domain, and the device comprises:
a service domain determining unit, configured to determine a target service domain corresponding to a service type of a current transaction;
the data storage unit is used for storing the data of the current transaction in the newly-built latest block of the user chain corresponding to the target service domain in the node;
a block determining unit, configured to determine a block storing data of the current transaction in other user nodes in the current transaction;
and the association establishing unit is used for establishing transaction association between the latest block storing the data of the current transaction in the node and the blocks storing the data of the current transaction in other user nodes in the current transaction.
10. A blockchain system comprising a plurality of user nodes;
each of said user nodes being adapted to perform a data storage method as claimed in any one of claims 1 to 8.
CN202010609784.3A 2020-06-29 2020-06-29 Data storage method, device and blockchain system Active CN111611321B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010609784.3A CN111611321B (en) 2020-06-29 2020-06-29 Data storage method, device and blockchain system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010609784.3A CN111611321B (en) 2020-06-29 2020-06-29 Data storage method, device and blockchain system

Publications (2)

Publication Number Publication Date
CN111611321A CN111611321A (en) 2020-09-01
CN111611321B true CN111611321B (en) 2023-07-25

Family

ID=72200495

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010609784.3A Active CN111611321B (en) 2020-06-29 2020-06-29 Data storage method, device and blockchain system

Country Status (1)

Country Link
CN (1) CN111611321B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115829731A (en) * 2021-09-15 2023-03-21 华为技术有限公司 Transaction information processing method and device
CN113708937B (en) * 2021-10-28 2022-03-01 湖南天河国云科技有限公司 Processing method and system for block chain transaction
CN115473895B (en) * 2022-09-01 2023-09-12 北京大数据先进技术研究院 Method and device for dividing digital object warehouse node consensus groups under ubiquitous environment
CN115412464B (en) * 2022-11-01 2023-03-24 江苏荣泽信息科技股份有限公司 Dynamic expansion method of block chain based on flow

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109635036A (en) * 2018-11-16 2019-04-16 播金信息科技(上海)有限公司 A kind of block chain building model and construction method
CN109886678A (en) * 2019-01-24 2019-06-14 杭州趣链科技有限公司 A kind of art work traceability system based on block chain
CN110543788A (en) * 2019-09-11 2019-12-06 腾讯科技(深圳)有限公司 Data storage method, data storage device, computer-readable storage medium and computer equipment
CN110598446A (en) * 2019-09-16 2019-12-20 腾讯科技(深圳)有限公司 Block chain based test method and device, storage medium and computer equipment
CN110633323A (en) * 2019-09-16 2019-12-31 腾讯科技(深圳)有限公司 Business data storage method, device, storage medium and computer equipment
CN111177202A (en) * 2019-12-13 2020-05-19 浙商银行股份有限公司 Supply chain financial system data query optimization method and platform based on block chain

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109635036A (en) * 2018-11-16 2019-04-16 播金信息科技(上海)有限公司 A kind of block chain building model and construction method
CN109886678A (en) * 2019-01-24 2019-06-14 杭州趣链科技有限公司 A kind of art work traceability system based on block chain
CN110543788A (en) * 2019-09-11 2019-12-06 腾讯科技(深圳)有限公司 Data storage method, data storage device, computer-readable storage medium and computer equipment
CN110598446A (en) * 2019-09-16 2019-12-20 腾讯科技(深圳)有限公司 Block chain based test method and device, storage medium and computer equipment
CN110633323A (en) * 2019-09-16 2019-12-31 腾讯科技(深圳)有限公司 Business data storage method, device, storage medium and computer equipment
CN111177202A (en) * 2019-12-13 2020-05-19 浙商银行股份有限公司 Supply chain financial system data query optimization method and platform based on block chain

Also Published As

Publication number Publication date
CN111611321A (en) 2020-09-01

Similar Documents

Publication Publication Date Title
CN111611321B (en) Data storage method, device and blockchain system
EP3848875B1 (en) Method, device, computer apparatus and storage medium for electing representative node apparatus
WO2019042101A1 (en) Cross-chain trading method and apparatus
US11863624B2 (en) Fast propagation of recent transactions over a blockchain network
CN102449616B (en) Swarm-based synchronization over a network of object stores
CN102668513B (en) For in peer-to-peer network to the method and apparatus of positioning service
CN111131399B (en) Method and device for dynamically increasing consensus nodes in block chain
WO2020134895A1 (en) Blockchain-based accounting method and apparatus, and electronic device
CN107919977B (en) Online capacity expansion and online capacity reduction method and device based on Paxos protocol
CN111163148B (en) Synchronization method and related equipment for consensus state of block chain system
JP6700308B2 (en) Data copy method and device
CN112966052A (en) Method and device for obtaining block chain data in multiple times
WO2020197514A1 (en) A distributed hash table based blockchain architecture for resource constrained environments
CN112187866B (en) Novel block chain consensus method based on shared storage
US10362105B1 (en) Generating probalistic data structures in gossip protocols
CN112650812A (en) Data fragment storage method and device, computer equipment and storage medium
CN113064764A (en) Method and apparatus for performing blocks in a blockchain system
CN110417833B (en) Data processing method and device based on block chain and storage medium
CN114884962A (en) Load balancing method and device and electronic equipment
US8412676B2 (en) Forgetting items with knowledge based synchronization
CN107147708A (en) A kind of peer-to-peer network redundant data balance method and system
CN111526165B (en) Consensus method and system in alliance chain
EP2025133B1 (en) Repository synchronization in a ranked repository cluster
WO2021129541A1 (en) Synchronization of identity data
CN112100234B (en) Content addressing method and system of graph type account book based on random consensus

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 401121 b7-7-2, Yuxing Plaza, No.5 Huangyang Road, Yubei District, Chongqing

Applicant after: Chongqing duxiaoman Youyang Technology Co.,Ltd.

Address before: 201800 room 307, 3 / F, building 8, 55 Huiyuan Road, Jiading District, Shanghai

Applicant before: SHANGHAI YOUYANG NEW MEDIA INFORMATION TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20211221

Address after: 100193 Room 606, 6 / F, building 4, West District, courtyard 10, northwest Wangdong Road, Haidian District, Beijing

Applicant after: Du Xiaoman Technology (Beijing) Co.,Ltd.

Address before: 401121 b7-7-2, Yuxing Plaza, No.5 Huangyang Road, Yubei District, Chongqing

Applicant before: Chongqing duxiaoman Youyang Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant