WO2022048359A1 - 一种数据归档方法、装置、电子设备和存储介质 - Google Patents

一种数据归档方法、装置、电子设备和存储介质 Download PDF

Info

Publication number
WO2022048359A1
WO2022048359A1 PCT/CN2021/109269 CN2021109269W WO2022048359A1 WO 2022048359 A1 WO2022048359 A1 WO 2022048359A1 CN 2021109269 W CN2021109269 W CN 2021109269W WO 2022048359 A1 WO2022048359 A1 WO 2022048359A1
Authority
WO
WIPO (PCT)
Prior art keywords
archived
block
groups
blockchain
blocks
Prior art date
Application number
PCT/CN2021/109269
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 WO2022048359A1 publication Critical patent/WO2022048359A1/zh

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/21Design, administration or maintenance of databases
    • 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/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the present application relates to the field of blockchain technology, and in particular, to a data filing method, device, electronic device and storage medium.
  • blockchain technology is widely used in many fields. Further, the inventor realizes that a large amount of data is often generated during the application of blockchain technology, such as transaction data, insurance business-related data, etc. Therefore, the blockchain nodes need to store more and more data. , the storage space occupied by block data in blockchain nodes is also increasing. Therefore, how to reduce the storage pressure of blockchain nodes has become an urgent problem to be solved.
  • the embodiments of the present application provide a data archiving method, apparatus, electronic device, and storage medium, and by implementing the embodiments of the present application, the storage pressure of blockchain nodes is reduced.
  • a first aspect of the present application provides a data archiving method, which includes: when an archiving operation is detected on an archiving interface, acquiring N block chain identifiers to be archived, N groups of block heights to be archived, and N archive addresses, the The N block chain identifiers to be archived are in one-to-one correspondence with the heights of the N groups of blocks to be archived, the N block chain identifiers to be archived are in one-to-one correspondence with the N archive addresses, and the N is greater than 1 Integer; determine the lengths of the N blockchains to be archived corresponding to the identifiers of the N blockchains to be archived; according to the lengths of the N blockchains to be archived, N groups of blocks corresponding to the heights of the N groups of blocks to be archived are determined in the chain; N groups of block data are obtained from the N groups of blocks, the N groups of blocks and the N groups of blocks One-to-one correspondence of data; send the N groups of block data to N archive
  • a second aspect of the present application provides a data filing device, comprising: a first obtaining module, a first determining module, a second determining module, a second obtaining module, a sending module and a deleting module; the first obtaining module is used for When an archiving operation is detected on the archiving interface, obtain N block chain identifiers to be archived, N groups of block heights to be archived, and N archive addresses, the N block chain identifiers to be archived and the N groups to be archived
  • the block heights are in one-to-one correspondence, the N block chain identifiers to be archived correspond to the N archive addresses, and the N is an integer greater than 1;
  • the first determination module is used to determine the The lengths of the N blockchains to be archived correspond to the identifiers of the N blockchains to be archived; the second determining module is used to determine the lengths of the N blockchains to be archived according to the lengths of the N blockchains to be archived.
  • N groups of blocks corresponding to the heights of the N groups of blocks to be archived are determined in the archiving block chain;
  • the second obtaining module is used to obtain N groups of block data from the N groups of blocks, and the The N groups of blocks are in one-to-one correspondence with the N groups of block data;
  • the sending module is configured to send the N groups of block data to the N archive nodes corresponding to the N archive addresses one-to-one;
  • the deletion module is used to delete the N groups of block data on the N block chains to be archived.
  • a third aspect of the present application provides an electronic device for data archiving, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and executed by the The processor is executed to implement a data archiving method, the data archiving method comprising: when an archiving operation is detected on the archiving interface, acquiring N block chain identifiers to be archived, N groups of block heights to be archived, and N archive addresses, The N block chain identifiers to be archived are in one-to-one correspondence with the heights of the N groups of blocks to be archived, the N block chain identifiers to be archived are in one-to-one correspondence with the N archive addresses, and N is greater than an integer of 1; determine the lengths of the N blockchains to be archived corresponding to the identifiers of the N blockchains to be archived; according to the lengths of the N blockchains to be archived, N groups of blocks corresponding to the heights of the N groups of
  • a fourth aspect of the present application provides a computer-readable storage medium, where the computer-readable storage medium is used to store a computer program, and the stored computer program is executed by the processor to implement a data archiving method, the data archiving The method includes: when an archiving operation is detected on the archiving interface, obtaining N block chain identifiers to be archived, N groups of block heights to be archived, and N archive addresses, the N block chain identifiers to be archived and the N block chain identifiers to be archived.
  • the heights of the blocks to be archived are in one-to-one correspondence, the N block chain identifiers to be archived correspond to the N archive addresses, and the N is an integer greater than 1;
  • the N archive nodes corresponding to one-to-one addresses send the N groups of block data, and delete the N groups of block data on the N blocks to be archived.
  • the block is determined based on the length of the block chain, so as to prepare for the subsequent efficient storage of block data to the archive node corresponding to the archive address.
  • the storage space of blockchain nodes is saved, and the storage pressure of blockchain nodes is reduced.
  • FIG. 1 is a schematic diagram of a data archiving system provided by an embodiment of the present application.
  • FIG. 2A is a schematic flowchart of a data archiving method provided by an embodiment of the present application.
  • FIG. 2B is a schematic diagram of a filing interface provided by an embodiment of the present application.
  • FIG. 2C is a schematic diagram of determining the length of a blockchain to be archived according to an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another data archiving method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a data archiving apparatus according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an electronic device of a hardware operating environment involved in an embodiment of the present application.
  • AI artificial intelligence
  • the basic technologies of artificial intelligence generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation/interaction systems, and mechatronics.
  • Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning/deep learning.
  • This application can be applied to data archiving scenarios based on blockchain.
  • the medical data can include personal health files, prescriptions, inspection reports, medical insurance business data and other data.
  • the data involved in this application can be stored in the blockchain.
  • FIG. 1 is a schematic diagram of a data archiving system provided by an embodiment of the present application.
  • the data archiving system 100 includes a data archiving apparatus 110 .
  • the data filing device 110 is used for processing, storing and displaying block data.
  • the data filing system 100 may include an integrated single device or multiple devices.
  • the data filing system 100 is collectively referred to as a blockchain node in this application.
  • the blockchain node can include various handheld devices with wireless communication capabilities, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to wireless modems, as well as various forms of User Equipment (UE) , the mobile station (Mobile Station, MS), terminal equipment (terminal device) and so on.
  • UE User Equipment
  • MS Mobile Station
  • terminal equipment terminal device
  • a blockchain is a chained data structure that connects data blocks in chronological order, and is a cryptographically guaranteed immutable and unforgeable distributed ledger.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the characteristics of blockchain include openness, consensus, decentralization, trustlessness, transparency, anonymity of both parties, immutability, and traceability.
  • openness and transparency mean that anyone can participate in the blockchain network, each device can be used as a node, and each node is allowed to obtain a complete copy of the database.
  • nodes Based on a consensus mechanism, nodes jointly maintain the entire blockchain through competitive computing. If any node fails, the remaining nodes can still work normally.
  • decentralization and de-confidence are arbitrary because the blockchain is composed of many nodes to form an end-to-end network, and there is no centralized equipment and management organization. The data exchange between nodes is verified by digital signature technology, and there is no need to trust each other.
  • the blockchain can use the block chain data structure to verify and store data, use distributed node consensus algorithm to generate and update data, use cryptography to ensure the security of data transmission and access, and use automated script code.
  • the smart contract makes all the terms written into the program, these terms can be automatically executed on the blockchain, which ensures that when there are conditions to trigger the smart contract, the blockchain can enforce the execution according to the content of the smart contract, and does not Blocked by any external force, thus ensuring the validity and execution of the contract, which can not only greatly reduce costs, but also improve efficiency.
  • Each node on the blockchain has the same ledger, which ensures that the ledger recording process is open and transparent.
  • Blockchain technology can realize a point-to-point, open and transparent direct interaction, making efficient, large-scale, decentralized information exchange a reality.
  • the embodiments of the present application propose a data archiving method to solve the above problems, and the embodiments of the present application are described in detail below.
  • FIG. 2A is a schematic flowchart of a data archiving method provided by an embodiment of the present application.
  • This data archiving method can be applied to a blockchain node, as shown in Figure 2A, the method includes the following steps.
  • N block chain identifiers to be archived When an archiving operation is detected on the archiving interface, obtain N block chain identifiers to be archived, N groups of block heights to be archived, and N archive addresses, the N block chain identifiers to be archived and the N groups of block chain identifiers.
  • the heights of the blocks to be archived correspond one-to-one
  • the N block chain identifiers to be archived correspond to the N archive addresses one-to-one
  • the N is an integer greater than 1.
  • FIG. 2B is a schematic diagram of a filing interface provided by an embodiment of the present application.
  • the filing interface 200 includes a block chain identification selection box to be archived, a block height selection box to be archived, an archive address selection box, and a confirmation button.
  • the user can perform selection operations in the selection box of the blockchain identifier to be archived, the height selection box of the block to be archived, and the selection box of the archive address, so as to determine the blockchain identifier to be archived, the height of the block to be archived, and the archived address selection box. address.
  • the filing operation may be a click operation on the confirmation button.
  • each of the N groups of block heights to be archived includes M block heights to be archived corresponding to each block chain identifier to be archived in the N block chain identifiers to be archived, and M is greater than An integer of 0. Further, in this application, the height of the block to be archived may be the number of the block to be archived.
  • each of the N archive addresses may include one of the following: an internet protocol address (internet protocol address, IP address), an IP address and a port number, and a domain name.
  • IP address internet protocol address
  • IP address IP address
  • port number IP address
  • domain name a domain name
  • the determining the lengths of the N to-be-archived blockchains corresponding to the N to-be-filed blockchain identifiers one-to-one includes: determining the N one-to-one corresponding to the N to-filed blockchain identifiers Block chains to be archived; determine the number of block headers corresponding to each block chain to be archived in the N block chains to be archived; The number of block headers, which determines the length of the N blockchains to be archived.
  • FIG. 2C is a schematic diagram of determining the length of a blockchain to be archived according to an embodiment of the present application.
  • the N blockchains to be archived include blockchain 1 to be archived to blockchain N to be archived.
  • the blockchain 1 to be archived includes at least one block, and each block in the at least one block includes a block header.
  • the blockchain N to be archived includes at least one block, and each block in the at least one block includes a block header.
  • the block header stores the header information of the block, including the hash value (PreHash) of the previous block, the hash value (Hash) of the current block body, and the timestamp (TimeStamp), etc.
  • the determining the lengths of the N to-be-archived blockchains that correspond one-to-one with the N to-be-filed blockchain identifiers includes: determining a first to-be-archived area corresponding to the first to-be-filed blockchain identifiers block chain; obtain the block height corresponding to the starting block and the block height corresponding to the ending block in the first block chain to be archived; according to the block height corresponding to the starting block in the first block chain to be archived The difference between the block height and the block height corresponding to the termination block determines the length of the first block chain to be archived.
  • the starting block in the first blockchain to be archived is the block with the smallest block height in the first blockchain to be archived
  • the terminating block in the first blockchain to be archived is the first area to be archived The block with the largest block height in the blockchain.
  • N determine, from the N blockchains to be archived, N groups of blocks corresponding to the heights of the N groups of blocks to be archived one-to-one.
  • the first block chain identifier to be archived is any one of the N block chain identifiers to be archived, and the first block chain identifier to be archived corresponds to the first group of block chain identifiers to be archived.
  • the height of the archived blocks includes the heights of M blocks to be archived corresponding to the first block chain identifier to be archived, wherein the height of the first group of blocks to be archived is one of the heights of the N groups of blocks to be archived.
  • the block height of the group to be archived is any one of the N block chain identifiers to be archived, and the first block chain identifier to be archived corresponds to the first group of block chain identifiers to be archived.
  • the height of the archived blocks includes the heights of M blocks to be archived corresponding to the first block chain identifier to be archived, wherein the height of the first group of blocks to be archived is one of the heights of the N groups of blocks to be archived.
  • the first group of block heights to be archived includes M block heights to be archived, wherein M is an integer greater than 1, and the first group of blocks corresponding to the first group of block heights to be archived includes M.
  • the M blocks are determined from the first block chain to be archived corresponding to the identifier of the first block chain to be archived according to the height of the M blocks to be archived, and the first block chain to be archived is determined.
  • the archived blockchain is a blockchain to be archived among the N blockchains to be archived.
  • the first group of block data corresponding to the first block chain to be archived is obtained from the first block to be archived according to the height of the first group of blocks to be archived corresponding to the identifier of the first block chain to be archived
  • the first group of block data is obtained from the first group of blocks.
  • the nodes to be archived may include, for example, various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to wireless modems, as well as various forms of users Equipment (User Equipment, UE), mobile station (Mobile Station, MS), terminal equipment (terminal device) and so on.
  • User Equipment User Equipment
  • MS Mobile Station
  • terminal device terminal equipment
  • the block is determined based on the length of the block chain, so as to prepare for the subsequent efficient storage of block data to the archive node corresponding to the archive address.
  • the storage space of blockchain nodes is saved, and the storage pressure of blockchain nodes is reduced.
  • the lengths of the N blockchains to be archived determine a one-to-one correspondence with the heights of the N groups of blocks to be archived from the N blockchains to be archived N groups of blocks, including: from the N blockchains to be archived, determining a second blockchain to be archived and a third blockchain to be archived; determining the second blockchain to be archived and the third blockchain to be archived 3.
  • the length difference value of , and N groups of blocks corresponding to the heights of the N groups of blocks to be archived are determined from the N blockchains to be archived, and the N-1 fifth blockchains to be archived are A
  • the second blockchain to be archived is the blockchain with the longest blockchain length among the N blockchains to be archived
  • the third blockchain to be archived is the N areas to be archived
  • the preset length difference can be set by the administrator, or can be configured in the blockchain node.
  • the determining the length difference between the second blockchain to be archived and the third blockchain to be archived includes: according to the length of the second blockchain to be archived and the third blockchain to be archived.
  • the length of the blockchain to be archived is determined by determining the length difference between the second blockchain to be archived and the third blockchain to be archived.
  • the length of the second blockchain to be archived may be determined according to the number of block headers corresponding to the second blockchain to be archived, or may be determined according to the starting area in the second blockchain to be archived The difference between the block height corresponding to the block and the block height corresponding to the termination block is determined.
  • the length of the third blockchain to be archived may be determined according to the number of block headers corresponding to the third blockchain to be archived, or may be determined according to the starting area in the third blockchain to be archived The difference between the block height corresponding to the block and the block height corresponding to the termination block is determined.
  • the block is determined by the difference in length, which realizes the rapid determination of the block and avoids the problem of low efficiency caused by randomly determining the block.
  • determine from the N blockchains to be archived The N groups of blocks corresponding to the heights of the N groups of blocks to be archived one-to-one include: according to the first order, determining the heights of the N groups of blocks to be archived one-to-one from the N blocks of blocks to be archived.
  • the blocks are determined according to the order of the length difference from small to large, so that the blocks can be quickly determined, and the problem of low efficiency caused by randomly determining the blocks is avoided.
  • determine from the N blockchains to be archived The N groups of blocks corresponding to the heights of the N groups of blocks to be archived one-to-one include: according to the second order, determining the heights of the N groups of blocks to be archived one-to-one from the N blocks to be archived For the corresponding N groups of blocks, the second order is in descending order of length differences between the second block chain to be archived and the N-1 fifth block chains to be archived.
  • the blocks are determined in descending order of the length difference, so that the blocks can be quickly determined, and the problem of low efficiency caused by randomly determining the blocks is avoided.
  • the lengths of the N blockchains to be archived determine a one-to-one correspondence with the heights of the N groups of blocks to be archived from the N blockchains to be archived N groups of blocks, including: obtaining a preset length; determining whether there are K block chains to be archived greater than the preset length in the lengths of the N block chains to be archived, where the K is greater than 0 and an integer less than N; if yes, then from the K blockchains to be archived, determine the blockchain with the shortest blockchain length among the K blockchains to be archived; according to the K blockchains to be archived The length difference between the blockchain with the shortest blockchain length and the K-1 blockchains to be archived, determined from the K blockchains to be archived and the height of the K groups of blocks to be archived one-to-one correspondence
  • the K groups of blocks to be archived, the K-1 blockchains to be archived are those of the K blockchains to be archived except the blockchains with the shortest blockchain length among the K
  • a blockchain other than the archived blockchain according to the length difference between the longest blockchain in the NK blockchains to be archived and the NK-1 blockchains to be archived, from the The NK group blocks corresponding to the heights of the NK groups to be archived are determined in the NK block chains to be archived, and the NK-1 block chains to be archived are among the NK block chains to be archived.
  • Other blockchains except the blockchain with the longest blockchain length among the NK blockchains to be archived; if not, according to the length of the N to-be-archived blockchains in descending order In sequence, N groups of blocks corresponding to the heights of the N groups of blocks to be archived one-to-one are determined from the N block chains to be archived.
  • the preset length can be set by the administrator, or can be configured in the blockchain node.
  • determining, from the K blockchains to be archived, the blockchain with the shortest blockchain length in the K blockchains to be archived includes: determining which of the K blockchains to be archived The number of block headers corresponding to each block chain to be archived; the length of the K block chains to be archived is determined according to the number of block headers corresponding to each block chain to be archived in the K block chains to be archived; According to the lengths of the K blockchains to be archived, determine the blockchain with the shortest blockchain length among the K blockchains to be archived.
  • determining, from the K blockchains to be archived, the blockchain with the shortest blockchain length in the K blockchains to be archived includes: determining which of the K blockchains to be archived The block height corresponding to the start block of each block chain to be archived and the block height corresponding to the end block; according to the corresponding block height of each block chain to be archived in the K block chains to be archived The difference between the block height and the block height corresponding to the termination block determines the length of the K block chains to be archived; according to the length of the K block chains to be archived, determine the K blocks to be archived The blockchain with the shortest blockchain length among the blockchains.
  • Determining the K groups of blocks that correspond one-to-one with the heights of the K groups of blocks to be archived includes: according to the third order, determining the K groups of blocks that are one-to-one corresponding to the heights of the K groups of blocks to be archived from the K block chains to be archived group of blocks, and the third order is the order in which the length difference between the block chain with the shortest block chain length and the K-1 block chains to be archived among the K block chains to be archived is from small to large.
  • the NK group blocks that correspond one-to-one with the heights of the blocks to be archived in the NK group include: according to the fourth order, determining the heights of the blocks to be archived in the NK group from the NK blocks to be archived one-to-one Corresponding NK group blocks, the fourth order is that the length difference between the block chain with the longest block chain length among the NK block chains to be archived and the length of the NK-1 block chains to be archived is from Largest to smallest order.
  • FIG. 3 is a schematic flowchart of another data archiving method provided by an embodiment of the present application.
  • This data archiving method can be applied to a blockchain node, which, as shown in Figure 3, includes the following steps.
  • the N block chain identifiers to be archived correspond one-to-one with the heights of the N groups of blocks to be archived, the N block chain identifiers to be archived are in one-to-one correspondence with the N archive addresses, and the N is an integer greater than 1.
  • N determine, from the N blockchains to be archived, N groups of blocks corresponding to the heights of the N groups of blocks to be archived one-to-one.
  • the first filing node corresponds to the filing address corresponding to the first block chain identifier to be archived
  • the first block chain identifier to be archived is any one of the N block chain identifiers to be archived to be archived
  • the block chain identifier, the first group of block data is based on the height of the first group of blocks to be archived corresponding to the first block chain identifier to be archived from the first block chain identifier to be archived.
  • the height of the first group of blocks to be archived is a group of block heights to be archived among the N groups of block heights to be archived.
  • the deleting the N groups of block data on the N blockchains to be archived includes: deleting the first group of block data on the first blockchain to be archived.
  • FIG. 4 is a schematic diagram of a data archiving apparatus provided by an embodiment of the present application.
  • a data filing device 400 provided in this embodiment of the present application includes a first acquisition module 401, a first determination module 402, a second determination module 403, a second acquisition module 404, a sending module 405, and a deletion module 405.
  • Module 406 wherein the first obtaining module 401 is used to obtain N block chain identifiers to be archived, N groups of block heights to be archived, and N archive addresses when an archive operation is detected on the archive interface.
  • the N block chain identifiers to be archived are in one-to-one correspondence with the heights of the N groups of blocks to be archived, the N block chain identifiers to be archived are in one-to-one correspondence with the N archive addresses, and the N is greater than 1 Integer;
  • the first determination module 402 is used to determine the lengths of the N blockchains to be archived corresponding to the identifiers of the N blockchains to be archived one-to-one;
  • the second determination module 403 is used to determine the lengths of the N blockchains to be archived according to the the length of the N block chains to be archived, and determine the N groups of blocks corresponding to the heights of the N groups of blocks to be archived one-to-one from the N block chains to be archived;
  • the second obtaining module 404 It is used to obtain N groups of block data from the N groups of blocks, and the N groups of blocks are in one-to-one correspondence with the N groups of block data.
  • the sending module 405 is configured
  • the block is determined based on the length of the block chain, so as to prepare for the subsequent efficient storage of block data to the archive node corresponding to the archive address.
  • the storage space of blockchain nodes is saved, and the storage pressure of blockchain nodes is reduced.
  • the first block chain identifier to be archived is any one of the N block chain identifiers to be archived.
  • the first determining module 402 is specifically configured to determine the N to-be-filed blocks corresponding to the N to-be-filed blockchain identifiers determine the number of block headers corresponding to each block chain to be archived in the N block chains to be archived; according to the number of block headers corresponding to each block chain to be archived in the N block chains to be archived, Determine the lengths of the N blockchains to be archived.
  • the first block chain identifier to be archived is any one of the N block chain identifiers to be archived.
  • the first determination module 402 is specifically configured to determine the first blockchain to be archived corresponding to the identifier of the first blockchain to be archived; obtain The block height corresponding to the starting block and the block height corresponding to the ending block in the first block chain to be archived; according to the block height and the block height corresponding to the starting block in the first block chain to be archived
  • the length of the first block chain to be archived is determined by the difference between the block heights corresponding to the termination block.
  • the second determining module 402 is specifically configured to determine the second block chain to be archived and the third block chain to be archived from the N block chains to be archived, the second block chain to be archived
  • the archived blockchain is the blockchain with the longest blockchain length among the N to-be-archived blockchains
  • the third to-be-archived blockchain is the blockchain length of the N to-be-archived blockchains
  • the shortest blockchain determine the length difference between the second blockchain to be archived and the third blockchain to be archived; if the second blockchain to be archived and the third blockchain to be archived If the length difference of the chain is higher than the preset length difference, then according to the length difference between the third block chain to be archived and the N-1 fourth block chain to be archived, from the N blocks to be archived N groups of blocks corresponding
  • Block chains other than the block chain to be archived if the length difference between the second block chain to be archived and the third block chain to be archived is lower than the preset length difference, according to the The length difference between the second block chain to be archived and the N-1 fifth block chain to be archived, determined from the N block chains to be archived and the height of the N groups of blocks to be archived in one-to-one correspondence N groups of blocks, the N-1 fifth blockchains to be archived are the blockchains other than the second blockchain to be archived among the N blockchains to be archived.
  • the block is determined by the difference in length, which realizes the rapid determination of the block and avoids the problem of low efficiency caused by randomly determining the block.
  • the second determination module 403 is specifically configured to determine, according to the first order, from the N block chains to be archived N groups of N groups of blocks corresponding to the heights of the blocks to be archived one-to-one, wherein the first order is the length difference between the third blockchain to be archived and the N-1 fourth blockchains to be archived Values in ascending order.
  • the blocks are determined according to the order of the length difference from small to large, so that the blocks can be quickly determined, and the problem of low efficiency caused by randomly determining the blocks is avoided.
  • the second determination module 403 is specifically configured to determine, according to the second order, from the N block chains to be archived.
  • the heights of the N groups of blocks to be archived correspond to one-to-one N groups of blocks
  • the second order is the difference between the lengths of the second block chain to be archived and the N-1 fifth block chains to be archived from in order of largest to smallest.
  • the blocks are determined in descending order of the length difference, so that the blocks can be quickly determined, and the problem of low efficiency caused by randomly determining the blocks is avoided.
  • the sending module 405 when sending the N groups of block data to the N archiving nodes corresponding to the N archiving addresses, the sending module 405 is configured to send to the first archiving node
  • the first filing node corresponds to the filing address corresponding to the first block chain identifier to be archived
  • the first block chain identifier to be archived is one of the N block chain identifiers to be archived.
  • the first group of block data is based on the height of the first group of blocks to be archived corresponding to the first block chain identifier to be archived from the first block chain to be archived.
  • the block data obtained in the corresponding first block chain to be archived is identified, and the height of the first group of blocks to be archived is a group of block heights to be archived among the N groups of block heights to be archived.
  • FIG. 5 is a schematic structural diagram of an electronic device of a hardware operating environment involved in an embodiment of the present application.
  • An embodiment of the present application provides an electronic device for data archiving, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured by The processor executes instructions to perform the steps comprising any of the data archiving methods.
  • the electronic device of the hardware operating environment involved in the embodiments of the present application may include: a processor 501 , such as a CPU.
  • the memory 502 optionally, the memory may be a high-speed RAM memory, or may be a stable memory, such as a disk memory.
  • the communication interface 503 is used to realize the connection communication between the processor 501 and the memory 502 .
  • FIG. 5 does not constitute a limitation thereof, and may include more or less components than the one shown, or combine some components, or arrange different components.
  • the memory 502 may include an operating system, a network communication module, and one or more programs.
  • An operating system is a program that manages and controls server hardware and software resources, and supports the operation of one or more programs.
  • the network communication module is used to realize the communication between various components in the memory 502, as well as the communication with other hardware and software in the electronic device.
  • the processor 501 is configured to execute one or more programs in the memory 502, and implement the following steps: when an archiving operation is detected on the archiving interface, acquiring N blockchain identifiers to be archived, N A set of block heights to be archived and N archive addresses, the N block chain identifiers to be archived are in one-to-one correspondence with the N groups of block heights to be archived, and the N block chain identifiers to be archived correspond to the N block chain identifiers to be archived.
  • N There is a one-to-one correspondence between the N archive addresses, and the N is an integer greater than 1; determine the lengths of the N to-be-archived blockchains corresponding to the N to-be-archived blockchain identifiers; according to the N to-be-archived areas
  • the length of the block chain N groups of blocks corresponding to the heights of the N groups of blocks to be archived are determined from the N blocks to be archived; N groups of block data are obtained from the N groups of blocks , the N groups of blocks are in one-to-one correspondence with the N groups of block data; send the N groups of block data to the N archive nodes corresponding to the N archive addresses one-to-one, and send the N groups of block data to the N archive addresses.
  • the N groups of block data are deleted from the blockchain to be archived.
  • the present application also provides a computer-readable storage medium for storing a computer program, and the stored computer program is executed by the processor to implement the following steps: detecting an archive on an archive interface During operation, N block chain identifiers to be archived, N group heights of blocks to be archived, and N archive addresses are obtained, and the N block chain identifiers to be archived correspond one-to-one with the N groups of block heights to be archived, The N block chain identifiers to be archived correspond one-to-one with the N archive addresses, and the N is an integer greater than 1; determine the N block chain identifiers to be archived that correspond one-to-one with the N block chain identifiers to be archived The length of the block chain; according to the length of the N block chains to be archived, N groups of blocks corresponding to the heights of the N groups of blocks to be archived one-to-one are determined from the N block chains to be archived; Obtain N groups of block data from the N groups of blocks, and the N groups of
  • the storage medium involved in this application such as a computer-readable storage medium

