WO2020147673A1 - 区块链账本的存储方法及装置 - Google Patents

区块链账本的存储方法及装置 Download PDF

Info

Publication number
WO2020147673A1
WO2020147673A1 PCT/CN2020/071747 CN2020071747W WO2020147673A1 WO 2020147673 A1 WO2020147673 A1 WO 2020147673A1 CN 2020071747 W CN2020071747 W CN 2020071747W WO 2020147673 A1 WO2020147673 A1 WO 2020147673A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
cluster
cluster head
storage
head node
Prior art date
Application number
PCT/CN2020/071747
Other languages
English (en)
French (fr)
Inventor
钱良芳
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2020147673A1 publication Critical patent/WO2020147673A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • 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
    • 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/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators

Definitions

  • This application relates to the field of communication, and in particular to a communication method and device.
  • Blockchain is a distributed ledger that combines multiple data blocks each containing several transaction records in chronological order.
  • the latter data block contains the verification information of the previous data block, such as a hash value, so that multiple data blocks are formed into a chain data structure that is difficult to be tampered with, and multiple distributed nodes
  • the same block chain copy is stored on the above for mutual verification, and the security of the transaction can be ensured when the two parties in the transaction are directly trading, that is, without the participation of a third-party trusted institution.
  • each distributed node needs to save a complete copy of the blockchain. Therefore, when the amount of data in the blockchain is large, the storage space occupied is also large and the cost is high. In addition, the storage capacity of different distributed nodes may be different. Once some distributed nodes have insufficient storage space, they cannot save a complete copy of the blockchain, thereby reducing the security of the blockchain.
  • This application provides a storage method and device for a blockchain ledger, which can solve the problem that a single node cannot store a copy of the blockchain ledger, and can improve the security and reliability of the blockchain technology.
  • a method for storing a blockchain ledger is provided.
  • the method is applied to the first cluster head node, the first cluster head node belongs to the first node cluster, and the first node cluster is used to store the first copy of the blockchain ledger.
  • the blockchain ledger includes a header block and at least one data block.
  • the first node cluster also includes at least one ordinary node.
  • the storage method of the blockchain ledger includes: receiving the first copy and the available storage space size reported by at least one common node. Then, according to the available storage space size reported by the at least one ordinary node and the data amount of the first copy, the data block that each ordinary node in the at least one ordinary node needs to store is determined. After that, the header block and the storage information of at least one data block are stored. Among them, the storage information is used to indicate the correspondence between each data block and the common node where it is located.
  • the first cluster head node can dynamically according to the total amount of available storage space reported by at least one ordinary node in the first node cluster and the data volume of the copy of the blockchain ledger that needs to be stored Determine the data block that each ordinary node needs to store, and store the head block of the blockchain ledger and the storage information of each data block in the first cluster head node, so as to achieve the use of multiple nodes in the first node cluster.
  • the storage capacity of the nodes jointly complete the storage of a copy of the blockchain ledger, which solves the problem that the storage space of a single node is not enough to store a copy of the blockchain ledger, which leads to the inability to store the copy of the blockchain ledger, which can improve the block The safety and reliability of chain technology.
  • the aforementioned at least one ordinary node includes a first ordinary node and a second ordinary node.
  • the storage method of the blockchain ledger may further include: transferring part or all of the data blocks in the first data block set to the second ordinary node.
  • the second node cluster is used to store a second copy of the blockchain ledger, and the second node cluster includes a second cluster head node.
  • the above-mentioned storage method of the blockchain ledger may further include: sending a part of the data block in the first copy to the second cluster head node, so that the second node cluster stores the part of the data block on its behalf.
  • the storage method of the above-mentioned blockchain ledger may further include: receiving available shared storage information sent by the second cluster head node.
  • the available shared storage information is used to indicate the total amount of available shared storage space in the second node cluster.
  • send a shared storage request to the second cluster head node The shared storage request is used to request the second node cluster to temporarily store part of the data block in the first copy.
  • the shared storage response sent by the second cluster head node is received.
  • the shared storage response is used to indicate whether the second cluster head node accepts the shared storage request.
  • the second cluster head node accepts the shared storage request, it sends a partial data block to the second cluster head node and modifies the storage information.
  • the storage method of the above-mentioned blockchain ledger may further include: obtaining and storing part of the data block temporarily stored by the second node cluster, modifying the storage information, and sending a shared storage release message to the second cluster head node .
  • the shared storage release message is used to notify the second cluster head node to release the shared storage space used for temporarily storing part of the data block in the second node cluster.
  • the aforementioned shared storage response further includes a shared expiration time.
  • the storage method of the above-mentioned blockchain ledger may further include: sending a shared storage renewal request to the second cluster head node when the sharing expiration time is reached.
  • the shared storage renewal request is used to request the second node cluster to continue to temporarily store some data blocks on its behalf.
  • the aforementioned shared storage response further includes a shared expiration time.
  • the storage method of the above-mentioned blockchain ledger may further include: receiving a shared storage renewal notification sent by the second cluster head node.
  • the shared storage renewal notification is used for when the sharing expiration time is reached, the second cluster head node asks whether the first cluster head node needs the second node cluster to continue to temporarily store some data blocks on its behalf.
  • the storage method of the blockchain ledger may further include: receiving a shared storage termination notice sent by the second node cluster.
  • the shared storage termination notice is used to notify the first cluster head node that the second node cluster will no longer temporarily store some data blocks on its behalf.
  • a cluster head node belongs to the first node cluster; the first node cluster is used to store the first copy of the blockchain ledger, and the blockchain ledger includes a header block and at least one data block.
  • the aforementioned first node cluster also includes at least one ordinary node.
  • the aforementioned cluster head node includes: a communication module, a processing module, and a storage module.
  • the communication module is used to receive the first copy and the available storage space size reported by at least one common node.
  • the processing module is configured to determine the data block that each ordinary node in the at least one ordinary node needs to store according to the available storage space size reported by the at least one ordinary node and the data amount of the first copy.
  • the storage module is used to store the header block and storage information of at least one data block; wherein the storage information is used to indicate the correspondence between each data block and the common node where it is located.
  • the aforementioned at least one ordinary node includes a first ordinary node and a second ordinary node.
  • the aforementioned processing module is also used to transfer part or all of the data blocks in the first data block set to the second normal node.
  • the storage device of the above-mentioned blockchain ledger is in communication connection with the second node cluster, and the second node cluster is used to store the second copy of the blockchain ledger, and the second node cluster includes the second node cluster.
  • Cluster head node the above-mentioned communication module is also used to send part of the data block in the first copy to the second cluster head node, so that the second node cluster stores the part of the data block on its behalf.
  • the aforementioned communication module is also used to receive available shared storage information sent by the second cluster head node; wherein the available shared storage information is used to indicate the total amount of available shared storage space in the second node cluster.
  • the aforementioned communication module is also used to send a shared storage request to the second cluster head node.
  • the shared storage request is used to request the second node cluster to temporarily store part of the data block in the first copy.
  • the above-mentioned communication module is further configured to receive a shared storage response sent by the second cluster head node; wherein the shared storage response is used to indicate whether the second cluster head node accepts the shared storage request.
  • the above-mentioned communication module is further configured to send a partial data block to the second cluster head node if the second cluster head node accepts the shared storage request.
  • the above processing module is also used to modify the storage information.
  • the above-mentioned processing module is also used to obtain and store a partial data block temporarily stored by the second node cluster.
  • the processing module is also used to modify storage information.
  • the communication module is also used to send a shared storage release message to the second cluster head node.
  • the shared storage release message is used to notify the second cluster head node to release the shared storage space used for temporarily storing part of the data block in the second node cluster.
  • the aforementioned shared storage response further includes a shared expiration time.
  • the aforementioned communication module is also configured to send a shared storage renewal request to the second cluster head node when the sharing expiration time is reached.
  • the shared storage renewal request is used to request the second node cluster to continue to temporarily store some data blocks on its behalf.
  • the aforementioned shared storage response further includes a shared expiration time.
  • the above-mentioned communication module is also used to receive a shared storage renewal notice sent by the second cluster head node; wherein the shared storage renewal notice is used for when the sharing expiration time is reached, the second cluster head node inquires the cluster head node Whether it is necessary for the second node cluster to continue to temporarily store some data blocks on its behalf.
  • the aforementioned communication module is further configured to receive a shared storage termination notice sent by the second node cluster.
  • the shared storage termination notice is used to notify the cluster head node described in the second aspect that the second node cluster will no longer temporarily store some data blocks on its behalf.
  • a cluster head node belongs to the first node cluster; the first node cluster is used to store the first copy of the blockchain ledger.
  • the blockchain ledger includes a header block and at least one data block.
  • the first node cluster also includes at least one ordinary node.
  • the cluster head node includes a processor and a transceiver, and the processor is coupled with the transceiver and the memory.
  • the memory is used to store computer programs.
  • the processor is configured to execute the computer program stored in the memory, so that the cluster head node executes the blockchain ledger storage method as described in the first aspect or any one of the possible implementation manners of the first aspect.
  • the cluster head node described in the third aspect can be a network device or a chip in the network device.
  • the coupling of the processor to the transceiver and the memory means that there is a signal connection between the processor, the transceiver and the memory, for example, it can be connected through a bus.
  • the memory may be a memory inside the cluster head node, or an external memory located outside the cluster head node and signally connected to the cluster head node.
  • a storage system for a blockchain ledger including: multiple node clusters including one cluster head node as described in the second or third aspect.
  • a readable storage medium which stores a program or instruction.
  • the program or instruction runs on a computer, the computer executes the method described in the first aspect or any one of the possible implementations of the first aspect.
  • the storage method of the blockchain ledger is provided, which stores a program or instruction.
  • a computer program product including computer program code, which when the computer program code runs on a computer, causes the computer to execute the block described in the first aspect or any one of the possible implementation manners in the first aspect
  • the storage method of the chain ledger is provided, including computer program code, which when the computer program code runs on a computer, causes the computer to execute the block described in the first aspect or any one of the possible implementation manners in the first aspect The storage method of the chain ledger.
  • Figure 1 is a schematic diagram of the structure of a distributed system for storing blockchain ledgers
  • Figure 2 is a schematic flow diagram of a method for storing a blockchain ledger
  • FIG. 3 is a schematic diagram of the structure of a distributed system to which the storage method of the blockchain ledger provided by this application is applicable;
  • Fig. 4 is a schematic diagram 1 of the process of the storage method of the blockchain ledger provided by this application;
  • 5A is a schematic diagram 1 of an application scenario of a method for storing a blockchain ledger provided by an embodiment of the application;
  • FIG. 5B is a schematic diagram 2 of an application scenario of a method for storing a blockchain ledger provided by an embodiment of the application;
  • FIG. 5C is a third schematic diagram of an application scenario of a method for storing a blockchain ledger provided by an embodiment of the application;
  • Fig. 6 is a second flowchart of the storage method of the blockchain ledger provided by this application.
  • FIG. 7 is a first structural diagram of a cluster head node provided by an embodiment of this application.
  • FIG. 8 is a second structural diagram of a cluster head node provided by an embodiment of this application.
  • blockchain technology can solve the communication system based on a trusted third-party centralized verification agency to process transaction records.
  • the transaction records of all nodes require a few third-party centralized verification agencies to complete identity verification, which is easy to be malicious. Tampering, and when the number of nodes is large and/or the amount of data recorded in the transaction is large, it is easy to cause congestion of the third-party centralized verification agency and cause inefficiency.
  • a consistent transaction can be directly reached between the parties to the transaction without the participation of the above-mentioned third-party centralized intermediary, thereby improving the reliability and efficiency of the transaction.
  • Figure 1 is a schematic diagram of a distributed system for storing blockchain ledgers.
  • the distributed system includes a total of 6 nodes: node 1-node 6.
  • the aforementioned node may be a device in the IoT communication system, such as a sensor, a monitoring device, a forwarding device, etc., which is not limited here.
  • the following takes the node 3 in the distributed system shown in FIG. 1 as an example to introduce in detail the storage method of the existing blockchain ledger.
  • Fig. 2 is a schematic flow chart of an existing method for storing a blockchain ledger.
  • the method may include S201-S203:
  • Node 3 receives and stores a copy of the blockchain ledger.
  • the copy of the blockchain ledger includes a header block and at least one data block, the header block contains verification information of the blockchain, and the data block stores one or more transaction records.
  • the copy of the blockchain ledger received by node 3 can be sent by neighboring nodes, such as node 2, node 4, and node 6, or sent by the master control device of the Internet of Things, which is not limited here. .
  • Node 3 updates its stored copy of the blockchain ledger according to the new data.
  • the new data includes new transaction records.
  • the new transaction record may be generated by node 3 in the process of completing the new transaction, or may be a new transaction record received from an upstream neighboring node.
  • Node 3 forwards the aforementioned new data to its downstream neighboring nodes, so that its downstream neighboring nodes update the copy of the blockchain ledger.
  • upstream neighboring node and downstream neighboring node are based on the transmission direction of a certain new data.
  • node 2 source node
  • node 2 needs to send new data A to node 1, node 3 and node 6, then node 2 is node 1, node 3.
  • node 6's upstream neighboring nodes correspondingly, node 1, node 3, and node 6 are the downstream neighboring nodes of node 2.
  • node 3 also needs to forward the new data A it receives to node 4, and node 4 is the downstream neighboring node of node 3.
  • node 4 needs to send new data B to node 3 and node 5, then node 3 and node 5 are downstream neighbors of node 4, and node 4 It is the upstream neighboring node of node 3 and node 5.
  • each of the aforementioned nodes 1 to 6 needs to store a complete copy of the blockchain ledger to ensure the reliability and decentralization of transactions based on the blockchain.
  • some nodes may not have enough storage space to store a complete copy of the blockchain ledger.
  • the above nodes also need to process other businesses besides transactions, which may also result in insufficient storage space for some nodes to store a complete copy of the blockchain ledger.
  • the embodiments of the present application provide a new Internet of Things architecture, and based on the Internet of Things architecture, provide a method for storing blockchain ledger.
  • the technical solutions of the embodiments of the present application can be applied to various distributed communication systems, such as Internet of Things (IoT) systems connected in a wired or wireless manner, machine type communication (MTC) systems, etc.
  • IoT Internet of Things
  • MTC machine type communication
  • the network architecture and business scenarios described in the embodiments of the present application are to more clearly explain the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. With the evolution of the architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
  • the embodiments of the present application take an IoT system as an example for description. It should be noted that the technical solutions provided by the embodiments of this application can also be applied to other distributed communication systems, such as long term evolution (LTE) systems, fourth-generation mobile communication technologies (4G), or fifth-generation mobile Communication technology (5G), etc., the corresponding name can also be replaced with the name of the corresponding function in other distributed communication systems.
  • LTE long term evolution
  • 4G fourth-generation mobile communication technologies
  • 5G fifth-generation mobile Communication technology
  • the communication system shown in FIG. 3 is taken as an example to describe in detail the distributed communication system applicable to the embodiments of the present application.
  • the distributed communication system includes multiple node clusters.
  • each node cluster includes a cluster head node and one or more common nodes.
  • the cluster head node is used to communicate with other clusters of nodes in the distributed communication system, such as receiving a blockchain ledger and storing the head block in the blockchain ledger, and ordinary nodes are used to store the data area in the blockchain ledger.
  • the header block is used to store the verification message of the blockchain ledger and the storage information of each data block.
  • the data block is used for the verification message of the previous data block and one or more transaction records.
  • any two ordinary nodes in Figure 3 can communicate directly, such as ordinary node 2 and ordinary node 3, or they may not communicate directly, but indirectly communicate through cluster head nodes, such as ordinary node 1 and ordinary node 3. Node 4, this embodiment of the application does not limit this.
  • the aforementioned cluster head nodes and ordinary nodes may be network devices in the aforementioned distributed communication system, such as sensors, monitoring devices, and forwarding devices in the Internet of Things.
  • FIG. 3 is only a simplified schematic diagram of an example for ease of understanding, and the communication system may also include other network devices, which are not shown in FIG. 3.
  • FIG. 4 is a schematic flowchart of a method for storing a blockchain ledger provided by an embodiment of the application.
  • the method is applied to the first cluster head node, the first cluster head node belongs to the first node cluster, and the first node cluster is used to store the first copy of the blockchain ledger.
  • the blockchain ledger includes a header block and at least one data block.
  • the first node cluster also includes at least one ordinary node. As shown in FIG. 3, the first node cluster may be any node cluster in FIG. 3, and the first cluster head node may be a cluster head node in any one of the above-mentioned node clusters.
  • the following takes the cluster head node in node cluster 1 as an example to describe in detail the storage method of the blockchain ledger provided by this application.
  • the method may include S401-S403:
  • S401 Receive the first copy and the available storage space size reported by at least one common node.
  • the first copy can be a copy of the blockchain ledger issued by the master control device (not shown in Figure 3), or it can be other node clusters adjacent to the first node cluster, such as node cluster 2 in Figure 3 Or the copy of the blockchain ledger forwarded by the cluster head node in node cluster 4, which is not limited here.
  • the size of the available storage space may be periodically reported to the cluster head node by at least one ordinary node, or may be obtained by the cluster head node from the above at least one ordinary node through a query, which is not limited here.
  • S402 Determine the data block that each ordinary node in the at least one ordinary node needs to store according to the available storage space size reported by the at least one ordinary node and the data amount of the first copy.
  • different ordinary nodes can be allocated different numbers of data blocks according to the available storage space of different ordinary nodes. For example, according to the available storage space reported by at least one common node, the data blocks that each common node needs to store can be allocated in proportion.
  • the first copy includes a total of 4 data blocks: data block 1-data block 4, common node 1 and common node 3 can store 1 data block, and common node 4 can store 2 data Blocks, and ordinary node 2 has insufficient available storage space to store data blocks.
  • the data blocks that need to be stored can be allocated to each ordinary node as follows: ordinary node 1 stores data blocks 1. Normal node 2 does not store data block, normal node 3 stores data block 2, and normal node 4 stores data block 3 and data block 4. It is easy to understand that other data block distribution methods can also be used. For example, ordinary node 4 stores data block 1 and data block 2, while data block 3 and data block 4 are stored by ordinary node 1 and ordinary node 3. There is no limitation here.
  • the storage information is used to indicate the correspondence between each data block and the common node where it is located.
  • the cluster head node is used to store the head block, such as block 0.
  • the header block includes the ledger verification information of the first copy, such as the master hash value of the blockchain ledger.
  • the cluster head node is also used to store storage information of all data blocks of the first copy.
  • the storage information of a data block may include the following content: the node identification and storage path of the ordinary node storing the data block.
  • the node identifier can be the node name, internet protocol (IP) address, media access control (MAC) address, etc., or it can be a combination of the above multiple node identifiers, used to distinguish different common node.
  • the storage path can be a detailed path composed of the drive letter and folder name of the storage data block, which is used to distinguish the storage space occupied by different data blocks in the same common node.
  • the first cluster head node when there is a new data block to be stored, for example, when the first cluster head node receives a data block sent by other cluster head nodes, the first cluster head node also needs to instruct an ordinary node in the first node cluster to store the data block. A new data block, and the storage information of the new data block is added at the end of the storage information of the data block locally stored by the first cluster head node.
  • the first cluster head node can also store data blocks. This is not limited.
  • the first cluster head node can dynamically according to the total amount of available storage space reported by at least one ordinary node in the first node cluster and the data volume of the copy of the blockchain ledger that needs to be stored Determine the data block that each ordinary node needs to store, and store the head block of the blockchain ledger and the storage information of each data block in the first cluster head node, so as to achieve the use of multiple nodes in the first node cluster.
  • the storage capacity of the nodes jointly complete the storage of a copy of the blockchain ledger, which solves the problem that the storage space of a single node is not enough to store a copy of the blockchain ledger, which leads to the inability to store the copy of the blockchain ledger, which can improve the block The safety and reliability of chain technology.
  • the first cluster head node can also dynamically adjust the number of data blocks stored on different ordinary nodes according to the changes in the available storage space reported by all ordinary nodes in the same node cluster, so as to further improve the storage blockchain ledger Reliability. Therefore, in a possible design method, the aforementioned at least one ordinary node includes a first ordinary node and a second ordinary node.
  • the storage method of the above-mentioned blockchain ledger may further include the following steps:
  • the cluster head node may instruct the ordinary node 3 to directly obtain the data block 1 from the ordinary node 1, or the cluster head node may obtain the data block 1 from the ordinary node 1 and forward it to the ordinary node 3, which is not limited here.
  • the cluster head node can instruct to transfer the data block 2 originally stored in the ordinary node 4 to the ordinary Node 2 in order to balance the number of data blocks stored by all ordinary nodes in the node cluster.
  • the transaction records contained in the data block that occupies the storage space at the top can be included in the data block that occupies the storage space at the bottom. Before, it can also be after the transaction records contained in the data block at the end of the occupied storage space. This application does not limit this, as long as the order of the storage information of the data blocks stored in the cluster head node is consistent with the order of the transaction records contained in different data blocks.
  • the data block 3 is stored before the data block 4, and the transaction records contained in the data block 3 are also before the transaction records contained in the data block 4.
  • the data block 1 is stored after the data block 2, but the transaction records contained in the data block 1 are also before the transaction records contained in the data block 2.
  • the cluster head node needs to modify the storage information of the transferred data block.
  • the above method of dynamically adjusting the number of data blocks stored between different ordinary nodes in the same node cluster can also be extended to different node clusters, so as to further improve the reliability of the blockchain ledger. Therefore, in another possible design method, it is assumed that there is a communication connection between the first node cluster and the second node cluster, the second node cluster is used to store the second copy of the blockchain ledger, and the second node cluster includes the second node cluster.
  • Cluster head node the storage method of the above-mentioned blockchain ledger may further include the following steps:
  • the first cluster head node may hand over part of the data blocks of the first copy to the second node cluster For temporary storage.
  • the first cluster head node receives available shared storage information sent by the second cluster head node.
  • the available shared storage information is used to indicate the total amount of available shared storage space in the second node cluster.
  • the second cluster head node may send the available shared storage information to cluster head nodes of other node clusters adjacent to the second node cluster in a manner such as broadcast, multicast, and the like.
  • the first cluster head node sends a shared storage request to the second cluster head node.
  • the shared storage request is used to request the second node cluster to temporarily store part of the data block in the first copy.
  • the first cluster head node may use broadcast, multicast, etc. to send a shared storage request to cluster head nodes of other node clusters adjacent to the first node cluster and capable of providing temporary storage services for partial data blocks. .
  • the first cluster head node can determine that it can provide temporary data blocks based on the amount of data in some data blocks that other node clusters need to temporarily store, and the total amount of available relational storage space provided by other node clusters.
  • S603 The first cluster head node receives the shared storage response sent by the second cluster head node.
  • the shared storage response is used to indicate whether the second cluster head node accepts the shared storage request.
  • the shared storage request can also carry the number of partial data blocks or the amount of data that the first cluster head node expects other node clusters to temporarily store, so as to facilitate the provider to decide whether to accept the shared storage request.
  • the first cluster head node can select one of all other node clusters that accept shared storage requests as the provider of temporary storage of partial data blocks, such as the second node cluster, and send it to the cluster head of the provider.
  • the first cluster head node receives the storage information of the partial data block that needs to be temporarily stored on behalf of the second cluster head node.
  • the first cluster head node modifies the storage information of the partial data block that needs to be temporarily stored in its local storage.
  • the second cluster head node After the second cluster head node instructs ordinary nodes in the second node cluster to store the aforementioned partial data blocks on its behalf, it will send the storage information of the aforementioned partial data blocks to the first cluster head node.
  • the storage information when the partial data blocks are stored in the second node cluster may only include the nodes of the second cluster head node.
  • the identifier such as the name, IP address, MAC address, etc. of the second cluster head node, may also include the node identifier of the second cluster head node, and the second node cluster is the node identifier of the ordinary node storing the aforementioned partial data block.
  • the first cluster head node needs to retrieve the part of the data block in order to return to the first node cluster. Stored in a cluster of nodes. Therefore, as shown in Figure 6, in a possible design method, the first cluster head node also needs to perform S607-S609:
  • the first cluster head node obtains and stores a partial data block temporarily stored by the second node cluster on behalf of the cluster.
  • S609 The first cluster head node sends a shared storage release message to the second cluster head node, so that the second node cluster releases the shared storage space temporarily occupied by the partial data block.
  • the shared storage release message is used to notify the second cluster head node to release the shared storage space used for temporarily storing part of the data block in the second node cluster.
  • the aforementioned shared storage response further includes a shared expiration time.
  • the storage method of the aforementioned blockchain ledger may further include the following steps:
  • the first cluster head node When the sharing expiration time is reached, if the first node cluster still does not have enough storage space to store the partial data blocks stored by the second node cluster, the first cluster head node also needs to send to the second cluster head node Shared storage renewal request.
  • the shared storage renewal request is used to request the second node cluster to continue to temporarily store some data blocks on its behalf.
  • the first cluster head node receives the shared storage renewal notification sent by the second cluster head node.
  • the shared storage renewal notification is used for when the sharing expiration time is reached, the second cluster head node asks whether the first cluster head node needs the second node cluster to continue temporarily storing part of the data block.
  • the storage method of the above-mentioned blockchain ledger may further include the following steps:
  • the first cluster head node receives the shared storage termination notice sent by the second node cluster.
  • the shared storage termination notice is used to notify the first cluster head node that the second node cluster will no longer temporarily store some data blocks on its behalf.
  • the storage method of the blockchain ledger in the embodiment of the present application is described in detail above with reference to FIGS. 4 to 6.
  • the cluster head node and node cluster provided by the embodiment of the present application will be described in detail below with reference to FIGS. 7-8.
  • Fig. 7 is a cluster head node provided by an embodiment of the application.
  • the cluster head node belongs to the first node cluster.
  • the first node cluster is used to store the first copy of the blockchain ledger.
  • the blockchain ledger includes a header block and at least one data block.
  • the aforementioned first node cluster also includes at least one ordinary node.
  • the communication module 701 is configured to receive the first copy and the available storage space size reported by at least one common node.
  • the processing module 702 is used to store the header block and storage information of at least one data block; wherein the storage information is used to indicate the correspondence between each data block and the common node where it is located.
  • the aforementioned at least one ordinary node includes a first ordinary node and a second ordinary node.
  • the aforementioned processing module 702 is also used to transfer part or all of the data blocks in the first data block set to the second normal node.
  • the storage device of the above-mentioned blockchain ledger is in communication connection with the second node cluster, and the second node cluster is used to store the second copy of the blockchain ledger, and the second node cluster includes the second node cluster.
  • Cluster head node the above-mentioned communication module 701 is further configured to send a part of the data block in the first copy to the second cluster head node, so that the second node cluster can store the part of the data block on its behalf.
  • the above-mentioned processing module 702 is further configured to obtain and store a partial data block temporarily stored by the second node cluster.
  • the processing module 702 is also used to modify storage information.
  • the communication module 701 is further configured to send a shared storage release message to the second cluster head node.
  • the shared storage release message is used to notify the second cluster head node to release the shared storage space used for temporarily storing part of the data block in the second node cluster.
  • the aforementioned shared storage response further includes a shared expiration time.
  • the aforementioned communication module 701 is also configured to send a shared storage renewal request to the second cluster head node when the sharing expiration time is reached.
  • the shared storage renewal request is used to request the second node cluster to continue to temporarily store some data blocks on its behalf.
  • the aforementioned shared storage response further includes a shared expiration time.
  • the above-mentioned communication module 701 is also configured to receive a shared storage renewal notice sent by the second cluster head node; wherein the shared storage renewal notice is used when the sharing expiration time is reached, the second cluster head node inquires the cluster head Whether the node needs the second node cluster to continue to temporarily store some data blocks on its behalf.
  • the aforementioned communication module 701 is further configured to receive a shared storage termination notice sent by the second node cluster.
  • the shared storage termination notice is used to notify the first cluster head node that the second node cluster will no longer temporarily store some data blocks on its behalf.
  • FIG. 8 is another cluster head node 800 provided by an embodiment of this application.
  • the cluster head node 800 belongs to the first node cluster; the first node cluster is used to store the first copy of the blockchain ledger.
  • the blockchain ledger includes a header block and at least one data block.
  • the first node cluster also includes at least one ordinary node.
  • the cluster head node 800 includes a processor 801 and a transceiver 802, and the processor 801 is coupled with the transceiver 802 and a memory 803.
  • the memory 803 is used to store computer programs.
  • the aforementioned cluster head node 800 may be a network device, or a chip in the network device.
  • the coupling of the processor 801 with the transceiver 802 and the memory 803 means that there is a signal connection between the processor 801 and the transceiver 802 and the memory 803, for example, it can be connected through a bus 804.
  • the memory 803 may be a memory inside the cluster head node 800, or may be an external memory located outside the cluster head node 800 and signally connected to the cluster head node 800, which is not limited here.
  • the cluster head node 800 may be a network device or a chip set inside the network device, which is not limited in this application.
  • This application provides a storage system for a blockchain ledger, which includes one or more node clusters, wherein the node cluster includes one cluster head node described in the above device embodiment.
  • This application provides a readable storage medium that stores a program or instruction.
  • the program or instruction runs on a computer, the computer executes the blockchain ledger storage method described in the above method embodiment.
  • This application provides a computer program product, including computer program code, which when the computer program code runs on a computer, causes the computer to execute the blockchain ledger storage method described in the above method embodiment.
  • the processor in the embodiments of the present application may be a central processing unit (central processing unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), and dedicated integration Circuit (application specific integrated circuit, ASIC), field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory in the embodiments of the present application may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electronically Erasable programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • Volatile memory can be random access memory (random access memory, RAM), which acts as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • Access memory synchronous DRAM, SDRAM
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous connection dynamic random access memory Take memory (synchlink DRAM, SLDRAM) and direct memory bus random access memory (direct rambus RAM, DRRAM).
  • the above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware, or any other combination.
  • the above-described embodiments may be fully or partially implemented in the form of computer program products.
  • the computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more sets of available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium.
  • the semiconductor medium may be a solid state drive.
  • At least one refers to one or more, and “multiple” refers to two or more.
  • At least one of the following or similar expressions refers to any combination of these items, including any combination of single items or plural items.
  • at least one of a, b, or c can represent one of the following: a; b; c; a and b; a and c; b and c; a, b, and c, where a , B, c can be single or multiple.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the unit is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical, or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
  • the foregoing storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Power Engineering (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请提供一种区块链账本的存储方法及装置。该方法应用于第一簇头节点,第一簇头节点属于第一节点簇,第一节点簇用于存储区块链账本的第一副本。区块链账本包括一个头区块和至少一个数据区块。第一节点簇还包括至少一个普通节点。该方法包括:接收第一副本和至少一个普通节点上报的可用存储空间大小。然后,根据至少一个普通节点上报的可用存储空间大小和第一副本的数据量,确定至少一个普通节点中每个普通节点需要存储的数据区块。之后,存储头区块,以及至少一个数据区块的存储信息。其中,存储信息用于指示每个数据区块与其所在的普通节点的对应关系。可以适用于利用多个分布式节点共同存储区块链账本的一个副本。

Description

区块链账本的存储方法及装置
本申请要求于2019年01月17日提交国家知识产权局、申请号为201910045742.9、申请名称为“区块链账本的存储方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信领域,尤其涉及一种通信方法及装置。
背景技术
区块链(blockchain)是一种将各自包含有若干条交易记录的多个数据区块按照时间顺序组合而成的分布式账本。其中,后一个数据区块均包含前一个数据区块的验证信息,如哈希(hash)值,从而将多个数据区块组成一个难以被篡改的链式数据结构,且多个分布式节点上均保存有相同的区块链副本以便相互验证,可以在交易双方直接交易,也就是没有第三方信任机构参与的情况下,确保交易的安全性。
目前,每个分布式节点均需要保存完整的区块链副本。因此,当区块链的数据量较大时,占用的存储空间也较大,成本较高。并且,不同分布式节点的存储能力可能存在差异,一旦某些分布式节点存储空间不足,则无法保存完整的区块链副本,从而降低区块链的安全性。
发明内容
本申请提供一种区块链账本的存储方法及装置,能够解决单个节点无法存储区块链账本副本的问题,能够提高区块链技术的安全性和可靠性。
第一方面,提供一种区块链账本的存储方法。该方法应用于第一簇头节点,第一簇头节点属于第一节点簇,第一节点簇用于存储区块链账本的第一副本。区块链账本包括一个头区块和至少一个数据区块。第一节点簇还包括至少一个普通节点。该区块链账本的存储方法,包括:接收第一副本和至少一个普通节点上报的可用存储空间大小。然后,根据至少一个普通节点上报的可用存储空间大小和第一副本的数据量,确定至少一个普通节点中每个普通节点需要存储的数据区块。之后,存储头区块,以及至少一个数据区块的存储信息。其中,存储信息用于指示每个数据区块与其所在的普通节点的对应关系。
本申请提供的区块链账本的存储方法,第一簇头节点能够根据第一节点簇内至少一个普通节点上报的可用存储空间总量,以及需要存储的区块链账本副本的数据量,动态地确定每个普通节点需要存储的数据区块,并在第一簇头节点存储区块链账本的头区块和每个数据区块的存储信息,从而达到利用第一节点簇内的多个节点的存储能力共同完成一个区块链账本副本的存储工作,解决了由于单个节点的存储空间不足以存储一个区块链账本副本,从而导致无法存储区块链账本副本的问题,能够提高区块链技术的安全性和可靠性。
在一种可能的设计方法中,上述至少一个普通节点包括第一普通节点和第二普通节点。上述区块链账本的存储方法,还可以包括:将第一数据区块集合中的部分或全部数据区块转存至第二普通节点。
在一种可能的设计方法中,上述第一节点簇与第二节点簇存在通信连接。第二节点簇用于存储区块链账本的第二副本,第二节点簇包括第二簇头节点。上述区块链账本的存储方法,还可以包括:向第二簇头节点发送第一副本中的部分数据区块,以便第二节点簇代为存储部分数据区块。
在另一种可能的设计方法中,上述区块链账本的存储方法,还可以包括:接收第二簇头节点发送的可用共享存储信息。其中,可用共享存储信息用于指示第二节点簇内的可用共享存储空间总量。然后,向第二簇头节点发送共享存储请求。其中,共享存储请求用于请求第二节点簇代为暂存第一副本中的部分数据区块。之后,接收第二簇头节点发送的共享存储响应。其中,共享存储响应用于指示第二簇头节点是否接受共享存储请求。最后,若第二簇头节点接受共享存储请求,则向第二簇头节点发送部分数据区块,并修改存储信息。
可选地,上述区块链账本的存储方法,还可以包括:获取并存储第二节点簇代为暂存的部分数据区块,以及修改存储信息,并向第二簇头节点发送共享存储释放消息。其中,共享存储释放消息用于通知第二簇头节点释放第二节点簇内用于暂存部分数据区块的共享存储空间。
可选地,上述共享存储响应还包括共享到期时间。相应地,上述区块链账本的存储方法,还可以包括:当达到共享到期时间时,向第二簇头节点发送共享存储续约请求。其中,共享存储续约请求用于请求第二节点簇继续代为暂存部分数据区块。
可选地,上述共享存储响应还包括共享到期时间。相应地,上述区块链账本的存储方法,还可以包括:接收第二簇头节点发送的共享存储续约通知。其中,共享存储续约通知用于当达到共享到期时间时,第二簇头节点询问第一簇头节点是否需要第二节点簇继续代为暂存部分数据区块。
可选地,上述区块链账本的存储方法,还可以包括:接收第二节点簇发送的共享存储解约通知。其中,共享存储解约通知用于通知第一簇头节点第二节点簇不再代为暂存部分数据区块。
第二方面,提供一种簇头节点。该簇头节点属于第一节点簇;第一节点簇用于存储区块链账本的第一副本,区块链账本包括一个头区块和至少一个数据区块。上述第一节点簇还包括至少一个普通节点。上述簇头节点包括:通信模块、处理模块和存储模块。其中,通信模块,用于接收第一副本和至少一个普通节点上报的可用存储空间大小。处理模块,用于根据至少一个普通节点上报的可用存储空间大小和第一副本的数据量,确定至少一个普通节点中每个普通节点需要存储的数据区块。存储模块,用于存储头区块,以及至少一个数据区块的存储信息;其中,存储信息用于指示每个数据区块与其所在的普通节点的对应关系。
在一种可能的设计中,上述至少一个普通节点包括第一普通节点和第二普通节点。相应地,上述处理模块,还用于将第一数据区块集合中的部分或全部数据区块转存至第二普通节点。
在另一种可能的设计中,上述区块链账本的存储装置,与第二节点簇存在通信连接,第二节点簇用于存储区块链账本的第二副本,第二节点簇包括第二簇头节点。相应地,上述通信模块,还用于向第二簇头节点发送第一副本中的部分数据区块,以便第二节点簇代为存储部分数据区块。
在一种可能的设计中,上述通信模块,还用于接收第二簇头节点发送的可用共享存储信息;其中,可用共享存储信息用于指示第二节点簇内的可用共享存储空间总量。上述通信模块,还用于向第二簇头节点发送共享存储请求。其中,共享存储请求用于请求第二节点簇代为暂存第一副本中的部分数据区块。上述通信模块,还用于接收第二簇头节点发送的共享存储响应;其中,共享存储响应用于指示第二簇头节点是否接受共享存储请求。上述通信模块,还用于若第二簇头节点接受共享存储请求,则向第二簇头节点发送部分数据区块。上述处理模块,还用于修改存储信息。
可选地,上述处理模块,还用于获取并存储第二节点簇代为暂存的部分数据区块。处理模块,还用于修改存储信息。通信模块,还用于向第二簇头节点发送共享存储释放消息。其中,共享存储释放消息用于通知第二簇头节点释放第二节点簇内用于暂存部分数据区块的共享存储空间。
可选地,上述共享存储响应还包括共享到期时间。相应地,上述通信模块,还用于当达到共享到期时间时,向第二簇头节点发送共享存储续约请求。其中,共享存储续约请求用于请求第二节点簇继续代为暂存部分数据区块。
可选地,上述共享存储响应还包括共享到期时间。相应地,上述通信模块,还用于接收第二簇头节点发送的共享存储续约通知;其中,共享存储续约通知用于当达到共享到期时间时,第二簇头节点询问簇头节点是否需要第二节点簇继续代为暂存部分数据区块。
可选地,上述通信模块,还用于接收第二节点簇发送的共享存储解约通知。其中,共享存储解约通知用于通知第二方面所述的簇头节点第二节点簇不再代为暂存部分数据区块。
第三方面,提供一种簇头节点。该簇头节点属于第一节点簇;第一节点簇用于存储区块链账本的第一副本。该区块链账本包括一个头区块和至少一个数据区块。第一节点簇还包括至少一个普通节点。其中,簇头节点包括处理器和收发器,该处理器与收发器和存储器耦合。存储器,用于存储计算机程序。处理器,用于执行存储器中存储的计算机程序,使得簇头节点执行如第一方面或第一方面的任一种可能的实现方式所述的区块链账本的存储方法。
第三方面所述的簇头节点可以是网络设备,也可以是网络设备内的芯片。所述处理器与收发器和存储器耦合,是指处理器与收发器和存储器之间存在信号连接,如可以通过总线连接。其中,存储器可以是簇头节点内部的存储器,也可以是位于簇头节点外部且与簇头节点存在信号连接的外部存储器。
第四方面,提供一种区块链账本的存储系统,包括:多个包含由一个如第二方面或第三方面所述的簇头节点的节点簇。
第五方面,提供一种可读存储介质,存储有程序或指令,当程序或指令在计算机上运行时,使得计算机执行如第一方面或第一方面中任一种可能的实现方式所述的区 块链账本的存储方法。
第六方面,提供一种计算机程序产品,包括计算机程序代码,当计算机程序代码在计算机上运行时,使得计算机执行如第一方面或第一方面中任一种可能的实现方式所述的区块链账本的存储方法。
附图说明
图1为一种用于存储区块链账本的分布式系统的结构示意图;
图2为一种区块链账本的存储方法的流程示意图;
图3为本申请提供的区块链账本的存储方法所适用的分布式系统的结构示意图;
图4为本申请提供的区块链账本的存储方法的流程示意图一;
图5A为本申请实施例提供的区块链账本的存储方法的应用场景示意图一;
图5B为本申请实施例提供的区块链账本的存储方法的应用场景示意图二;
图5C为本申请实施例提供的区块链账本的存储方法的应用场景示意图三;
图6为本申请提供的区块链账本的存储方法的流程示意图二;
图7为本申请实施例提供的簇头节点的结构示意图一;
图8为本申请实施例提供的簇头节点的结构示意图二。
具体实施方式
区块链是一个分布式的账本,多个独立的分布式节点保存相同的记录,是一种通过去中心化、去信任的方式集体维护一个可靠数据库的技术方案。每当有新数据,如交易记录需要写入区块链时,会将新数据汇总到一个区块中,添加在区块链已有区块的末端,并通过共识算法保证每个节点新添加的区块是完全相同的。其中,每个区块(block)内均会记录一条或多条交易记录,并在该区块头部记录前一区块的验证信息,如哈希值。通过上述链式结构,将所有区块按照交易记录的先后顺序首尾相连,从而形成一个完整的区块链账本。由于区块链中的每个区块均记录有前一区块的验证信息,若想修改某一个区块,则需要修改该区块以及该区块之前的所有区块,并且需要修改一半以上的分布式节点上存储的同一个区块链账本,技术难度较大,因此区块链具有难以被篡改的特性。基于上述原因,区块链技术可以解决基于可信赖的第三方中心化验证机构来处理交易记录的通信系统中,所有节点的交易记录均需要少数第三方中心化验证机构完成身份验证,容易被恶意篡改,且当节点数量较多和/或交易记录的数据量较大时,容易造成第三方中心化验证机构的拥塞而导致效率低下的问题。也就是说,基于区块链技术,可以在交易双方之间直接达成一致性交易,不需要上述第三方中心化中介机构的参与,从而提高交易的可靠性和效率。
鉴于区块链技术的独特优势,也被引入物联网领域。图1为一种用于存储区块链账本的分布式系统的结构示意图。
如图1所示,该分布式系统共计包括6个节点:节点1-节点6。上述节点可以为物联网通信系统中的一台设备,如传感器、监控设备、转发设备等,此处不做限定。
在如图1所示的分布式系统中,有的节点之间存在直接的通信连接,如节点1与节点2、节点3与节点6。当然,也有的节点之间不存在直接的通信连接,如节点4与节点6、节点2与节点5。其中,上述通信连接可以是有线的,也可以是无线的,此处不做限定。
下面以图1所示的分布式系统中的节点3为例,详细介绍现有的区块链账本的存储方法。
图2为一种现有的区块链账本的存储方法的流程示意图。
如图2所示,该方法可以包括S201-S203:
S201,节点3接收并存储区块链账本副本。
其中,区块链账本副本包含头区块和至少一个数据区块,头区块包含区块链的验证信息,数据区块存储有一条或多条交易记录。
上述节点3接收的区块链账本副本,可以是相邻节点,如节点2、节点4、节点6中的一个,发送的,也可以物联网的主控设备下发的,此处不再限定。
S202,节点3根据新数据更新其存储的区块链账本副本。
其中,新数据包括新增交易记录。该新增交易记录可以是节点3在完成新交易的过程中产生的,也可以是从上游相邻节点接收的新增交易记录。
S203,节点3向其下游相邻节点转发上述新数据,以便其下游相邻节点更新区块链账本副本。
需要说明的是,上述上游相邻节点和下游相邻节点是以某一个新数据的传输方向为参考的。例如,如图1所示,假定新数据A是由节点2(源节点)生成的,节点2需要将新数据A发送给节点1、节点3和节点6,则节点2为节点1、节点3和节点6的上游相邻节点,相应地,节点1、节点3和节点6为节点2的下游相邻节点。同理,节点3还需要将其接收到的新数据A向节点4转发,则节点4为节点3的下游相邻节点。
容易理解,假定新数据B是由节点4(源节点)生成的,节点4需要向节点3和节点5发送新数据B,则节点3和节点5为节点4的下游相邻节点,而节点4为节点3和节点5的上游相邻节点。
然而,上述节点1-节点6中的每个节点,均需要存储一个完整的区块链账本副本,方能确保基于区块链的交易的可靠性和去中心化。鉴于物联网中部分节点的存储能力有限,随着区块链账本的数据量较大时,部分节点可能没有足够存储空间存储一个完整的区块链账本副本。除存储区块账本副本之外,上述节点还需要处理交易之外的其他业务,也有可能导致部分节点没有足够存储空间存储一个完整的区块链账本副本。此外,还可能存在部分节点可用存储空间不足,同时另一部分节点存在大量存储空间闲置的情况,即不同节点之间的存储空间无法平衡利用的问题。上述原因均会导致物联网中实际存储的区块链账本副本的数量下降,从而导致现有物联网中基于区块链的交易的安全性和可靠性下降。
为了解决上述问题,本申请实施例提供一种新的物联网架构,并基于该物联网架构,提供一种区块链账本的存储方法。
下面将结合附图,对本申请中的技术方案进行描述。
本申请实施例的技术方案可以应用于各种分布式通信系统,如以有线或无线方式连接的物联网(internet of things,IoT)系统,机器通信(machine type communication,MTC)系统等。
本申请将围绕可包括多个设备、组件、模块等的系统来呈现各个方面、实施例或 特征。应当理解和明白的是,各个系统可以包括另外的设备、组件、模块等,并且/或者可以并不包括结合附图讨论的所有设备、组件、模块等。此外,还可以使用这些方案的组合。
另外,在本申请实施例中,“示例”、“例如”用于表示作例子、例证或说明。本申请中被描述为“示例”、“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用示例的一词旨在以具体方式呈现概念。
本申请实施例中,“的(of)”,“相应的(corresponding,relevant)”和“对应的(corresponding)”有时可以混用,应当指出的是,在不强调其区别时,其所要表达的含义是一致的。
本申请实施例描述的网络架构以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请实施例以物联网系统为例进行说明。应当指出的是,本申请实施例提供的技术方案还可以应用于其他分布式通信系统,如长期演进(long term evolution,LTE)系统、第四代移动通信技术(4G)、或第五代移动通信技术(5G)等,相应的名称也可以用其他分布式通信系统中的对应功能的名称进行替代。
为便于理解本申请实施例,首先以图3中示出的通信系统为例详细说明适用于本申请实施例的分布式通信系统。如图3所示,该分布式通信系统包括多个节点簇。其中,每个节点簇包括一个簇头节点,以及一个或多个普通节点。簇头节点用于与分布式通信系统中的其他节点簇通信,如接收一个区块链账本,以及存储区块链账本中的头区块,普通节点用于存储区块链账本中的数据区块。头区块用于存储区块链账本的验证消息,以及每个数据区块的存储信息。数据区块用于前一个数据区块的验证消息,以及一条或多条交易记录。
需要说明的是,图3中的任意两个普通节点之间可以直接通信,如普通节点2和普通节点3,也可以不能直接通信,而是通过簇头节点间接通信,如普通节点1与普通节点4,本申请实施例对此不做限定。
其中,上述簇头节点和普通节点可以为上述分布式通信系统中的网络设备,如物联网中的传感器、监控设备、转发设备等。
应理解,图3仅为便于理解而示例的简化示意图,该通信系统中还可以包括其他网络设备,图3中未予以画出。
图4为本申请实施例提供的区块链账本的存储方法的流程示意图。该方法应用于第一簇头节点,第一簇头节点属于第一节点簇,第一节点簇用于存储区块链账本的第一副本。其中,区块链账本包括一个头区块和至少一个数据区块。第一节点簇还包括至少一个普通节点。如图3所示,第一节点簇可以为图3中的任意一个节点簇,第一簇头节点可以为上述任意一个节点簇中的簇头节点。下面以节点簇1中的簇头节点为例,详细说明本申请提供的区块链账本的存储方法。
如图4所示,该方法可以包括S401-S403:
S401,接收第一副本和至少一个普通节点上报的可用存储空间大小。
其中,第一副本可以是主控设备(图3中未画出)下发的区块链账本副本,也可以是与第一节点簇相邻的其他节点簇,如图3中的节点簇2或节点簇4中的簇头节点转发的区块链账本副本,此处不做限定。
可用存储空间大小可以由至少一个普通节点周期性上报给簇头节点,也可以是簇头节点通过查询的方式从上述至少一个普通节点获取的,此处不再限定。
S402,根据至少一个普通节点上报的可用存储空间大小和第一副本的数据量,确定至少一个普通节点中每个普通节点需要存储的数据区块。
在一种可能的设计方法中,可以根据不同普通节点的可用存储空间大小,为不同的普通节点分配不同数量的数据区块。例如,可以按照至少一个普通节点上报的可用存储空间大小,按比例分配每个普通节点需要存储数据区块。
示例性地,假定第一副本共计包括4个数据区块:数据区块1-数据区块4,普通节点1和普通节点3分别可以存储1个数据区块,普通节点4可以存储2个数据区块,而普通节点2可用存储空间不足,不能存储数据区块,则如图5A所示,可以按照采用如下方式为每个普通节点分配需要存储的数据区块:普通节点1存储数据区块1,普通节点2不存储数据区块,普通节点3存储数据区块2,普通节点4存储数据区块3和数据区块4。容易理解,也可以采用其他的数据区块分配方式,如普通节点4存储数据区块1和数据区块2,而数据区块3和数据区块4分别由普通节点1和普通节点3存储,此处不做限定。
需要说明的是,为了不影响除存储第一副本之外的其他业务,如存储其他区块链账本的副本、传输其他业务数据等,在为每个普通节点分配需要存储的数据区块的过程中,还需要预留预设比例或预设数量的存储空间。
S403,存储头区块,以及至少一个数据区块的存储信息。
其中,存储信息用于指示每个数据区块与其所在的普通节点的对应关系。
示例性地,如图5A所示,簇头节点用于存储头区块,如区块0。其中,头区块包括第一副本的账本验证信息,如区块链账本的主哈希值。
此外,如图5A所示,簇头节点还用于存储第一副本的所有数据区块的存储信息。其中,一个数据区块的存储信息可以包括如下内容:存储该数据区块的普通节点的节点标识和存储路径。容易理解,节点标识可以为节点名称、互联网(internet protocol,IP)地址、媒体接入控制(media access control,MAC)地址等,也可以为上述多种节点标识的组合,用于区分不同的普通节点。存储路径可以为存储数据区块的盘符、文件夹名称等组成的详细路径,用于区分同一普通节点内不同数据区块占用的存储空间。
当然,当有新数据区块需要存储,如第一簇头节点接收到其他簇头节点发送的数据区块时,第一簇头节点还需要指示第一节点簇内的某个普通节点存储该新数据区块,并在第一簇头节点本地存储的数据区块的存储信息的尾部增加该新数据区块的存储信息。
需要说明的是,除存储头区块和所有数据区块的存储信息之外,若第一簇头节点的可用存储空间较大,则第一簇头节点还可以存储数据区块,本申请对此不做限定。
本申请提供的区块链账本的存储方法,第一簇头节点能够根据第一节点簇内至少 一个普通节点上报的可用存储空间总量,以及需要存储的区块链账本副本的数据量,动态地确定每个普通节点需要存储的数据区块,并在第一簇头节点存储区块链账本的头区块和每个数据区块的存储信息,从而达到利用第一节点簇内的多个节点的存储能力共同完成一个区块链账本副本的存储工作,解决了由于单个节点的存储空间不足以存储一个区块链账本副本,从而导致无法存储区块链账本副本的问题,能够提高区块链技术的安全性和可靠性。
实际应用中,第一簇头节点还可以根据同一节点簇内所有普通节点上报的可用存储空间的变化情况,动态调整不同普通节点上存储的数据区块的数量,以便进一步提高存储区块链账本的可靠性。因此,在一种可能的设计方法中,上述至少一个普通节点包括第一普通节点和第二普通节点。上述区块链账本的存储方法,还可以包括如下步骤:
将第一数据区块集合中的部分或全部数据区块转存至第二普通节点。
例如,如图5B所示,假定普通节点1的可用存储空间不足以存储数据区块1,而普通节点3的可用存储空间还可以存储更多的数据区块,则可以将原本存储于普通节点1中的数据区块1转存至普通节点3。具体地,簇头节点可以指示普通节点3直接从普通节点1获取数据区块1,也可以由簇头节点从普通节点1获取到数据区块1后转发给普通节点3,此处不作限定。
又例如,如图5C所示,假定普通节点2的可用存储空间也足以存储至少一个数据区块了,则簇头节点可以指示将原本存储在普通节点4中的数据区块2转存至普通节点2,以便平衡节点簇内所有普通节点存储的数据区块的数量。
需要说明的是,当一个普通节点上存储有多个数据区块时,占用的存储空间靠前的数据区块包含的交易记录,可以在占用的存储空间靠后的数据区块包含的交易记录之前,也可以在占用的存储空间靠后的数据区块包含的交易记录之后。本申请对此不做限定,只要簇头节点中存储的数据区块的存储信息的顺序,与不同数据区块中包含的交易记录的顺序一致就可以了。
例如,如图5A和图5B所示,对于普通节点4,数据区块3存储在数据区块4之前,且数据区块3包含的交易记录也在数据区块4包含的交易记录之前。又例如,如图5B所示,对于普通节点3,数据区块1存储在数据区块2之后,但数据区块1包含的交易记录也在数据区块2包含的交易记录之前。
容易理解,无论出于何种考量转存数据区块,均需要簇头节点修改转存的数据区块的存储信息。
进一步地,上述动态调整同一节点簇内不同普通节点之间存储的数据区块数量的方法也可以推广至不同的节点簇之间,以便进一步提高区块链账本的可靠性。因此,在另一种可能的设计方法中,假定上述第一节点簇与第二节点簇存在通信连接,第二节点簇用于存储区块链账本的第二副本,第二节点簇包括第二簇头节点,则上述区块链账本的存储方法,还可以包括如下步骤:
向第二簇头节点发送第一副本中的部分数据区块,以便第二节点簇代为存储部分数据区块。
示例性地,当第一节点簇的可用存储空间总量不足以存储第一副本的所有数据区 块时,第一簇头节点可以将第一副本的部分数据区块,交由第二节点簇代为暂存。
具体地,如图6所示,上述向第二簇头节点发送第一副本中的部分数据区块,以便第二节点簇代为存储部分数据区块,可以具体实现为S601-S606:
S601,第一簇头节点接收第二簇头节点发送的可用共享存储信息。
其中,可用共享存储信息用于指示第二节点簇内的可用共享存储空间总量。示例性地,第二簇头节点可以采用广播、组播等方式向与第二节点簇相邻的其他节点簇的簇头节点发送可用共享存储信息。
S602,第一簇头节点向第二簇头节点发送共享存储请求。
其中,共享存储请求用于请求第二节点簇代为暂存第一副本中的部分数据区块。
示例性地,第一簇头节点可以采用广播、组播等方式向与第一节点簇相邻、且能够为其提供部分数据区块暂存服务的其他节点簇的簇头节点发送共享存储请求。
具体地,第一簇头节点可以根据其需要其他节点簇代为暂存的部分数据区块的数据量,以及其他节点簇提供的可用关系存储空间总量,确定可以为其提供部分数据区块暂存服务的节点簇,并向上述暂存服务提供方发生共享存储请求。
S603,第一簇头节点接收第二簇头节点发送的共享存储响应。
其中,共享存储响应用于指示第二簇头节点是否接受共享存储请求。
容易理解,共享存储请求也可以携带第一簇头节点期望其他节点簇可代为暂存的部分数据区块的数量,或数据量,以方便提供方决策是否需要接受共享存储请求。
S604,若第二簇头节点接受共享存储请求,则第一簇头节点向第二簇头节点发送需要代为暂存的部分数据区块。
具体地,第一簇头节点可以在所有接受共享存储请求的其他节点簇中选择一个,作为代为暂存部分数据区块服务的提供方,如第二节点簇,并向该提供方的簇头节点,如第二簇头节点发送需要代为暂存的部分数据区块。
S605,第一簇头节点接收第二簇头节点发送的需要代为暂存的部分数据区块的存储信息。
S606,第一簇头节点修改其本地存储的需要代为暂存的部分数据区块的存储信息。
第二簇头节点在指示第二节点簇内的普通节点代为存储上述部分数据区块后,会向第一簇头节点发送上述部分数据区块的存储信息。
需要说明的是,与上述部分数据区块在第一节点簇内存储时的存储信息不同,上述部分数据区块在第二节点簇内存储时的存储信息可以只包括第二簇头节点的节点标识,如第二簇头节点的名称、IP地址、MAC地址等,也可以包括第二簇头节点的节点标识,第二节点簇内代为存储上述部分数据区块的普通节点的节点标识。
容易理解,当第一节点簇内的可用存储空间足以存储上述第二节点簇代为暂存的部分数据区块的时,第一簇头节点需要将上述部分数据区块取回,以便重新在第一节点簇内存储。因此,如图6所示,在一种可能的设计方法中,第一簇头节点还需要执行S607-S609:
S607,第一簇头节点获取并存储第二节点簇代为暂存的部分数据区块。
S608,第一簇头节点再次修改本地存储的上述需要代为暂存的部分数据区块的存储信息。
S609,第一簇头节点向第二簇头节点发送共享存储释放消息,以便第二节点簇释放上述部分数据区块临时占用的共享存储空间。
其中,共享存储释放消息用于通知第二簇头节点释放第二节点簇内用于暂存部分数据区块的共享存储空间。
可选地,上述共享存储响应还包括共享到期时间。相应地,上述区块链账本的存储方法,还可以包括如下步骤:
当达到共享到期时间时,若第一节点簇仍然没有足够的存储空间用于存储上述第二节点簇代为存储的部分数据区块,则第一簇头节点还需要向第二簇头节点发送共享存储续约请求。
其中,共享存储续约请求用于请求第二节点簇继续代为暂存部分数据区块。
可选地,上述共享存储响应还包括共享到期时间。相应地,当达到共享到期时间时,若第二节点簇仍然有足够的共享存储空间,则第二簇头节点也可以主动询问第一簇头节点是否还需要代为存储上述部分数据区块。因此,上述区块链账本的存储方法,还可以包括如下步骤:
第一簇头节点接收第二簇头节点发送的共享存储续约通知。
其中,共享存储续约通知用于当达到共享到期时间时,第二簇头节点询问第一簇头节点是否需要第二节点簇继续代为暂存部分数据区块。
容易理解,倘若第二节点簇的存储空间不足以同时存储其本身需要存储的区块链账本的第二副本和上述代为暂存的部分数据区块,则第二簇头节点需要通知第一簇头节点另寻可提供代为暂存服务的其他节点簇。也就是说,对于每一个节点簇,其本身需要存储的区块链账本副本的存储优先级要高于其代为暂存的部分数据区块的存储优先级。因此,上述区块链账本的存储方法,还可以包括如下步骤:
第一簇头节点接收第二节点簇发送的共享存储解约通知。
其中,共享存储解约通知用于通知第一簇头节点第二节点簇不再代为暂存部分数据区块。
以上结合图4-图6详细说明了本申请实施例的区块链账本的存储方法。以下结合图7-图8详细说明本申请实施例提供的簇头节点和节点簇。
图7为本申请实施例提供的一种簇头节点。该簇头节点属于第一节点簇。第一节点簇用于存储区块链账本的第一副本。区块链账本包括一个头区块和至少一个数据区块。上述第一节点簇还包括至少一个普通节点。
如图7所示,上述簇头节点700包括:通信模块701、处理模块702和存储模块703。
其中,通信模块701,用于接收第一副本和至少一个普通节点上报的可用存储空间大小。
处理模块702,用于根据至少一个普通节点上报的可用存储空间大小和第一副本的数据量,确定至少一个普通节点中每个普通节点需要存储的数据区块。
处理模块702,用于存储头区块,以及至少一个数据区块的存储信息;其中,存储信息用于指示每个数据区块与其所在的普通节点的对应关系。
在一种可能的设计中,上述至少一个普通节点包括第一普通节点和第二普通节点。 相应地,上述处理模块702,还用于将第一数据区块集合中的部分或全部数据区块转存至第二普通节点。
在另一种可能的设计中,上述区块链账本的存储装置,与第二节点簇存在通信连接,第二节点簇用于存储区块链账本的第二副本,第二节点簇包括第二簇头节点。相应地,上述通信模块701,还用于向第二簇头节点发送第一副本中的部分数据区块,以便第二节点簇代为存储部分数据区块。
在一种可能的设计中,上述通信模块701,还用于接收第二簇头节点发送的可用共享存储信息;其中,可用共享存储信息用于指示第二节点簇内的可用共享存储空间总量。上述通信模块701,还用于向第二簇头节点发送共享存储请求。其中,共享存储请求用于请求第二节点簇代为暂存第一副本中的部分数据区块。上述通信模块701,还用于接收第二簇头节点发送的共享存储响应;其中,共享存储响应用于指示第二簇头节点是否接受共享存储请求。上述通信模块701,还用于若第二簇头节点接受共享存储请求,则向第二簇头节点发送部分数据区块。上述处理模块702,还用于修改存储信息。
可选地,上述处理模块702,还用于获取并存储第二节点簇代为暂存的部分数据区块。处理模块702,还用于修改存储信息。通信模块701,还用于向第二簇头节点发送共享存储释放消息。其中,共享存储释放消息用于通知第二簇头节点释放第二节点簇内用于暂存部分数据区块的共享存储空间。
可选地,上述共享存储响应还包括共享到期时间。相应地,上述通信模块701,还用于当达到共享到期时间时,向第二簇头节点发送共享存储续约请求。其中,共享存储续约请求用于请求第二节点簇继续代为暂存部分数据区块。
可选地,上述共享存储响应还包括共享到期时间。相应地,上述通信模块701,还用于接收第二簇头节点发送的共享存储续约通知;其中,共享存储续约通知用于当达到共享到期时间时,第二簇头节点询问簇头节点是否需要第二节点簇继续代为暂存部分数据区块。
可选地,上述通信模块701,还用于接收第二节点簇发送的共享存储解约通知。其中,共享存储解约通知用于通知第一簇头节点第二节点簇不再代为暂存部分数据区块。
需要说明的是,簇头节点700可以是网络设备,也可以是设置于该网络设备内部的芯片,本申请对此不做限定。
图8为本申请实施例提供的另一种簇头节点800。该簇头节点800属于第一节点簇;第一节点簇用于存储区块链账本的第一副本。该区块链账本包括一个头区块和至少一个数据区块。第一节点簇还包括至少一个普通节点。
如图8所示,簇头节点800包括处理器801和收发器802,处理器801与收发器802和存储器803耦合。
存储器803,用于存储计算机程序。
处理器801,用于执行存储器803中存储的计算机程序,使得簇头节点800执行上述方法实施例所述的区块链账本的存储方法。
上述簇头节点800可以是网络设备,也可以是网络设备内的芯片。所述处理器801 与收发器802和存储器803耦合,是指处理器801与收发器802和存储器803之间存在信号连接,如可以通过总线804连接。其中,存储器803可以是簇头节点800内部的存储器,也可以是位于簇头节点800外部且与簇头节点800存在信号连接的外部存储器,此处不做限定。
需要说明的是,簇头节点800可以是网络设备,也可以是设置于该网络设备内部的芯片,本申请对此不做限定。
本申请提供一种区块链账本的存储系统,其包括一个或多个节点簇,其中,所述节点簇包含有一个上述装置实施例所述的簇头节点。
本申请提供一种可读存储介质,存储有程序或指令,当程序或指令在计算机上运行时,使得计算机执行上述方法实施例所述的区块链账本的存储方法。
本申请提供一种计算机程序产品,包括计算机程序代码,当计算机程序代码在计算机上运行时,使得计算机执行如上述方法实施例所述的区块链账本的存储方法。
应理解,在本申请实施例中的处理器可以是中央处理单元(central processing unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
还应理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的随机存取存储器(random access memory,RAM)可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DRRAM)。
上述实施例,可以全部或部分地通过软件、硬件(如电路)、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令或计算机程序。在计算机上加载或执行所述计算机指令或计算机程序时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以为通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质 可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质。半导体介质可以是固态硬盘。
应理解,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,其中A、B可以是单数或者复数。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系,但也可能表示的是一种“和/或”的关系,具体可参考前后文进行理解。
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b或c中的至少一项(个),可以表示下述项之一:a;b;c;a和b;a和c;b和c;a、b和c,其中a、b、c可以是单个,也可以是多个。
应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法 的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (19)

  1. 一种区块链账本的存储方法,其特征在于,应用于第一簇头节点,所述第一簇头节点属于第一节点簇,所述第一节点簇用于存储区块链账本的第一副本,所述区块链账本包括一个头区块和至少一个数据区块;所述第一节点簇还包括至少一个普通节点;
    所述区块链账本的存储方法,包括:
    接收所述第一副本和所述至少一个普通节点上报的可用存储空间大小;
    根据所述至少一个普通节点上报的可用存储空间大小和所述第一副本的数据量,确定所述至少一个普通节点中每个普通节点需要存储的数据区块;
    存储所述头区块,以及所述至少一个数据区块的存储信息;其中,所述存储信息用于指示每个数据区块与其所在的普通节点的对应关系。
  2. 根据权利要求1所述的区块链账本的存储方法,其特征在于,所述至少一个普通节点包括第一普通节点和第二普通节点;
    所述区块链账本的存储方法,还包括:
    将第一数据区块集合中的部分或全部数据区块转存至所述第二普通节点。
  3. 根据权利要求1或2所述的区块链账本的存储方法,其特征在于,所述第一节点簇与第二节点簇存在通信连接;所述第二节点簇用于存储区块链账本的第二副本,所述第二节点簇包括第二簇头节点;
    所述区块链账本的存储方法,还包括:
    向所述第二簇头节点发送所述第一副本中的部分数据区块,以便所述第二节点簇代为存储所述部分数据区块。
  4. 根据权利要求3所述的区块链账本的存储方法,其特征在于,所述区块链账本的存储方法,还包括:
    接收所述第二簇头节点发送的可用共享存储信息;其中,所述可用共享存储信息用于指示所述第二节点簇内的可用共享存储空间总量;
    向所述第二簇头节点发送共享存储请求;其中,所述共享存储请求用于请求所述第二节点簇代为暂存所述第一副本中的部分数据区块;
    接收所述第二簇头节点发送的共享存储响应;其中,所述共享存储响应用于指示所述第二簇头节点是否接受所述共享存储请求;
    若所述第二簇头节点接受所述共享存储请求,则向所述第二簇头节点发送所述部分数据区块,并修改所述存储信息。
  5. 根据权利要求3或4所述的区块链账本的存储方法,其特征在于,所述区块链账本的存储方法,还包括:
    获取并存储所述第二节点簇代为暂存的所述部分数据区块;
    修改所述存储信息,并向所述第二簇头节点发送共享存储释放消息;其中,所述共享存储释放消息用于通知所述第二簇头节点释放所述第二节点簇内用于暂存所述部分数据区块的共享存储空间。
  6. 根据权利要求4或5所述的区块链账本的存储方法,其特征在于,所述共享存储响应还包括共享到期时间;
    所述区块链账本的存储方法,还包括:
    当达到所述共享到期时间时,向所述第二簇头节点发送共享存储续约请求;其中,所述共享存储续约请求用于请求所述第二节点簇继续代为暂存所述部分数据区块。
  7. 根据权利要求4或5所述的区块链账本的存储方法,其特征在于,所述共享存储响应还包括共享到期时间;
    所述区块链账本的存储方法,还包括:
    接收所述第二簇头节点发送的共享存储续约通知;其中,所述共享存储续约通知用于当达到所述共享到期时间时,所述第二簇头节点询问所述第一簇头节点是否需要所述第二节点簇继续代为暂存所述部分数据区块。
  8. 根据权利要求4或5所述的区块链账本的存储方法,其特征在于,所述区块链账本的存储方法,还包括:
    接收所述第二节点簇发送的共享存储解约通知;其中,所述共享存储解约通知用于通知所述第一簇头节点所述第二节点簇不再代为暂存所述部分数据区块。
  9. 一种簇头节点,其特征在于,属于第一节点簇;所述第一节点簇用于存储区块链账本的第一副本,所述区块链账本包括一个头区块和至少一个数据区块;所述第一节点簇还包括至少一个普通节点;所述簇头节点包括通信模块、处理模块和存储模块:其中,
    所述通信模块,用于接收所述第一副本和所述至少一个普通节点上报的可用存储空间大小;
    所述处理模块,用于根据所述至少一个普通节点上报的可用存储空间大小和所述第一副本的数据量,确定所述至少一个普通节点中每个普通节点需要存储的数据区块;
    所述存储模块,用于存储所述头区块,以及所述至少一个数据区块的存储信息;其中,所述存储信息用于指示每个数据区块与其所在的普通节点的对应关系。
  10. 根据权利要求9所述的簇头节点,其特征在于,所述至少一个普通节点包括第一普通节点和第二普通节点;
    所述处理模块,还用于将第一数据区块集合中的部分或全部数据区块转存至所述第二普通节点。
  11. 根据权利要求9或10所述的簇头节点,其特征在于,与第二节点簇存在通信连接;所述第二节点簇用于存储区块链账本的第二副本,所述第二节点簇包括第二簇头节点;
    所述通信模块,还用于向所述第二簇头节点发送所述第一副本中的部分数据区块,以便所述第二节点簇代为存储所述部分数据区块。
  12. 根据权利要求11所述的簇头节点,其特征在于,
    所述通信模块,还用于接收所述第二簇头节点发送的可用共享存储信息;其中,所述可用共享存储信息用于指示所述第二节点簇内的可用共享存储空间总量;
    所述通信模块,还用于向所述第二簇头节点发送共享存储请求;其中,所述共享存储请求用于请求所述第二节点簇代为暂存所述第一副本中的部分数据区块;
    所述通信模块,还用于接收所述第二簇头节点发送的共享存储响应;其中,所述共享存储响应用于指示所述第二簇头节点是否接受所述共享存储请求;
    所述通信模块,还用于若所述第二簇头节点接受所述共享存储请求,则向所述第二簇头节点发送所述部分数据区块;
    所述处理模块,还用于修改所述存储信息。
  13. 根据权利要求11或12所述的簇头节点,其特征在于,
    所述处理模块,还用于获取并存储所述第二节点簇代为暂存的所述部分数据区块;
    所述处理模块,还用于修改所述存储信息;
    所述通信模块,还用于向所述第二簇头节点发送共享存储释放消息;其中,所述共享存储释放消息用于通知所述第二簇头节点释放所述第二节点簇内用于暂存所述部分数据区块的共享存储空间。
  14. 根据权利要求12或13所述的簇头节点,其特征在于,所述共享存储响应还包括共享到期时间;
    所述通信模块,还用于当达到所述共享到期时间时,向所述第二簇头节点发送共享存储续约请求;其中,所述共享存储续约请求用于请求所述第二节点簇继续代为暂存所述部分数据区块。
  15. 根据权利要求12或13所述的簇头节点,其特征在于,所述共享存储响应还包括共享到期时间;
    所述通信模块,还用于接收所述第二簇头节点发送的共享存储续约通知;其中,所述共享存储续约通知用于当达到所述共享到期时间时,所述第二簇头节点询问所述簇头节点是否需要所述第二节点簇继续代为暂存所述部分数据区块。
  16. 根据权利要求12或13所述的簇头节点,其特征在于,
    所述通信模块,还用于接收所述第二节点簇发送的共享存储解约通知;其中,所述共享存储解约通知用于通知所述簇头节点所述第二节点簇不再代为暂存所述部分数据区块。
  17. 一种簇头节点,其特征在于,属于第一节点簇;所述第一节点簇用于存储区块链账本的第一副本,所述区块链账本包括一个头区块和至少一个数据区块;所述第一节点簇还包括至少一个普通节点;其中,所述簇头节点包括处理器和收发器,所述处理器与所述收发器和存储器耦合;
    所述存储器,用于存储计算机程序;
    所述处理器,用于执行所述存储器中存储的计算机程序,使得所述簇头节点执行如权利要求1-8中任一项所述的区块链账本的存储方法。
  18. 一种可读存储介质,其特征在于,存储有程序或指令,当所述程序或指令在计算机上运行时,使得所述计算机执行如权利要求1-8中任一项所述的区块链账本的存储方法。
  19. 一种计算机程序产品,其特征在于,包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得所述计算机执行如权利要求1-8中任一项所述的区块链账本的存储方法。
PCT/CN2020/071747 2019-01-17 2020-01-13 区块链账本的存储方法及装置 WO2020147673A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910045742.9 2019-01-17
CN201910045742.9A CN111447055B (zh) 2019-01-17 2019-01-17 区块链账本的存储方法及装置

Publications (1)

Publication Number Publication Date
WO2020147673A1 true WO2020147673A1 (zh) 2020-07-23

Family

ID=71614390

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/071747 WO2020147673A1 (zh) 2019-01-17 2020-01-13 区块链账本的存储方法及装置

Country Status (2)

Country Link
CN (1) CN111447055B (zh)
WO (1) WO2020147673A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131602A (zh) * 2020-09-22 2020-12-25 北京八分量信息科技有限公司 基于可信计算进行节点间信任关系快速扩展的方法、装置及相关产品
CN113497737A (zh) * 2021-05-13 2021-10-12 曙光信息产业(北京)有限公司 系统拓扑结构维护方法、装置、计算机设备和存储介质
CN117687578A (zh) * 2024-02-01 2024-03-12 南京信息工程大学 区块链中基于动态分簇的区块协同存储方法、介质及设备

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112134883B (zh) * 2020-09-22 2023-05-30 北京八分量信息科技有限公司 基于可信计算进行节点间信任关系快速认证的方法、装置及相关产品
CN112988891B (zh) * 2021-03-11 2023-04-21 重庆文理学院 存储区块链账本的方法、装置、电子设备及存储介质
CN114006914B (zh) * 2021-12-28 2022-03-22 深圳市华盛智联科技有限公司 文件副本的云安全存储方法、系统、介质及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107079059A (zh) * 2016-12-21 2017-08-18 深圳前海达闼云端智能科技有限公司 区块链存储方法、装置及节点设备
JP2018014567A (ja) * 2016-07-19 2018-01-25 ソフトバンク株式会社 制御方法、情報処理システム、コンピュータ及び制御プログラム
CN107786642A (zh) * 2017-09-30 2018-03-09 上海数据交易中心有限公司 用于数据流通的区块链构建方法及装置、存储介质、服务器
CN108519862A (zh) * 2018-03-30 2018-09-11 百度在线网络技术(北京)有限公司 区块链系统的存储方法、装置、系统和存储介质
CN108769146A (zh) * 2018-05-11 2018-11-06 北京奇虎科技有限公司 一种基于区块链的数据传输方法、装置及区块链系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180211202A1 (en) * 2017-01-26 2018-07-26 Eugenio S. YNION, JR. Method, system, apparatus, and program for real-time and online freight management
CN108829350B (zh) * 2018-05-31 2020-02-21 阿里巴巴集团控股有限公司 基于区块链的数据迁移方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018014567A (ja) * 2016-07-19 2018-01-25 ソフトバンク株式会社 制御方法、情報処理システム、コンピュータ及び制御プログラム
CN107079059A (zh) * 2016-12-21 2017-08-18 深圳前海达闼云端智能科技有限公司 区块链存储方法、装置及节点设备
CN107786642A (zh) * 2017-09-30 2018-03-09 上海数据交易中心有限公司 用于数据流通的区块链构建方法及装置、存储介质、服务器
CN108519862A (zh) * 2018-03-30 2018-09-11 百度在线网络技术(北京)有限公司 区块链系统的存储方法、装置、系统和存储介质
CN108769146A (zh) * 2018-05-11 2018-11-06 北京奇虎科技有限公司 一种基于区块链的数据传输方法、装置及区块链系统

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131602A (zh) * 2020-09-22 2020-12-25 北京八分量信息科技有限公司 基于可信计算进行节点间信任关系快速扩展的方法、装置及相关产品
CN112131602B (zh) * 2020-09-22 2024-02-20 北京八分量信息科技有限公司 基于可信计算进行节点间信任关系快速扩展的方法、装置及相关产品
CN113497737A (zh) * 2021-05-13 2021-10-12 曙光信息产业(北京)有限公司 系统拓扑结构维护方法、装置、计算机设备和存储介质
CN117687578A (zh) * 2024-02-01 2024-03-12 南京信息工程大学 区块链中基于动态分簇的区块协同存储方法、介质及设备
CN117687578B (zh) * 2024-02-01 2024-04-16 南京信息工程大学 区块链中基于动态分簇的区块协同存储方法、介质及设备

Also Published As

Publication number Publication date
CN111447055A (zh) 2020-07-24
CN111447055B (zh) 2022-02-25

Similar Documents

Publication Publication Date Title
WO2020147673A1 (zh) 区块链账本的存储方法及装置
US20230188465A1 (en) Medical device communication method
WO2020259352A1 (zh) 一种数据处理方法、节点及区块链系统
US11769150B2 (en) Transaction scheduling for block space on a blockchain
WO2019201043A1 (zh) 网络通信方法、系统、设备及存储介质
EP3739826B1 (en) Communication method, system and apparatus
WO2019165665A1 (zh) 一种域名解析方法、服务器及系统
US9495392B2 (en) System and method for parallel multiplexing between servers in a cluster
US8463850B1 (en) System and method of algorithmically generating a server side transaction identifier
WO2018137217A1 (zh) 一种数据处理的系统、方法及对应装置
WO2020199474A1 (zh) 一种医疗信息共享方法、装置、可读存储介质及服务器
US20060036707A1 (en) Method and apparatus for routing images
EP4160425A1 (en) Data transmission method, chip, and device
US20100020818A1 (en) Sharing buffer space in link aggregation configurations
JP4415023B2 (ja) Pppマルチリンクをサポートするシステムにおけるマルチキャストトラフィックフォーワーディング装置及び制御方法
WO2019153702A1 (zh) 一种中断处理方法、装置及服务器
CN101257457A (zh) 网络处理器复制报文的方法和网络处理器
CN113360077B (zh) 数据存储方法、计算节点及存储系统
WO2021184551A1 (zh) 基于多个网络的通信方法、装置、电子设备及存储介质
WO2021135745A1 (zh) 用于在区块链节点处进行交易数据处理的方法及装置
US10284672B2 (en) Network interface
WO2021185083A1 (zh) Vnf实例化方法及装置
US7502881B1 (en) Data packet routing mechanism utilizing the transaction ID tag field
WO2022193530A1 (zh) 一种区块链协议栈架构方法、系统、设备及存储介质
WO2023040453A1 (zh) 一种交易信息处理方法及装置

Legal Events

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

Ref document number: 20741483

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20741483

Country of ref document: EP

Kind code of ref document: A1