WO2019024780A1 - 区块链轻量化处理方法、区块链节点及存储介质 - Google Patents

区块链轻量化处理方法、区块链节点及存储介质 Download PDF

Info

Publication number
WO2019024780A1
WO2019024780A1 PCT/CN2018/097415 CN2018097415W WO2019024780A1 WO 2019024780 A1 WO2019024780 A1 WO 2019024780A1 CN 2018097415 W CN2018097415 W CN 2018097415W WO 2019024780 A1 WO2019024780 A1 WO 2019024780A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
chain
parameter
blocks
deleted
Prior art date
Application number
PCT/CN2018/097415
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 WO2019024780A1 publication Critical patent/WO2019024780A1/zh

Links

Images

Classifications

    • 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
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • 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
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • 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
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]
    • G06Q30/0609Buyer or seller confidence or verification
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0823Network architectures or network communication protocols for network security for authentication of entities using certificates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • H04L67/5681Pre-fetching or pre-delivering data based on network characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • H04L67/5682Policies or rules for updating, deleting or replacing the stored data
    • 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/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • 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/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions

Definitions

  • the present disclosure relates to the field of information technology, and in particular, to a blockchain lightweight processing method, a blockchain node, and a computer storage medium.
  • the blockchain technology that has emerged in recent years is a chained data structure in which data blocks are sequentially connected in a chronological order, and cryptographically guaranteed non-tamperable and unforgeable distributed ledgers.
  • the core technology of blockchain is to use blockchain data structure to verify and store data, use distributed node consensus algorithm to generate and update data, and use cryptography to ensure data transmission and access security.
  • a big problem with blockchains is that they contain all the historical transactions. As the volume of transactions increases, the blocks in the blockchain will also increase, and the data of the entire blockchain will become larger and larger. The demand for storage and computing resources will increase.
  • embodiments of the present disclosure are expected to provide a blockchain lightweight processing method, a blockchain node, and a computer storage medium, at least partially solving the problem of large resource consumption such as storage resources in the blockchain technology.
  • a first aspect of the embodiments of the present disclosure provides a blockchain lightweight processing method, which is applied to a first blockchain node, and includes:
  • the method further includes:
  • Generating a parameter block based on the N blocks to be deleted that are continuously distributed in the transaction chain including:
  • a parameter block is generated based on the N blocks.
  • the parameter block includes at least: a head pointer and a tail pointer;
  • the head pointer points to a previous one of the N blocks deleted in the transaction chain
  • the tail pointer points to the next one of the N blocks deleted in the transaction chain.
  • the head pointer includes: a hash value of a previous one of the N blocks deleted in the transaction chain;
  • the tail pointer includes: a hash value of a subsequent block of the N regions deleted in the transaction chain.
  • the generating the parameter block based on the N blocks to be deleted that are continuously distributed in the transaction chain including:
  • the method further includes:
  • the parameter block is updated according to the block parameter of the newly added block; wherein the updated parameter block is linked to the a subsequent block of the block in the transaction chain that satisfies the preset deletion condition;
  • a second aspect of the embodiments of the present disclosure provides a blockchain lightweight processing method, which is applied to a second blockchain node, and includes:
  • a block chain node is a block chain node that stores a transaction chain corresponding to the optimization chain; the obtaining request is used to acquire N blocks that have been deleted and continuously distributed in the optimization chain, where the N is positive Integer
  • the optimized block is stored to form the optimized chain.
  • the first blockchain node when the first blockchain node returns an optimized chain based on the replication request, sending, according to the parameter block in the optimization chain, the optimization to the third blockchain node.
  • the request for obtaining the block parameters of the N blocks deleted in the chain includes:
  • the parameter block Determining, according to the parameter block, a first hash value and a second hash value, wherein the first hash value is: a dispersion of the first block of the N consecutive blocks that have been deleted a column value, the second hash value is: a hash value of the last block of the N consecutive blocks that have been deleted; wherein the block parameter includes at least: N consecutively deleted a hash value of the second block to the N-1th block in the block; the parameter block further includes: a check value;
  • the verifying, by the block parameter, the parameter block in the optimization chain including:
  • the third embodiment of the present disclosure provides a blockchain node, where the blockchain node is a first blockchain node, including:
  • a generating unit configured to generate a parameter block based on the N blocks to be deleted that are continuously distributed in the transaction chain, where the N is a positive integer;
  • a deleting unit configured to delete the N blocks in the transaction chain
  • a first storage unit configured to store the parameter block, wherein the parameter block and the unremoved block in the transaction chain form an optimization chain, wherein the parent block of the parameter block is: The previous block of the N blocks deleted in the transaction chain, and the sub-area of the parameter block is: the latter area of the N blocks deleted in the transaction chain.
  • a fourth aspect of the embodiments of the present disclosure provides a blockchain node, where the blockchain node is a second blockchain node, including:
  • a sending unit configured to send a copy request of the blockchain to the first blockchain node; when the first blockchain node returns an optimized chain based on the copy request, based on the parameter region in the optimized chain a block, sending an acquisition request to the third blockchain node, wherein the third blockchain node is a blockchain node that completes a transaction chain corresponding to the optimized chain; the obtaining request is used to acquire Deleting and continuously distributing N blocks in the optimization chain, where N is a positive integer;
  • a receiving unit configured to receive a block parameter returned by the third blockchain node
  • a verification unit configured to verify a parameter block in the optimization chain based on the block parameter
  • a second storage unit configured to: when the parameter block passes the verification, store the optimized block to form the optimized chain.
  • a fifth aspect of an embodiment of the present disclosure provides a blockchain node, including: a transceiver, a memory, a processor, and a computer program stored on the memory and processed by the processor;
  • the processor is respectively connected to the transceiver and the memory, for controlling information exchange of the transceiver, storing information of the memory by executing the computer program, and performing any one or more of the foregoing technologies
  • the blockchain lightweight processing method provided by the scheme.
  • a fifth aspect of the embodiments of the present disclosure provides a computer storage medium, wherein the computer storage medium stores a computer program, and after the computer program is executed, can implement a blockchain provided by any one or more of the foregoing technical solutions. Lightweight processing method.
  • the blockchain lightweight processing method, the blockchain node, and the computer storage medium provided by the embodiments of the present disclosure generate a parameter block based on the block parameter of the block to be deleted, in order to reduce the data amount of the blockchain.
  • the parameter block can link the previous block and the next block of the deleted block to form an optimized optimization chain.
  • the number of blocks in the optimization chain is smaller than the number of blocks in the transaction chain that retains the complete block
  • the data volume of the parameter block is usually smaller than the data volume of the block including the transaction information in one transaction chain, thereby optimizing the chain as a whole.
  • the amount of data is far less than the volume of transactions.
  • the blockchain node only stores the optimized chain, it is obvious that the storage resources consumed by the blockchain storage can be reduced, and the computing resources consumed by the subsequent query operations are facilitated, thereby saving the subsequent operations such as the query operation of the blockchain of the query.
  • the computing resources consumed Therefore, the problem of large resource consumption such as storage resources in the blockchain technology in the related art is solved.
  • 1 is a schematic structural view of a blockchain
  • FIG. 3 is a schematic flowchart of a first blockchain lightweighting process according to an embodiment of the present disclosure
  • FIG. 4 is a schematic flowchart of a second blockchain lightweighting process according to an embodiment of the present disclosure
  • FIG. 5 is a schematic structural diagram of a transaction chain according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of an optimization chain formed after the optimization of the transaction chain shown in FIG. 5;
  • FIG. 7 is a schematic flowchart of a third blockchain lightweighting process according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of an optimization chain re-optimized on the basis of the optimization chain shown in FIG. 6;
  • FIG. 9 is a schematic flowchart of a fourth blockchain lightening process according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram of a first blockchain node according to an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of a second blockchain node according to an embodiment of the present disclosure.
  • FIG. 12 is a schematic structural diagram of a blockchain node according to an embodiment of the present disclosure.
  • blocks are sequentially generated in chronological order and connected into chains, and each block records transaction information generated during creation, and is obtained based on each block chain node in the blockchain network.
  • a recognized transaction of the consensus mechanism will be permanently stored in the blockchain.
  • the data structure of the block is generally divided into a block header and a block body.
  • the block header of each block contains the hash value of the previous block (ie, the parent block), thereby forming a chain from the creation block to the current block, and determining each area. The location of the block in the entire blockchain.
  • the block header of the latter block includes the hash value stored in the block header of the previous block.
  • the blockchain uses the Merkle tree to summarize all the transactions in a block, and the Merkle root is a summary of all transactions, any transaction information in the block. Changes will change the Merkle root.
  • the block body contains the verified transaction information generated during the block creation process.
  • the block header of the block k includes the hash value in the block header of the block k-1; and the block header of each block further includes information such as a random number, a time stamp of the generation time, and the like.
  • a block may record multiple transaction information, and the timestamp here may also be the transaction timestamp for each transaction.
  • the embodiment of the present disclosure provides a blockchain lightweight processing method, which is applied to a first blockchain node, as shown in FIG. 3, and includes:
  • Step S110 Generate a parameter block based on the N blocks to be deleted that are continuously distributed in the transaction chain, where the N is a positive integer;
  • Step S120 deleting the N blocks in the transaction chain
  • Step S130 The parameter block is stored, wherein the parameter block and the undeleted block in the transaction chain form an optimization chain, wherein the parent block of the parameter block is: the transaction chain The previous block of the N blocks deleted, the sub-area of the parameter block is: the latter area of the N blocks deleted in the transaction chain.
  • the blockchain lightweight processing method provided in this embodiment is essentially a method for reducing the data amount of the blockchain, so that the blockchain exhibits a lightweight feature in the amount of data.
  • the first blockchain node in this embodiment may be any one of the billing nodes in the blockchain network.
  • the accounting node deletes the original blockchain composed of the blocks (ie, the transaction chain) in order to save the data storage capacity of the local storage blockchain and the computing resources for maintaining the data storage.
  • the N blocks that are continuously distributed in this embodiment are preferably a plurality of blocks that are continuously distributed, so that the generation of parameter blocks can be minimized and the amount of data of the optimized chain can be reduced.
  • This parameter block can replace the deleted multiple blocks and link the undeleted blocks in the transaction chain to form data.
  • the amount is much smaller than the optimized chain of the original trading chain. In this case, the chain structure of the blockchain is still completely preserved.
  • the first blockchain node can only store the optimized chain by deleting the corresponding block, thereby reducing the occupation of the storage resources of the blockchain and reducing the consumption of system resources required for maintaining the blockchain.
  • the method further includes:
  • Step S100 determining whether the N blocks that are continuously distributed in the transaction chain meet the preset deletion condition
  • the step S110 may specifically include step S111; the step S111 may include:
  • a parameter block is generated based on the N blocks.
  • the step S100 may include:
  • the block body of each block in the transaction chain stores the certificate information allocated to the corresponding user, and the certificate information has a time-effectiveness.
  • the certificate information has exceeded the validity period, the immediate effect has been lost.
  • the certificate information stored in the block of the block is considered invalid.
  • the block can be deleted. Then, the information state of the block can be considered to satisfy the preset storage condition.
  • the certificate information here may be one of the aforementioned transaction information.
  • the certificate information here may include: an authorization certificate and user information of an authorization certificate.
  • the step S100 may include:
  • the corresponding block may be considered as a block that satisfies the preset deletion condition.
  • the probability that the corresponding transaction information in the block can be subsequently queried is almost zero, or is less than the preset probability.
  • a block that is generated for more than one time threshold is generated.
  • the time threshold may be 1 year, 2 years or 5 years, and the like.
  • the step S100 may include:
  • the corresponding block is considered to be the block to be deleted that meets the preset deletion condition.
  • a historical block in the transaction chain is separated from the current latest block by a predetermined number of blocks.
  • the transaction chain A currently includes 53,000 blocks, and if the predetermined number is 10,000, then The blocks before the 43,000th block (except the creation block) are all blocks that can be deleted.
  • the block that can be deleted in this embodiment does not include the creation block in the transaction chain, where the creation block is the first block of the transaction chain.
  • the deletion of the valid information caused by deleting the block is avoided, and only the block in the transaction chain or in the optimized chain that meets the preset deletion condition is deleted, so as to ensure that the optimized block after the corresponding block is deleted. It can meet the requirements of subsequent information query and/or verification, and reduce the storage resources and computing resources occupied by the data amount as much as possible to meet the needs of information query.
  • step S100 it is equivalent to deleting only the block that meets the preset deletion condition in the first blockchain node, and in some cases, the first blockchain node may be based on its own The storage condition of the storage resource, etc., selectively uses the storage of the discarded partial blocks of the above technical solution without determining which blocks satisfy the preset deletion condition.
  • the current storage resource usage rate of the blockchain node A is higher than the maximum usage threshold.
  • some storage resources must be released. Then, according to a random algorithm or the like, the block in one or more transaction chains is set as the block to be deleted, and part of the storage resource is released through the deletion of the block and the storage of the optimized chain.
  • the parameter block includes at least: a head pointer and a tail pointer;
  • the head pointer points to a previous one of the N blocks deleted in the transaction chain
  • the tail pointer points to the next one of the N blocks deleted in the transaction chain.
  • the deleted N blocks are the i-th block to the j-th block, and the head pointer points to the i-1th block in the transaction chain, and the j+1 is pointed to by the tail pointer.
  • the head pointer and the tail pointer may be block identifiers for executing corresponding blocks, and/or a storage address or the like may uniquely identify the block or the location of the block in the link chain.
  • the blockchain may include: a transaction chain that completely includes all the blocks, and may also include an optimized chain that introduces the parameter blocks.
  • Figure 5 is a schematic diagram of the structure of a complete transaction chain.
  • the head pointer includes: a hash value of a previous one of the N blocks deleted in the transaction chain; the tail pointer includes: a latter one of the N areas deleted in the transaction chain The hash value of the block.
  • FIG. 6 is a schematic structural diagram of an optimization chain in which a plurality of consecutively distributed blocks in the transaction chain shown in FIG. 5 are deleted and a parameter block is introduced.
  • the head pointer may be a hash value of the i-1th block
  • the tail pointer is a hash value of the j+1th block.
  • the head pointer of the parameter block is hi-1; wherein hi-1 is the hash value of the block header of block i-1; the tail pointer of the parameter block is hj+1; +1 may be the hash value of the block header of block j+1.
  • a hash value is a chain in a blockchain that links two adjacent blocks.
  • the hash value of a sub-block is generated based on the hash value of the parent block, and is one of the information that can uniquely identify the location of the block in a transaction chain.
  • step S110 may include:
  • a preset function such as a hash function may be utilized to calculate the check value based on the hash value of each block.
  • the hash value of the first block to be deleted and the hash value of the second block to be deleted may be logically operated according to the distribution order of the N blocks in the transaction chain.
  • the hash value of the i-th block to be deleted is logically operated with the i+1th hash value to be deleted, and after the N-1 logical operations are completed, the result of the logical operation is taken as the preset function.
  • the dependent variable can obtain the function value of the preset function, and the function value can be used as the check value and stored in the parameter block as part of the parameter block.
  • the logical operation can: convert the corresponding hash value into a binary code, perform an AND operation or an operation between the binary, or a plurality of different types of operation results of various logical operations such as AND, NAND, and the like.
  • various logical operations such as AND, NAND, and the like.
  • the above is only a way of calculating the check value, and other operations may be included in the specific implementation process.
  • the corresponding hash value is sequentially input as a dependent variable to the preset function to calculate the function value, and the function value of the previous calculation and the function value of the latter calculation are again subjected to a function operation.
  • the corresponding check value is executed cyclically until all the hash values of the block to be deleted participate in the calculation, so that the corresponding check value is also obtained.
  • the check value when the corresponding optimization chain is copied to other blockchain nodes, it is convenient for other blockchain nodes to check the parameter block, and the optimized chain storage information caused by the tampering of the parameter block is reduced. Wrong question. For example, by tampering with the head pointer or the tail pointer of the parameter block, the parameter block can be linked into the forged blockchain, and the occurrence of this phenomenon can be avoided or reduced by the introduction of the check value.
  • the method shown in FIG. 7 further includes:
  • Step S140 When there is a block in the optimization chain that satisfies the preset deletion condition, the parameter block is updated according to the block parameter of the newly added block to be deleted; wherein the updated parameter block is updated. Linking to the next block of the block in the transaction chain that satisfies the preset deletion condition;
  • Step S150 Delete the newly added block to be deleted.
  • FIG. 8 is a schematic structural diagram of a re-optimization chain formed after the newly added block to be deleted is deleted again based on the optimization chain shown in FIG. 6. Obviously, in Figure 8, the tail pointer of the parameter block is changed from hj+1 to hj+2; thus the block pointed to by the tail of the parameter block is block j+2.
  • the step S140 may include:
  • the step S140 may further include:
  • the optimization chain can be re-optimized by updating part of the information in the parameter block, and a re-optimization chain with a further optimization effect can be generated.
  • the parameter block corresponding to one optimization chain may include only one.
  • the parameter block may include multiple, but multiple parameter blocks are not adjacently distributed in the optimization chain. If two parameter blocks are adjacently distributed, a parameter block can be generated based on the combination of the first and last pointers in the two parameter blocks, and the parameter block is simplified as much as possible.
  • the method further includes: in order to distinguish the parameter block in the optimization chain from the other block in which the actual transaction information is stored, the type tag of the parameter block is also set in the parameter block, and the subsequent information is During the query or copy process, different blocks in the blockchain can be distinguished by a quick comparison of the type tags of the blocks.
  • the optimization chain may also be separately stored by different types of blocks, facilitating the type distinction of subsequent blocks, and different processing of different types of blocks.
  • the embodiment further provides a blockchain lightweight processing method, which is applied to a second blockchain node, and includes:
  • Step S210 Send a copy request of the blockchain to the first blockchain node
  • Step S220 When the first blockchain node returns an optimization chain based on the copy request, sending an acquisition request to the third blockchain node based on the parameter block in the optimization chain, where a third block chain node is a block chain node that stores a transaction chain corresponding to the optimized chain; the obtaining request is used to acquire N blocks that have been deleted and continuously distributed in the optimization chain, N is a positive integer;
  • Step S230 Receive a block parameter returned by the third blockchain node.
  • Step S240 Verify parameter blocks in the optimization chain based on the block parameters.
  • Step S250 When the parameter block passes the verification, the optimized block is stored to form the optimized chain.
  • a blockchain network there are a plurality of distributed blockchain nodes, which may duplicate the stored blockchains between the nodes.
  • the optimization chain generation is locally generated in a blockchain node. If other blockchain nodes copy their stored optimization chains, in order to ensure the authenticity and reliability of the optimized chain, other Blockchain nodes may need to verify the optimized chain of copies.
  • block chain nodes are collectively referred to as a second block chain node that distinguishes the first block chain node forming the optimized chain.
  • the second blockchain node sends a copy request to the first blockchain node. After the first blockchain node receives the copy request, since the partial block is deleted before, the local storage of the first block chain node is only an optimization chain, not a complete transaction chain, so the first block chain node The optimization chain is sent to the second blockchain node.
  • the second blockchain node After receiving the optimization chain, the second blockchain node can find the currently received optimization chain instead of the complete transaction chain by type identification and statistics of the number of blocks.
  • the second blockchain node also stores the blockchain with as few storage resources as possible, that is, only wants to store the optimized chain, and then requests the third blockchain node that stores the complete transaction chain to request the missing in the optimized chain. Block information for the block.
  • the first blockchain node and the second blockchain node may both be client nodes, and the third blockchain node may be a server node.
  • a server node must store a complete transaction chain for at least a period of time. Therefore, the acquisition request can be sent to the server node in step S220.
  • At least a predetermined number of server nodes storing a complete transaction chain are included in a blockchain node system. The predetermined number here can be only one. Of course, this is only an example.
  • the server node may also delete the corresponding block, store only the hash value of the corresponding block, and the like for the subsequent optimization chain.
  • the verified information, or even the information used for verification is not stored, and only the verification-free indication corresponding to the block deletion is sent to the entire system, and the optimized chain replication between the subsequent blockchain nodes corresponds to Partially exempt from verification.
  • the third blockchain node After transmitting the acquisition request, the third blockchain node returns corresponding block information for the second blockchain node to check the parameter block.
  • the verification of the parameter block includes at least: checking the tail pointer in the parameter block, and of course including: checking the head pointer.
  • the verification can ensure that the optimized chain currently copied from the first blockchain node is trusted, ensuring the authenticity and credibility of the blockchain information.
  • step S220 may include:
  • the first hash value is: a dispersion of the first block of the N consecutive blocks that have been deleted a column value
  • the second hash value is: a hash value of the last block of the N consecutive blocks that have been deleted
  • the block parameter includes at least: a hash value of the second block to the N-1th block among the N blocks that are continuously distributed.
  • the hash value is mainly used as the head pointer and the tail pointer in the parameter block. Therefore, in the embodiment, when the acquisition request is sent to the third block chain node, the parameter block may be used as the parameter block.
  • the first hash value of the head pointer and the second hash value as the tail pointer are carried in the acquisition request.
  • the query transaction chain or the query still includes the optimization chain of the corresponding block, and obtains the i-th block corresponding to the first hash value and the first block. a hash value of the i+1th to j-1th blocks between the jth blocks corresponding to the two hash values, and returning the hash values as the request response of the fetch request to the second block Chain node.
  • the second block chain node After receiving the hash values, the second block chain node performs function calculation and obtains a function based on the pre-negotiated preset function or a function defined by the consensus mechanism, using the hash values as at least one of the dependent variables. value.
  • the function value is compared with the check value carried in the corresponding parameter block, and the parameter block is verified.
  • the step S240 may include:
  • the authenticity and reliability of the information in the parameter block can be ensured, thereby ensuring the reliability and authenticity of the currently received optimization chain.
  • the second block chain node stores the optimized chain from the beginning, which greatly reduces various resources such as storage resources consumed by the blockchain, and facilitates accounting processing of blockchain nodes with less storage resources.
  • the embodiment of the present disclosure further provides a blockchain weighting processing method applied to a third blockchain node, including:
  • the block parameter may include a hash value or other block identification of the deleted block in the optimization chain.
  • the obtaining request may carry a first hash value of the first deleted block of the N blocks deleted in the optimization chain, and a second hash value of the last block of the deleted N blocks.
  • the embodiment provides a blockchain node, where the blockchain node is a first blockchain node, and includes:
  • the generating unit 110 is configured to generate a parameter block based on the N blocks to be deleted that are continuously distributed in the transaction chain, where the N is a positive integer;
  • a deleting unit 120 configured to delete the N blocks in the transaction chain
  • a first storage unit 130 configured to store the parameter block, where the parameter block and the undeleted block in the transaction chain form an optimization chain, wherein a parent block of the parameter block is The previous block of the N blocks deleted in the transaction chain, and the sub-area of the parameter block is: the latter area of the N blocks deleted in the transaction chain.
  • a schematic structural diagram of a blockchain node provided by this embodiment.
  • Both the generating unit 110 and the deleting unit 120 may correspond to a connection structure of a processor and a memory of a physical node where the block chain node is located.
  • the memory can be used to store various information; the processor is connected to the memory based on a bus interface such as an integrated circuit bus, and the execution of the executable code by a computer program can optimize the transaction chain and generate less data. Optimization chain.
  • the processor may be a central processing unit (CPU), a microprocessor (MCU), a digital signal processor (DSP), an application processor (AP), a programmable array (PLC), or an application specific integrated circuit (ASIC).
  • CPU central processing unit
  • MCU microprocessor
  • DSP digital signal processor
  • AP application processor
  • PLC programmable array
  • ASIC application specific integrated circuit
  • the first storage unit 130 may correspond to a storage medium and may be used for storage of the parameter block.
  • the first blockchain node deletes some blocks that can be deleted in the blockchain.
  • corresponding parameter blocks are generated to form an optimized blockchain.
  • the optimized optimization chain includes fewer blocks than the block tree included in the complete transaction chain.
  • the data volume of the parameter block is generally less than the data volume of the block including transaction information in one transaction volume, so the overall optimization is performed.
  • the amount of data in the chain is much smaller than the data chain of the transaction chain. In this way, if only the optimization chain is stored, the storage resource is obviously saved compared with the storage transaction chain, and the computing resources of subsequent queries are saved. For example, the information stored in the normally deleted block is invalid or the frequency of the accessed is very low.
  • a query request is received, if the transaction chain is queried based on the hash value, if the transaction chain includes M blocks, then It may be necessary to compare the hash values of the M blocks, and the optimization chain only includes MN blocks, and the maximum number of matches in the query process is MN times, which obviously saves the number of query matching.
  • the first blockchain node further includes:
  • a determining unit configured to determine whether the N blocks that are continuously distributed in the transaction chain meet the preset deletion condition
  • the generating unit 110 is specifically configured to generate a parameter block based on the N blocks if the preset deletion condition is met.
  • the judging unit here may also correspond to a processor or a processing circuit.
  • the first storage unit 130 is specifically configured to use a head pointer included in the parameter block to point to a previous one of the N blocks deleted in the transaction chain;
  • the included tail pointer points to the next block in the N blocks deleted in the transaction chain.
  • the head pointer includes: a hash value of a previous one of the N blocks deleted in the transaction chain; the tail pointer includes: a latter area of the N areas deleted in the transaction chain The hash value of the block.
  • the generating unit 110 is specifically configured to calculate a check value by using a hash value of the N blocks to be deleted, where the parameter block further includes the check value, a check value, configured to be used by the second block chain node to verify the optimized chain when the optimized chain is sent to the second block chain node.
  • the first block connection node further includes:
  • an update unit configured to update the parameter block according to the block parameter of the newly added block when the block to be deleted is newly added in the optimization chain; wherein the updated parameter block, Linking to the next block of the block in the transaction chain that satisfies the preset deletion condition;
  • the deleting unit is further configured to delete the newly added block to be deleted.
  • the deletion unit here can also correspond to a processor or a processing circuit.
  • the embodiment further provides a blockchain node, where the blockchain node is a second blockchain node, including:
  • the sending unit 210 is configured to send a copy request of the blockchain to the first blockchain node; when the first blockchain node returns an optimized chain based on the copy request, based on parameters in the optimized chain a block, sending an acquisition request to the third blockchain node, wherein the third blockchain node is a blockchain node that stores a transaction chain corresponding to the optimized chain; the obtaining request is used to obtain N blocks that have been deleted and continuously distributed in the optimization chain, and the N is a positive integer;
  • the receiving unit 220 is configured to receive a block parameter returned by the third blockchain node
  • the verification unit 230 is configured to verify the parameter block in the optimization chain based on the block parameter
  • the second storage unit 240 is configured to store the optimized block to form the optimized chain when the parameter block passes the verification.
  • a second blockchain node is provided in this embodiment.
  • the blockchain node includes: a sending unit 210 and a receiving unit 220, which may correspond to a network interface of a physical node where the blockchain node is located.
  • the network interface can be a cable interface, a fiber optic cable interface, and/or a transceiver antenna.
  • the physical node may be various communication devices, such as a personal communication device such as a web server, a mobile phone, or a desktop computer.
  • the verification unit 230 may correspond to a processor; a related description of the processor may refer to the foregoing embodiment, and is not repeated here.
  • the second storage unit 240 may correspond to a local storage medium of the second blockchain node, and the storage medium is preferably a non-transitory storage medium, which can be used for a non-instantaneous storage optimization chain, and reduces the stored resources through optimization of the transaction chain. Consumption, the consumption of computing resources for subsequent operations.
  • the second blockchain node may include a determining unit that may also correspond to the processor; the determining unit may be configured to determine the first hash value and the second hash based on the parameter block a column value, wherein the first hash value is: a hash value of the first block of the successive N blocks that have been deleted, and the second hash value is: the deleted consecutive respectively The hash value of the last block in the N blocks; wherein the block parameter includes at least: the second block to the N-1th block of the N blocks that have been continuously distributed are deleted Column value; the parameter block further includes: a check value.
  • the sending unit 210 is configured to send, to the third blockchain node, an acquisition request that carries the first hash value and the second hash value;
  • the verification unit 230 is specifically configured to generate a function value by using a preset function based on the hash value of the deleted N blocks that are continuously distributed; and matching the generated function value with the check value; If the matches are consistent, it is determined that the parameter block passes the verification.
  • the second blockchain node may directly copy or copy the optimized chain from other blockchain nodes to reduce the storage resources consumed by the blockchain storage, or the computing resources consumed by subsequent operations.
  • the embodiment further provides a blockchain node, including: a transceiver 310, a memory 320, a processor 330, and a computer program stored on the memory 320 and processed by the processor 330;
  • the processor 330 is connected to the transceiver 310 and the memory 320, respectively, for controlling the information interaction of the transceiver 310 and the information storage of the memory 320 by executing the computer program, and the foregoing one or A blockchain lightweight processing method provided by a plurality of technical solutions.
  • the processor 330 can implement the blockchain lightening processing method shown in FIG. 3, FIG. 4, FIG. 7, and/or FIG. 9 by execution of a computer program.
  • the blockchain node provided in this embodiment may be various blockchain nodes such as a first blockchain node, a second blockchain node, and a third blockchain node.
  • the processor 330 can be coupled to the transceiver 310 and the memory 320 via an integrated circuit (IIC) bus.
  • IIC integrated circuit
  • the transceiver 310 can include various communication interfaces to which physical nodes are connected to the network, such as cable interfaces, fiber optic cable interfaces, and transceiver antennas.
  • the embodiment of the present disclosure further provides a computer storage medium, where the computer storage medium stores a computer program, and after the computer program is executed, the blockchain lightweight processing method provided by one or more of the foregoing technical solutions can be implemented, for example, The blockchain weighting processing method shown in FIG. 3, FIG. 4, FIG. 7, and/or FIG. 9 can be implemented.
  • the computer storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. Medium.
  • the computer storage medium can be a non-transitory storage medium.
  • the method is applicable to a scenario in which a large number of blocks can be deleted, and the local node needs to record a plurality of group parameters, and each group of parameters corresponds to a group of consecutive deletable blocks.
  • Each set of parameters consists of the following:
  • Header Pointer Records the parent block header hash value of the first block in a consecutive set of deletable blocks.
  • Tail pointer Records the sub-block header hash value of the last block in a consecutive set of deletable blocks.
  • Check value Calculate the hash value of all block headers in a group of consecutive deletable blocks, and save the operation result as a check value.
  • the calculation method is shown in the following example.
  • the hash value of the block header of block k is recorded as hk. If block i to block j needs to be deleted, the node needs to calculate the following parameters:
  • the node can delete block i, block j, and all blocks between the two, and use the above parameters to connect block i-1 with block j+1, as shown in FIG. 6.
  • the block identified by the tail pointer (block j+1) can also be deleted, it can be further optimized on the basis of the above, and the optimized blockchain is as shown in FIG. 7. Shown. Where the head pointer is unchanged, the tail pointer of the parameter block is pointed to the block j+2, and in addition, the check value is recalculated, and only H(h
  • the node can verify the parameter block by querying the complete block header, thereby ensuring the correctness of the parameter block.
  • a set of parameters can identify several consecutive blocks, and multiple sets of parameters can identify multiple sets of consecutive blocks, so that the block can be freely deleted.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner such as: multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored or not executed.
  • the coupling, or direct coupling, or communication connection of the components shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may be electrical, mechanical or other forms. of.
  • the units described above as separate components may or may not be physically separated, and the components displayed as the unit may or may not be physical units, that is, may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present disclosure may be integrated into one processing module, or each unit may be separately used as one unit, or two or more units may be integrated into one unit;
  • the unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Physics & Mathematics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Economics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Development Economics (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

本公开公开了一种区块链轻量化处理方法、区块链节点及计算机存储介质。应用于第一区块链节点中的所述方法区块链轻量化处理方法,包括:基于交易链中连续分布的待删除的N个区块,生成参数区块,其中,所述N为正整数;删除所述交易链中的所述N个区块;存储所述参数区块,其中,所述参数区块与所述交易链中未删除的区块共同形成优化链,其中,所述参数区块的父区块为:所述交易链中删除的N个区块的前一个区块,所述参数区块的子区域为:所述交易链中删除的N个区块的后一个区域。

Description

区块链轻量化处理方法、区块链节点及存储介质
相关申请的交叉引用
本申请主张在2017年8月3日在中国提交的中国专利申请号No.201710657510.X的优先权,其全部内容通过引用包含于此。
技术领域
本公开涉及信息技术领域,尤其涉及一种区块链轻量化处理方法、区块链节点及计算机存储介质。
背景技术
近年来兴起的区块链技术是一种按照时间顺序将数据区块以顺序相连的方式组合成的一种链式数据结构,并以密码学方式保证其不可篡改和不可伪造的分布式账本。区块链的核心技术是利用块链式数据结构来验证与存储数据、利用分布式节点共识算法来生成和更新数据、利用密码学的方式保证数据传输和访问的安全。
区块链的一个很大问题在于其中会包含所有的历史交易,随着交易量的增加,区块链中的区块也将不断增多,整个区块链的数据会越来越大,对节点存储和计算资源的需求会越来越高。
发明内容
有鉴于此,本公开实施例期望提供一种区块链轻量化处理方法、区块链节点及计算机存储介质,至少部分解决区块链技术中存储资源等资源消耗大的问题。
为达到上述目的,本公开的技术方案是这样实现的:
本公开实施例第一方面提供种区块链轻量化处理方法,应用于第一区块链节点中,包括:
基于交易链中连续分布的待删除的N个区块,生成参数区块,其中,所述N为正整数;
删除所述交易链中的所述N个区块;
存储所述参数区块,其中,所述参数区块与所述交易链中未删除的区块共同形成优化链,其中,所述参数区块的父区块为:所述交易链中删除的N个区块的前一个区块,所述参数区块的子区域为:所述交易链中删除的N个区块的后一个区域。
可选的,所述方法还包括:
判断交易链中连续分布的N个区块是否满足预设删除条件;
所述基于交易链中连续分布的待删除的N个区块,生成参数区块,包括:
若满足所述预设删除条件,基于所述N个区块生成参数区块。
可选的,所述参数区块中至少包括:头指针和尾指针;
所述头指针,指向所述交易链中删除的N个区块中前一个区块;
所述尾指针,指向所述交易链中删除的N个区块中后一个区块。
可选的,所述头指针包括:所述交易链中删除的N个区块中前一个区块的散列值;
所述尾指针包括:所述交易链中删除的N个区域的后一个区块的散列值。
可选的,所述基于交易链中连续分布的待删除的N个区块,生成参数区块,包括:
利用待删除的N个区块的散列值,计算校验值,其中,所述参数区块还包括所述校验值,所述校验值,用于将所述优化链发送给第二区块链节点时,用于所述第二区块链节点对所述优化链的验证。
可选的,所述方法还包括:
当所述优化链中有新增待删除的区块时,根据新增待删除的区块的区块参数,更新所述参数区块;其中,更新后的参数区块,将链接到所述交易链中满足所述预设删除条件的区块的后一个区块;
删除新增的待删除的区块。
本公开实施例第二方面提供一种区块链轻量化处理方法,应用于第二区块链节点中,包括:
向第一区块链节点发送区块链的复制请求;
当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述 优化链中的参数区块,向第三区块链节点发送获取请求,其中,所述第三区块链节点为完成存储有所述优化链对应的交易链的区块链节点;所述获取请求,用于获取所述优化链中已删除且连续分布的N个区块,所述N为正整数;
接收所述第三区块链节点返回的区块参数;
基于所述区块参数对所述优化链中的参数区块进行验证;
当所述参数区块通过验证时,存储所述优化区块以形成所述优化链。
可选的,所述当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述优化链中的参数区块,向第三区块链节点发送获取所述优化链中删除的N个区块的区块参数的获取请求,包括:
基于所述参数区块,确定出第一散列值和第二散列值,其中,所述第一散列值为:所述已删除连续分别的N个区块中首个区块的散列值,所述第二散列值为:所述已删除连续分别的N个区块中尾个区块的散列值;其中,所述区块参数,至少包括:已删除连续分布的N个区块中第2个区块至第N-1个区块的散列值;所述参数区块中还包括:校验值;
向所述第三区块链节点发送携带有所述第一散列值和所述第二散列值的获取请求;
所述基于所述区块参数对所述优化链中的参数区块进行验证,包括:
基于已删除的连续分布的N个区块的散列值,利用预设函数生成函数值;
将生成的所述函数值与所述校验值进行匹配;
若匹配一致,则确定所述参数区块通过验证。
本公开实施例第三方提供一种区块链节点,所述区块链节点为第一区块链节点,包括:
生成单元,用于基于交易链中连续分布的待删除的N个区块,生成参数区块,其中,所述N为正整数;
删除单元,用于删除所述交易链中的所述N个区块;
第一存储单元,用于存储所述参数区块,其中,所述参数区块与所述交易链中未删除的区块共同形成优化链,其中,所述参数区块的父区块为:所述交易链中删除的N个区块的前一个区块,所述参数区块的子区域为:所述交易链中删除的N个区块的后一个区域。
本公开实施例第四方面提供一种区块链节点,所述区块链节点为第二区块链节点,包括:
发送单元,用于向第一区块链节点发送区块链的复制请求;当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述优化链中的参数区块,向第三区块链节点发送获取请求,其中,所述第三区块链节点为完成存储有所述优化链对应的交易链的区块链节点;所述获取请求,用于获取所述优化链中已删除且连续分布的N个区块,所述N为正整数;
接收单元,用于接收所述第三区块链节点返回的区块参数;
验证单元,用于基于所述区块参数对所述优化链中的参数区块进行验证;
第二存储单元,用于当所述参数区块通过验证时,存储所述优化区块以形成所述优化链。
本公开实施例第五方面提供一种区块链节点,包括:收发器、存储器、处理器及存储在所述存储器上并由所述处理器处理的计算机程序;
所述处理器,分别与所述收发器及所述存储器连接,用于通过执行所述计算机程序控制所述收发器的信息交互、所述存储器的信息存储,并执行前述任意一个或多个技术方案提供的区块链轻量化处理方法。
本公开实施例第五方面提供一种计算机存储介质,其中,所述计算机存储介质存储有计算机程序,所述计算机程序被执行后,能够实现执行前述任意一个或多个技术方案提供的区块链轻量化处理方法。
本公开实施例提供的区块链轻量化处理方法、区块链节点及计算机存储介质,为了减少区块链的数据量,会基于待删除的区块的区块参数,生成参数区块,该参数区块可以链接删除的区块的前一个区块和后一个区块,形成一个优化的优化链。通常优化链的区块数少于保留了完整区块的交易链的区块数,且参数区块的数据量通常小于一个交易链中包括交易信息的区块的数据量,从而整体上优化链的数据量远远少于交易量。若区块链节点仅存储优化链,显然可以减少区块链存储所消耗的存储资源,同时方便后续查询操作等所消耗的计算资源,从而可以节省查询都区块链的查询操作等后续操作所消耗的计算资源。从而解决了相关技术中的区块链技术中存储资源等资源消耗大的问题。
附图说明
图1为一种区块链的结构示意图;
图2为另一种区块链的结构示意图;
图3为本公开实施例提供的第一种区块链轻量化处理的流程示意图;
图4为本公开实施例提供的第二种区块链轻量化处理的流程示意图;
图5为本公开实施例提供的一种交易链的结构示意图;
图6为图5所示的交易链优化后形成的优化链的结构示意图;
图7为本公开实施例提供的第三种区块链轻量化处理的流程示意图;
图8为在图6所示的优化链基础上再次优化后的优化链的结构示意图;
图9为本公开实施例提供的第四种区块链轻量化处理的流程示意图;
图10为本公开实施例提供的一种第一区块链节点的结构示意图;
图11为本公开实施例提供的一种第二区块链节点的结构示意图;
图12为本公开实施例提供的一种区块链节点的结构示意图。
具体实施方式
以下结合说明书附图及具体实施例对本公开的技术方案做进一步的详细阐述。
以下介绍以下交易链的区块的相关信息。
如图1所示,在区块链技术中,区块按时间顺序逐个先后生成并连接成链,每一个区块记录了创建期间产生的交易信息,得到区块链网络中各区块链节点基于共识机制的公认的交易将在区块链中永久存储。如图1所示,区块的数据结构一般分为区块头和区块体。如图2所示,每个区块的区块头包含了前一个区块(即父区块)的散列值,从而形成从创世区块到当前区块的链条,并确定了每个区块在整个区块链中所处的位置。通常后一个区块的区块头包括前一个区块的区块头内存储的散列值。为防止区块中的交易被篡改,区块链使用了默克尔(Merkle)树来归纳一个区块中的所有交易,Merkle根则是所有交易的摘要,区块中任意一笔交易信息的改变都会改变Merkle根。区块体则包含了经过验证的、区块创建过程中产生的交易信息。如图2所示,区块k的区块头包括区块k-1的区块头中的散列值;且每一个区块的区块头 中还包含随机数、产生时间的时间戳等信息。一个区块可能记录多笔交易信息,这里的时间戳还可能是每一个交易的交易时间戳。
本公开实施例提供一种区块链轻量化处理方法,应用于第一区块链节点中,如图3所示,包括:
步骤S110:基于交易链中连续分布的待删除的N个区块,生成参数区块,其中,所述N为正整数;
步骤S120:删除所述交易链中的所述N个区块;
步骤S130:存储所述参数区块,其中,所述参数区块与所述交易链中未删除的区块共同形成优化链,其中,所述参数区块的父区块为:所述交易链中删除的N个区块的前一个区块,所述参数区块的子区域为:所述交易链中删除的N个区块的后一个区域。
本实施例提供的区块链轻量化处理方法,实质上是减少区块链的数据量的方法,从而使得区块链在数据量上呈现轻量的特点。
本实施例中所述第一区块链节点可为区块链网络中任意一个记账节点。在本实施例中,所述记账节点为了节省本地存储区块链的数据存储量和维护数据存储的计算资源等,会删除由区块构成的原始的区块链(即所述交易链)中部分满足删除条件的区块。在本实施例中连续分布的N个区块,优选为连续分布的多个区块,这样可以最大限度的减少参数区块的生成,减少优化链的数据量。
但是删除这些区块之后,需要确保区块链的链式结构,会参数区块,该参数区块是可以替代已删除的多个区块,链接交易链中未删除的区块的,形成数据量远远小于原始的交易链的优化链的。这样的话,依然完整的保存了区块链的链式结构。
这样第一区块链节点可以通过对应区块的删除,仅存储优化链,从而可以达到减少区块链的存储资源的占用,减少维护这些区块链所需的系统资源的消耗。
在一些实施例中,如图4所示,所述方法还包括:
步骤S100:判断交易链中连续分布的N个区块是否满足预设删除条件;
所述步骤S110具体可包括步骤S111;所述步骤S111可包括:
若满足所述预设删除条件,基于所述N个区块生成参数区块。
判断连续分布的N个区块是否满足预设删除条件的方式有多种,以下提供几种可选方式。
可选方式一:
所述步骤S100可包括:
判断连续分布的N个区块记载的交易内容是否超过有效期;
当连续分布的N个区块记载的交易内容超过有效期,则认为这N个连续分布的区块满足所述预设删除条件。
例如,交易链中每一个区块的区块体中存储有分配给对应用户的证书信息,而证书信息是有一定时效性的,当该证书信息已经超过有效期,即时效性已经丧失,则可认为该区块的区块体内存储的证书信息已经无效,为了节省存储空间,可以删除该区块。则可认为该区块的信息状态满足所述预设存储条件。这里的证书信息可为前述交易信息的一种。这里的证书信息可包括:授权证书及授权证书的用户信息等。
可选方式二:
所述步骤S100可包括:
提取所述交易链中或优化链中各区块的时间戳;所述时间戳包括对应区块的生成时间;
判断当前时间距离所述生成时间的时间差是否超于预设时间阈值;
若所述时间差超过预设时间阈值,可认为对应区块为满足所述预设删除条件的区块。
例如,在一些情况下,有些区块虽然不会硬性的设计信息的有效性,但是该区块内对应的交易信息后续可被查询的概率几乎为零,或者,小于预设概率。例如,生成时间超过一个时间阈值的区块。所述时间阈值可为1年、2年或5年等。
可选方式三:
所述步骤S100可包括:
提取所述交易链或优化链中历史区块距离最后一个生成的区块之间间隔的区块个数;
当所述区块个数超过个数阈值时,则认为对应区块为满足预设删除条件的待删除的区块。
例如,交易链中距离当前最新的区块之间隔离有预定个数区块的历史区块,例如,交易链A中目前包括5.3万个区块,若所述预定个数为1万,则第4.3万个区块之前的区块(创世区块除外)都是可以删除的区块。
值得注意的是,在本实施例中可删除的区块不包括交易链中的创世区块,这里的创世区块为交易链的第一区块。
总之,在本实施例中避免删除区块导致的有效信息的缺失,仅会对交易链中或优化链中满足预设删除条件的区块进行删除,以确保删除对应区块后的优化区块能够满足后续信息查询和/或验证的需求,在减少数据量占用的存储资源和计算资源的同时,尽可能满足信息查询的需求。
在本实施例中通过步骤S100的引入,相当于仅会在第一区块链节点中删除满足预设删除条件的区块,在一些情况下,所述第一区块链节点可以根据自身的存储资源的使用状况等,有选择性使用上述技术方案的丢弃部分区块的存储,而不用判断哪些区块是满足预设删除条件的。例如,在一种应用场景中,区块链节点A目前的存储资源的使用率高于最大使用率阈值,为了确保区块链节点的正常运行,必须释放部分存储资源。则可以根据随机算法等选择方式,将一条或多条交易链中的区块设定为待删除的区块,通过区块的删除及优化链的存储,释放部分存储资源。
可选地,所述参数区块中至少包括:头指针和尾指针;
所述头指针,指向所述交易链中删除的N个区块中前一个区块;
所述尾指针,指向所述交易链中删除的N个区块中后一个区块。
例如,在交易链中,删除的N个区块为第i个区块至第j个区块,则头指针指向交易链中的第i-1个区块,尾指针指向的第j+1个区块。这里的头指针和尾指针可为执行对应区块的区块标识,和/或,存储地址等可以唯一标识该区块或该区块在区链中位置的信息。在本实施例中,所述区块链可以包括:完整包含所有区块的交易链,也可以包括引入了参数区块的优化链。
图5所示的一个完整的交易链的结构示意图。优选地为,所述头指针包括:所述交易链中删除的N个区块中前一个区块的散列值;所述尾指针包括: 所述交易链中删除的N个区域的后一个区块的散列值。
图6所示为一种删除了图5所示的交易链中,多个连续分布的区块之后并引入了参数区块的优化链的一种结构示意图。基于上述举例,则所述头指针可为所述第i-1个区块的散列值,所述尾指针为第j+1个区块的散列值。在图6中,参数区块的头指针为hi-1;其中hi-1为区块i-1的区块头的散列值;所述参数区块的尾指针为hj+1;所述hj+1可为区块j+1的区块头的散列值。
散列值是区块链中链接相邻两个区块的链条。通常子区块的散列值是基于父区块的散列值生成的,是可以唯一标识一条交易链中该区块的位置的信息之一。
可选地,所述步骤S110可包括:
利用待删除的N个区块的散列值,计算校验值,其中,所述参数区块还包括所述校验值,所述校验值,用于将所述优化链发送给第二区块链节点时,用于所述第二区块链节点对所述优化链的验证。
在本实施例中可以利用哈希函数等预设函数,基于每一个区块的散列值,计算出所述校验值。在本实施例中,可以根据N个区块在交易链中的分布顺序,从待删除的第1个区块的散列值,与待删除的第2个区块的散列值进行逻辑运算,总之,待删除第i个区块的散列值与待删除的第i+1个散列值进行逻辑运算,完成N-1次逻辑运算之后,将逻辑运算的结果作为所述预设函数的因变量,可以得到预设函数的函数值,该函数值可以作为所述校验值,作为参数区块的一部分存储在参数区块中。这里的逻辑运算,可以:将对应的散列值转换成二进制代码后,进行二进制之间的与运算、或运算,或者,多次不同类型的与、或、非等各种逻辑运算的运算结果。当然,以上仅是一种计算校验值的方式,在具体的实现过程中,还可以包括其他运算方式。
例如,按照区块的生成时间,依次将对应的散列值作为因变量输入到预设函数计算得到函数值,并将前一次计算的函数值与后一次计算的函数值进行再次的函数运算得到对应的校验值,循环执行直到所有的待删除的区块的散列值都参与了计算为止,这样也会得到对应的校验值。
通过校验值的引入,当对应的优化链被拷贝到其他区块链节点时,方便 其他区块链节点对参数区块的校验,减少参数区块的被篡改导致的优化链存储的信息有误的问题。例如,通过篡改参数区块的头指针或尾指针,可以使得参数区块链接到伪造的区块链中,而通过校验值的引入,可以避免或减少这种现象的发生。
在一些实施例中,如图7所示的方法,还包括:
步骤S140:当所述优化链中有满足所述预设删除条件的区块时,根据新增待删除的区块的区块参数,更新所述参数区块;其中,更新后的参数区块,将链接到所述交易链中满足所述预设删除条件的区块的后一个区块;
步骤S150:删除新增的待删除的区块。
由于交易链中的区块都是按照时间生成,待删除的区块可能也是基于生成时间产生的,故一条优化链在完成一次优化之后,在下一个优化时刻来临时,可以在原始删除的多个区块后面产生了多个满足前述预设删除条件的多个新增的待删除区块,则此时,仅需要通过更新该参数区块即可,不用生成一个全新的参数区块。图8为基于图6所示的优化链,再次删除了新增待删除区块后形成的再次优化链的结构示意图。显然图8中,参数区块的尾指针从hj+1变化成了hj+2;从而参数区块尾部指向的区块为区块j+2。
具体如,所述步骤S140可包括:
确定出新增的待删除区块的下一个区块;
提取新增的待删除区块的下一个区块的区块标识,例如,该区块的散列值,修订所述参数区块中尾指针的内容,则实现了参数区块的更新。
在还有一些实施例中,所述步骤S140还可包括:
根据新增的待删除区块自身的散列值,更新参数区块中的校验值等,
总之,一旦一条优化链生成之后,可以通过参数区块中部分信息的更新,实现优化链的再次优化,生成优化效果更近一步的再次优化链。
在一些情况下,一条优化链对应的参数区块可能仅包括一个,在还有一些实施例中,参数区块可能包括多个,但是多个参数区块在优化链中是不相邻分布的,若两个参数区块相邻分布,则可以基于两个参数区块中的首尾指针的合并,生成一个参数区块,尽可能的简化参数区块。
在一些实施例中,所述方法还包括:为了区分优化链中的参数区块和其 他存储有实际交易信息的区块,在参数区块中还设置有参数区块的类型标记,则后续信息查询或复制过程中,可以通过区块的类型标记的快速比对,区分出区块链中的不同区块的。在一些实施例中,所述优化链还可以通过不同类型区块的分别存储,方便后续的区块的类型区分,及对不同类型的区块的不同处理。
如图9所示,本实施例还提供一种区块链轻量化处理方法,应用于第二区块链节点中,包括:
步骤S210:向第一区块链节点发送区块链的复制请求;
步骤S220:当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述优化链中的参数区块,向第三区块链节点发送获取请求,其中,所述第三区块链节点为完成存储有所述优化链对应的交易链的区块链节点;所述获取请求,用于获取所述优化链中已删除且连续分布的N个区块,所述N为正整数;
步骤S230:接收所述第三区块链节点返回的区块参数;
步骤S240:基于所述区块参数对所述优化链中的参数区块进行验证;
步骤S250:当所述参数区块通过验证时,存储所述优化区块以形成所述优化链。
在一些实施例中区块链网络中,存在着多个分布式的区块链节点,这些节点之间可能会相互复制存储的区块链。
在本实施例中优化链的生成,都是在一个区块链节点中的本地生成的,若其他区块链节点拷贝其存储的优化链,为了确保优化链的真实性和可靠性,则其他区块链节点可能需要校验拷贝的优化链。
在本实施例中其他区块链节点统称为区分形成优化链的第一区块链节点的第二区块链节点。
第二区块链节点向第一区块链节点发送了一个复制请求。第一区块链节点接收到该复制请求之后,由于之前删除了部分区块,这样导致第一区块链节点本地存储仅是优化链,而非完整的交易链,故第一区块链节点会将优化链发送给第二区块链节点。
第二区块链节点接收到优化链之后,通过类型识别及区块个数的统计等, 可发现当前接收到的优化链,而非完整的交易链。
第二区块链节点同样向以尽可能少的存储资源进行区块链的存储,即仅想存储优化链,则会向存储有完整的交易链的第三区块链节点请求优化链中缺失区块的区块信息。
在本实施例中,通常第一区块链节点和第二区块链节点都可为客户端节点,而第三区块链节点可为服务器节点。通常情况下服务器节点必须存储至少一段时间类的完整交易链。故在步骤S220中可以向服务器节点发送所述获取请求。在一个区块链节点系统中至少包括预定个数的存储完整交易链的服务器节点。这里的预定个数可仅为一个。当然这也仅是举例。在一些情况下,若基于交易链中的交易信息的有效性,针对某些交易信息已经失效,服务器节点也可以删除对应的区块,仅存储对应区块的散列值等用于后续优化链验证的信息,或者,甚至连用于校验的信息都不存储,仅通过向整个系统发送对应区块删除的免校验指示即可,后续区块链节点之间的优化链复制,则对对应部分进行免校验。
在发送所述获取请求之后,第三区块链节点会返回对应的区块信息,用于第二区块链节点对参数区块的校验。在本实施例中,对参数区块的校验,至少包括:对参数区块中尾指针的校验,当然也包括:对头指针的校验。
通过校验可以确保当前从第一区块链节点拷贝的优化链是可信的,确保区块链的信息的真实性和可信度。
进一步地,所述步骤S220可包括:
基于所述参数区块,确定出第一散列值和第二散列值,其中,所述第一散列值为:所述已删除连续分别的N个区块中首个区块的散列值,所述第二散列值为:所述已删除连续分别的N个区块中尾个区块的散列值;
其中,所述区块参数,至少包括:已删除连续分布的N个区块中第2个区块至第N-1个区块的散列值。
在一些实施例中,主要以散列值作为参数区块中的头指针和尾指针,故在本实施例中,在向第三区块链节点发送获取请求时,可以将参数区块中作为头指针的第一散列值和作为尾指针的第二散列值携带在获取请求中。
第三区块链节点接收到第一散列值和第二散列值之后,查询交易链或查 询依然包括对应区块的优化链,获得第一散列值对应的第i个区块和第二散列值对应的第j个区块之间的第i+1至第j-1个区块的散列值,将这些散列值作为所述获取请求的请求响应返回给第二区块链节点。
第二区块链节点接收到这些散列值之后,会基于预先协商的预设函数或基于共识机制定义的函数,以这些散列值作为因变量的至少其中之一,进行函数计算,得到函数值。将该函数值与对应参数区块中携带的校验值进行比对,进行参数区块的校验。具体如,所述步骤S240可包括:
基于已删除的连续分布的N个区块的散列值,利用预设函数生成函数值;
将生成的所述函数值与所述校验值进行匹配;
若匹配一致,则确定所述参数区块通过验证。
通过函数值的计算及与校验值的匹配,可以确保参数区块中信息的真实性和可靠性,从而确保当前接收的优化链的可靠性及真实性。
这样第二区块链节点从一开始存储的就是优化链,大大的减少了区块链所消耗的存储资源等各种资源,方便一些存储资源少的区块链节点的记账处理。
本公开实施例中还提供一种应用于第三区块链节点的区块链轻量化处理方法,包括:
接收第二区块链发送的获取请求;
基于所述获取请求查询交易链,或包括获取请求对应的区块的区块参数的优化链;
将查询的区块参数发送给第二区块链节点,其中,所述区块参数,用于所述第二区块链节点验证优化链中的参数区块。
这里的优化链和交易链的相关描述和差异,都可以见前述实施例,再次就不重复了。
所述区块参数可以包括:优化链中被删除的区块的散列值或其他区块标识。
所述获取请求中可以携带优化链中删除的N个区块的第1个删除的区块的第一散列值,及删除的N个区块中最后一个区块的第二散列值。
如图10所示,本实施例提供一种区块链节点,所述区块链节点为第一区 块链节点,包括:
生成单元110,用于基于交易链中连续分布的待删除的N个区块,生成参数区块,其中,所述N为正整数;
删除单元120,用于删除所述交易链中的所述N个区块;
第一存储单元130,用于存储所述参数区块,其中,所述参数区块与所述交易链中未删除的区块共同形成优化链,其中,所述参数区块的父区块为:所述交易链中删除的N个区块的前一个区块,所述参数区块的子区域为:所述交易链中删除的N个区块的后一个区域。
本实施例提供的一种区块链节点的结构示意图。
所述生成单元110及删除单元120都可以对应于区块链节点所在物理节点的处理器及存储器的连接结构。所述存储器可以用于进行各种信息的储存;所述处理器基于集成电路总线等总线接口与所述存储器连接,通过计算机程序等可执行代码的执行,可以优化交易链,生成数据量更少的优化链。
所述处理器可为中央处理器(CPU)、微处理器(MCU)、数字信号处理器(DSP)、应用处理器(AP)、可编程阵列(PLC)或专用集成电路(ASIC)等可进行信息处理的结构。
所述第一存储单元130可对应于存储介质,可以用于所述参数区块的存储。
本实施例中所述第一区块链节点会删除区块链中部分可以删除的区块,为了确保区块链的链式结构,会生成对应的参数区块,形成优化的区块链。通常优化后的优化链包括的区块数少于完整的交易链包括的区块树,参数区块的数据量一般少于一个交易量中包括交易信息的区块的数据量,故整体上优化链的数据量是远远小于交易链的数据链的。这样,若仅存储优化链,相对于存储交易链,显然大大的节省了存储资源,节省了后续查询的计算资源。例如,通常删除的区块存储的信息都是无效的或被访问的频次很低的信息,若接收到一个查询请求,若基于散列值查询交易链,若交易链包括M个区块,则可能需要比对M个区块的散列值,而优化链仅包括M-N个区块,则查询过程中最多的匹配次数为M-N次,显然节省了查询匹配次数。
可选地,所述第一区块链节点还包括:
判断单元,用于判断交易链中连续分布的N个区块是否满足预设删除条件;
所述生成单元110,具体可用于若满足所述预设删除条件,基于所述N个区块生成参数区块。
这里的判断单元,同样可对应于处理器或处理电路。
可选地,所述第一存储单元130,具体可用于利用所述参数区块包括的头指针,指向所述交易链中删除的N个区块中前一个区块;利用所述参数区块包括的尾指针,指向所述交易链中删除的N个区块中后一个区块。
进一步地,所述头指针包括:所述交易链中删除的N个区块中前一个区块的散列值;所述尾指针包括:所述交易链中删除的N个区域的后一个区块的散列值。
在一些实施例中,所述生成单元110,具体可用于利用待删除的N个区块的散列值,计算校验值,其中,所述参数区块还包括所述校验值,所述校验值,用于将所述优化链发送给第二区块链节点时,用于所述第二区块链节点对所述优化链的验证。
在还有一些实施中,所述第一区块连节点还包括:
更新单元,用于当所述优化链中有新增待删除的区块时,根据新增待删除的区块的区块参数,更新所述参数区块;其中,更新后的参数区块,将链接到所述交易链中满足所述预设删除条件的区块的后一个区块;
所述删除单元,还用于删除新增的待删除的区块。
这里的删除单元,同样可对应于处理器或处理电路。
如图11所示,本实施例还提供一种区块链节点,所述区块链节点为第二区块链节点,包括:
发送单元210,用于向第一区块链节点发送区块链的复制请求;当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述优化链中的参数区块,向第三区块链节点发送获取请求,其中,所述第三区块链节点为完成存储有所述优化链对应的交易链的区块链节点;所述获取请求,用于获取所述优化链中已删除且连续分布的N个区块,所述N为正整数;
接收单元220,用于接收所述第三区块链节点返回的区块参数;
验证单元230,用于基于所述区块参数对所述优化链中的参数区块进行验证;
第二存储单元240,用于当所述参数区块通过验证时,存储所述优化区块以形成所述优化链。
本实施例中提供一种第二区块链节点。该区块链节点包括:发送单元210及接收单元220,可对应于区块链节点所在物理节点的网络接口等。所述网络接口可为电缆接口、光缆接口和/或收发天线等。所述物理节点可为各种通信设备,例如,网络服务器、手机或台式电脑等个人通信设备等。
所述验证单元230可对应于处理器;所述处理器的相关描述可以参见前述实施例,在此就不重复了。
所述第二存储单元240可对应于第二区块链节点的本地存储介质,该存储介质优选为非瞬间存储介质,可用于非瞬间存储优化链,通过交易链的优化,减少了存储的资源的消耗,后续其他操作的计算资源的消耗。
可选地,所述第二区块链节点,可包括同样可对应于处理器的确定单元;所述确定单元,可用于基于所述参数区块,确定出第一散列值和第二散列值,其中,所述第一散列值为:所述已删除连续分别的N个区块中首个区块的散列值,所述第二散列值为:所述已删除连续分别的N个区块中尾个区块的散列值;其中,所述区块参数,至少包括:已删除连续分布的N个区块中第2个区块至第N-1个区块的散列值;所述参数区块中还包括:校验值。
所述发送单元210,可用于向所述第三区块链节点发送携带有所述第一散列值和所述第二散列值的获取请求;
所述验证单元230,具体可用于基于已删除的连续分布的N个区块的散列值,利用预设函数生成函数值;将生成的所述函数值与所述校验值进行匹配;及若匹配一致,则确定所述参数区块通过验证。
本实施例中第二区块链节点直接可以从其他区块链节点,拷贝或复制优化链,以减少区块链存储所消耗的存储资源,或,后续操作所消耗的计算资源等。
如图12所示,本实施例还提供一种区块链节点,包括:收发器310、存储器320、处理器330及存储在所述存储器320上并由所述处理器330处理 的计算机程序;
所述处理器330,分别与所述收发器310及所述存储器320连接,用于通过执行所述计算机程序控制所述收发器310的信息交互、所述存储器320的信息存储,并前述一个或多个技术方案提供的区块链轻量化处理方法。
例如,所述处理器330可通过计算机程序的执行,可以实现图3、图4、图7和/或图9所示的区块链轻量化处理方法。
本实施例提供的区块链节点可为第一区块链节点、第二区块链节点及第三区块链节点等各种区块链节点。
所述处理器330可以通过集成电路(IIC)总线与所述收发器310及存储器320连接。
所述收发器310可包括物理节点连接到网络的各种通信接口,例如,电缆接口、光缆接口及收发天线等。
本公开实施例还提供一种计算机存储介质,所述计算机存储介质存储有计算机程序,所述计算机程序被执行后,能够实现前述一个或多个技术方案提供的区块链轻量化处理方法,例如,可实现图3、图4、图7和/或图9所示的区块链轻量化处理方法。
本公开实施例提供的计算机存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。可选为,所述计算机存储介质可为非瞬间存储介质。
以下结合上述实施例提供一个具体示例:
示例1:
本方法适用于有大量区块可以删除的场景,需要本地节点记录若干组参数,每组参数对应一组连续的可删除区块。每组参数由如下内容构成:
头指针:记录一组连续的可删除区块中第一个区块的父区块头散列值。
尾指针:记录一组连续的可删除区块中最后一个区块的子区块头散列值。
校验值:对一组连续的可删除区块中所有区块头的散列值进行运算,将运算结果作为校验值保存。计算方法见如下示例。
以图5所示区块链为例,区块k的区块头的散列值记为hk,如果需要删 除区块i至区块j,那么节点需要计算如下参数:
头指针:hi-1
尾指针:hj+1
校验值:H(H(…H(H(hi)||hi+1)||…||hj-1)||hj),其中H是单向函数。
计算上述参数之后,节点可以删除区块i、区块j、以及两者之间的所有区块,利用上述参数将区块i-1与区块j+1连接起来,如图6所示。
在图6所示的优化链基础上进一步优化,如果尾指针所标识的区块(区块j+1)也可以删除,那么可以在上述基础上进一步优化,优化之后的区块链如图7所示。其中,头指针不变,将参数区块的尾指针指向区块j+2,此外,重新计算校验值,仅需在图6校验值h基础上计算H(h||hj+10),从而得到图8所示的优化链。
由于参数区块中含有校验值,因此,节点可以通过查询完整的区块头验证参数区块,从而可以确保参数区块的正确性。
扩展性:本提案具备扩展性,图5和图6中的示例说明,如果尾指针所标识的区块如果也可以删除,那么仅需利用相关技术中的参数区块以及尾指针所示的区块信息计算新的参数区块即可,无需使用其他区块数据。
存储效率:一组参数可标识若干连续的区块,多组参数可以标识多组连续的区块,从而可以实现区块的自由删减。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分 或全部单元来实现本实施例方案的目的。
另外,在本公开各实施例中的各功能单元可以全部集成在一个处理模块中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤。
以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应以所述权利要求的保护范围为准。

Claims (12)

  1. 一种区块链轻量化处理方法,应用于第一区块链节点中,包括:
    基于交易链中连续分布的待删除的N个区块,生成参数区块,其中,所述N为正整数;
    删除所述交易链中的所述N个区块;
    存储所述参数区块,其中,所述参数区块与所述交易链中未删除的区块共同形成优化链,其中,所述参数区块的父区块为:所述交易链中删除的N个区块的前一个区块,所述参数区块的子区域为:所述交易链中删除的N个区块的后一个区域。
  2. 根据权利要求1所述的方法,还包括:
    判断交易链中连续分布的N个区块是否满足预设删除条件;
    所述基于交易链中连续分布的待删除的N个区块,生成参数区块,包括:
    若满足所述预设删除条件,基于所述N个区块生成参数区块。
  3. 根据权利要求1所述的方法,其特在在于,
    所述参数区块中至少包括:头指针和尾指针;
    所述头指针,指向所述交易链中删除的N个区块中前一个区块;
    所述尾指针,指向所述交易链中删除的N个区块中后一个区块。
  4. 根据权利要求3所述的方法,其中,
    所述头指针包括:所述交易链中删除的N个区块中前一个区块的散列值;
    所述尾指针包括:所述交易链中删除的N个区域的后一个区块的散列值。
  5. 根据权利要求1至4任一项所述的方法,其特在于,
    所述基于交易链中连续分布的待删除的N个区块,生成参数区块,包括:
    利用待删除的N个区块的散列值,计算校验值,其中,所述参数区块还包括所述校验值,所述校验值,用于将所述优化链发送给第二区块链节点时,用于所述第二区块链节点对所述优化链的验证。
  6. 根据权利要求1至4任一项所述的方法,还包括:
    当所述优化链中有新增待删除的区块时,根据新增待删除的区块的区块参数,更新所述参数区块;其中,更新后的参数区块,将链接到所述交易链中满足所述预设删除条件的区块的后一个区块;
    删除新增的待删除的区块。
  7. 一种区块链轻量化处理方法,应用于第二区块链节点中,包括:
    向第一区块链节点发送区块链的复制请求;
    当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述优化链中的参数区块,向第三区块链节点发送获取请求,其中,所述第三区块链节点为完成存储有所述优化链对应的交易链的区块链节点;所述获取请求,用于获取所述优化链中已删除且连续分布的N个区块,所述N为正整数;
    接收所述第三区块链节点返回的区块参数;
    基于所述区块参数对所述优化链中的参数区块进行验证;
    当所述参数区块通过验证时,存储所述优化区块以形成所述优化链。
  8. 根据权利要求7所述的方法,其中,
    所述当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述优化链中的参数区块,向第三区块链节点发送获取所述优化链中删除的N个区块的区块参数的获取请求,包括:
    基于所述参数区块,确定出第一散列值和第二散列值,其中,所述第一散列值为:所述已删除连续分别的N个区块中首个区块的散列值,所述第二散列值为:所述已删除连续分别的N个区块中尾个区块的散列值;其中,所述区块参数,至少包括:已删除连续分布的N个区块中第2个区块至第N-1个区块的散列值;所述参数区块中还包括:校验值;
    向所述第三区块链节点发送携带有所述第一散列值和所述第二散列值的获取请求;
    所述基于所述区块参数对所述优化链中的参数区块进行验证,包括:
    基于已删除的连续分布的N个区块的散列值,利用预设函数生成函数值;
    将生成的所述函数值与所述校验值进行匹配;
    若匹配一致,则确定所述参数区块通过验证。
  9. 一种区块链节点,其中,所述区块链节点为第一区块链节点,包括:
    生成单元,用于基于交易链中连续分布的待删除的N个区块,生成参数区块,其中,所述N为正整数;
    删除单元,用于删除所述交易链中的所述N个区块;
    第一存储单元,用于存储所述参数区块,其中,所述参数区块与所述交易链中未删除的区块共同形成优化链,其中,所述参数区块的父区块为:所述交易链中删除的N个区块的前一个区块,所述参数区块的子区域为:所述交易链中删除的N个区块的后一个区域。
  10. 一种区块链节点,其中,所述区块链节点为第二区块链节点,包括:
    发送单元,用于向第一区块链节点发送区块链的复制请求;当所述第一区块链节点基于所述复制请求返回的为优化链时,基于所述优化链中的参数区块,向第三区块链节点发送获取请求,其中,所述第三区块链节点为完成存储有所述优化链对应的交易链的区块链节点;所述获取请求,用于获取所述优化链中已删除且连续分布的N个区块,所述N为正整数;
    接收单元,用于接收所述第三区块链节点返回的区块参数;
    验证单元,用于基于所述区块参数对所述优化链中的参数区块进行验证;
    第二存储单元,用于当所述参数区块通过验证时,存储所述优化区块以形成所述优化链。
  11. 一种区块链节点,包括:收发器、存储器、处理器及存储在所述存储器上并由所述处理器处理的计算机程序;
    所述处理器,分别与所述收发器及所述存储器连接,用于通过执行所述计算机程序控制所述收发器的信息交互、所述存储器的信息存储,并执行权利要求1至8任一项提供的区块链轻量化处理方法。
  12. 一种计算机存储介质,其中,所述计算机存储介质存储有计算机程序,所述计算机程序被执行后,能够实现权利要求1至8任一项提供的区块链轻量化处理方法。
PCT/CN2018/097415 2017-08-03 2018-07-27 区块链轻量化处理方法、区块链节点及存储介质 WO2019024780A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710657510.XA CN109391645B (zh) 2017-08-03 2017-08-03 区块链轻量化处理方法、区块链节点及存储介质
CN201710657510.X 2017-08-03

Publications (1)

Publication Number Publication Date
WO2019024780A1 true WO2019024780A1 (zh) 2019-02-07

Family

ID=65233411

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/097415 WO2019024780A1 (zh) 2017-08-03 2018-07-27 区块链轻量化处理方法、区块链节点及存储介质

Country Status (2)

Country Link
CN (1) CN109391645B (zh)
WO (1) WO2019024780A1 (zh)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110570196A (zh) * 2019-09-05 2019-12-13 腾讯科技(深圳)有限公司 交易数据处理方法、装置、终端设备以及存储介质
CN111611319A (zh) * 2020-06-08 2020-09-01 杭州复杂美科技有限公司 分布式数据存储方法、设备和存储介质
CN111897826A (zh) * 2020-06-27 2020-11-06 中国建设银行股份有限公司 参数信息更新方法、装置、电子设备及可读存储介质
US20210182841A1 (en) * 2019-12-11 2021-06-17 Intuit Inc. Shareable and nested transactions on hash chains
CN113592639A (zh) * 2021-05-21 2021-11-02 上海佩俪信息科技有限公司 一种区块链交易删除方法及系统
US11693393B2 (en) 2019-09-25 2023-07-04 Schneider Electric Industries Sas Blockchain method for controlling an industrial process

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110222052A (zh) * 2019-05-20 2019-09-10 重庆金融资产交易所有限责任公司 区块链数据处理方法、装置、计算机设备和存储介质
US10764062B2 (en) 2019-06-03 2020-09-01 Alibaba Group Holding Limited Blockchain ledger compression
CN110362568B (zh) * 2019-06-03 2020-07-24 阿里巴巴集团控股有限公司 一种针对块链式账本的压缩方法、装置及设备
CN112153085B (zh) * 2019-06-26 2022-05-17 华为技术有限公司 一种数据处理方法、节点及区块链系统
CN110490741B (zh) * 2019-08-13 2023-03-24 山大地纬软件股份有限公司 一种区块链中数据有效性及可控性管理的装置与方法
CN110636042B (zh) * 2019-08-14 2021-07-16 创新先进技术有限公司 一种服务端已验证块高的更新方法、装置及设备
CN111917572B (zh) * 2020-07-12 2022-10-25 中信银行股份有限公司 交易请求的处理方法、装置、电子设备及可读存储介质
CN111913978B (zh) * 2020-09-02 2023-07-25 度小满科技(北京)有限公司 一种区块删除方法、装置及系统
CN114331443B (zh) * 2022-03-10 2022-06-21 南京金宁汇科技有限公司 一种删除区块链数据的方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160292048A1 (en) * 2015-03-30 2016-10-06 Western Digital Technologies, Inc. Data deduplication using chunk files
US20160292672A1 (en) * 2015-03-31 2016-10-06 Nasdaq, Inc. Systems and methods of blockchain transaction recordation
CN106251216A (zh) * 2016-07-18 2016-12-21 恒宝股份有限公司 一种用于缓解节点存储压力的方法和系统
CN106897352A (zh) * 2016-12-29 2017-06-27 北京瑞卓喜投科技发展有限公司 在拓展中进行修改的区块链的生成方法及系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015116998A2 (en) * 2014-01-30 2015-08-06 Gary Kremen Electronic transfer and obligation enforcement system
CN106503589A (zh) * 2016-10-26 2017-03-15 北京瑞卓喜投科技发展有限公司 区块链交易信息正确性的校验方法、装置及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160292048A1 (en) * 2015-03-30 2016-10-06 Western Digital Technologies, Inc. Data deduplication using chunk files
US20160292672A1 (en) * 2015-03-31 2016-10-06 Nasdaq, Inc. Systems and methods of blockchain transaction recordation
CN106251216A (zh) * 2016-07-18 2016-12-21 恒宝股份有限公司 一种用于缓解节点存储压力的方法和系统
CN106897352A (zh) * 2016-12-29 2017-06-27 北京瑞卓喜投科技发展有限公司 在拓展中进行修改的区块链的生成方法及系统

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110570196A (zh) * 2019-09-05 2019-12-13 腾讯科技(深圳)有限公司 交易数据处理方法、装置、终端设备以及存储介质
US11693393B2 (en) 2019-09-25 2023-07-04 Schneider Electric Industries Sas Blockchain method for controlling an industrial process
US20210182841A1 (en) * 2019-12-11 2021-06-17 Intuit Inc. Shareable and nested transactions on hash chains
AU2020385370B2 (en) * 2019-12-11 2022-08-18 Intuit Inc. Shareable and nested transactions on hash chains
US11941611B2 (en) * 2019-12-11 2024-03-26 Intuit Inc. Shareable and nested transactions on hash chains
CN111611319A (zh) * 2020-06-08 2020-09-01 杭州复杂美科技有限公司 分布式数据存储方法、设备和存储介质
CN111897826A (zh) * 2020-06-27 2020-11-06 中国建设银行股份有限公司 参数信息更新方法、装置、电子设备及可读存储介质
CN113592639A (zh) * 2021-05-21 2021-11-02 上海佩俪信息科技有限公司 一种区块链交易删除方法及系统
CN113592639B (zh) * 2021-05-21 2023-10-13 上海简苏网络科技有限公司 一种区块链交易删除方法及系统

Also Published As

Publication number Publication date
CN109391645B (zh) 2020-09-11
CN109391645A (zh) 2019-02-26

Similar Documents

Publication Publication Date Title
WO2019024780A1 (zh) 区块链轻量化处理方法、区块链节点及存储介质
US10204341B2 (en) Method and system for an efficient consensus mechanism for permissioned blockchains using bloom filters and audit guarantees
WO2021032138A1 (zh) 一种基于区块链系统的共识方法、装置及系统
CN102867064B (zh) 关联字段查询装置和关联字段查询方法
CN102170455A (zh) 用于在本地装置和远程装置间更新对象的方法和系统
US9438676B2 (en) Speculative data processing of streaming data
WO2004063928A1 (ja) データベース負荷軽減システムおよび負荷軽減プログラム
CN112069169B (zh) 区块数据存储方法、装置、电子设备及可读存储介质
CN108134775A (zh) 一种数据处理方法和设备
Wang et al. Ess: An efficient storage scheme for improving the scalability of bitcoin network
CN115186304A (zh) 一种基于区块链的交易数据校验方法和系统
WO2019024631A1 (zh) 区块链轻量化处理方法、区块链节点及存储介质
CN110162532A (zh) 交易数据处理方法和设备
US20230336368A1 (en) Block chain-based data processing method and related apparatus
CN115310137A (zh) 一种智能结算系统的保密方法及相关装置
WO2023075941A1 (en) Method and system for pruning blocks from blockchains for data retention and storage scalability purposes
CN115982279A (zh) 数据同步方法、装置、系统和计算机设备
CN113760519B (zh) 分布式事务处理方法、装置、系统和电子设备
CN117010889A (zh) 数据处理方法、装置及设备、介质、产品
CN116107801A (zh) 交易处理方法及相关产品
CN114328731A (zh) 信息处理方法、装置、电子设备和存储介质
CN112487065A (zh) 一种数据检索方法和装置
US11726979B2 (en) Determining a chronological order of transactions executed in relation to an object stored in a storage system
CN116188167B (zh) 一种基于dag结构的区块链系统及共识方法
CN113495982B (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: 18842131

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 18/06/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18842131

Country of ref document: EP

Kind code of ref document: A1