Landscapes

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

Abstract

本申请涉及区块存储系统,公开了一种数据归档方法、装置、电子设备和存储介质,该方法包括:在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址;确定与N个待归档区块链标识一一对应的N个待归档区块链的长度;根据N个待归档区块链的长度,从N个待归档区块链中确定与N组待归档区块高度一一对应的N组区块;从N组区块中获取N组区块数据,N组区块与所述N组区块数据一一对应;向与N个归档地址一一对应的N个归档节点发送N组区块数据,并在N个待归档区块链上删除N组区块数据。实施本申请实施例,减轻区块链节点的存储压力。

Description

一种数据归档方法、装置、电子设备和存储介质
本申请要求于2020年9月3日提交中国专利局、申请号为202010918632.1,发明名称为“一种数据归档方法、装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及区块链技术领域,尤其涉及一种数据归档方法、装置、电子设备和存储介质。
背景技术
随着区块链技术的快速发展,在很多领域都在广泛应用区块链技术。进一步的,发明人意识到,在区块链技术的应用过程中往往会产生大量的数据,比如交易数据、保险业务相关的数据等,因此,区块链节点所要存储的数据也越来越多,区块链节点中区块数据占用的存储空间也越来越大。因此,如何减轻区块链节点的存储压力成为目前急需解决的问题。
技术问题
本申请实施例提供了一种数据归档方法、装置、电子设备和存储介质,实施本申请实施例,减轻区块链节点的存储压力。
技术解决方案
本申请第一方面提供了一种数据归档方法,包括:在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
本申请第二方面提供了一种数据归档装置,包括:第一获取模块、第一确定模块、第二确定模块、第二获取模块、发送模块和删除模块;所述第一获取模块,用于在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;所述第一确定模块,用于确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;所述第二确定模块,用于根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;所述第二获取模块,用于从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;所述发送模块,用于向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据;所述删除模块,用于在所述N个待归档区块链上删除所述N组区块数据。
本申请第三方面提供了一种数据归档的电子设备,包括处理器、存储器、通信接口以及一个或多个程序,其中,所述一个或多个程序被存储在所述存储器中,并且由所述处理器执行以实现数据归档方法,所述数据归档方法包括:在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
本申请第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机程序,所述存储计算机程序被所述处理器执行,以实现数据归档方法,所述数据归档方法包括:在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
有益效果
可以看出,上述技术方案中,通过基于区块链长度,确定区块,为后续高效将区块数据存储至归档地址对应的归档节点做准备。同时,通过删除区块数据,节省了区块链节点的存储空间,减轻了区块链节点的存储压力。
附图说明
图1是本申请实施例提供的一种数据归档系统的示意图。
图2A为本申请实施例提供的一种数据归档方法的流程示意图。
图2B为本申请实施例提供的一种归档界面的示意图。
图2C为本申请实施例提供的一种待归档区块链的长度确定示意图。
图3为本申请实施例提供的又一种数据归档方法的流程示意图。
图4为本申请实施例提供的一种数据归档装置的示意图。
图5为本申请的实施例涉及的硬件运行环境的电子设备结构示意图。
本发明的实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。
本申请可涉及人工智能技术领域,比如可以基于人工智能技术对相关的数据进行获取和处理。其中,人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。人工智能基础技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理技术、操作/交互系统、机电一体化等技术。人工智能软件技术主要包括计算机视觉技术、机器人技术、生物识别技术、语音处理技术、自然语言处理技术以及机器学习/深度学习等几大方向。
本申请可应用于基于区块链的数据归档场景,例如,可具体应用于数字医疗中的医疗数据的归档场景,该医疗数据可包括个人健康档案、处方、检查报告、医疗保险业务数据等数据;又如,可具体应用于金融科技中的交易数据的归档场景,等等。本申请涉及的数据如医疗数据和交易数据可存储于区块链中。
首先,参见图1,图1是本申请实施例提供的一种数据归档系统的示意图,该数据归档系统100包括数据归档装置110。该数据归档装置110用于处理、存储、显示区块数据。该数据归档系统100可以包括集成式单体设备或者多设备,为方便描述,本申请将数据归档系统100统称为区块链节点。显然该区块链节点可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(User Equipment,UE),移动台(Mobile Station,MS),终端设备(terminal device)等等。
进一步的,为了使得本申请实施例更加的清楚,在此对本申请实施例中的部分概念或内容作简单介绍。
区块链是一种按照时间顺序将数据区块相连的一种链式数据结构,并以密码学方式保证的不可篡改和不可伪造的分布式账本。该区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
进一步的,区块链的特性有开放、共识、去中心、去信任、透明、双方匿名、不可篡改以及可追溯等。其中,开放与透明意为任何人都可以参与到区块链网络,每一台设备都能作为一个节点,每个节点都允许获得一份完整的数据库拷贝。节点基于一套共识机制,通过竞争计算共同维护整个区块链。任一节点失效,其余节点仍能正常工作。其中,去中心化与去信任意为区块链由众多节点共同组成一个端到端的网络,不存在中心化的设备和管理机构。节点之间数据交换通过数字签名技术进行验证,无需互相信任,只要按照系统既定的规则进行,节点之间不能也无法欺骗其他节点。其中,透明与双方匿名意为区块链的运行规则是公开的,所有的数据信息也是公开的,因此每一笔交易都对所有节点可见。由于节点与节点之间是去信任的,因此节点之间无需公开身份,每个参与的节点都是匿名的。其中,不可篡改和可追溯意为每个甚至多个节点对数据库的修改无法影响其他节点的数据库,除非能控制整个网络中超过51%的节点同时修改,这是几乎不可能发生的。区块链中的,每一笔交易都通过密码学方法与相邻两个区块串联,因此可以追溯到任何一笔交易记录。
具体的,区块链可以利用块链式数据结构来验证与存储数据、利用分布式节点共识算法来生成和更新数据、利用密码学的方式保证数据传输和访问的安全、利用由自动化脚本代码组成的智能合约来编程和操作数据的一种全新的分布式基础架构与计算方式。因此,区块链技术不可篡改的特性从根本上改变了中心化的信用创建方式,有效提高了数据的不可更改性以及安全性。其中,由于智能合约使得所有的条款编写为程序,这些条款可在区块链上自动执行,保证了当存在触发智能合约的条件时,区块链能强制根据智能合约中的内容执行,且不受任何外力阻挡,从而保证了合约的有效性和执行力,不仅能够大大降低成本,也能提高效率。区块链上的各个节点都有相同的账本,能够确保账本记录过程是公开透明的。区块链技术可以实现了一种点对点的、公开透明的直接交互,使得高效率、大规模、无中心化代理的信息交互方式成为了现实。
另外,随着区块链技术的快速发展,在交易领域应用区块链技术也越来越广泛。进一步的,随着交易数据量的逐渐增加,区块链节点所要存储的数据也越来越多,区块链节点中区块数据占用的存储空间也越来越大。因此,如何减轻区块链节点的存储压力成为目前急需解决的问题。
基于此,本申请实施例提出一种数据归档方法以解决上述问题,下面对本申请实施例进行详细介绍。
参见图2A,图2A为本申请实施例提供的一种数据归档方法的流程示意图。该数据归档方法可以应用于区块链节点,如图2A所示,所述方法包括以下步骤。
201、在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数。
其中,参见图2B,图2B为本申请实施例提供的一种归档界面的示意图。如图2B所示,归档界面200包括待归档区块链标识选择框、待归档区块高度选择框、归档地址选择框和确认按钮。可以理解的,用户可以在待归档区块链标识选择框、待归档区块高度选择框、归档地址选择框进行选择操作,从而可以确定出待归档区块链标识、待归档区块高度、归档地址。进一步的,归档操作可以为对确认按钮进行点击操作。
其中,所述N组待归档区块高度中的每组包括所述N个待归档区块链标识中每个待归档区块链标识对应的M个待归档区块高度,所述M为大于0的整数。进一步的,在本申请中,待归档区块高度可以为待归档区块的编号。
其中,N个归档地址中的每个归档地址可以包括以下一种:互联网协议地址(internet protocol address,IP地址)、IP地址和端口号、域名。
202、确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度。
其中,所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:确定与所述N个待归档区块链标识一一对应的N个待归档区块链;确定所述N个待归档区块链中每个待归档区块链对应的区块头数量;根据所述N个待归档区块链中每个待归档区块链对应的区块头数量,确定所述N个待归档区块链的长度。
具体的,参见图2C,图2C为本申请实施例提供的一种待归档区块链的长度确定示意图。如图2C所示,N个待归档区块链包括待归档区块链1至待归档区块链N。其中,待归档区块链1包括至少一个区块,至少一个区块中的每个区块包括区块头。待归档区块链N包括至少一个区块,至少一个区块中的每个区块包括区块头。可以理解的,区块头里面存储着区块的头信息,包含上一个区块的哈希值(PreHash),本区块体的哈希值(Hash),以及时间戳(TimeStamp)等等。
可以看出,上述技术方案中,实现了区块链长度的确定,为后续高效将区块数据存储至归档地址对应的归档节点做准备。
其中,所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:确定所述第一待归档区块链标识对应的第一待归档区块链;获取所述第一待归档区块链中起始区块对应的区块高度以及终止区块对应的区块高度;根据所述第一待归档区块链中起始区块对应的区块高度和终止区块对应的区块高度的差值,确定所述第一待归档区块链的长度。
可以理解的,第一待归档区块链中起始区块为第一待归档区块链中区块高度最小的区块,第一待归档区块链中终止区块为第一待归档区块链中区块高度最大的区块。
可以看出,上述技术方案中,实现了区块链长度的确定,为后续高效将区块数据存储至归档地址对应的归档节点做准备。
203、根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块。
可以理解的,第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,所述第一待归档区块链标识对应的第一组待归档区块高度包括所述第一待归档区块链标识对应的M个待归档区块高度,其中,所述第一组待归档区块高度为所述N组待归档区块高度中的一组待归档区块高度。
进一步的,所述第一组待归档区块高度包括M个待归档区块高度,其中,M为大于1的整数,所述第一组待归档区块高度对应的第一组区块包括M个区块,所述M个区块是根据所述M个待归档区块高度,从所述第一待归档区块链标识对应的第一待归档区块链确定的,所述第一待归档区块链为所述N个待归档区块链中的一个待归档区块链。
204、从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应。
其中,所述第一待归档区块链对应的第一组区块数据是根据所述第一待归档区块链标识对应的第一组待归档区块高度从所述第一待归档区块链标识对应的第一待归档区块链中获取的区块数据。具体的,所述第一组区块数据从所述第一组区块中获取的。
205、向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
其中,在本申请实施例中,待归档节点例如可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(User Equipment,UE),移动台(Mobile Station,MS),终端设备(terminal device)等等。
可以看出,上述技术方案中,通过基于区块链长度,确定区块,为后续高效将区块数据存储至归档地址对应的归档节点做准备。同时,通过删除区块数据,节省了区块链节点的存储空间,减轻了区块链节点的存储压力。
在一种可能的实施方式中,所述根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:从所述N个待归档区块链中,确定第二待归档区块链和第三待归档区块链;确定所述第二待归档区块链和所述第三待归档区块链的长度差值;若所述第二待归档区块链和所述第三待归档区块链的长度差值高于预设长度差值,则根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第四待归档区块链为所述N个待归档区块链中除所述第三待归档区块链之外的区块链;若所述第二待归档区块链和所述第三待归档区块链的长度差值低于所述预设长度差值,则根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第五待归档区块链为所述N个待归档区块链中除所述第二待归档区块链之外的区块链。
其中,所述第二待归档区块链为所述N个待归档区块链中区块链长度最长的区块链,所述第三待归档区块链为所述N个待归档区块链中区块链长度最短的区块链。
其中,预设长度差值可以由管理员设置,也可以配置在区块链节点中。
可以理解的,所述确定所述第二待归档区块链和所述第三待归档区块链的长度差值,包括:根据所述第二待归档区块链的长度和所述第三待归档区块链的长度,确定所述第二待归档区块链和所述第三待归档区块链的长度差值。
其中,所述第二待归档区块链的长度可以是根据所述第二待归档区块链对应的区块头数量确定的,也可以是根据所述第二待归档区块链中起始区块对应的区块高度以及终止区块对应的区块高度的差值确定的。
其中,所述第三待归档区块链的长度可以是根据所述第三待归档区块链对应的区块头数量确定的,也可以是根据所述第三待归档区块链中起始区块对应的区块高度以及终止区块对应的区块高度的差值确定的。
可以看出,上述技术方案中,通过长度差值,确定区块,实现了快速确定区块,避免了随机确定区块时导致的效率低的问题。
在一种可能的实施方式中,所述根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:按照第一顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,其中,所述第一顺序为所述第三待归档区块链与所述N-1个第四待归档区块链的长度差值从小到大的顺序。
可以看出,上述技术方案中,实现了按照长度差值从小到大的顺序确定区块,实现了快速确定区块,避免了随机确定区块时导致的效率低的问题。
在一种可能的实施方式中,所述根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:按照第二顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述第二顺序为所述第二待归档区块链与所述N-1个第五待归档区块链的长度差值从大到小的顺序。
可以看出,上述技术方案中,实现了按照长度差值从大到小的顺序确定区块,实现了快速确定区块,避免了随机确定区块时导致的效率低的问题。
在一种可能的实施方式中,所述根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:获取预设长度;确定所述N个待归档区块链的长度中是否存在大于所述预设长度的K个待归档区块链,其中,所述K为大于0且小于N的整数;若是,则从所述K个待归档区块链中,确定所述K个待归档区块链中区块链长度最短的区块链;根据所述K个待归档区块链中区块链长度最短的区块链与K-1个待归档区块链的长度差值,从所述K个待归档区块链中确定与K组待归档区块高度一一对应的K组区块,所述K-1个待归档区块链为所述K个待归档区块链中除所述K个待归档区块链中区块链长度最短的区块链之外的其他区块链,所述K组待归档区块高度为所述N组待归档区块高度中与所述K个待归档区块链对应的区块高度;从N-K个待归档区块链中,确定所述N-K个待归档区块链中区块链长度最长的区块链,所述N-K个待归档区块链为所述N个待归档区块链中除所述K个待归档区块链之外的区块链;根据所述N-K个待归档区块链中区块链长度最长的区块链与N-K-1个待归档区块链的长度差值,从所述N-K个待归档区块链中确定与所述N-K组待归档区块高度一一对应的N-K组区块,所述N-K-1个待归档区块链为所述N-K个待归档区块链中除所述N-K个待归档区块链中区块链长度最长的区块链之外的其他区块链;若否,则按照所述N个待归档区块链的长度从大到小的顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块。
其中,预设长度可以由管理员设置,也可以配置在区块链节点中。
其中,所述从所述K个待归档区块链中,确定所述K个待归档区块链中区块链长度最短的区块链,包括:确定所述K个待归档区块链中每个待归档区块链对应的区块头数量;根据所述K个待归档区块链中每个待归档区块链对应的区块头数量,确定所述K个待归档区块链的长度;根据所述K个待归档区块链的长度,确定所述K个待归档区块链中区块链长度最短的区块链。
其中,所述从所述K个待归档区块链中,确定所述K个待归档区块链中区块链长度最短的区块链,包括:确定所述K个待归档区块链中每个待归档区块链起始区块对应的区块高度以及终止区块对应的区块高度;根据所述K个待归档区块链中每个待归档区块链起始区块对应的区块高度以及终止区块对应的区块高度的差值,确定所述K个待归档区块链的长度;根据所述K个待归档区块链的长度,确定所述K个待归档区块链中区块链长度最短的区块链。
其中,所述根据所述K个待归档区块链中区块链长度最短的区块链与K-1个待归档区块链的长度差值,从所述K个待归档区块链中确定与K组待归档区块高度一一对应的K组区块,包括:按照第三顺序,从所述K个待归档区块链中确定与K组待归档区块高度一一对应的K组区块,所述第三顺序为所述K个待归档区块链中区块链长度最短的区块链与K-1个待归档区块链的长度差值从小到大的顺序。
其中,根据所述N-K个待归档区块链中区块链长度最长的区块链与N-K-1个待归档区块链的长度差值,从所述N-K个待归档区块链中确定与所述N-K组待归档区块高度一一对应的N-K组区块,包括:按照第四顺序,从所述N-K个待归档区块链中确定与所述N-K组待归档区块高度一一对应的N-K组区块,所述第四顺序为所述N-K个待归档区块链中区块链长度最长的区块链与所述N-K-1个待归档区块链的长度差值从大到小的顺序。
可以看出,上述技术方案中,实现了区块链长度的确定,为后续高效将区块数据存储至归档地址对应的归档节点做准备。
参见图3,图3为本申请实施例提供的又一种数据归档方法的流程示意图。该数据归档方法可以应用于区块链节点,其中,如图3所示,包括以下步骤。
301、在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址。
其中,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数。
其中,关于归档界面,可以参考步骤201中归档界面的描述,在此不加赘述。关于N组待归档区块高度,可以参考步骤201中N组待归档区块高度的描述,在此不加赘述。关于N个归档地址,可以参考步骤201中N个归档地址的描述,在此不加赘述。
302、确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度。
303、根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块。
304、向第一归档节点发送第一组区块数据。
其中,所述第一归档节点与第一待归档区块链标识对应的归档地址对应,所述第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,所述第一组区块数据是根据所述第一待归档区块链标识对应的第一组待归档区块高度从所述第一待归档区块链标识对应的第一待归档区块链中获取的区块数据,所述第一组待归档区块高度为所述N组待归档区块高度中的一组待归档区块高度。
其中,所述在所述N个待归档区块链上删除所述N组区块数据,包括:在所述第一待归档区块链上删除所述第一组区块数据。
可以看出,上述技术方案中,实现了区块数据的归档,从而为后续删除已归档的区块数据做准备。
参见图4,图4为本申请实施例提供的一种数据归档装置的示意图。其中,如图4所示,本申请实施例提供的一种数据归档装置400包括第一获取模块401、第一确定模块402、第二确定模块403、第二获取模块404、发送模块405和删除模块406,其中,所述第一获取模块401,用于在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;所述第一确定模块402,用于确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;所述第二确定模块403,用于根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;所述第二获取模块404,用于从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应。所述发送模块405,用于向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据;所述删除模块406,用于在所述N个待归档区块链上删除所述N组区块数据。
可以看出,上述技术方案中,通过基于区块链长度,确定区块,为后续高效将区块数据存储至归档地址对应的归档节点做准备。同时,通过删除区块数据,节省了区块链节点的存储空间,减轻了区块链节点的存储压力。
在一种可能的实施方式中,第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,在确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度时,所述第一确定模块402,具体用于确定与所述N个待归档区块链标识一一对应的N个待归档区块链;确定所述N个待归档区块链中每个待归档区块链对应的区块头数量;根据所述N个待归档区块链中每个待归档区块链对应的区块头数量,确定所述N个待归档区块链的长度。
可以看出,上述技术方案中,实现了区块链长度的确定,为后续高效将区块数据存储至归档地址对应的归档节点做准备。
在一种可能的实施方式中,第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,在确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度时,所述第一确定模块402,具体用于确定所述第一待归档区块链标识对应的第一待归档区块链;获取所述第一待归档区块链中起始区块对应的区块高度以及终止区块对应的区块高度;根据所述第一待归档区块链中起始区块对应的区块高度和终止区块对应的区块高度的差值,确定所述第一待归档区块链的长度。
可以看出,上述技术方案中,实现了区块链长度的确定,为后续高效将区块数据存储至归档地址对应的归档节点做准备。
在一种可能的实施方式中,在根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块时,所述第二确定模块402,具体用于从所述N个待归档区块链中,确定第二待归档区块链和第三待归档区块链,所述第二待归档区块链为所述N个待归档区块链中区块链长度最长的区块链,所述第三待归档区块链为所述N个待归档区块链中区块链长度最短的区块链;确定所述第二待归档区块链和所述第三待归档区块链的长度差值;若所述第二待归档区块链和所述第三待归档区块链的长度差值高于预设长度差值,则根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第四待归档区块链为所述N个待归档区块链中除所述第三待归档区块链之外的区块链;若所述第二待归档区块链和所述第三待归档区块链的长度差值低于所述预设长度差值,则根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第五待归档区块链为所述N个待归档区块链中除所述第二待归档区块链之外的区块链。
可以看出,上述技术方案中,通过长度差值,确定区块,实现了快速确定区块,避免了随机确定区块时导致的效率低的问题。
在一种可能的实施方式中,在根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块时,所述第二确定模块403,具体用于按照第一顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,其中,所述第一顺序为所述第三待归档区块链与所述N-1个第四待归档区块链的长度差值从小到大的顺序。
可以看出,上述技术方案中,实现了按照长度差值从小到大的顺序确定区块,实现了快速确定区块,避免了随机确定区块时导致的效率低的问题。
在一种可能的实施方式中,在根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块时,所述第二确定模块403,具体用于按照第二顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述第二顺序为所述第二待归档区块链与所述N-1个第五待归档区块链的长度差值从大到小的顺序。
可以看出,上述技术方案中,实现了按照长度差值从大到小的顺序确定区块,实现了快速确定区块,避免了随机确定区块时导致的效率低的问题。
在一种可能的实施方式中,在向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据时,所述发送模块405,用于向第一归档节点发送第一组区块数据,所述第一归档节点与第一待归档区块链标识对应的归档地址对应,所述第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,所述第一组区块数据是根据所述第一待归档区块链标识对应的第一组待归档区块高度从所述第一待归档区块链标识对应的第一待归档区块链中获取的区块数据,所述第一组待归档区块高度为所述N组待归档区块高度中的一组待归档区块高度。
可以看出,上述技术方案中,实现了区块数据的归档,从而为后续删除已归档的区块数据做准备。
参见图5,图5为本申请的实施例涉及的硬件运行环境的电子设备结构示意图。
本申请实施例提供了一种数据归档的电子设备,包括处理器、存储器、通信接口以及一个或多个程序,其中,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,以执行包括任一项数据归档方法中的步骤的指令。其中,如图5所示,本申请的实施例涉及的硬件运行环境的电子设备可以包括:处理器501,例如CPU。存储器502,可选的,存储器可以为高速RAM存储器,也可以是稳定的存储器,例如磁盘存储器。通信接口503,用于实现处理器501和存储器502之间的连接通信。
本领域技术人员可以理解,图5中示出的电子设备的结构并不构成对其的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图5所示,存储器502中可以包括操作系统、网络通信模块以及一个或多个程序。操作系统是管理和控制服务器硬件和软件资源的程序,支持一个或多个程序的运行。网络通信模块用于实现存储器502内部各组件之间的通信,以及与电子设备内部其他硬件和软件之间通信。
在图5所示的电子设备中,处理器501用于执行存储器502中一个或多个程序,实现以下步骤:在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
本申请涉及的电子设备的具体实施可参见上述数据归档方法的各实施例,在此不做赘述。
本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质用于存储计算机程序,所述存储计算机程序被所述处理器执行,以实现以下步骤:在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
可选的,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。本申请涉及的计算机可读存储介质的具体实施可参见上述数据归档方法的各实施例,在此不做赘述。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应所述知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应所述知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (20)

  1. 一种数据归档方法,包括:
    在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;
    确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;
    根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;
    从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;
    向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
  2. 根据权利要求1所述方法,其中,所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:
    确定与所述N个待归档区块链标识一一对应的N个待归档区块链;
    确定所述N个待归档区块链中每个待归档区块链对应的区块头数量;
    根据所述N个待归档区块链中每个待归档区块链对应的区块头数量,确定所述N个待归档区块链的长度。
  3. 根据权利要求1所述方法,其中,第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:
    确定所述第一待归档区块链标识对应的第一待归档区块链;
    获取所述第一待归档区块链中起始区块对应的区块高度以及终止区块对应的区块高度;
    根据所述第一待归档区块链中起始区块对应的区块高度和终止区块对应的区块高度的差值,确定所述第一待归档区块链的长度。
  4. 根据权利要求1-3任意一项所述方法,其中,所述根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:
    从所述N个待归档区块链中,确定第二待归档区块链和第三待归档区块链,所述第二待归档区块链为所述N个待归档区块链中区块链长度最长的区块链,所述第三待归档区块链为所述N个待归档区块链中区块链长度最短的区块链;
    确定所述第二待归档区块链和所述第三待归档区块链的长度差值;
    若所述第二待归档区块链和所述第三待归档区块链的长度差值高于预设长度差值,则根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第四待归档区块链为所述N个待归档区块链中除所述第三待归档区块链之外的区块链;
    若所述第二待归档区块链和所述第三待归档区块链的长度差值低于所述预设长度差值,则根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第五待归档区块链为所述N个待归档区块链中除所述第二待归档区块链之外的区块链。
  5. 根据权利要求4所述方法,其中,所述根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:
    按照第一顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,其中,所述第一顺序为所述第三待归档区块链与所述N-1个第四待归档区块链的长度差值从小到大的顺序。
  6. 根据权利要求4所述方法,其中,所述根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:
    按照第二顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述第二顺序为所述第二待归档区块链与所述N-1个第五待归档区块链的长度差值从大到小的顺序。
  7. 根据权利要求1-3任意一项所述方法,其中,所述向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,包括:
    向第一归档节点发送第一组区块数据,所述第一归档节点与第一待归档区块链标识对应的归档地址对应,所述第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,所述第一组区块数据是根据所述第一待归档区块链标识对应的第一组待归档区块高度从所述第一待归档区块链标识对应的第一待归档区块链中获取的区块数据,所述第一组待归档区块高度为所述N组待归档区块高度中的一组待归档区块高度。
  8. 一种数据归档装置,其中,所述装置包括第一获取模块、第一确定模块、第二确定模块、第二获取模块、发送模块和删除模块,
    所述第一获取模块,用于在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;
    所述第一确定模块,用于确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;
    所述第二确定模块,用于根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;
    所述第二获取模块,用于从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;
    所述发送模块,用于向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据;
    所述删除模块,用于在所述N个待归档区块链上删除所述N组区块数据。
  9. 一种数据归档的电子设备,包括处理器、存储器、通信接口以及一个或多个程序,其中,所述一个或多个程序被存储在所述存储器中,并且由所述处理器执行以实现数据归档方法,所述数据归档方法包括:
    在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;
    确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;
    根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;
    从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;
    向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
  10. 根据权利要求9所述的电子设备,其中,执行所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:
    确定与所述N个待归档区块链标识一一对应的N个待归档区块链;
    确定所述N个待归档区块链中每个待归档区块链对应的区块头数量;
    根据所述N个待归档区块链中每个待归档区块链对应的区块头数量,确定所述N个待归档区块链的长度。
  11. 根据权利要求9所述的电子设备,其中,第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,执行所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:
    确定所述第一待归档区块链标识对应的第一待归档区块链;
    获取所述第一待归档区块链中起始区块对应的区块高度以及终止区块对应的区块高度;
    根据所述第一待归档区块链中起始区块对应的区块高度和终止区块对应的区块高度的差值,确定所述第一待归档区块链的长度。
  12. 根据权利要求9-11任意一项所述的电子设备,其中,执行所述根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:
    从所述N个待归档区块链中,确定第二待归档区块链和第三待归档区块链,所述第二待归档区块链为所述N个待归档区块链中区块链长度最长的区块链,所述第三待归档区块链为所述N个待归档区块链中区块链长度最短的区块链;
    确定所述第二待归档区块链和所述第三待归档区块链的长度差值;
    若所述第二待归档区块链和所述第三待归档区块链的长度差值高于预设长度差值,则根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第四待归档区块链为所述N个待归档区块链中除所述第三待归档区块链之外的区块链;
    若所述第二待归档区块链和所述第三待归档区块链的长度差值低于所述预设长度差值,则根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第五待归档区块链为所述N个待归档区块链中除所述第二待归档区块链之外的区块链。
  13. 根据权利要求12所述的电子设备,其中,执行所述根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:
    按照第一顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,其中,所述第一顺序为所述第三待归档区块链与所述N-1个第四待归档区块链的长度差值从小到大的顺序;或者,
    按照第二顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述第二顺序为所述第二待归档区块链与所述N-1个第五待归档区块链的长度差值从大到小的顺序。
  14. 根据权利要求9-11任意一项所述的电子设备,其中,执行所述向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,包括:
    向第一归档节点发送第一组区块数据,所述第一归档节点与第一待归档区块链标识对应的归档地址对应,所述第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,所述第一组区块数据是根据所述第一待归档区块链标识对应的第一组待归档区块高度从所述第一待归档区块链标识对应的第一待归档区块链中获取的区块数据,所述第一组待归档区块高度为所述N组待归档区块高度中的一组待归档区块高度。
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质用于存储计算机程序,所述存储计算机程序被所述处理器执行,以实现数据归档方法,所述数据归档方法包括:
    在归档界面上检测到归档操作时,获取N个待归档区块链标识、N组待归档区块高度以及N个归档地址,所述N个待归档区块链标识与所述N组待归档区块高度一一对应,所述N个待归档区块链标识与所述N个归档地址一一对应,所述N为大于1的整数;
    确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度;
    根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块;
    从所述N组区块中获取N组区块数据,所述N组区块与所述N组区块数据一一对应;
    向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,并在所述N个待归档区块链上删除所述N组区块数据。
  16. 根据权利要求15所述的计算机可读存储介质,其中,执行所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:
    确定与所述N个待归档区块链标识一一对应的N个待归档区块链;
    确定所述N个待归档区块链中每个待归档区块链对应的区块头数量;
    根据所述N个待归档区块链中每个待归档区块链对应的区块头数量,确定所述N个待归档区块链的长度。
  17. 根据权利要求15所述的计算机可读存储介质,其中,第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,执行所述确定与所述N个待归档区块链标识一一对应的N个待归档区块链的长度,包括:
    确定所述第一待归档区块链标识对应的第一待归档区块链;
    获取所述第一待归档区块链中起始区块对应的区块高度以及终止区块对应的区块高度;
    根据所述第一待归档区块链中起始区块对应的区块高度和终止区块对应的区块高度的差值,确定所述第一待归档区块链的长度。
  18. 根据权利要求15-17任意一项所述的计算机可读存储介质,其中,执行所述根据所述N个待归档区块链的长度,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:
    从所述N个待归档区块链中,确定第二待归档区块链和第三待归档区块链,所述第二待归档区块链为所述N个待归档区块链中区块链长度最长的区块链,所述第三待归档区块链为所述N个待归档区块链中区块链长度最短的区块链;
    确定所述第二待归档区块链和所述第三待归档区块链的长度差值;
    若所述第二待归档区块链和所述第三待归档区块链的长度差值高于预设长度差值,则根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第四待归档区块链为所述N个待归档区块链中除所述第三待归档区块链之外的区块链;
    若所述第二待归档区块链和所述第三待归档区块链的长度差值低于所述预设长度差值,则根据所述第二待归档区块链与N-1个第五待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述N-1个第五待归档区块链为所述N个待归档区块链中除所述第二待归档区块链之外的区块链。
  19. 根据权利要求18所述的计算机可读存储介质,其中,执行所述根据所述第三待归档区块链与N-1个第四待归档区块链的长度差值,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,包括:
    按照第一顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,其中,所述第一顺序为所述第三待归档区块链与所述N-1个第四待归档区块链的长度差值从小到大的顺序;或者,
    按照第二顺序,从所述N个待归档区块链中确定与所述N组待归档区块高度一一对应的N组区块,所述第二顺序为所述第二待归档区块链与所述N-1个第五待归档区块链的长度差值从大到小的顺序。
  20. 根据权利要求15-17任意一项所述的计算机可读存储介质,其中,执行所述向与所述N个归档地址一一对应的N个归档节点发送所述N组区块数据,包括:
    向第一归档节点发送第一组区块数据,所述第一归档节点与第一待归档区块链标识对应的归档地址对应,所述第一待归档区块链标识为所述N个待归档区块链标识中的任意一个待归档区块链标识,所述第一组区块数据是根据所述第一待归档区块链标识对应的第一组待归档区块高度从所述第一待归档区块链标识对应的第一待归档区块链中获取的区块数据,所述第一组待归档区块高度为所述N组待归档区块高度中的一组待归档区块高度。
PCT/CN2021/109269 2020-09-03 2021-07-29 一种数据归档方法、装置、电子设备和存储介质 WO2022048359A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010918632.1A CN111984735A (zh) 2020-09-03 2020-09-03 一种数据归档方法、装置、电子设备和存储介质
CN202010918632.1 2020-09-03

Publications (1)

Publication Number Publication Date
WO2022048359A1 true WO2022048359A1 (zh) 2022-03-10

Family

ID=73447440

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/109269 WO2022048359A1 (zh) 2020-09-03 2021-07-29 一种数据归档方法、装置、电子设备和存储介质

Country Status (2)

Country Link
CN (1) CN111984735A (zh)
WO (1) WO2022048359A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984735A (zh) * 2020-09-03 2020-11-24 深圳壹账通智能科技有限公司 一种数据归档方法、装置、电子设备和存储介质
CN112559533B (zh) * 2020-12-23 2023-06-16 杭州趣链科技有限公司 连续型数据库的归档方法、装置及电子设备
CN112291376B (zh) * 2020-12-31 2021-04-09 腾讯科技(深圳)有限公司 区块链系统中的数据处理方法及相关设备
CN113220665B (zh) * 2021-05-20 2023-10-20 成都质数斯达克科技有限公司 一种区块链数据归档方法、装置、电子设备及可读存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108596767A (zh) * 2018-05-09 2018-09-28 中国工商银行股份有限公司 区块链历史数据清理方法及装置
CN109298835A (zh) * 2018-08-16 2019-02-01 北京京东尚科信息技术有限公司 区块链的数据归档处理方法、装置、设备及存储介质
CN110442644A (zh) * 2019-07-08 2019-11-12 深圳壹账通智能科技有限公司 区块链数据归档存储方法、装置、计算机设备和存储介质
CN110597887A (zh) * 2019-09-27 2019-12-20 腾讯科技(深圳)有限公司 一种基于区块链网络的数据管理方法、装置及存储介质
CN111382119A (zh) * 2018-12-29 2020-07-07 华为技术有限公司 区块数据归档方法及相关设备
CN111984735A (zh) * 2020-09-03 2020-11-24 深圳壹账通智能科技有限公司 一种数据归档方法、装置、电子设备和存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102417067B1 (ko) * 2017-12-08 2022-07-05 한국전자통신연구원 블록 체인 네트워크의 노드에서 수행되는 블록 생성 방법 및 장치
CN109271446B (zh) * 2018-08-30 2020-10-23 杭州复杂美科技有限公司 一种平行链数据同步方法、设备和存储介质
CN109902091B (zh) * 2019-02-21 2021-08-10 腾讯科技(深圳)有限公司 数据区块在区块链上记录的方法、领导记账节点和介质
WO2020035088A2 (en) * 2019-11-06 2020-02-20 Alipay (Hangzhou) Information Technology Co., Ltd. Prioritizing shared blockchain data storage
CN111309808A (zh) * 2020-02-18 2020-06-19 腾讯科技(深圳)有限公司 去中心化应用的页面访问方法、装置、设备以及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108596767A (zh) * 2018-05-09 2018-09-28 中国工商银行股份有限公司 区块链历史数据清理方法及装置
CN109298835A (zh) * 2018-08-16 2019-02-01 北京京东尚科信息技术有限公司 区块链的数据归档处理方法、装置、设备及存储介质
CN111382119A (zh) * 2018-12-29 2020-07-07 华为技术有限公司 区块数据归档方法及相关设备
CN110442644A (zh) * 2019-07-08 2019-11-12 深圳壹账通智能科技有限公司 区块链数据归档存储方法、装置、计算机设备和存储介质
CN110597887A (zh) * 2019-09-27 2019-12-20 腾讯科技(深圳)有限公司 一种基于区块链网络的数据管理方法、装置及存储介质
CN111984735A (zh) * 2020-09-03 2020-11-24 深圳壹账通智能科技有限公司 一种数据归档方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
CN111984735A (zh) 2020-11-24

Similar Documents

Publication Publication Date Title
WO2022048359A1 (zh) 一种数据归档方法、装置、电子设备和存储介质
JP7417677B2 (ja) ファイル共有のための技術
JP7184959B2 (ja) ネットワーク内の分散データベースのための方法及び装置
US11797502B2 (en) Methods and apparatus for a distributed database within a network
US11232081B2 (en) Methods and apparatus for a distributed database within a network
CN109034809B (zh) 区块链的生成方法、装置、区块链节点及存储介质
KR102454779B1 (ko) 이벤트들의 삭제를 가능하게 하는 분산 데이터베이스를 위한 방법 및 장치
US20210243007A1 (en) Maintaining blocks of a blockchain in a partitioned blockchain network
US11487772B2 (en) Multi-party data joint query method, device, server and storage medium
CN113711536A (zh) 从区块链网络中提取数据
JP7328237B2 (ja) コンピュータにより実施される投票処理およびシステム
CN107733972A (zh) 一种短链接解析方法、装置及设备
CA3068345C (en) Witness blocks in blockchain applications
CN113157648A (zh) 基于区块链的分布式数据存储方法、装置、节点及系统
JP2023544422A (ja) ネットワーク内の分散データベースのための方法及び装置
Heo et al. Blockchain data storage optimisations: a comprehensive survey
CN116915467A (zh) 基于区块链的数据安全共享系统及方法
JP2024505105A (ja) データベースクエリ結果を検証するための方法及びそのデバイス
CN115098893A (zh) 基于区块链的数据存储方法及装置
CN114610803A (zh) 一种数据处理方法、装置、电子设备和存储介质
CN114519191A (zh) 医疗数据管理方法及装置
CN114490704A (zh) 数据处理方法、装置、设备及存储介质
Zichichi et al. Are distributed ledger technologies ready for smart transportation systems?
CN113821425B (zh) 信任风险事件的追踪方法、装置、电子设备和存储介质
EP4064065A1 (en) Data retention in a decentralized distributed database

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: 21863427

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

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

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 130/06/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21863427

Country of ref document: EP

Kind code of ref document: A1