WO2021114796A1 - Method and apparatus for updating trusted point in multi-layer blockchain structure - Google Patents

Method and apparatus for updating trusted point in multi-layer blockchain structure Download PDF

Info

Publication number
WO2021114796A1
WO2021114796A1 PCT/CN2020/116042 CN2020116042W WO2021114796A1 WO 2021114796 A1 WO2021114796 A1 WO 2021114796A1 CN 2020116042 W CN2020116042 W CN 2020116042W WO 2021114796 A1 WO2021114796 A1 WO 2021114796A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
layer
blocks
block chain
target
Prior art date
Application number
PCT/CN2020/116042
Other languages
French (fr)
Chinese (zh)
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 WO2021114796A1 publication Critical patent/WO2021114796A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • 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
    • 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]

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)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

A method for updating a trusted point in a multi-layer blockchain structure, the multi-layer blockchain structure comprising a bottom blockchain layer and at least one upper blockchain layer, the blocks of the bottom blockchain layer being generated based on transaction data, and the upper layer blocks of the at least one upper blockchain layer being generated at least partially on the basis of block information of reference blocks in a lower blockchain layer based on the upper blockchain layer, the trusted point indicating a verified bottom layer block with the greatest block height in the bottom blockchain layer, and the method comprising: on the basis of the multi-layer blockchain structure, determining a verification path between the verified bottom layer block indicated by a current trusted point and a target bottom layer block (720); for each block in the verification path, verifying whether the link between said block and the block preceding said block is correct (740); and, when the links between the blocks in the verification path are all correct, updating the target bottom layer block as a trusted point (780).

Description

用于更新多层块链式结构中的信任点的方法及装置Method and device for updating trust points in multi-layer block chain structure 技术领域Technical field
本说明书实施例涉及区块链技术领域,具体地,涉及用于更新多层块链式结构中的信任点的方法及装置。The embodiments of this specification relate to the field of blockchain technology, in particular, to a method and device for updating trust points in a multi-layer blockchain structure.
背景技术Background technique
区块链网络是一种去中心化的、由多个节点参与的分布式数据存储系统。数据一旦被写入每个节点上的区块链,一方面,意味着数据在区块链网络中被公开,另一方面,写入区块链的数据也难以被删除与篡改。此外,在类区块链系统中,中心化设备也可以采用类似于区块链存储(可以视为中心化的区块链存储)的方式对数据进行存储。在本说明书中,诸如区块链系统和类区块链系统之类的,以块链方式存储数据的系统被称为块链式系统。The blockchain network is a decentralized distributed data storage system involving multiple nodes. Once data is written to the blockchain on each node, on the one hand, it means that the data is disclosed in the blockchain network. On the other hand, the data written to the blockchain is also difficult to delete and tamper with. In addition, in a blockchain-like system, centralized devices can also store data in a manner similar to blockchain storage (which can be regarded as centralized blockchain storage). In this specification, systems that store data in a block-chain manner, such as blockchain systems and quasi-blockchain systems, are called block-chain systems.
在块链式系统中,块链数据非常庞大,而且随着时间推移,数据量会不断增长。在传统的块链式结构中,如果想要对块链上存储的数据进行同步、验证或查询等操作时,数据访问量和运算量巨大。因此,亟需一种能够提高对块链数据的操作效率的技术。In a block chain system, the block chain data is very large, and over time, the amount of data will continue to grow. In the traditional block chain structure, if you want to synchronize, verify, or query the data stored on the block chain, the amount of data access and calculation is huge. Therefore, there is an urgent need for a technology that can improve the operation efficiency of block chain data.
发明内容Summary of the invention
鉴于上述,本说明书实施例提供了一种用于更新多层块链式结构中的信任点的方法及装置。In view of the foregoing, the embodiments of this specification provide a method and device for updating trust points in a multi-layer block chain structure.
根据本说明书实施例的一个方面,提供了一种用于更新多层块链式结构中的信任点的方法,所述多层块链式结构包括底层块链式层和至少一个上层块链式层,所述底层块链式层的区块基于交易数据生成,所述至少一个上层块链式层的上层区块是至少部分地基于该上层块链式层的下层块链式层中的基准区块的区块信息生成的,所述信任点指示所述底层块链式层中的块高最大的已验证底层区块,所述方法包括:基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径;针对所述验证路径中的各个区块,验证该区块与该区块的前一区块之间的链路是否正确;以及当所述验证路径中的各个区块之间的链路均正确时,将所述目标底层区块更新为信任点。According to an aspect of the embodiments of the present specification, a method for updating trust points in a multi-layer block chain structure is provided. The multi-layer block chain structure includes a bottom block chain layer and at least one upper block chain layer. The blocks of the underlying block chain layer are generated based on transaction data, and the upper blocks of the at least one upper block chain layer are based at least in part on the benchmarks in the lower block chain layer of the upper block chain layer Generated by the block information of the block, the trust point indicates the verified bottom block with the largest block height in the bottom block chain layer, and the method includes: determining the current block based on the multi-layer block chain structure The verification path between the verified underlying block and the target underlying block indicated by the trust point; for each block in the verification path, the link between the block and the previous block of the block is verified Whether it is correct; and when the link between each block in the verification path is correct, update the target bottom block as a trust point.
可选的,在一个示例中,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径可以包括:在所述目标底层区块和所述已验证底层区块之间存在至少两个底层基准区块时,经由至少一个上层块链式层确定所述验证路径。Optionally, in an example, based on the multi-layer block chain structure, determining the verification path between the verified underlying block and the target underlying block indicated by the current trust point may include: When there are at least two bottom-level reference blocks between the block and the verified bottom-level block, the verification path is determined via at least one upper-level block chain layer.
可选的,在一个示例中,所述多层块链式结构中的各个块链式层中的相邻两个基准区块之间的第一区块数可以相等,所述验证路径所经过的上层块链式层的数量可以不超过所述第一区块数。Optionally, in an example, the number of first blocks between two adjacent reference blocks in each block chain layer in the multi-layer block chain structure may be equal, and the verification path traverses The number of upper block chain layers may not exceed the first block number.
可选的,在一个示例中,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径可以包括:基于第一区块数和第二区块数来确定所述验证路径,所述第一区块数是各个块链式层的相邻两个基准区块之间的区块数,所述第二区块数是所述目标底层区块与所述已验证底层区块之间的底层区块数。Optionally, in an example, based on the multi-layer block chain structure, determining the verification path between the verified underlying block indicated by the current trust point and the target underlying block may include: based on the first block number And the second number of blocks to determine the verification path, the first number of blocks is the number of blocks between two adjacent reference blocks of each block chain layer, and the second number of blocks is the number of blocks The number of bottom-layer blocks between the target bottom-layer block and the verified bottom-layer block.
可选的,在一个示例中,所述各个块链式层的相邻两个基准区块之间的第一区块数可以是基于区块索引信息确定的,所述区块索引信息指示各个基准区块与所对应的上层区块的索引。Optionally, in an example, the first number of blocks between two adjacent reference blocks of each block chain layer may be determined based on block index information, and the block index information indicates each The index of the reference block and the corresponding upper block.
可选的,在一个示例中,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径可以包括:基于区块索引信息确定所述验证路径,所述区块索引信息指示各个基准区块与对应上层区块之间的索引。Optionally, in an example, based on the multi-layer block chain structure, determining the verification path between the verified underlying block indicated by the current trust point and the target underlying block may include: determining based on block index information For the verification path, the block index information indicates the index between each reference block and the corresponding upper block.
可选的,在一个示例中,所述方法还可以包括:验证所述目标底层区块是否正确。当所述验证路径中的各个区块之间的链路均正确时,将所述目标底层区块更新为信任点可以包括:当所述验证路径中的各个区块之间的链路均正确并且所述目标区块经过被确定为正确时,将所述目标底层区块更新为信任点。Optionally, in an example, the method may further include: verifying whether the target underlying block is correct. When the links between the blocks in the verification path are correct, updating the target underlying block as a trust point may include: when the links between the blocks in the verification path are correct And when the target block is determined to be correct, the target bottom block is updated as a trust point.
可选的,在一个示例中,验证所述目标底层区块是否正确可以包括:从区块链系统中的多个全量节点处获取所述目标底层区块的多个目标底层区块信息;以及当所述多个目标底层区块信息中存在不低于法定数量的一致的目标底层区块信息时,确定所述目标底层区块是正确的。Optionally, in an example, verifying whether the target underlying block is correct may include: obtaining multiple target underlying block information of the target underlying block from multiple full nodes in the blockchain system; and When there is no less than a statutory number of consistent target bottom-layer block information in the multiple target bottom-layer block information, it is determined that the target bottom-layer block is correct.
可选的,在一个示例中,所述验证路径中的各个区块包括至少基于所述前一区块的区块信息生成的第一哈希值,验证该区块与该区块的前一区块之间的链路是否正确可以包括:至少部分地基于本地获取的所述前一区块的区块信息进行哈希运算,以得到第二哈希值;基于所述第二哈希值与所述第一哈希值之间的一致性,验证该区块与前一区 块之间的链路是否正确。Optionally, in an example, each block in the verification path includes a first hash value generated at least based on the block information of the previous block, and the block is verified against the previous block of the block. Whether the link between the blocks is correct may include: performing a hash operation based at least in part on the block information of the previous block obtained locally to obtain a second hash value; and based on the second hash value The consistency with the first hash value verifies whether the link between the block and the previous block is correct.
可选的,在一个示例中,所述目标底层区块的块高可以不小于将被执行SPV验证的待验证交易所在的待验证底层区块。Optionally, in an example, the block height of the target bottom layer block may not be less than the bottom layer block to be verified where the transaction to be verified is to be verified by SPV.
根据本说明书实施例的另一方面,还提供一种用于更新多层块链式结构中的信任点的装置,所述多层块链式结构包括底层块链式层和至少一个上层块链式层,所述底层块链式层的区块基于交易数据生成,所述至少一个上层块链式层的上层区块是至少部分地基于该上层块链式层的下层块链式层中的基准区块的区块信息生成的,所述信任点指示所述底层块链式层中的块高最大的已验证底层区块,所述装置包括:验证路径确定单元,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径;链路验证单元,针对所述验证路径中的各个区块,验证该区块与该区块的前一区块之间的链路是否正确;以及信任点更新单元,当所述验证路径中的各个区块之间的链路均正确时,将所述目标底层区块更新为信任点。According to another aspect of the embodiments of the present specification, there is also provided an apparatus for updating trust points in a multi-layer block chain structure, the multi-layer block chain structure including a bottom block chain layer and at least one upper block chain layer The blocks of the underlying block chain layer are generated based on transaction data, and the upper blocks of the at least one upper block chain layer are based at least in part on the blocks in the lower block chain layer of the upper block chain layer. Generated by the block information of the reference block, the trust point indicates the verified bottom block with the largest block height in the bottom block chain layer, and the device includes: a verification path determination unit based on the multi-layer block The chain structure determines the verification path between the verified underlying block and the target underlying block indicated by the current trust point; the link verification unit verifies the block and the area for each block in the verification path Whether the link between the previous block of the block is correct; and the trust point update unit, when the link between each block in the verification path is correct, update the target underlying block to the trust point .
可选的,在一个示例中,验证路径确定单元可以在所述目标底层区块和所述已验证底层区块之间存在至少两个底层基准区块时,经由至少一个上层块链式层确定所述验证路径。Optionally, in an example, the verification path determination unit may determine via at least one upper-level block chain layer when there are at least two bottom-level reference blocks between the target bottom-level block and the verified bottom-level block. The verification path.
可选的,在一个示例中,各个区块链式层中的相邻两个基准区块之间的第一区块数可以相等,所述验证路径所经过的上层块链式层的数量不超过所述第一区块数。Optionally, in an example, the number of first blocks between two adjacent reference blocks in each block chain layer may be equal, and the number of upper block chain layers passed by the verification path may not be the same. Exceeds the number of first blocks.
可选的,在一个示例中,验证路径确定单元可以基于第一区块数和第二区块数来确定所述验证路径,所述第一区块数是各个块链式层的相邻两个基准区块之间的区块数,所述第二区块数是所述目标底层区块与所述已验证底层区块之间的底层区块数。Optionally, in an example, the verification path determination unit may determine the verification path based on the first block number and the second block number, where the first block number is two adjacent blocks of each block chain layer. The number of blocks between two reference blocks, and the second number of blocks is the number of bottom blocks between the target bottom block and the verified bottom block.
可选的,在一个示例中,所述各个块链式层的相邻两个基准区块之间的第一区块数可以是基于区块索引信息确定的,所述区块索引信息指示各个基准区块与所对应的上层区块的索引。Optionally, in an example, the first number of blocks between two adjacent reference blocks of each block chain layer may be determined based on block index information, and the block index information indicates each The index of the reference block and the corresponding upper block.
可选的,在一个示例中,验证路径确定单元可以基于区块索引信息确定所述验证路径,所述区块索引信息指示各个基准区块与对应上层区块之间的索引。Optionally, in an example, the verification path determination unit may determine the verification path based on block index information, where the block index information indicates an index between each reference block and a corresponding upper-layer block.
可选的,在一个示例中,所述装置还可以包括:目标底层区块验证单元,验证所述目标底层区块是否正确;所述信任点更新单元当所述验证路径中的各个区块之间的链路均正确并且所述目标区块被验证为正确时,将所述目标底层区块更新为信任点。Optionally, in an example, the device may further include: a target bottom-level block verification unit, which verifies whether the target bottom-level block is correct; When the links between the two are correct and the target block is verified as correct, the target bottom block is updated as a trust point.
可选的,在一个示例中,所述目标底层区块验证单元可以包括:目标底层区块信 息获取模块,从区块链系统中的多个全量节点处获取所述目标底层区块的多个目标底层区块信息;以及目标底层区块验证模块,当所述多个目标底层区块信息中存在不低于法定数量的一致的目标底层区块信息时,确定所述目标底层区块是正确的。Optionally, in an example, the target bottom-level block verification unit may include: a target bottom-level block information acquisition module, which obtains multiple target bottom-level blocks from multiple full nodes in the blockchain system Target bottom-level block information; and a target bottom-level block verification module for determining that the target bottom-level block is correct when there is no less than a legal number of consistent target bottom-level block information in the multiple target bottom-level block information of.
可选的,在一个示例中,所述验证路径中的各个区块包括至少基于所述前一区块的区块信息生成的第一哈希值,所述验路验证单元可以包括:哈希运算模块,至少部分地基于本地获取的所述前一区块的区块信息进行哈希运算,以得到第二哈希值;链路验证模块,基于所述第二哈希值与所述第一哈希值之间的一致性,验证该区块与前一区块之间的链路是否正确。Optionally, in an example, each block in the verification path includes a first hash value generated at least based on block information of the previous block, and the path verification verification unit may include: hash An arithmetic module, which performs a hash operation based at least in part on the block information of the previous block obtained locally to obtain a second hash value; a link verification module, which is based on the second hash value and the first The consistency between a hash value verifies whether the link between the block and the previous block is correct.
根据本说明书实施例的另一方面,还提供一种计算设备,包括:至少一个处理器;以及存储器,所述存储器存储指令,当所述指令被所述至少一个处理器执行时,使得所述至少一个处理器执行如上所述的方法。According to another aspect of the embodiments of this specification, there is also provided a computing device, including: at least one processor; and a memory, the memory stores instructions, and when the instructions are executed by the at least one processor, the At least one processor executes the method as described above.
根据本说明书实施例的另一方面,还提供一种非暂时性机器可读存储介质,其存储有可执行指令,所述指令当被执行时使得所述机器执行如上所述的方法。According to another aspect of the embodiments of the present specification, there is also provided a non-transitory machine-readable storage medium, which stores executable instructions, which when executed cause the machine to execute the method as described above.
利用本说明书实施例的方法和装置,通过在存在触发上层块链式层生成条件的基准区块时,至少部分地基于该基准区块的区块信息,生成上层块链式层的对应上层区块,从而能够生成多层块链式结构。利用多层块链式结构,在对块链式结构中的数据进行相关操作时,可以不必一一访问底层块链式层的各个区块,从而能够降低数据访问量和运算量,以提高操作效率。Using the method and device of the embodiment of the present specification, when there is a reference block that triggers the generation condition of the upper block chain layer, the corresponding upper zone of the upper block chain layer is generated based at least in part on the block information of the reference block Block, which can generate a multi-layer block chain structure. Using the multi-layer block chain structure, when performing related operations on the data in the block chain structure, it is not necessary to visit each block of the underlying block chain layer one by one, which can reduce the amount of data access and the amount of calculation to improve the operation effectiveness.
附图说明Description of the drawings
通过参照下面的附图,可以实现对于本说明书实施例内容的本质和优点的进一步理解。在附图中,类似组件或特征可以具有相同的附图标记。附图是用来提供对本发明实施例的进一步理解,并且构成说明书的一部分,与下面的具体实施方式一起用于解释本说明书实施例的实施例,但并不构成对本说明书实施例的实施例的限制。在附图中:By referring to the following drawings, a further understanding of the nature and advantages of the contents of the embodiments of this specification can be achieved. In the drawings, similar components or features may have the same reference signs. The accompanying drawings are used to provide a further understanding of the embodiments of the present invention, and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the embodiments of the specification, but do not constitute an example of the embodiments of the specification. limit. In the attached picture:
图1示出了可用于执行根据本说明书实施例的实施例的用于生成多层块链式结构的方法和用于更新多层块链式结构中的信任点的方法的环境的示例的示意图;FIG. 1 shows a schematic diagram of an example of an environment that can be used to perform a method for generating a multi-layer block chain structure and a method for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification ;
图2示出了执行根据本说明书实施例的实施例的用于生成多层块链式结构的方法和用于更新多层块链式结构中的信任点的方法的系统架构的示例的示意图;FIG. 2 shows a schematic diagram of an example of a system architecture that executes the method for generating a multi-layer block chain structure and the method for updating trust points in the multi-layer block chain structure according to an embodiment of the present specification;
图3是根据本说明书的一个实施例的用于生成多层块链式结构的方法的流程图;Fig. 3 is a flowchart of a method for generating a multi-layer block chain structure according to an embodiment of the present specification;
图4是根据本说明书的一个实施例的多层块链式结构的示意图;Fig. 4 is a schematic diagram of a multi-layer block chain structure according to an embodiment of the present specification;
图5A是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的流程图;5A is a flowchart of a reference block determination process in a method for generating a multi-layer block chain structure according to an embodiment of the present specification;
图5B是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的一个示例流程图;FIG. 5B is an example flowchart of the reference block determination process in the method for generating a multi-layer block chain structure according to an embodiment of the present specification;
图6A是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的另一示例流程图;6A is another example flowchart of the reference block determination process in the method for generating a multi-layer block chain structure according to an embodiment of the present specification;
图6B是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的另一示例流程图;6B is another example flowchart of the reference block determination process in the method for generating a multi-layer block chain structure according to an embodiment of the present specification;
图7是根据本说明书的一个实施例的用于更新多层块链式结构中的信任点的方法的流程图;FIG. 7 is a flowchart of a method for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification;
图8是根据本说明书的一个实施例的用于更新多层块链式结构中的信任点的方法中的链路验证过程的流程图;FIG. 8 is a flowchart of a link verification process in a method for updating a trust point in a multi-layer block chain structure according to an embodiment of the present specification;
图9是根据本说明书的另一实施例的用于更新多层块链式结构中的信任点的方法的流程图;FIG. 9 is a flowchart of a method for updating trust points in a multi-layer block chain structure according to another embodiment of the present specification;
图10是根据本说明书的一个实施例的用于更新多层块链式结构中的信任点的方法中的目标底层区块验证过程的流程图;FIG. 10 is a flowchart of a target underlying block verification process in a method for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification;
图11是根据本说明书的一个实施例的对待验证交易进行SPV验证的方法的流程图;FIG. 11 is a flowchart of a method for performing SPV verification on a transaction to be verified according to an embodiment of the present specification;
图12是根据本说明书的一个实施例的多层块链式结构生成装置的结构框图;FIG. 12 is a structural block diagram of a device for generating a multi-layer block chain structure according to an embodiment of the present specification;
图13是根据本说明书的一个实施例的用于更新多层块链式结构中的信任点的装置的结构框图;FIG. 13 is a structural block diagram of an apparatus for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification;
图14是图13所示的用于更新多层块链式结构中的信任点的装置中的链路验证单元的结构框图;FIG. 14 is a structural block diagram of a link verification unit in the device for updating trust points in a multi-layer block chain structure shown in FIG. 13;
图15是图13所示的用于更新多层块链式结构中的信任点的装置中的目标底层区块验证单元的结构框图;以及FIG. 15 is a structural block diagram of a target bottom-level block verification unit in the device for updating trust points in a multi-layer block chain structure shown in FIG. 13; and
图16是根据本说明书的一个实施例的用于实现用于生成多层块链式结构的方法或用于更新多层块链式结构中的信任点的方法的计算设备的结构框图。Fig. 16 is a structural block diagram of a computing device for implementing a method for generating a multi-layer block chain structure or a method for updating a trust point in a multi-layer block chain structure according to an embodiment of the present specification.
具体实施方式Detailed ways
以下将参考示例实施方式讨论本文描述的主题。应该理解,讨论这些实施方式只是为了使得本领域技术人员能够更好地理解从而实现本文描述的主题,并非是对权利要求书中所阐述的保护范围、适用性或者示例的限制。可以在不脱离本说明书实施例内容的保护范围的情况下,对所讨论的元素的功能和排列进行改变。各个示例可以根据需要,省略、替代或者添加各种过程或组件。另外,相对一些示例所描述的特征在其它例子中也可以进行组合。The subject described herein will be discussed below with reference to example embodiments. It should be understood that the discussion of these embodiments is only to enable those skilled in the art to better understand and realize the subject described herein, and is not to limit the scope of protection, applicability, or examples set forth in the claims. The function and arrangement of the discussed elements can be changed without departing from the protection scope of the content of the embodiments of this specification. Various examples can omit, substitute, or add various procedures or components as needed. In addition, features described with respect to some examples can also be combined in other examples.
如本文中使用的,术语“包括”及其变型表示开放的术语,含义是“包括但不限于”。术语“基于”表示“至少部分地基于”。术语“一个实施例”和“一实施例”表示“至少一个实施例”。术语“另一个实施例”表示“至少一个其他实施例”。术语“第一”、“第二”等可以指代不同的或相同的对象。下面可以包括其他的定义,无论是明确的还是隐含的。除非上下文中明确地指明,否则一个术语的定义在整个说明书中是一致的。As used herein, the term "including" and its variations mean open terms, meaning "including but not limited to". The term "based on" means "based at least in part on." The terms "one embodiment" and "an embodiment" mean "at least one embodiment." The term "another embodiment" means "at least one other embodiment." The terms "first", "second", etc. may refer to different or the same objects. Other definitions can be included below, whether explicit or implicit. Unless clearly indicated in the context, the definition of a term is consistent throughout the specification.
现在结合附图来描述本说明书实施例的用于生成具有多层结构的区块链的方法及装置、和用于更新区块链中的信任点的方法及装置。The method and device for generating a blockchain with a multi-layer structure and the method and device for updating trust points in the blockchain of the embodiments of the present specification will now be described with reference to the accompanying drawings.
区块链是一种按照时间顺序来将数据区块顺序相连组合而成的链式数据结构,并且以密码学方式保证数据区块不可篡改和不可伪造。区块链包括一个或多个区块。区块链中的每个区块通过包括该区块链中紧接其之前的前一个区块的加密散列而链接到该前一个区块。每个区块还包括时间戳、该区块的加密哈希以及一个或多个交易(transaction)。对已经被区块链网络的节点验证的交易进行哈希处理并形成Merkle树。在Merkle树中,对叶节点处的数据进行哈希处理,并且针对Merkle树的每个分支,在该分支的根处级联该分支的所有哈希值。针对Merkle树执行上述处理,直到整个Merkle树的根节点。Merkle树的根节点存储代表该Merkle树中的所有数据的哈希值。当一个哈希值声称是Merkle树中存储的交易时,可以通过判断该哈希值是否与Merkle树的结构一致来进行快速验证。Blockchain is a chain data structure that connects and combines data blocks sequentially in chronological order, and cryptographically ensures that the data blocks cannot be tampered with or forged. The blockchain includes one or more blocks. Each block in the blockchain is linked to the previous block by including the encrypted hash of the immediately preceding block in the blockchain. Each block also includes a timestamp, a cryptographic hash of the block, and one or more transactions. The transaction that has been verified by the nodes of the blockchain network is hashed and a Merkle tree is formed. In the Merkle tree, the data at the leaf nodes is hashed, and for each branch of the Merkle tree, all the hash values of the branch are concatenated at the root of the branch. The above processing is performed on the Merkle tree until the root node of the entire Merkle tree. The root node of the Merkle tree stores hash values representing all data in the Merkle tree. When a hash value claims to be a transaction stored in the Merkle tree, it can be quickly verified by judging whether the hash value is consistent with the structure of the Merkle tree.
区块链是用于存储交易的数据结构。区块链网络是用于管理、更新和维护一个或多个区块链结构的计算节点网络。如上所述,区块链网络可以包括公有区块链网络、私有区块链网络或联盟区块链网络。Blockchain is a data structure used to store transactions. The blockchain network is a network of computing nodes used to manage, update and maintain one or more blockchain structures. As mentioned above, the blockchain network can include a public blockchain network, a private blockchain network, or a consortium blockchain network.
在公有区块链网络中,共识过程由共识网络的节点控制。例如,在公有区块链网 络中可以存在成千上万个实体协作处理,每个实体操作该公有区块链网络中的至少一个节点。因此,公有区块链网络可以被认为是参与实体的公有网络。在一些示例中,大多数实体(节点)必须按序对每个区块进行签名,并且将签名后的区块添加到区块链网络的区块链中。公有区块链网络的示例可以包括特定对等支付网络。此外,术语“区块链”不特别指代任何特定的区块链。In the public blockchain network, the consensus process is controlled by the nodes of the consensus network. For example, in a public blockchain network, there may be thousands of entities in collaborative processing, and each entity operates at least one node in the public blockchain network. Therefore, the public blockchain network can be considered as a public network of participating entities. In some examples, most entities (nodes) must sign each block in sequence, and add the signed block to the blockchain of the blockchain network. Examples of public blockchain networks may include specific peer-to-peer payment networks. In addition, the term "blockchain" does not specifically refer to any particular blockchain.
公有区块链网络支持公有交易。公有交易在公有区块链网络内的所有节点之间共享,并且存储在全局区块链中。全局区块链是指跨所有节点复制的区块链。为了达成共识(例如,同意向区块链添加区块),在公有区块链网络内实现共识协议。共识协议的示例包括但不限于:工作量证明(POW,proof-of-work),权益证明(POS,proof-of-stake)和权威证明(POA,proof-of-authority)。在本说明书实施例中,采用POW作为非限制性示例。The public blockchain network supports public transactions. Public transactions are shared among all nodes in the public blockchain network and stored in the global blockchain. A global blockchain refers to a blockchain that is replicated across all nodes. In order to reach a consensus (for example, agree to add a block to the blockchain), a consensus agreement is implemented in the public blockchain network. Examples of consensus protocols include but are not limited to: proof-of-work (POW), proof-of-stake (POS), and proof-of-authority (POA). In the embodiments of this specification, POW is used as a non-limiting example.
私有区块链网络被提供来用于特定实体。私有区块链网络中的各个节点的读写权限被严格控制。因此,私有区块链网络通常也称为许可网络,其对允许谁参与网络以及的网络参与水平(例如,仅在某些交易情形下)进行限制。在私有区块链网络中,可以使用各种类型的访问控制机制(例如,现有参与方对添加新实体进行投票,监管机构控制许可等)。Private blockchain networks are provided for specific entities. The read and write permissions of each node in the private blockchain network are strictly controlled. Therefore, a private blockchain network is usually also called a permissioned network, which restricts who is allowed to participate in the network and the level of network participation (for example, only in certain transaction situations). In a private blockchain network, various types of access control mechanisms can be used (for example, existing participants vote to add new entities, regulatory agencies control permissions, etc.).
联盟区块链网络在参与实体之间是私有的。在联盟区块链网络中,共识过程由授权节点控制。例如,由若干个(例如,10个)实体(例如,金融机构,保险公司)组成的联盟可以操作联盟区块链网络,每个实体操作该联盟区块链网络中的至少一个节点。因此,联盟区块链网络可以被认为是参与实体的私有网络。在一些示例中,每个参与实体(节点)必须按序对每个区块进行签名,并将该区块添加到区块链。在一些示例中,可以由参与实体(节点)的子集(例如,至少7个实体)来对每个区块进行签名,并将该区块添加到区块链。The alliance blockchain network is private among participating entities. In the alliance blockchain network, the consensus process is controlled by authorized nodes. For example, a consortium composed of several (for example, 10) entities (for example, financial institutions, insurance companies) can operate a consortium blockchain network, and each entity operates at least one node in the consortium blockchain network. Therefore, the consortium blockchain network can be considered as a private network of participating entities. In some examples, each participating entity (node) must sign each block in sequence and add the block to the blockchain. In some examples, each block may be signed by a subset of participating entities (nodes) (for example, at least 7 entities), and the block may be added to the blockchain.
在本说明书实施例中参考联盟区块链网络来详细描述本说明书实施例的实施例。然而,可以预期,本说明书实施例的实施例可以在任何适合的区块链网络中实现。In the embodiments of this specification, the embodiments of the embodiments of this specification are described in detail with reference to the alliance blockchain network. However, it is expected that the embodiments of the embodiments of the present specification can be implemented in any suitable blockchain network.
区块链是防篡改的共享数字分类账,其在公有或私有对等网络中记录交易。分类帐被分发到网络中的所有成员节点,并且网络中发生的资产交易历史记录被永久记录在区块中。Blockchain is a tamper-proof shared digital ledger that records transactions in a public or private peer-to-peer network. The ledger is distributed to all member nodes in the network, and the history of asset transactions that occurred in the network is permanently recorded in the block.
共识机制确保分布式区块链网络中的所有网络节点按照相同的顺序执行交易,并 且随后写入相同的分类账。共识模型旨在解决拜占庭问题。在拜占庭问题中,分布式区块链网络中的比如服务器或网络节点的组件可能会出现故障,或者故意向其他节点传播错误的信息。由于其他网络节点需要首先就哪个网络节点首先失败达成共识,从而其他网络节点很难将该组件声明失败并将其排除出区块链网络。The consensus mechanism ensures that all network nodes in the distributed blockchain network execute transactions in the same order and then write them to the same ledger. The consensus model aims to solve the Byzantine problem. In the Byzantine problem, components such as servers or network nodes in the distributed blockchain network may malfunction or deliberately spread wrong information to other nodes. Since other network nodes need to reach a consensus on which network node fails first, it is difficult for other network nodes to declare the component failure and exclude it from the blockchain network.
图1示出了可用于执行根据本说明书实施例的实施例的用于生成具有多层结构的区块链的方法和用于更新多层块链式结构中的信任点的方法的环境100的示例的示意图。在一些示例中,环境100使得实体能够参与区块链网络102。如图1所示,环境100包括网络104、和计算设备/系统106、108。在一些示例中,网络104可以包括局域网(LAN),广域网(WAN),因特网或其组合,并且连接网站、用户设备(例如,计算设备)和后端系统。在一些示例中,可以通过有线和/或无线通信链路来访问网络104。在一些示例中,计算设备/系统106、108通过网络104相互通信,以及通过网络104实现与区块链网络102之间的通信,以及区块链网络102中的节点(或,节点设备)通过网络104来进行通信。通常,网络104表示一个或多个通信网络。在一些情况下,计算设备/系统106、108可以是云计算系统(未示出)的节点,或者每个计算设备/系统106、108可以是单独的云计算系统,其包括通过网络104互连的多个计算机并且用作分布式处理系统。FIG. 1 shows an environment 100 that can be used to execute a method for generating a blockchain with a multi-layer structure and a method for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification. Schematic of the example. In some examples, the environment 100 enables entities to participate in the blockchain network 102. As shown in FIG. 1, the environment 100 includes a network 104, and computing devices/ systems 106, 108. In some examples, the network 104 may include a local area network (LAN), a wide area network (WAN), the Internet, or a combination thereof, and connect a website, a user device (for example, a computing device), and a back-end system. In some examples, the network 104 may be accessed through a wired and/or wireless communication link. In some examples, the computing devices/ systems 106 and 108 communicate with each other through the network 104, and communicate with the blockchain network 102 through the network 104, and the nodes (or node devices) in the blockchain network 102 pass through The network 104 communicates. Generally, the network 104 represents one or more communication networks. In some cases, the computing devices/ systems 106, 108 may be nodes of a cloud computing system (not shown), or each computing device/ system 106, 108 may be a separate cloud computing system, including interconnection through the network 104 Multiple computers and used as a distributed processing system.
在所说明的示例中,计算设备/系统106、108中的每个可以包括能够参与作为区块链网络102中的节点的任何合适的计算系统。计算设备/系统的示例包括但不限于,服务器,台式计算机,笔记本电脑,平板电脑设备和智能手机等。在一些示例中,计算设备/系统106、108上可以安装有用于与区块链网络102交互的一个或多个计算机实现的服务。例如,计算设备/系统106可以上可以安装有第一实体(例如,用户A)的服务,比如,第一实体用于管理其与一个或多个其他实体(例如,其他用户)的交易的交易管理系统。计算设备/系统108可以上可以安装有第二实体(例如,用户B)的服务,比如,第二实体用于管理其与一个或多个其他实体(例如,其他用户)的交易的交易管理系统。在图1的示例中,区块链网络102被表示为节点的对等网络,并且计算设备/系统106、108分别作为参与区块链网络102的第一实体和第二实体的节点。In the illustrated example, each of the computing devices/ systems 106, 108 may include any suitable computing system capable of participating as a node in the blockchain network 102. Examples of computing devices/systems include, but are not limited to, servers, desktop computers, laptops, tablet devices, smart phones, etc. In some examples, one or more computer-implemented services for interacting with the blockchain network 102 may be installed on the computing device/ system 106, 108. For example, the computing device/system 106 may be installed with the services of the first entity (for example, user A), for example, the first entity is used to manage transactions with one or more other entities (for example, other users). Management system. The computing device/system 108 may be installed with services of a second entity (for example, user B), for example, a transaction management system used by the second entity to manage transactions with one or more other entities (for example, other users) . In the example of FIG. 1, the blockchain network 102 is represented as a peer-to-peer network of nodes, and the computing devices/ systems 106, 108 serve as the nodes of the first entity and the second entity participating in the blockchain network 102, respectively.
图2示出了执行根据本说明书实施例的实施例的用于生成具有多层结构的区块链的方法和用于更新多层块链式结构中的信任点的方法的系统架构200的示例的示意图。系统架构200的示例包括分别与参与方A,参与方B和参与方C对应的参与方系统202、204、206。每个参与方(例如,用户,企业)参与被提供来作为对等网络的区块链网络212。区块链网络212包括多个节点214,其中,节点214中的至少一些节点在区块链 216中记录信息,并且所记录的信息不可更改。尽管在区块链网络212内示意性地示出了单个区块链216,但是可以提供区块链216的多个副本,并且在区块链网络212中维护多个副本,如稍后详细描述的。FIG. 2 shows an example of a system architecture 200 that executes the method for generating a blockchain with a multi-layer structure and the method for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification Schematic diagram. An example of the system architecture 200 includes the participant systems 202, 204, and 206 corresponding to the participant A, the participant B, and the participant C, respectively. Each participant (eg, user, enterprise) participates in the blockchain network 212 provided as a peer-to-peer network. The blockchain network 212 includes a plurality of nodes 214, wherein at least some of the nodes 214 record information in the blockchain 216, and the recorded information cannot be changed. Although a single blockchain 216 is schematically shown within the blockchain network 212, multiple copies of the blockchain 216 may be provided, and multiple copies are maintained in the blockchain network 212, as described in detail later of.
在所示出的示例中,每个参与方系统202、204、206分别由参与方A,参与方B和参与方C提供,或者被提供来作为参与方A,参与方B和参与方C,并且充当区块链网络212内的对应节点214。如这里所使用的,节点通常是指连接到区块链网络212的单个系统(例如,计算机,服务器),并且使得相应的参与方能够参与区块链网络。在图2示出的示例中,参与方对应于每个节点214。然而,一个参与方可以操作区块链网络212内的多个节点214,和/或多个参与方可以共享单个节点214。在一些示例中,参与方系统202、204、206使用协议(例如,超文本传输协议安全(HTTPS))和/或使用远程过程调用(RPC)来与区块链网络212通信,或者通过区块链网络212进行通信。In the example shown, each participant system 202, 204, 206 is provided by participant A, participant B, and participant C, or provided as participant A, participant B, and participant C, respectively, And it serves as the corresponding node 214 in the blockchain network 212. As used herein, a node generally refers to a single system (eg, computer, server) connected to the blockchain network 212 and enables corresponding participants to participate in the blockchain network. In the example shown in FIG. 2, the participant corresponds to each node 214. However, one participant can operate multiple nodes 214 within the blockchain network 212, and/or multiple participants can share a single node 214. In some examples, the participant systems 202, 204, 206 use protocols (e.g., Hypertext Transfer Protocol Security (HTTPS)) and/or use remote procedure calls (RPC) to communicate with the blockchain network 212, or through the blockchain The chain network 212 communicates.
节点214在区块链网络212的参与度可以不同。例如,一些节点214可以参与共识过程(例如,作为将区块添加到区块链216的矿工节点),而其他节点214不参与共识过程。作为另一示例,一些节点214存储区块链216的完整副本,而其他节点214仅存储区块链216的部分副本。在图2的示例中,参与方系统202、204、206各自存储区块链216的完整副本216'、216”、216”'。The degree of participation of the node 214 in the blockchain network 212 may vary. For example, some nodes 214 may participate in the consensus process (eg, as miner nodes that add blocks to the blockchain 216), while other nodes 214 do not participate in the consensus process. As another example, some nodes 214 store a complete copy of the blockchain 216, while other nodes 214 only store a partial copy of the blockchain 216. In the example of Figure 2, the participant systems 202, 204, 206 each store a complete copy of the blockchain 216 216', 216", 216"'.
区块链(例如,图2中的区块链216)由一连串的区块组成,每个区块存储数据。数据的示例可以包括表示两个或更多参与方之间的交易的交易数据。在本说明书实施例中,交易被使用来作为非限制性示例,可以预期的是,任何适当的数据都可以存储在区块链中(例如,文档,图像,视频,音频)。交易的示例可以包括但不限于交换有价值的东西(例如,资产,产品,服务和货币等)。交易数据被不可更改地存储在区块链中。A blockchain (for example, the blockchain 216 in FIG. 2) is composed of a series of blocks, and each block stores data. Examples of data may include transaction data representing transactions between two or more participants. In the embodiments of this specification, transactions are used as a non-limiting example, and it is expected that any appropriate data can be stored in the blockchain (for example, documents, images, videos, audios). Examples of transactions may include, but are not limited to, the exchange of valuable things (for example, assets, products, services, currency, etc.). Transaction data is stored immutably in the blockchain.
在存储在区块中之前,对交易数据进行哈希处理。哈希处理是将(作为字符串数据提供的)交易数据转换为固定长度的哈希值(也被作为字符串数据提供)的过程。通过对交易数据进行哈希处理后,即使交易数据出现轻微更改,也会导致得到完全不同的哈希值。哈希值通常是通过使用哈希函数来对交易数据进行哈希处理而生成的。哈希函数的示例包括但不限于安全散列算法(SHA)-256,其输出256比特的哈希值。Before storing in the block, hash the transaction data. Hashing is the process of converting transaction data (provided as string data) into a fixed-length hash value (also provided as string data). After the transaction data is hashed, even a slight change in the transaction data will result in a completely different hash value. The hash value is usually generated by hashing transaction data using a hash function. Examples of hash functions include, but are not limited to, Secure Hash Algorithm (SHA)-256, which outputs a 256-bit hash value.
多个交易的交易数据可以在被哈希化之后存储在区块中。例如,对两个交易数据进行哈希处理得到两个哈希值,然后,对所得到的两个哈希值再次进行哈希处理以得到另一哈希值。重复该过程,直到对于要存储在区块中的所有交易,得到单个哈希值。该哈希值被称为Merkle根哈希,并且被存储在区块的头部。任何交易的更改都会导致其 哈希值发生变化,最终导致Merkle根哈希值发生变化。The transaction data of multiple transactions can be stored in the block after being hashed. For example, two transaction data are hashed to obtain two hash values, and then the two obtained hash values are hashed again to obtain another hash value. This process is repeated until a single hash value is obtained for all transactions to be stored in the block. This hash value is called the Merkle root hash and is stored at the head of the block. Any transaction change will cause its hash value to change, and eventually the Merkle root hash value will change.
通过共识协议来将区块添加到区块链中。区块链网络中的多个节点参与共识协议,并且经过竞争之后将区块添加到区块链中。这样的节点被称为矿工节点(或记账节点)。以上介绍的POW用作非限制性示例。The block is added to the blockchain through a consensus protocol. Multiple nodes in the blockchain network participate in the consensus protocol and add blocks to the blockchain after competition. Such nodes are called miner nodes (or accounting nodes). The POW introduced above serves as a non-limiting example.
矿工节点执行共识过程来将交易(所对应的区块)添加到区块链。虽然多个矿工节点参与共识过程,但只有一个矿工节点可以将区块写入区块链。也就是说,矿工节点在共识过程中竞争以将其区块添加到区块链中。更详细地,矿工节点周期性地从交易池中收集待处理的交易(例如,直到达到在区块中可以包括的交易数量的预定限制,如果有的话)。交易池包括来自区块链网络中的参与方的交易消息。矿工节点创建区块,并将交易添加到区块中。在将交易添加到区块之前,矿工节点检查待添加的交易中是否存在区块链的区块中具有的交易。如果该交易已被添加到另一个区块中,则该交易将被丢弃。Miner nodes perform a consensus process to add transactions (corresponding blocks) to the blockchain. Although multiple miner nodes participate in the consensus process, only one miner node can write a block to the blockchain. In other words, miner nodes compete in the consensus process to add their blocks to the blockchain. In more detail, the miner node periodically collects pending transactions from the transaction pool (for example, until a predetermined limit on the number of transactions that can be included in the block is reached, if any). The transaction pool includes transaction messages from participants in the blockchain network. Miner nodes create blocks and add transactions to the blocks. Before adding the transaction to the block, the miner node checks whether there is a transaction in the block of the blockchain among the transactions to be added. If the transaction has been added to another block, the transaction will be discarded.
矿工节点生成区块头,对区块中的所有交易进行哈希处理,并且成对地组合哈希值以生成进一步的哈希值,直到针对区块中的所有交易得到单个哈希值(Merkle根哈希)。然后,将Merkle根哈希添加到区块头中。矿工还确定区块链中的最新区块(即,添加到区块链的最后一个区块)的哈希值。矿工节点还可以在区块头中添加随机数值(noune值)和时间戳。在挖掘过程中,矿工节点尝试找到满足所需参数的哈希值。矿工节点不断更改nonce值,直到找到满足所需参数的哈希值。The miner node generates a block header, hashes all transactions in the block, and combines the hash values in pairs to generate further hash values until a single hash value (Merkle root) is obtained for all transactions in the block. Hash). Then, add the Merkle root hash to the block header. The miner also determines the hash value of the latest block in the blockchain (ie, the last block added to the blockchain). Miner nodes can also add random values (noune values) and timestamps to the block header. During the mining process, the miner node tries to find a hash value that meets the required parameters. The miner node keeps changing the nonce value until it finds a hash value that meets the required parameters.
区块链网络中的每个矿工都试图找到满足所需参数的哈希值,并且以这种方式彼此竞争。最终,一个矿工节点找到满足所需参数的哈希值,并将该哈希值通告给区块链网络中的所有其他矿工节点。其他矿工节点验证哈希值,如果确定为正确,则验证区块中的每个交易,接受该区块,并将该区块附加到它们的区块链副本中。以这种方式,区块链的全局状态在区块链网络内的所有矿工节点上达成一致。上述过程是POW共识协议。Every miner in the blockchain network tries to find a hash value that meets the required parameters and competes with each other in this way. Finally, a miner node finds a hash value that meets the required parameters and advertises the hash value to all other miner nodes in the blockchain network. Other miner nodes verify the hash value, and if it is determined to be correct, verify each transaction in the block, accept the block, and attach the block to their copy of the blockchain. In this way, the global state of the blockchain is agreed upon on all miner nodes within the blockchain network. The above process is a POW consensus protocol.
在图2所提供的示例中,参与方A想要向参与方B发送一定数量的资金。参与方A生成交易消息,并将交易消息发送到区块链网络,该交易消息被增加到交易池中。区块链网络中的每个矿工节点创建区块,并从交易池中获取交易,并将交易添加到区块。按照这种方式,参与方A所发布的交易被添加到矿工节点的区块中。In the example provided in Figure 2, participant A wants to send a certain amount of funds to participant B. Participant A generates a transaction message and sends the transaction message to the blockchain network, and the transaction message is added to the transaction pool. Each miner node in the blockchain network creates a block, obtains transactions from the transaction pool, and adds the transaction to the block. In this way, the transaction issued by participant A is added to the block of the miner node.
在一些区块链网络中,实施密码技术来维护交易的隐私性。例如,如果两个节点 想要保持交易私密性,使得区块链网络中的其他节点不能获悉交易细节,则节点可以对交易数据进行加密处理。加密方法的示例包括但不限于对称加密和非对称加密。对称加密是指使用单个密钥进行加密(根据明文生成密文)和解密(根据密文生成明文)的加密过程。在对称加密中,多个节点可以使用相同的密钥,因此每个节点都可以对交易数据进行加密/解密。In some blockchain networks, cryptography is implemented to maintain the privacy of transactions. For example, if two nodes want to maintain the privacy of the transaction so that other nodes in the blockchain network cannot learn the details of the transaction, the node can encrypt the transaction data. Examples of encryption methods include, but are not limited to, symmetric encryption and asymmetric encryption. Symmetric encryption refers to the encryption process that uses a single key to encrypt (generate ciphertext based on plaintext) and decrypt (generate plaintext based on ciphertext). In symmetric encryption, multiple nodes can use the same key, so each node can encrypt/decrypt transaction data.
非对称加密是指使用密钥对来进行加密。每个密钥对包括私钥和公钥,私钥仅对于相应节点是已知的,并且公钥对于区块链网络中的任何或所有其他节点是已知的。节点可以使用另一个节点的公钥来加密数据,并且可以使用其他节点的私钥来解密经过加密的数据。例如,再次参考图1。参与方A可以使用参与方B的公钥来加密数据,并将加密数据发送给参与方B.参与方B可以使用其私钥来解密加密数据(密文)并提取原始数据(明文)。使用节点的公钥加密的消息,只能使用该节点的私钥解密。Asymmetric encryption refers to the use of key pairs for encryption. Each key pair includes a private key and a public key. The private key is only known to the corresponding node, and the public key is known to any or all other nodes in the blockchain network. A node can use another node's public key to encrypt data, and can use another node's private key to decrypt the encrypted data. For example, refer to Figure 1 again. Participant A can use the public key of participant B to encrypt data and send the encrypted data to participant B. Participant B can use its private key to decrypt the encrypted data (ciphertext) and extract the original data (plain text). Messages encrypted with the public key of the node can only be decrypted with the private key of the node.
非对称加密用于提供数字签名,这使得交易中的参与方能够确认交易中的其他参与方以及交易的有效性。例如,节点可以对消息进行数字签名,而另一个节点可以根据参与方A的数字签名确认消息是由该节点发送的。数字签名还可以用于确保消息在传输过程中不被篡改。例如,再次参考图1。参与方A将向参与方B发送消息。参与方A生成消息的哈希值,然后使用其私钥对哈希值进行加密来生成数字签名。参与方A将该数字签名附加到消息,并将具有数字签名的消息发送给参与方B。参与方B使用参与方A的公钥解密数字签名,从而解密出对应的哈希值。参与方B对所接收的消息进行哈希处理以得到另一哈希值,然后比较两个哈希值。如果哈希值相同,则参与方B可以确认该消息确实来自参与方A,并且未被篡改。Asymmetric encryption is used to provide digital signatures, which enables participants in a transaction to confirm other participants in the transaction and the validity of the transaction. For example, a node can digitally sign a message, and another node can confirm that the message was sent by the node based on the digital signature of participant A. Digital signatures can also be used to ensure that messages are not tampered with during transmission. For example, refer to Figure 1 again. Participant A will send a message to participant B. Participant A generates a hash value of the message, and then uses its private key to encrypt the hash value to generate a digital signature. Participant A attaches the digital signature to the message, and sends the message with the digital signature to participant B. Participant B uses the public key of participant A to decrypt the digital signature, thereby decrypting the corresponding hash value. Participant B hashes the received message to obtain another hash value, and then compares the two hash values. If the hash value is the same, participant B can confirm that the message is indeed from participant A and has not been tampered with.
虽然以上对可以适用本说明书实施例的区块链场景进行了说明,但是本说明书实施例还可以适用于其它块链式场景。例如,本说明书实施例还可以适用于类区块链系统。在类区块链系统中,数据可以同样地采用块链式结构来存储,与区块链系统不同的是,在类区块链系统中,存储于块链式结构中的块链数据不需要经过共识处理。Although the block chain scenarios that can be applied to the embodiments of this specification are described above, the embodiments of this specification can also be applied to other block chain scenarios. For example, the embodiments of this specification can also be applied to a blockchain-like system. In the quasi-blockchain system, data can be stored in the same block-chain structure. Unlike the blockchain system, in the quasi-blockchain system, the block-chain data stored in the block-chain structure does not need After consensus processing.
在以下所描述的实施例中,“底层块链式层”是指多层块链式结构的最下层块链式层,“上层块链式层”是指该多层结构中的除底层块链式层之外的各个块链式层,“块链式层”包括底层块链式层和各个上层块链式层。“底层区块”是指底层块链式层中的区块,“上层区块”是指各个上层块链式层中的区块。“相邻上层块链式层”是指相邻的“上一层上层块。“下层”是指“下一层”,例如“下层区块”是指某块链式层的下一层块链式层中的区块。“基准区块”是指各个块链式层中满足预定条件而触发生成对 应上层区块的区块,“上一基准区块”是指在同一块链式层中的上一基准区块,例如“基准区块的上一基准区块”中的“基准区块”和“上一基准区块”是指在同一块链式层中相邻的基准区块。“前一区块”或“后一区块”是指在本说明书中提及的验证路径中的某区块的前一区块或后一区块,该区块与其前一区块或后一区块可能位于同一块链式层,也可能位于不同的块链式层。“块高”是指区块在相应块链式层中所处的位置。例如,如果定义各个块链式层的第一个区块的块高为0,则该块链式层的第三个区块的块高可以为2。类似地,如果定义各个块链式层的第一个区块的块高为1,则该块链式层的第三个区块的块高可以为3。块高可以以任意有序的方式来确定,只要能够基于块高定位各个区块在相应块链式层的位置即可。In the embodiments described below, the "bottom block chain layer" refers to the lowermost block chain layer of the multi-layer block chain structure, and the "upper block chain layer" refers to the block except the bottom layer in the multi-layer structure. For each block chain layer other than the chain layer, the "block chain layer" includes the bottom block chain layer and each upper block chain layer. "Bottom block" refers to the block in the bottom block chain layer, and "upper block" refers to the block in each upper block chain layer. "Adjacent upper block chain layer" refers to the adjacent "upper layer block. "Lower layer" refers to the "next layer", for example, "lower block" refers to the next layer of a block chain layer. Blocks in the chain layer. The "base block" refers to the block in each block chain layer that meets the predetermined conditions and triggers the generation of the corresponding upper block. The "previous benchmark block" refers to the block in the same block chain layer. The previous reference block in the "reference block", for example, the "reference block" and "previous reference block" in the "previous reference block of the reference block" refer to adjacent reference blocks in the same block chain layer "Previous block" or "next block" refers to the previous block or the next block of a block in the verification path mentioned in this manual, and the block is or The latter block may be located in the same block chain layer or in a different block chain layer. "Block height" refers to the position of the block in the corresponding block chain layer. For example, if each block chain layer is defined The block height of the first block of the layer is 0, then the block height of the third block of the block chain layer can be 2. Similarly, if the block height of the first block of each block chain layer is defined If the height is 1, the block height of the third block of the block chain layer can be 3. The block height can be determined in any orderly manner, as long as each block can be located in the corresponding block chain layer based on the block height The location is fine.
图3是根据本说明书的一个实施例的用于生成多层块链式结构的方法的流程图。Fig. 3 is a flowchart of a method for generating a multi-layer block chain structure according to an embodiment of the present specification.
如图3所示,在块320,基于交易数据生成多层块链式结构的底层块链式层的底层区块。底层块链式层的底层区块可以采用生成块链式结构的任意方法生成,例如可以采用上述参考图1和图2说明的区块链生成方法生成,或采用比特币、以太坊等区块链生成方法来生成。各个交易数据可以在经过各个区块链节点的共识处理和智能合约执行处理之后被打包成底层区块。在类区块链系统中,被上链的交易数据可以不经过共识处理。As shown in FIG. 3, at block 320, the bottom block of the bottom block chain layer of the multi-layer block chain structure is generated based on the transaction data. The underlying block of the underlying block chain layer can be generated by any method that generates a block chain structure. For example, it can be generated using the block chain generation method described above with reference to Figures 1 and 2, or using blocks such as Bitcoin and Ethereum. Chain generation method to generate. Each transaction data can be packaged into the underlying block after the consensus processing of each blockchain node and the smart contract execution processing. In a blockchain-like system, the transaction data on the chain can be processed without consensus.
在块340,确定底层块链式层中是否存在触发上层块链式层生成条件的基准区块。各个块链式层中的基准区块是与上层块链式层中的各个区块对应的区块。例如,可以基于底层块链式层中的各个区块与其上一基准区块之间的区块数目是否达到指定数目来确定基准区块,还可以基于底层块链式层中的各个区块的生成时间与其上一基准区块的生成时间之间的时间间隔是否达到指定时间间隔来确定基准区块。在本说明书中,在确定区块与另一区块之间的区块数时将该另一区块包括在内。In block 340, it is determined whether there is a reference block in the underlying block chain layer that triggers the generation condition of the upper block chain layer. The reference block in each block chain layer is a block corresponding to each block in the upper block chain layer. For example, the reference block can be determined based on whether the number of blocks between each block in the underlying block chain layer and the previous reference block reaches a specified number, and it can also be based on the number of blocks in the underlying block chain layer. Whether the time interval between the generation time and the generation time of the previous reference block reaches the specified time interval to determine the reference block. In this specification, when determining the number of blocks between a block and another block, the other block is included.
在确定出基准区块时,在块360,响应于底层块链式层中存在触发上层块链式层生成条件的基准区块,至少部分地基于该基准区块的区块信息,生成上层块链式层的对应上层区块。多层块链式结构可以具有一个上层块链式层,还可以包括多个上层块链式层。当多层块链式结构具有多个上层块链式层时,在基于底层块链式层生成底层块链式层之后,还可以以同样的方式,针对各个上层块链式层,逐次地基于该上层块链式层生成相邻上层块链式层。具体地,可以针对各个上层块链式层,确定该上层块链式层是否存在触发上层块链式层生成条件的基准区块。当存在触发上层块链式层生成条件的基准区块时,至少部分地基于该基准区块的区块信息生成该上层块链式层的相邻上层块链式层。以下结合图4来对多层块链式结构的生成过程进行描述。When the reference block is determined, in block 360, in response to the presence of a reference block in the underlying block chain layer that triggers the generation condition of the upper block chain layer, the upper block is generated based at least in part on the block information of the reference block The corresponding upper block of the chain layer. The multi-layer block chain structure may have an upper block chain layer, and may also include a plurality of upper block chain layers. When a multi-layer block chain structure has multiple upper block chain layers, after the bottom block chain layer is generated based on the bottom block chain layer, the same way can also be used for each upper block chain layer, successively based on The upper block chain layer generates an adjacent upper block chain layer. Specifically, for each upper block chain layer, it can be determined whether the upper block chain layer has a reference block that triggers the generation condition of the upper block chain layer. When there is a reference block that triggers the generation condition of the upper block chain layer, the adjacent upper block chain layer of the upper block chain layer is generated based at least in part on the block information of the reference block. The following describes the generation process of the multi-layer block chain structure with reference to FIG. 4.
图4是根据本说明书的一个实施例的多层块链式结构的示意图。在图4中示意性地示出了四个块链式层,但是本说明书实施例对块链式层的数量没有限制。在图4中,B ij表示第i个块链式层的第j个区块,例如B 11表示第一个块链式层(即底层块链式层)的第一个区块,B 22表示第二个块链式层(即第一上层块链式层)的第二个区块。 Fig. 4 is a schematic diagram of a multi-layer block chain structure according to an embodiment of the present specification. Four block chain layers are schematically shown in FIG. 4, but the embodiment of this specification does not limit the number of block chain layers. In Figure 4, B ij represents the j-th block of the i-th block chain layer, for example, B 11 represents the first block of the first block chain layer (ie, the underlying block chain layer), and B 22 Represents the second block of the second block chain layer (that is, the first upper block chain layer).
在图4中,B 11为创世区块,创世区块是指底层块链式层的第一个区块。随着块链式系统处理的交易数据的增加,依次生成底层块链式层的区块B 12至B 111等。各个上层块链式层基于该上层块链式层的下层块链式层生成。例如,第一上层块链式层基于底层块链式层生成,第二上层块链式层基于第一上层块链式层生成。各个上层块链式层的第一个区块可以被称为头区块(如头区块B 21、B 31、B 41)。 In Figure 4, B 11 is the genesis block, which refers to the first block of the underlying blockchain layer. As the transaction data processed by the block chain system increases, blocks B 12 to B 111 of the underlying block chain layer are sequentially generated. Each upper block chain layer is generated based on the lower block chain layer of the upper block chain layer. For example, the first upper block chain layer is generated based on the bottom block chain layer, and the second upper block chain layer is generated based on the first upper block chain layer. The first block of each upper block chain layer can be called a header block (for example, header blocks B 21 , B 31 , B 41 ).
在一个示例中,可以将各个块链式层的第一个区块确定为该块链式层的第一个基准区块(例如区块B 11、B 21、B 31),然后基于该基准区块生成该块链式层的上层块链式层的头区块(例如区块B 21、B 31、B 41)。可以针对各个上层块链式层,使该上层块链式层的头区块包括该上层块链式层的下层块链式层的第一个区块的哈希值。各个上层块链式层的头区块还可以基于创世区块来生成,例如各个上层块链式层的头区块可以包括创世区块的哈希值。在另一示例中,在生成各个上层块链式层的头区块时,可以复制创世区块以生成该上层块链式层的头区块。通过使各个头区块基于创世区块生成,能够快速地从创世区块定位至各个上层块链式层。 In an example, the first block of each blockchain layer can be determined as the first reference block of the blockchain layer (for example, blocks B 11 , B 21 , B 31 ), and then based on the reference block The block generates the header block of the upper block chain layer of the block chain layer (for example, blocks B 21 , B 31 , B 41 ). For each upper block chain layer, the header block of the upper block chain layer may include the hash value of the first block of the lower block chain layer of the upper block chain layer. The header block of each upper blockchain layer may also be generated based on the genesis block. For example, the header block of each upper blockchain layer may include the hash value of the genesis block. In another example, when the header block of each upper block chain layer is generated, the genesis block can be copied to generate the header block of the upper block chain layer. By generating each header block based on the genesis block, it is possible to quickly locate from the genesis block to each upper block chain layer.
虽然图4中示出了各个上层块链式层的头区块均与创世区块对应的情形,但是在另一示例中,可以针对各个块链式层,将与该块链式层的第一个区块之间的区块数达到指定数目的区块或生成时间与第一个区块的生成时间之间的时间间隔达到指定时间间隔的区块确定为该块链式层的第一个基准区块。例如,可以对图4所示出的示例进行如下简单变形,即各个上层块链式层可以不包括图4所示出的区块B 21、B 31、B 41,从而将图4示出的B 22、B 32、B 42作为第一个区块。作为示例,可以将底层块链式层的区块B 13确定为底层块链式层的第一个基准区块,然后可以基于B 13来生成第一上层块链式层的第一个上层区块。在该示例中,各个上层块链式层的第一个上层区块可以包括创世区块的哈希值,以快速地从底层块链式层定位至各个上层块链式层,或从各个上层块链式层定位于至底层块链式层。 Although Figure 4 shows a situation where the header blocks of each upper block chain layer correspond to the genesis block, in another example, for each block chain layer, the block chain layer can be compared with the block chain layer. The number of blocks between the first block reaches the specified number of blocks or the time interval between the generation time and the generation time of the first block reaches the specified time interval is determined as the first block chain layer. A benchmark block. For example, the example shown in FIG. 4 can be simply modified as follows, that is, each upper block chain layer may not include the blocks B 21 , B 31 , and B 41 shown in FIG. B 22 , B 32 , and B 42 are used as the first block. As an example, the block B 13 of the bottom block chain layer can be determined as the first reference block of the bottom block chain layer, and then the first upper zone of the first upper block chain layer can be generated based on B 13 Piece. In this example, the first upper block of each upper block chain layer can include the hash value of the genesis block to quickly locate from the bottom block chain layer to each upper block chain layer, or from each The upper block chain layer is positioned to the bottom block chain layer.
在确定各个块链式层的第一个基准区块之后,可以以与上一基准区块之间的区块数目达到指定数目或生成时间与上一基准区块的生成时间之间的间隔达到指定时间间隔作为触发条件,来确定各个块链式层的其它基准区块。例如,可以利用如下述参照图 5A至图6B描述的过程来确定各个块链式层的各个基准区块,并对应于所确定的基准区块生成上层区块。各个块链式层的生成可以是实时并行执行的,还可以在底层块链式层的各个区块被生成之后,根据系统的计算资源占用情况,在合适的时机生成的各个上层块链式层。After determining the first reference block of each blockchain layer, the number of blocks from the previous reference block can reach the specified number or the interval between the generation time and the generation time of the previous reference block can reach Specify the time interval as the trigger condition to determine other reference blocks of each block chain layer. For example, the process described below with reference to FIG. 5A to FIG. 6B may be used to determine each reference block of each block chain layer, and generate an upper layer block corresponding to the determined reference block. The generation of each block chain layer can be executed in parallel in real time, or after each block of the underlying block chain layer is generated, according to the system's computing resource occupancy, each upper block chain layer generated at the right time .
图5A和图5B示出了与底层块链式层非同步地生成上层块链式层的示例。可以在各个块链式层中的各个区块被生成之后,在合适的时机(如系统资源充裕时),遍历该块链式层中未执行基准区块确定过程的区块,即一一查询各个区块,以确定当前被查询区块是否是触发上层块链式层生成条件的基准区块。在确定出基准区块后,可以生成上邻上层块链式层的对应上层区块。例如,可以在生成各个底层区块之后,在合适的时间段遍历所生成各个底层区块,以确定出触发生成第一上层块链式层中的上层区块的基准区块。5A and 5B show an example in which the upper block chain layer is generated asynchronously with the lower block chain layer. After each block in each block chain layer is generated, at an appropriate time (such as when system resources are abundant), traverse the blocks in the block chain layer that have not performed the benchmark block determination process, that is, query one by one Each block is used to determine whether the currently queried block is a reference block that triggers the generation conditions of the upper block chain layer. After the reference block is determined, the corresponding upper block adjacent to the upper block chain layer can be generated. For example, after each low-level block is generated, each generated low-level block may be traversed at a suitable time period to determine the reference block that triggers the generation of the upper-level block in the first upper-level block chain layer.
图5A是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的流程图。Fig. 5A is a flowchart of a reference block determination process in a method for generating a multi-layer block chain structure according to an embodiment of the present specification.
如图5A所示,在块5A02,针对各个块链式层,确定该块链式层的当前被查询区块与上一基准区块之间的区块数。然后在块5A04,确定当前被查询区块与上一基准区块之间的区块数是否达到指定数目。在本说明书实施例中,区块与另一区块之间的区块包括该另一区块,相应地,在提及区块与另一区块之间的区块数时,应将该另一区块计算在内。例如,B 11和B 13之间的区块包括B 12和B 13,相应地,B 11与B 13之间的区块数为2。 As shown in FIG. 5A, in block 5A02, for each block chain layer, the number of blocks between the currently queried block and the previous reference block of the block chain layer is determined. Then in block 5A04, it is determined whether the number of blocks between the currently queried block and the previous reference block reaches the specified number. In the embodiment of this specification, the block between a block and another block includes the other block. Accordingly, when referring to the number of blocks between a block and another block, the The other block is included. For example, the block between B 11 and B 13 includes B 12 and B 13 , and accordingly, the number of blocks between B 11 and B 13 is 2.
如果当前被查询区块与上一基准区块之间的区块数达到指定数目,则在块5A06,将当前被查询区块确定为基准区块。可以设定各个块链式层的基准区块之间的区块数,例如对于图4中的示例,可个基准区块与上一基准区块之间的区块数为2。如果当前被查询区块与上一基准区块之间的区块数达到了所设定的指定数目,则可以将当前被查询区块确定为基准区块。If the number of blocks between the currently queried block and the previous reference block reaches the specified number, in block 5A06, the currently queried block is determined as the reference block. The number of blocks between the reference blocks of each block chain layer can be set. For example, for the example in FIG. 4, the number of blocks between a reference block and the previous reference block can be 2. If the number of blocks between the currently queried block and the previous reference block reaches the set specified number, the currently queried block can be determined as the reference block.
如果当前被查询区块与上一基准区块之间的区块数未达到指定数目,则在块5A08,将该块链式层的下一区块作为当前被查询区块,并再次执行上述过程。If the number of blocks between the currently queried block and the previous reference block does not reach the specified number, in block 5A08, the next block of the blockchain layer is regarded as the current queried block, and the above is executed again process.
图5B是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的另一示例流程图。FIG. 5B is another example flowchart of the reference block determination process in the method for generating a multi-layer block chain structure according to an embodiment of the present specification.
如图5B所示,在块5B02,针对各个块链式层,确定该块链式层的当前被查询区 块与上一基准区块的生成时间之间的时间时隔。各个区块的生成时间例如可以基于该区块的时间戳来确定。然后在块5B04,判断所确定出的时间间隔是否达到指定时间间隔。As shown in Fig. 5B, in block 5B02, for each block chain layer, the time interval between the current inquired block of the block chain layer and the generation time of the previous reference block is determined. The generation time of each block can be determined based on the timestamp of the block, for example. Then in block 5B04, it is judged whether the determined time interval reaches the specified time interval.
如果所确定出的时间间隔达到指定时间间隔,则在块5B06,将当前被查询区块确定为基准区块。如果所确定出的时间间隔未达到指定时间间隔,则在块5B08,将该块链式层的下一区块作为当前被查询区块,并再次执行上述过程。If the determined time interval reaches the specified time interval, in block 5B06, the currently queried block is determined as the reference block. If the determined time interval does not reach the specified time interval, in block 5B08, the next block of the block chain layer is regarded as the currently queried block, and the above process is executed again.
图6A和6B示出了与底层块链式层同步地生成上层块链式层的示例。可以对各个块链式层中的区块进行监听,在监听到各个块链式层有新区块加入时,确定该新区块是否是触发上层块链式层生成条件的基准区块。对于全量节点,新加入的区块可以是新生成的区块,对于轻量节点,新加入的区块还可以是从全量节点获取的区块。轻量节点处的各个区块可以仅包括区块头。轻量节点可以在本地生成上层块链式层中和上层区块,还可以从全量节点处获取各个上层块链式层。6A and 6B show an example in which the upper block chain layer is generated in synchronization with the lower block chain layer. It is possible to monitor the blocks in each block chain layer. When a new block is added to each block chain layer, it is determined whether the new block is a reference block that triggers the generation conditions of the upper block chain layer. For full nodes, the newly added block can be a newly generated block, and for light nodes, the newly added block can also be a block obtained from the full node. Each block at the lightweight node may only include the block header. Lightweight nodes can locally generate upper-level block chain layers and upper-level blocks, and can also obtain upper-level block chain layers from all nodes.
图6A是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的另一示例流程图。Fig. 6A is another example flowchart of a reference block determination process in a method for generating a multi-layer block chain structure according to an embodiment of the present specification.
如图6A所示,在块6A02和块6A04,监听各个块链式层是否有新区块加入。As shown in Fig. 6A, in blocks 6A02 and 6A04, each block chain layer is monitored to see if there are new blocks added.
当某个块链式层有新区块加入时,在块6A08,确定新区块与上一基准区块之间的区块数。然后,在块6A10,判断所确定的区块数是否达到了指定数目。When a new block is added to a certain block chain layer, in block 6A08, the number of blocks between the new block and the previous reference block is determined. Then, in block 6A10, it is judged whether the determined number of blocks has reached the specified number.
如果所确定的区块数达到指定数目,则在块6A12,将该新区块为相应块链式层的基准区块。如果所确定的区块数未达到指定数目,则继续对该块链式层进行监听。If the determined number of blocks reaches the specified number, in block 6A12, the new block is the reference block of the corresponding block chain layer. If the determined number of blocks does not reach the specified number, then continue to monitor the block chain layer.
图6B是根据本说明书的一个实施例的用于生成多层块链式结构的方法中的基准区块确定过程的另一示例流程图。FIG. 6B is another example flowchart of the reference block determination process in the method for generating a multi-layer block chain structure according to an embodiment of the present specification.
图6B所示,在块6B02和块6B04,监听各个块链式层是否有新区块生成。As shown in Figure 6B, in blocks 6B02 and 6B04, each block chain layer is monitored to see if there is a new block generated.
当某个块链式层有新区块生成时,在块6B08,确定新区块的生成时间与上一基准区块的生成时间之间的时间间隔。然后,在块6B10,判断所确定的时间间隔是否达到了指定数目。When a new block is generated in a certain block chain layer, in block 6B08, the time interval between the generation time of the new block and the generation time of the previous reference block is determined. Then, in block 6B10, it is judged whether the determined time interval has reached a specified number.
如果所确定的时间间隔达到指定数目,则在块6B12,将该新区块为相应块链式层的基准区块。如果所确定的时间间隔未达到指定数目,则继续对该块链式层进行监听。If the determined time interval reaches the specified number, in block 6B12, the new block is the reference block of the corresponding block chain layer. If the determined time interval does not reach the specified number, then continue to monitor the block chain layer.
以图4为例,在该多层块链式结构中,底层块链式层的基准区块为B 11、B 13、B 15等,第一上层块链式层的基准区块为B 21、B 23、B 25等,第二上层块链式层的基准区块 为B 31、B 33等。 Taking Figure 4 as an example, in the multi-layer block chain structure, the reference block of the bottom block chain layer is B 11 , B 13 , B 15, etc., and the reference block of the first upper block chain layer is B 21 , B 23 , B 25, etc., the reference block of the second upper block chain layer is B 31 , B 33 and so on.
需要说明的是,在本说明书的实施例中,在基于与上一基准区块之间的区块数目是否达到指定数目来确定基准区块时,同一块链式层的相邻两个基准区块之前的区块数目可以相同也可以不同,各个块链式层所对应的指定数目可以相同也可以不同。此外,当基于生成时间之间的时间间隔来确定基准区块时,同一块链式层的相邻两个基准区块之前的生成时间间隔可以相同或不相同,各个块链式层所对应的指定时间间隔可以相同也可以不同。在一个示例中,可以使各个块链式层的各个基准区块对应的指定数目或指定时间间隔均相同,或者可以针对各个块链式层,使该块链式层的各个基准区块对应的指定数目或指定时间间隔均相同。在该块链式层的各个基准区块对应的指定数目或指定时间间隔均相同时,还可以基于预定规则来确定各个块链式层所对应的指定数目或指定时间间隔。例如,可以使得各个块链式层的相邻基准区块间的区块数以等差数列方式递增。由此,能够基于各个基准区块对应的指定数目或指定时间间隔,实现各个块链式层之间的快速定位。It should be noted that, in the embodiment of this specification, when the reference block is determined based on whether the number of blocks between the previous reference block and the previous reference block reaches the specified number, two adjacent reference blocks of the same block chain layer The number of blocks before the block can be the same or different, and the designated number corresponding to each block chain layer can be the same or different. In addition, when the reference block is determined based on the time interval between the generation times, the generation time interval before two adjacent reference blocks of the same block chain layer may be the same or different. Each block chain layer corresponds to The specified time interval can be the same or different. In an example, the specified number or specified time interval corresponding to each reference block of each block chain layer can be made the same, or for each block chain layer, each reference block of the block chain layer can be made to correspond to The specified number or specified time interval are the same. When the designated number or designated time interval corresponding to each reference block of the block chain layer is the same, the designated number or designated time interval corresponding to each block chain layer can also be determined based on a predetermined rule. For example, the number of blocks between adjacent reference blocks of each block chain layer can be increased in an arithmetic sequence. As a result, based on the specified number or specified time interval corresponding to each reference block, rapid positioning between each block chain layer can be realized.
在确定出基准区块之后,可以基于从该块链式层的第一个区块到该基准区块的所有区块中的至少部分区块的区块信息,生成该块链式层的上层块链式层的对应区块。对于底层块链式层,第一个区块是创世区块,对于各个上层块链式层,第一个区块是相应上层块链式层的头区块。区块信息可以是各个区块的哈希值或区块内容,还可以是区块内容中的部分内容(例如该区块的哈希值和时间戳或该区块的父区块的哈希值和该区块的哈希值)。由此,能够使各个块链式层与对应的下层块链式层链接起来,并能够基于相应区块信息来进行链路验证。After the reference block is determined, the upper layer of the block chain layer can be generated based on the block information of at least some of the blocks from the first block of the block chain layer to the reference block The corresponding block of the block chain layer. For the underlying block chain layer, the first block is the genesis block, and for each upper block chain layer, the first block is the head block of the corresponding upper block chain layer. Block information can be the hash value of each block or the content of the block, or part of the content of the block (such as the hash value and timestamp of the block or the hash of the parent block of the block) Value and the hash value of the block). In this way, each block chain layer can be linked to the corresponding lower block chain layer, and link verification can be performed based on the corresponding block information.
在一个示例中,所生成的上层区块可以包括该基准区块的哈希值。参考图4,第一上层块链式层的区块B 22可以包括基准区块B 13的哈希值。在另一示例中,针对各个块链式层,可以对该块链式层的第一个区块至基准区块的所有区块的区块内容进行哈希运算得出哈希值,并使对应于该基准区块上层区块包括该哈希值。参考图4,在生成区块B 23时,可以对从B 11至B 15的所有区块的区块内容进行哈希运算以得到哈希值,然后使区块B 23包括该哈希值。在另一示例中,针对各个块链式层,可以对该块链式层的第一个区块至基准区块的所有区块的哈希值进行哈希运算得出哈希值,并使对应于该基准区块对应的上层区块包括该哈希值。如图所示,可以对从B 11至B 15的所有区块的哈希值进行哈希运算以得到哈希值,然后使区块B 23包括该哈希值。在另一示例中,针对各个块链式层,还可以将该块链式层的第一个区块和基准区块的区块内容或哈希值进行哈希 运算得到哈希值,并使对应于该基准区块的上层块链式层的区块包括该哈希值。如图4所示,对于基准区块B 15,可以对B 11和B 15的区块内容或哈希值进行哈希运算以得到哈希值,然后使对应于B 15所生成的上层区块B 23包括该哈希值。此外,对应于相应基准区块所生成的上层区块还可以包括利用以上示例所确定出的多个哈希值。 In an example, the generated upper-level block may include the hash value of the reference block. Referring to FIG. 4, the block B 22 of the first upper block chaining layer may include the hash value of the reference block B 13. In another example, for each block chain layer, the block content of all blocks from the first block of the block chain layer to the reference block can be hashed to obtain the hash value, and the The upper block corresponding to the reference block includes the hash value. Referring to FIG. 4, when generating block B 23 , the block content of all blocks from B 11 to B 15 may be hashed to obtain a hash value, and then block B 23 may include the hash value. In another example, for each block chain layer, the hash value of all blocks from the first block of the block chain layer to the reference block can be hashed to obtain the hash value, and The upper block corresponding to the reference block includes the hash value. As shown in the figure, the hash value of all blocks from B 11 to B 15 may be hashed to obtain a hash value, and then block B 23 may include the hash value. In another example, for each block chain layer, the first block of the block chain layer and the block content or hash value of the reference block can also be hashed to obtain the hash value, and use The block corresponding to the upper block chain layer of the reference block includes the hash value. As shown in Figure 4, for the reference block B 15 , the block content or hash value of B 11 and B 15 can be hashed to obtain the hash value, and then the upper block generated by B 15 B 23 includes the hash value. In addition, the upper-level block generated corresponding to the corresponding reference block may also include multiple hash values determined using the above example.
此外,对应于各个块链式层的各个基准区块所生成的上层块链式层的区块还可以具有已知的块链式结构的区块属性。例如,各个上层块链式层的上层区块可包括该上层区块的前一上层区块(父区块)的哈希值。In addition, the blocks of the upper block chain layer generated by the respective reference blocks of each block chain layer may also have block attributes with a known block chain structure. For example, the upper block of each upper block chain layer may include the hash value of the previous upper block (parent block) of the upper block.
在另一示例中,还可以存储基准区块与所对应的上层区块的区块索引信息。区块索引信息有助于在各个块链式层之间进行定位。区块索引信息例如可以为基准区块或基准区块所对应的上层区块的块高。区块索引信息可以被包括在基准区块中,基准区块可以包括不参与该基准区块的哈希值运算的字段,可以在生成对应的上层区块之后,将该上层区块的块高写入该字段。区块索引信息可以被包括在基准区块所对应的上层区块中。例如,可以使上层区块的区块头包括基准区块块高字段,在生成对应的上层区块时,将该对应的基准区块的块高写入基准区块块高字段。区块索引信息还可以被包括在基准区块所对应的上层区块的下一区块中。可以在生成该上层区块的下一区块时,将该上层区块的基准区块的块高写入该下一区块的区块头中。在另一示例中,还可以设置索引数据库,在对应于基准区块生成上层区块时,可以将该上层区块与基准区块的区块索引信息存储在索引数据库中。In another example, the block index information of the reference block and the corresponding upper block can also be stored. Block index information helps to locate between each block chain layer. The block index information may be, for example, the block height of the reference block or the upper block corresponding to the reference block. The block index information can be included in the reference block. The reference block can include fields that do not participate in the hash value operation of the reference block. After the corresponding upper block is generated, the block height of the upper block can be Write this field. The block index information can be included in the upper block corresponding to the reference block. For example, the block header of the upper layer block may include a reference block block height field, and when the corresponding upper layer block is generated, the block height of the corresponding reference block is written into the reference block block height field. The block index information may also be included in the next block of the upper block corresponding to the reference block. When generating the next block of the upper block, the block height of the reference block of the upper block may be written into the block header of the next block. In another example, an index database can also be set. When the upper block is generated corresponding to the reference block, the block index information of the upper block and the reference block can be stored in the index database.
以下将参考图7至图11来说明本说明书实施例生成的多层块链式结构的应用。如下实施例可以用于区块链系统中的轻量节点。Hereinafter, the application of the multi-layer block chain structure generated by the embodiment of this specification will be explained with reference to FIGS. 7 to 11. The following embodiments can be used for lightweight nodes in a blockchain system.
图7是根据本说明书的一个实施例的用于更新多层块链式结构中的信任点的方法的流程图。信任点指示底层块链式层中的块高最大的已验证底层区块。信任点表示在节点处存储的底层区块中,从创世区块至信任点所指示的底层区块均已经通过了验证,即这些底层区块是被信任的区块。信任点的初始值可以是创世区块,例如,对于从未执行过区块验证的轻量节点,信任点指向创世区块。信任点可以存储在轻量节点处,可以在执行完一个批次的区块验证之后,轻量节点可以将信任点更新为指向当前区块最高的已验证底层区块,例如可以在信任点字段存储当前块高最大的已验证底层区块的块高或哈希值。作为信任点的一种应用,在轻量节点对待验证交易进行SPV验证时,如果待验证交易所在的底层区块位于信任点之前(即该底层区块是已验证过的可信任底层区块),则可以对该待验证交易进行存在性证明,并在存在性证明验证通过后确定该待验证交易 已被正确执行。Fig. 7 is a flowchart of a method for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification. The trust point indicates the verified bottom block with the largest block height in the bottom block chain layer. The trust point means that among the underlying blocks stored at the node, all the underlying blocks from the genesis block to the underlying blocks indicated by the trust point have passed verification, that is, these underlying blocks are trusted blocks. The initial value of the trust point can be the genesis block. For example, for a lightweight node that has never performed block verification, the trust point points to the genesis block. The trust point can be stored at the lightweight node. After performing a batch of block verification, the lightweight node can update the trust point to point to the highest verified underlying block of the current block, for example, in the trust point field Store the block height or hash value of the verified underlying block with the largest current block height. As an application of the trust point, when the lightweight node performs SPV verification for the transaction to be verified, if the underlying block of the transaction to be verified is located before the trust point (that is, the underlying block is a verified and trusted underlying block ), the existence proof of the transaction to be verified can be performed, and after the verification of the existence proof is passed, it is determined that the transaction to be verified has been executed correctly.
如图7所示,在块720,基于多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径。轻量节点可以在需要更新信任点时,从全量节点获取当前信任点指示的已验证区块与目标底层区块之间的各个块链式层的区块,并将所获取的区块添加到本地的各个块链式层中。然后,轻量节点可以基于本地存储的多层块链式结构来确定验证路径。参考图4,当前信任点可以指向底层块链式层的区块B 14。目标底层区块例如可以是图4中的B 112As shown in FIG. 7, at block 720, based on the multi-layer block chain structure, the verification path between the verified underlying block and the target underlying block indicated by the current trust point is determined. Lightweight nodes can obtain each block chain layer block between the verified block indicated by the current trust point and the target underlying block from the full node when the trust point needs to be updated, and add the obtained block to In each local block chain layer. Then, the lightweight node can determine the verification path based on the locally stored multi-layer block chain structure. Referring to Figure 4, the current trust point can point to the block B 14 of the underlying blockchain layer. The target bottom layer block can be, for example, B 112 in FIG. 4.
在一个示例中,可以在对待验证交易进行SPV验证时更新信任点,目标底层区块可以基于待验证交易所在的待验证底层区块来确定。图8是根据本说明书的一个实施例的对待验证交易进行SPV验证的方法的流程图。In one example, the trust point can be updated when the SPV verification of the transaction to be verified is performed, and the target underlying block can be determined based on the underlying block to be verified where the transaction to be verified is located. Fig. 8 is a flowchart of a method for performing SPV verification on a transaction to be verified according to an embodiment of the present specification.
如图8,在块802,确定待验证交易所在的待验证底层区块。当轻量节点想要获知某个交易是否被正确执行时,可以从全量节点处获取该交易所在的底层区块。全量节点可以将该交易所在的底层区块的块高发送给轻量节点。然后,轻量节点可以对该交易进行SPV验证。SPV验证可以包括正确性验证和存在性验证(或称为存在性证明)。正确性验证可以通过验证从创世区块至待验证底层区块之间的链路完整性来执行,用于证明待验证交易是正确的。存在性验证用于证明待验证交易确实存在于待验证区块中,可以基于任意存在性证明方法来执行。例如,可以基于MPT树获取待验证交易在MPT树中的查询路径,并基于所获取的查询路中各个MPT树的数据节点来验证交易树根哈希是否与块头中的交易树根哈希一致,当二者一致时,可以确定待验证交易确实存在于待验证底层区块中。As shown in Fig. 8, at block 802, the underlying block to be verified where the transaction to be verified is located is determined. When a lightweight node wants to know whether a transaction is executed correctly, it can obtain the underlying block of the transaction from the full node. The full node can send the block height of the underlying block of the exchange to the light node. Then, the lightweight node can perform SPV verification on the transaction. SPV verification can include correctness verification and existence verification (or called existence proof). Correctness verification can be performed by verifying the integrity of the link from the genesis block to the underlying block to be verified, and is used to prove that the transaction to be verified is correct. Existence verification is used to prove that the transaction to be verified does exist in the block to be verified, and can be performed based on any existence proof method. For example, it is possible to obtain the query path of the transaction to be verified in the MPT tree based on the MPT tree, and to verify whether the transaction tree root hash is consistent with the transaction tree root hash in the block header based on the obtained data nodes of each MPT tree in the query path When the two are consistent, it can be determined that the transaction to be verified does exist in the underlying block to be verified.
在确定待验证底层区块之后,在块804,确定待验证底层区块是否位于信任点之前。即,确定待验证底层区块是否是可信任的底层区块。可以通过比较待验证区块的块高与信任点所指向的已验证底层区块块高来确定待验证交易是否位于信任点之前。After the bottom layer block to be verified is determined, in block 804, it is determined whether the bottom layer block to be verified is located before the trust point. That is, it is determined whether the underlying block to be verified is a trusted underlying block. It can be determined by comparing the block height of the block to be verified with the block height of the verified underlying block pointed to by the trust point to determine whether the transaction to be verified is located before the trust point.
当待验证底层区块位于信任点之前时,表明从创世区块至待验证交易所在的待验证底层区块之间的链路是正确的。因而可以在块808,对待验证交易进行存在性证明,并在块810,确定存在性证明是否通过。当待验证底层区块不是位于信任点之前时,可以在块806,使用本说明书实施例所描述的信任点更新方法,将信任点更新至块高不小于待验证底层区块的目标底层区块。此时,块高不小于待验证交易所在的底层区块的任意底层区块均可以作为目标底层区块。在更新信任点之后,可以在块808,对待验证交易进行存在性证明。When the underlying block to be verified is located before the trust point, it indicates that the link from the genesis block to the underlying block to be verified where the exchange to be verified is located is correct. Therefore, at block 808, the existence proof of the transaction to be verified can be performed, and at block 810, it is determined whether the existence proof is passed. When the underlying block to be verified is not before the trust point, in block 806, the trust point update method described in the embodiment of this specification can be used to update the trust point to a target underlying block whose block height is not less than the underlying block to be verified . At this time, any underlying block whose block height is not less than the underlying block where the transaction to be verified is located can be used as the target underlying block. After the trust point is updated, at block 808, the existence proof of the transaction to be verified can be performed.
如果存在性证明通过,则可以在块812,确定待验证交易已被正确执行。如果存在性证明不通过,则可以在块814,确定待验证交易未被正确执行。If the proof of existence is passed, it can be determined in block 812 that the transaction to be verified has been executed correctly. If the proof of existence is not passed, it can be determined in block 814 that the transaction to be verified was not executed correctly.
验证路径是指从当前信任点验证至目标底层区块的路径。验证路径可以经由任意块链式层。例如,如图4所示,从当前信任点TP至目标底层区块B 112之间的验证路径可以是B 15→B 23→B 32→B 33→B 25→B 26→B 111→B 112The verification path refers to the path from the current trust point to the target underlying block. The verification path can go through any blockchain layer. For example, as shown in Figure 4, the verification path from the current trust point TP to the target underlying block B 112 can be B 15 → B 23 → B 32 → B 33 → B 25 → B 26 → B 111 → B 112 .
验证路径可以只经由底层块链式层,还可以经由至少一个上层块链式层来确定。由于各个块链式层的相邻两个基准区块之间间隔有至少一个区块,因而该块链式层的上层区块相当于“跳过”了所间隔的区块。由此,在经由至少一个上层块链式层来确定验证路径时,能够减少验证路径中的区块数,从而提高验证效率。可以从当前信任点所指向的已验证底层区块与目标底层区块之间的所有路径中,选择最短路径(即经过区块最少的路径)以作为验证路径。The verification path can be determined only via the underlying block chain layer, or via at least one upper block chain layer. Since there is at least one block between two adjacent reference blocks of each block chain layer, the upper block of the block chain layer is equivalent to "skipping" the spaced block. Thus, when the verification path is determined via at least one upper block chain layer, the number of blocks in the verification path can be reduced, thereby improving the verification efficiency. The shortest path (that is, the path with the least number of blocks) can be selected as the verification path from all the paths between the verified bottom-level block pointed to by the current trust point and the target bottom-level block.
在经由上层块链式层确定验证路径时,在从各个块链式层上升到上层块链式层或从上层块链式层下降至下层块链式层时,存在路径损耗。即,由于在块链式层之间的上升或下降,可能出现路径所经由的区块数增加的情况。因此,在当前信任点所指示的已验证底层区块与目标底层区块之间的的区块数较少时,如果经由上层块链式层可能会导致验证路径比仅经由底层块链式层确定的验证路径要长。因而,在一个示例中,可以在当前信任点所指示的已验证底层区块与目标底层区块之前至少存在两个底层基准区块时,经由至少一个上层块链式层来确定验证路径。在另一示例中,所确定出的目标底层区块与当前信任点所指示的已验证底层区块之间的底层区块数可以大于第一预定数量。由此,目标底层区块与当前信任点所指向的已验证底层区块之间的底层区块数足够大,因而可以在每次更新信任点时经由至少一个上层块链式层来确定验证路径。当目标底层区块与当前信任点所指示的已验证底层区块之间的底层区块数大于第二预定数量(第二预定数量不小于第一预定数量)时,可以经由多个上层块链式层来确定验证路径,从而能够尽量地减少验证路径中所包括的区块数,以提高验证效率。When the verification path is determined via the upper block chain layer, there is a path loss when rising from each block chain layer to the upper block chain layer or descending from the upper block chain layer to the lower block chain layer. That is, due to the ascent or descent between the blockchain layers, the number of blocks through which the path passes may increase. Therefore, when the number of blocks between the verified bottom-layer block indicated by the current trust point and the target bottom-layer block is less, if the upper-layer block chain layer is passed, the verification path may be more than that of only the bottom-layer block chain layer. The determined verification path must be long. Therefore, in an example, when there are at least two underlying reference blocks before the verified underlying block and the target underlying block indicated by the current trust point, the verification path can be determined via at least one upper block chain layer. In another example, the number of underlying blocks between the determined target underlying block and the verified underlying block indicated by the current trust point may be greater than the first predetermined number. Therefore, the number of bottom-layer blocks between the target bottom-layer block and the verified bottom-layer block pointed to by the current trust point is large enough, so that the verification path can be determined through at least one upper-level block chain layer each time the trust point is updated. . When the number of underlying blocks between the target underlying block and the verified underlying block indicated by the current trust point is greater than the second predetermined number (the second predetermined number is not less than the first predetermined number), multiple upper blockchains can be used The formula layer determines the verification path, so that the number of blocks included in the verification path can be reduced as much as possible to improve the verification efficiency.
验证路径可以基于第一区块数和第二区块数来确定,第一区块数是各个块链式层的相邻两个基准区块之间的区块数,第二区块数是目标底层区块与已验证底层区块之间的底层区块数。在一个示例中,在各个块链式层中相邻两个基准区块之间可以存在相同数量的区块,即相邻两个基准区块之间的第一区块数相等。在该示例中,假设第一区块数为N,则第L层块链式层中的相邻两个区块之间所存在的底层区块数为N L-1个。例如,参考图4,第二个块链式层(即第一上层块链式层)中的相邻两个区块之间有2 2-1个底 层区块。可以基于第一区块数和第二区块数来确定验证路径所经由的块链式层的上升点,对于验证路径所经过的各个区块,如果该区块的后一区块是相临上层块链式层的区块,则该区块被称为上升点。在验证路径中第L个块链式层的上升点所对应的区块在第L层块链式层中的序号为(%表示取余运算): The verification path can be determined based on the first block number and the second block number. The first block number is the number of blocks between two adjacent reference blocks of each block chain layer, and the second block number is The number of bottom-level blocks between the target bottom-level block and the verified bottom-level block. In an example, the same number of blocks may exist between two adjacent reference blocks in each block chain layer, that is, the number of first blocks between two adjacent reference blocks is the same. In this example, assuming that the number of first blocks is N, the number of underlying blocks existing between two adjacent blocks in the L-th block chain layer is N L-1. For example, referring to FIG. 4, there are 2 2-1 bottom-level blocks between adjacent two blocks in the second block-chain layer (ie, the first upper-level block-chain layer). The ascending point of the blockchain layer through which the verification path passes can be determined based on the first block number and the second block number. For each block passed by the verification path, if the next block of the block is adjacent The upper block chain layer is called the rising point. In the verification path, the sequence number of the block corresponding to the rising point of the L-th block-chain layer in the L-th block-chain layer is (% represents the remainder operation):
X+[N-(X-1)%N]%N,X+[N-(X-1)%N]%N,
其中,B LX为验证路径中的第L个块链式层的第一个区块。例如,在图4所示的验证路径中,对于第二个块链式层(即第一上层块链式层),其上升点为3+[2-(3-1)%2]%2,运算结果为3,即X的值是3,因此第二个块链式层中的第三个区块B 23为上升点。 Among them, B LX is the first block of the L-th blockchain layer in the verification path. For example, in the verification path shown in Figure 4, for the second block chain layer (that is, the first upper block chain layer), the rising point is 3+[2-(3-1)%2]%2 , The calculation result is 3, that is, the value of X is 3, so the third block B 23 in the second block chain layer is the rising point.
验证路径所经过的各个块链式层的下降点也可以基于第一区块数和第二区块数来确定。对于验证路径所经过的各个区块,如果该区块的后一区块是下层块链式层的区块,则该区块被称为下降点。假设当前信任点所指示的已验证区块为B 1j(底层块链式层的第j个区块),目标底层区块为B 1k(底层块链式层的第k个区块)。则第L层块链式层中的下降点所对应的区块的序号为: The drop point of each block chain layer passed by the verification path can also be determined based on the first block number and the second block number. For each block passed by the verification path, if the next block of the block is a block of the lower block chain layer, the block is called a drop point. Assume that the verified block indicated by the current trust point is B 1j (the jth block of the underlying blockchain layer), and the target bottom block is B 1k (the kth block of the underlying blockchain layer). Then the sequence number of the block corresponding to the descending point in the L-th block chain layer is:
(k-k%N)/N L-1 (kk%N)/N L-1
如果某区块同时符合上升点和下降点的条件,则将该区块确定为下降点(如B 33)。 If a block meets the conditions of the rising point and the falling point at the same time, the block is determined as the falling point (such as B 33 ).
在确定出各个块链式层中的上升点和下降点之后,该块链式层中的上升点和下降点之间的区块均是验证路径中的区块。在图4所示出的示例中,确定出的上升点分别是B 15、B 23,下降点分别是B 33和B 26After determining the ascending point and descending point in each block chain layer, the blocks between the ascending point and the falling point in the block chain layer are all blocks in the verification path. In the example shown in Fig. 4, the determined rising points are B 15 and B 23 respectively, and the falling points are B 33 and B 26 respectively .
在各个块链式层中相邻两个区块之间的第一区块数相等时,为了使得所确定出的验证路径是当前信任点所指向的已验证底层区块和目标底层区块之间的最短路径,可以使得所经过的块链式层的最大层数不超过第一区块数。例如,以图4为例,通过上述实施例所确定出的验证路径B 15→B 23→B 32→B 33→B 25→B 26→B 111→B 112包括8个区块。如果使验证路径所经过的块链式层的最大层数不超过相邻两个基准区块的第一区块数(即2),则验证路径所经过的最大层数为第二个块链式层(即第一上层块链式层),那么所确定的验证路径将会是B 15→B 23→B 24→B 25→B 26→B 111→B 112,该验证路径包括7个区块。即,验证路径相对于经过的块链式层数超过第一间隔区块数时的情形被缩短了。 When the number of first blocks between two adjacent blocks in each block chain layer is equal, in order to make the determined verification path be the one between the verified underlying block pointed to by the current trust point and the target underlying block The shortest path between the two can make the maximum number of blockchain layers passed by not exceeding the number of first blocks. For example, taking FIG. 4 as an example, the verification path B 15 → B 23 → B 32 → B 33 → B 25 → B 26 → B 111 → B 112 determined by the above embodiment includes 8 blocks. If the maximum number of blockchain layers passed by the verification path does not exceed the first block number (ie 2) of the two adjacent reference blocks, the maximum number of layers passed by the verification path is the second block chain Type layer (that is, the first upper block chain layer), then the determined verification path will be B 15 → B 23 → B 24 → B 25 → B 26 → B 111 → B 112 , the verification path includes 7 areas Piece. That is, the verification path is shortened compared to the case when the number of blockchain layers passed exceeds the number of blocks in the first interval.
对于各个块链式层中的相邻两个基准区块之间的第一区块数不相等的情况,第一区块数可以基于区块索引信息来确定。由于区块索引信息中包括基准区块与所对应的上层区块之间的索引关系,可以基于区块索引信息来确定已验证底层区块与目标底层区块 之间的各层块链式层中的基准区块,并确定出各层块链式层中相邻两个基准区块之间的第一区块数。在确得到第一区块数之后,出在经由上层块链式层确定验证路径时,可以基于相邻两个基准区块之间的第一区块数和已验证底层区块与目标底层区块之间的第二区块数,计算得出各层块链式层应当被包括在验证路径中的区块。For the case where the first block number between two adjacent reference blocks in each block chain layer is not equal, the first block number can be determined based on block index information. Since the block index information includes the index relationship between the reference block and the corresponding upper block, the block chain layer between the verified bottom block and the target bottom block can be determined based on the block index information And determine the first number of blocks between two adjacent reference blocks in each layer of the block chain layer. After the first block number is confirmed, when the verification path is determined through the upper block chain layer, it can be based on the first block number between two adjacent reference blocks and the verified bottom block and the target bottom zone. The second number of blocks between blocks is calculated and the blocks of each layer of the block chain layer should be included in the verification path.
如果相邻两个基准区块之间的区块数不完全相等,还可以基于区块索引信息确定验证路径,区块索引信息指示各个基准区块与所对应的上一层区块之间的索引。可以基于区块索引来确定各个块链式层中的基准区块,然后可以在上升到各个上层块链式层之后,可以通过试探的方式来确定该块链式层的下一区块是否已达到或超过目标底层区块。如果达到或超过了底层区块,则舍弃该块链式层,并下降到下层块链式层继续查找。If the number of blocks between two adjacent reference blocks is not completely equal, the verification path can also be determined based on the block index information. The block index information indicates the distance between each reference block and the corresponding upper-level block. index. The reference block in each block chain layer can be determined based on the block index, and then after rising to each upper block chain layer, the next block of the block chain layer can be determined by heuristics. Reach or exceed the target underlying block. If it reaches or exceeds the underlying block, then discard the block chain layer and descend to the lower block chain layer to continue searching.
由于区块索引信息中存储有各个基准区块与对应上层区块之间的索引关系,因而可以基于区块索引信息来确定在上层块链式层中的各个上层区块实际上是否已超过目标底层区块。例如,区块索引信息可以被包括在各个基准区块中,各个基准区块中可以包括上层区块索引字段,例如可以把该基准区块所对应的上层区块的块高或哈希值写入该基准区块的上层区块索引字段。在确定验证路径时,可以从当前信任点所指向的已验证底层区块起查询各个底层区块,当被查询区块的上层区块索引字段为空时表明该被查询区块不是相应块链式层的基准区块,当上层区块索引字段不为空时,表明该被查询区块是基准区块。此时,可以基于上层区块索引信息确定该被查询区块所对应的上层区块,然后上升到相邻上层块链式层继续进行查询。在上层块链式层进行查询时,如果确定出某个上层区块是相应上层块链式层中的基准区块,由于上层区块中包括相应下层区块的索引,可以基于相应下层区块的索引确定该上层区块所能够定位到的底层区块是否已超过了目标底层区块。如果没有超过目标底层区块,则可以继续上升到上层块链式层,若超过了目标底层区块则回退到该上层块链式层的前一上层区块,并下降到下层块链式层。在下降到该上层块链式层的下层块链式层之后,如果该下层块链式层仍然是上层块链式层,则可以继续确定所下降到的下层区块的下一区块是否超过目标底层区块。如果下一区块没有超过目标底层区块,则该下层区块的下一区块可以被确定为验证路径中的区块。如果该下层区块的下一区块已超过目标底层区块,则继续下降,直到下降到底层区块链为止。执行上述过程直到查询至目标底层区块即可确定出验证路径。Since the block index information stores the index relationship between each reference block and the corresponding upper block, it can be determined based on the block index information whether each upper block in the upper block chain layer has actually exceeded the target The bottom layer. For example, the block index information may be included in each reference block, and each reference block may include an upper block index field. For example, the block height or hash value of the upper block corresponding to the reference block may be written Enter the upper block index field of the reference block. When determining the verification path, each underlying block can be queried from the verified underlying block pointed to by the current trust point. When the upper block index field of the queried block is empty, it indicates that the queried block is not the corresponding block chain When the index field of the upper-level block is not empty, it indicates that the queried block is a reference block. At this time, the upper-layer block corresponding to the queried block can be determined based on the upper-layer block index information, and then ascending to the adjacent upper-layer block chain layer to continue the query. When querying in the upper block chain layer, if it is determined that a certain upper block is the reference block in the corresponding upper block chain layer, since the upper block includes the index of the corresponding lower block, it can be based on the corresponding lower block The index of determines whether the bottom-layer block that the upper-layer block can locate has exceeded the target bottom-layer block. If it does not exceed the target bottom block, it can continue to rise to the upper block chain layer, if it exceeds the target bottom block, it will fall back to the previous upper block of the upper block chain layer and drop to the lower block chain. Floor. After descending to the lower block chain layer of the upper block chain layer, if the lower block chain layer is still the upper block chain layer, you can continue to determine whether the next block of the lower block that has fallen to exceeds Target bottom block. If the next block does not exceed the target bottom block, the next block of the bottom block can be determined as the block in the verification path. If the next block of the lower-level block has exceeded the target bottom-level block, it will continue to descend until it reaches the bottom-level blockchain. Perform the above process until the target underlying block is queried to determine the verification path.
在确定验证路径之后,在块740,针对验证路径中的各个区块,验证该区块与前一区块之间的链路是否正确。链路验证过程可以基于各个区块之间的链接关系来确定。对于验证路径中位于同一块链式层的区块,每个区块中存储有父哈希,因而可以基于前一 区块的区块信息来验证各个区块与前一区块之间的链路是否正确。例如,以图4中实线箭头所指示的验证路径为例,B 14和B 15、B 32和B 33分别位于底层块链式层和第二上层块链式层,B 14是B 15的父区块,B 32是B 33的父区块。因而可以基于B 15中的父哈希和B 14的区块信息来验证B 14与B 15之间的链路是否正确。对于位于不同块链式层的相邻区块,由于上层区块是基于下层的对应基准区块生成的,因而可以基于对应基准区块的区块信息来验证该两个相邻区块之间的链路是否正确。以图4中示出的验证路径为例,B 15与B 23、B 32分别位于不同的块链式层,B 15是B 23的基准区块、B 23是B 32的基准区块。由于B 23是至少基于B 15的区块信息生成的、B 32是至少基于B 23的区块信息而生成的,因而可以基于B 15和B 23的区块信息来验证B 15和B 23之前的链路,并基于B 23和B 32的区块信息来验证B 23和B 32之前的链路。具体的链路验证过程将在下文参照图9来进行描述。 After the verification path is determined, in block 740, for each block in the verification path, it is verified whether the link between the block and the previous block is correct. The link verification process can be determined based on the link relationship between each block. For the blocks in the same block chain layer in the verification path, each block stores the parent hash, so the chain between each block and the previous block can be verified based on the block information of the previous block Is the path correct? For example, taking the verification path indicated by the solid arrow in Figure 4 as an example, B 14 and B 15 , B 32 and B 33 are located at the bottom block chain layer and the second upper block chain layer, respectively, B 14 is the B 15 The parent block, B 32 is the parent block of B 33. Thus a block may be based on the information in the hash and the parent B 15 B 14 to verify the link between B 14 and B 15 are correct. For adjacent blocks located in different blockchain layers, since the upper block is generated based on the corresponding reference block of the lower layer, the block information of the corresponding reference block can be used to verify the relationship between the two adjacent blocks The link is correct. In order to verify the path shown in FIG. 4 for example, B 15 and B 23, B 32 are located at different layers of the chain block, B 15 is the reference block B 23, B 23 B 32 of the block is the reference. Since the block B 23 is based on at least information generated B 15, B 32 is block information based on at least B 23 is generated, and thus the information may be based on the block B 15 and B 23 to B 15 and verified prior to B 23 link, based on information of the block B 23 and B 32 to verify that the link prior to B 23 and B 32. The specific link verification process will be described below with reference to FIG. 9.
需要说明的是,验证路径中各个区块之间的链路验证过程可以是在确定验证路径之后执行的,也可以是在确定验证路径的过程中执行的。例如,对于图4所示出的验证路径,可以在确定B 14的下一区块(即B 15)时,验证B 14与B 15之间的链路,然后确定B 15的下一区块。在确定出B 15的下一区块(即B 23)之后,验证B 15与B 23之间的链路。在验证路径的确定过程以及链路验证过程中,当出现任意两个区块之前的链路不正确时,即可以确定验证路径中的链路不正确。 It should be noted that the verification process of the link between each block in the verification path may be executed after the verification path is determined, or may be executed during the process of determining the verification path. For example, for the verification path shown in Figure 4, when determining the next block of B 14 (ie B 15 ), verify the link between B 14 and B 15 and then determine the next block of B 15 . After determining the next block of B 15 (ie, B 23 ), the link between B 15 and B 23 is verified. In the process of determining the verification path and the link verification process, when the link before any two blocks is incorrect, it can be determined that the link in the verification path is incorrect.
然后,在块760,确定验证路径中的各个区块之间的链路是否均正确。当验证路径中的各个区块之间的链路均正确时,在块780,将信任点更新为指示目标底层区块。Then, at block 760, it is determined whether the links between each block in the verification path are correct. When the link between each block in the verification path is correct, at block 780, the trust point is updated to indicate the target underlying block.
验证路径中的各个区块中可以存储有至少基于前一区块的区块信息生成的第一哈希值。如果该区块的前一区块与该区块位于相同块链式层,则第一哈希值可以是该区块的父哈希。如果该区块的前一区块与该区块位于不同块链式层,则第一哈希值可以是至少部分地基于该前一区块的区块信息来进行哈希运算得到的。此时,可以利用如图9所示的示例来进行链路验证。图9是根据本说明书的一个实施例的用于更新区块链中的信任点的方法中的链路验证过程的流程图。Each block in the verification path may store a first hash value generated at least based on block information of the previous block. If the previous block of the block is in the same block chain layer as the block, the first hash value may be the parent hash of the block. If the previous block of the block and the block are located in a different block chain layer, the first hash value may be obtained by performing a hash operation based at least in part on the block information of the previous block. At this time, the example shown in FIG. 9 can be used for link verification. Fig. 9 is a flowchart of a link verification process in a method for updating a trust point in a blockchain according to an embodiment of the present specification.
如图9所示,在块902,至少基于上一区块的区块信息进行哈希运算,以得到第二哈希值。然后,在块904,确定所得到的第二哈希值与该区块中的第一哈希值是否一致。当二者一致时,在块906,确定该区块与前一区块之间的链路是正确的。当二者不一致时,在块908,确定该区块与前一区块之间的链路是不正确的。As shown in FIG. 9, in block 902, a hash operation is performed at least based on the block information of the previous block to obtain the second hash value. Then, in block 904, it is determined whether the obtained second hash value is consistent with the first hash value in the block. When the two are consistent, at block 906, it is determined that the link between the block and the previous block is correct. When the two are inconsistent, at block 908, it is determined that the link between the block and the previous block is incorrect.
当该区块的前一区块与该区块位于相同块链式层时,可以对前一区块的区块头进 行哈希运算以得到第二哈希值。然后,可以比较该第二哈希值与该区块中的父哈希的一致性。例如,以图4中实线箭头所指示的验证路径为例,由于B 14是B 15的父区块,因而可以对B 14的区块信息进行哈希运算以得到哈希值,并比较所得到的哈希值与B 15中存储的父哈希的一致性。当二者一致时,可以确定B 14和B 15之间的链路是正确的。 When the previous block of the block and the block are in the same block chain layer, the block header of the previous block can be hashed to obtain the second hash value. Then, the consistency of the second hash value and the parent hash in the block can be compared. For example, taking the verification path indicated by the solid arrow in Figure 4 as an example, since B 14 is the parent block of B 15 , the block information of B 14 can be hashed to obtain the hash value and compare all The obtained hash value is consistent with the parent hash stored in B 15. When the two are consistent, it can be determined that the link between B 14 and B 15 is correct.
当该区块的前一区块与该区块位于不同块链式层时,前一区块是该区块的基准区块,因而可以至少部分地基于前一区块的区块信息来进行哈希运算,以得到第二哈希值。例如,上层区块可以包括对应基准区块的哈希值。在该示例中,如果验证路径中的某个区块的前一区块位于下层块链式层,则可以对前一区块的区块信息进行哈希运算以得到第二哈希值。以图4中示出的验证路径中的B 15与B 23为例,可以对B 15的区块头进行哈希运算以得到第二哈希值。然后可以比较所得到的第二哈希值与B 23中存储的B 15的哈希值是否一致,如果二者一致则可以确定B 15和B 23之间的链路是正确的。再例如,在对应于基准区块来生成上层区块时,可以对从基准区块所在的块链式层中,从第一个区块至该基准区块的所有区块的区块信息进行哈希运算,并将所得到的哈希值作为第一哈希值存储在所生成的上层区块中。在该示例中,如果验证路径中的某个区块的前一区块位于下层块链式层,可以对前一区块所在的块链式层中的第一个区块至该前一区块的所有区块信息进行哈希运算,以得到第二哈希值。以图4中示出的验证路径中的B 15与B 23为例,可以对B 11、B 12、B 13、B 14和B 15的区块信息进行哈希运算以得到第二哈希值。然后可以比较所得到的哈希值与B 23中存储的第一哈希值,如果二者一致则可以确定B 15与B 23之间的链路是正确的。 When the previous block of the block and the block are located in different block chain layers, the previous block is the reference block of the block, so it can be performed based at least in part on the block information of the previous block Hash operation to obtain the second hash value. For example, the upper block may include the hash value of the corresponding reference block. In this example, if the previous block of a certain block in the verification path is located in the lower block chain layer, the block information of the previous block can be hashed to obtain the second hash value. Taking B 15 and B 23 in the verification path shown in FIG. 4 as an example, the block header of B 15 may be hashed to obtain the second hash value. Then, it can be compared whether the obtained second hash value is consistent with the hash value of B 15 stored in B 23. If the two are consistent, it can be determined that the link between B 15 and B 23 is correct. For another example, when the upper block is generated corresponding to the reference block, the block information from the first block to the reference block in the block chain layer where the reference block is located can be performed. Hash operation, and store the obtained hash value as the first hash value in the generated upper block. In this example, if the previous block of a block in the verification path is located in the lower block chain layer, the first block in the block chain layer where the previous block is located can be compared to the previous block. All block information of the block is hashed to obtain the second hash value. Taking B 15 and B 23 in the verification path shown in FIG. 4 as an example, the block information of B 11 , B 12 , B 13 , B 14 and B 15 can be hashed to obtain the second hash value . Then, the obtained hash value can be compared with the first hash value stored in B 23 , and if the two are consistent, it can be determined that the link between B 15 and B 23 is correct.
在验证路径中的各个区块之间的链路被验证为正确之后,还可以对目标底层区块的正确性进行验证。目标底层区块的正确性可以通过验证其是否经过了全网共识来执行。图10是根据本说明书的另一实施例的用于更新区块链中的信任点的方法的流程图。After the link between each block in the verification path is verified as correct, the correctness of the target underlying block can also be verified. The correctness of the target underlying block can be executed by verifying whether it has passed the consensus of the entire network. Fig. 10 is a flowchart of a method for updating trust points in a blockchain according to another embodiment of the present specification.
如图10所示,在块1002,基于多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径。在确定验证路径之后,在块1004,针对验证路径中的各个区块,验证该区块与该区块的前一区块之间的链路是否正确。然后在块1006,判断是否验证路径中各个区块之间的链路均被验证为正确。As shown in FIG. 10, at block 1002, based on the multi-layer block chain structure, the verification path between the verified underlying block and the target underlying block indicated by the current trust point is determined. After the verification path is determined, in block 1004, for each block in the verification path, it is verified whether the link between the block and the previous block of the block is correct. Then in block 1006, it is judged whether the links between each block in the verification path are all verified as correct.
如果各个区块与上一区块之间的链路均被验证为正确,则在块1008,确定目标底层区块是否正确。可以参照图11所示的示例来验证目标底层区块是否正确。If the links between each block and the previous block are all verified as correct, then in block 1008, it is determined whether the target underlying block is correct. You can refer to the example shown in FIG. 11 to verify whether the target underlying block is correct.
图11是根据本说明书的一个实施例的用于更新多层块链式结构中的信任点的方法中的目标底层区块验证过程的流程图。Fig. 11 is a flowchart of a target underlying block verification process in a method for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification.
如图11所示,在块1102,从区块链系统中的多个全量节点处获取目标底层区块的多个目标底层区块信息。As shown in FIG. 11, at block 1102, multiple target bottom-level block information of the target bottom-level block is obtained from multiple full nodes in the blockchain system.
然后,在块1104,当多个目标底层区块信息中存在不低于法定数量的一致的目标底层区块信息时,确定目标底层区块是正确的。当存在不低于法定数量的一致的目标底层区块信息时,可以确定目标底层区块已经过全网共识,因而可以确定其是正确的。Then, in block 1104, when there is no less than a statutory number of consistent target bottom-layer block information in the multiple target bottom-layer block information, it is determined that the target bottom-layer block is correct. When there is no less than a statutory number of consistent target bottom-level block information, it can be determined that the target bottom-level block has passed the consensus of the entire network, and thus it can be determined that it is correct.
在目标底层区块被确定正确时,在块1010,将信任点更新为指示目标底层区块。如果验证路径各个区块与上一区块之间的链路不完全正确或目标底层区块被确定为不正确,则表明目标底层区块不能信任的区块。在这种情况下,可以重新确定目标底层区块,并执行信任点更新过程。When the target underlying block is determined to be correct, at block 1010, the trust point is updated to indicate the target underlying block. If the link between each block of the verification path and the previous block is not completely correct or the target underlying block is determined to be incorrect, it indicates that the target underlying block cannot be trusted. In this case, the target underlying block can be re-determined and the trust point update process can be performed.
在多层块链式结构应用于中心化的类区块链系统时,各个底层块链式层中的各个区块在被生成以后,可以将该区块发送给所信任的第三方服务器,第三方服务器可以利用其私钥对该区块进行签名认证。在验证目标底层区块是否正确时,可以从第三方服务器获取针对该目标底层区块的签名,然后用第三方服务器的公钥对所获取的目标底层区块的签名进行验证,验证通过时可以确定目标底层区块是正确的。When the multi-layer block chain structure is applied to a centralized blockchain-like system, after each block in each underlying block chain layer is generated, the block can be sent to a trusted third-party server. The three-party server can use its private key to sign and authenticate the block. When verifying whether the target underlying block is correct, you can obtain the signature of the target underlying block from the third-party server, and then use the public key of the third-party server to verify the signature of the obtained target underlying block. Make sure that the target underlying block is correct.
通过该实施例,能够进一步保证更新后的信任点的可信程度。Through this embodiment, the credibility of the updated trust point can be further ensured.
图12是根据本说明书的一个实施例的多层块链式结构生成装置的结构框图。如图12所示,多层块链式结构生成装置1200包括底层块链式层生成单元1210和上层块链式层生成单元1220。Fig. 12 is a structural block diagram of a device for generating a multi-layer block chain structure according to an embodiment of the present specification. As shown in FIG. 12, the multi-layer block chain structure generating device 1200 includes a bottom block chain layer generating unit 1210 and an upper block chain layer generating unit 1220.
底层块链式层生成单元1210基于交易数据生成多层结构中的底层块链式层的区块。上层块链式层生成单元1220根据上层块链式层生成条件,基于底层块链式层生成上层块链式层。上层块链式层生成单元1220包括基准区块确定模块1221和上层块链式层生成模块1222。基准区块确定模块1221确定底层块链式层中是否存在触发上层块链式层生成条件的基准区块。上层块链式层生成条件可以包括该基准区块与上一基准区块之间的区块数目达到指定数目,还可以包括该基准区块的生成时间与上一基准区块的生成时间之间的时间间隔达到指定时间间隔。The bottom block chain layer generating unit 1210 generates blocks of the bottom block chain layer in the multi-layer structure based on the transaction data. The upper block chain layer generating unit 1220 generates the upper block chain layer based on the lower block chain layer according to the upper block chain layer generation conditions. The upper block chain layer generating unit 1220 includes a reference block determining module 1221 and an upper block chain layer generating module 1222. The reference block determination module 1221 determines whether there is a reference block that triggers the generation condition of the upper block chain layer in the underlying block chain layer. The upper block chain layer generation condition may include the number of blocks between the reference block and the previous reference block reaching a specified number, and may also include the generation time of the reference block and the generation time of the previous reference block The time interval reaches the specified time interval.
在一个示例中,基准区块确定模块1221可以遍历多层块链式结构中的各个块链式层中的区块,以确定满足上层块链式层生成条件的基准区块。在另一个示例中,基准区块确定模块1221可以针对区块链中的各个块链式层,确定新生成的区块是否是满足上层块链式层生成条件的基准区块。In one example, the reference block determination module 1221 may traverse the blocks in each block chain layer in the multi-layer block chain structure to determine the reference block that meets the generation conditions of the upper block chain layer. In another example, the reference block determination module 1221 may determine whether the newly generated block is a reference block that meets the generation conditions of the upper block chain layer for each block chain layer in the blockchain.
上层块链式层生成模块1222响应于底层块链式层中存在触发上层块链式层区块生成条件的基准区块,至少部分地基于该基准区块的区块信息,生成上层块链式层的对应上层区块。The upper block chain layer generation module 1222 responds to the presence of a reference block in the lower block chain layer that triggers the block generation condition of the upper block chain layer, and generates the upper block chain layer based at least in part on the block information of the reference block. The corresponding upper block of the layer.
多层块链式结构可以包括多个上层块链式层。在该示例中,上层块链式层生成单元1220可以针对各个上层块链式层,根据相同或者不同的上层块链式层生成条件,基于该上层块链式层生成该上层块链式层的相邻上层块链式层。具体地,基准区块确定模块1221可以针对各个上层块链式层,确定该上层块链式层中是否存在触发上层块链式层生成条件的基准区块。当存在触发上层块链式层生成条件的基准区块时,上层块链式层生成模块1222可以至少部分地基于该基准区块的区块信息,生成该上层块链式层的相邻上层块链式层的对应上层区块。The multi-layer block chain structure may include a plurality of upper block chain layers. In this example, the upper block chain layer generating unit 1220 can generate the upper block chain layer based on the upper block chain layer according to the same or different upper block chain layer generation conditions for each upper block chain layer. The adjacent upper block chain layer. Specifically, the reference block determination module 1221 may determine whether there is a reference block in the upper block chain layer that triggers the generation condition of the upper block chain layer for each upper block chain layer. When there is a reference block that triggers the generation condition of the upper block chain layer, the upper block chain layer generation module 1222 may generate the adjacent upper block of the upper block chain layer based at least in part on the block information of the reference block The corresponding upper block of the chain layer.
在一个示例中,上层块链式层生成模块1222还可以基于从各个块链式层的第一个区块到该基准区块的所有区块中的至少部分区块的区块信息,生成该块链式层的相邻上层块链式层的对应区块。In an example, the upper block chain layer generation module 1222 may also generate the block information based on the block information of at least part of all blocks from the first block of each block chain layer to the reference block. The corresponding block of the adjacent upper block chain layer of the block chain layer.
区块链生成装置还可以包括区块索引信息存储单元(附图中未示出)。区块索引信息存储单元存储基准区块与对应上层区块的区块索引信息。在一个示例中,区块索引信息存储单元可以将区块索引信息存储在基准区块或基准区块所对应的上层区块中,还可以将区块索引信息存储在该上层区块的下一区块中。在另一示例中,区块索引信息存储单元还可以将区块索引信息存储在索引数据库中。The block chain generation device may also include a block index information storage unit (not shown in the drawings). The block index information storage unit stores the block index information of the reference block and the corresponding upper block. In an example, the block index information storage unit may store the block index information in the reference block or the upper block corresponding to the reference block, and may also store the block index information in the next block of the upper block. Block. In another example, the block index information storage unit may also store the block index information in the index database.
图13是根据本说明书的一个实施例的用于更新多层块链式结构中的信任点的装置的结构框图。如图13所示,信任点更新装置1300包括验证路径确定单元1310、链路验证单元1320、目标底层区块验证单元1330和信任点更新单元1340。Fig. 13 is a structural block diagram of an apparatus for updating trust points in a multi-layer block chain structure according to an embodiment of the present specification. As shown in FIG. 13, the trust point update device 1300 includes a verification path determination unit 1310, a link verification unit 1320, a target bottom layer block verification unit 1330, and a trust point update unit 1340.
验证路径确定单元1310基于多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径。在一个示例中,验证路径确定单元1310可以在目标底层区块和已验证底层区块之间存在至少两个底层块链式层的基准区块时,经由至少一个上层块链式层确定验证路径。The verification path determination unit 1310 determines the verification path between the verified bottom-level block and the target bottom-level block indicated by the current trust point based on the multi-layer block chain structure. In one example, the verification path determination unit 1310 may determine the verification path via at least one upper-level block chain layer when there are at least two base-level block-chain-type reference blocks between the target bottom-level block and the verified bottom-level block. .
在一个示例中,各个块链式层中的相邻两个基准区块之间的第一区块数可以是相等的,验证路径所经过的上层块链式层的数量可以不超过第一区块数。In an example, the number of first blocks between two adjacent reference blocks in each block chain layer may be equal, and the number of upper block chain layers passed by the verification path may not exceed the first zone Number of blocks.
在一个示例中,验证路径确定单元1310可以基于第一区块数和第二区块数来确定验证路径,第一区块数是各个块链式层的相邻两个基准区块之间的区块数,第二区块数 是目标底层区块与已验证底层区块之间的区块数。各个块链式层的相邻两个基准区块之间的第一间隔区块数可以是基于区块索引信息确定的。In an example, the verification path determination unit 1310 may determine the verification path based on the first block number and the second block number, where the first block number is the difference between two adjacent reference blocks of each block chain layer. Block number, the second block number is the number of blocks between the target bottom block and the verified bottom block. The number of first interval blocks between two adjacent reference blocks of each block chain layer may be determined based on block index information.
在另一示例中,验证路径确定单元1310还可以基于区块索引信息确定验证路径。In another example, the verification path determination unit 1310 may also determine the verification path based on block index information.
在确定验证路径之后,链路验证单元1320针对验证路径中的各个区块,验证该区块与该区块的前一区块之间的链路是否正确。目标底层区块验证单元1330验证目标底层区块是否正确。信任点更新单元1340当验证路径中的各个区块之间的链路均正确并且目标区块是正确的时,将目标底层区块更新为信任点。After the verification path is determined, the link verification unit 1320 verifies whether the link between the block and the previous block in the verification path is correct for each block in the verification path. The target bottom block verification unit 1330 verifies whether the target bottom block is correct. The trust point update unit 1340 updates the target bottom block as the trust point when the link between each block in the verification path is correct and the target block is correct.
在另一示例中,信任点更新装置可以不包括目标底层区块验证单元1330。在该示例中,信任点更新单元1340可以当验证路径中的各个区块之间的链路均正确时,将目标底层区块更新为信任点。In another example, the trust point update apparatus may not include the target underlying block verification unit 1330. In this example, the trust point update unit 1340 may update the target underlying block to the trust point when the link between each block in the verification path is correct.
图14是图13所示的用于更新多层块链式结构的信任点的装置中的链路验证单元的结构框图。如图14所示,链路验证单元1320包括哈希运算模块1321和链路验证模块1322。在该示例中,验证路径中的各个区块包括前一区块的第一哈希值。FIG. 14 is a structural block diagram of the link verification unit in the device for updating the trust point of the multi-layer block chain structure shown in FIG. 13. As shown in FIG. 14, the link verification unit 1320 includes a hash operation module 1321 and a link verification module 1322. In this example, each block in the verification path includes the first hash value of the previous block.
哈希运算模块1321至少部分地基于本地获取的前一区块的区块信息进行哈希运算,以得到第二哈希值。链路验证模块1322基于第二哈希值与第一哈希值之间的一致性,验证该区块与前一区块之间的链路是否正确。The hash operation module 1321 performs a hash operation based at least in part on the block information of the previous block obtained locally to obtain the second hash value. The link verification module 1322 verifies whether the link between the block and the previous block is correct based on the consistency between the second hash value and the first hash value.
图15是图13所示的用于更新多层块链式结构中的信任点的装置中的目标底层区块验证单元的结构框图。如图15所示,目标底层区块验证单元1330包括哈希运算模块1321和链路验证模块1322。FIG. 15 is a structural block diagram of a target bottom-level block verification unit in the device for updating trust points in a multi-layer block chain structure shown in FIG. 13. As shown in FIG. 15, the target bottom layer block verification unit 1330 includes a hash operation module 1321 and a link verification module 1322.
目标底层区块信息获取模块1331从区块链系统中的多个全量节点处获取目标底层区块的多个目标底层区块信息。目标底层区块验证模块1332当多个目标底层区块信息中存在不低于法定数量的一致的目标底层区块信息时,确定目标底层区块是否正确。The target bottom block information acquisition module 1331 obtains multiple target bottom block information of the target bottom block from multiple full nodes in the blockchain system. The target bottom block verification module 1332 determines whether the target bottom block is correct when there is no less than a statutory number of consistent target bottom block information in the multiple target bottom block information.
以上参照图1到6和图12,对根据本说明书实施例的用于生成多层块链式结构的方法及装置的实施例进行了描述,并参照图7到11、13至15对信任点更新方法及装置进行了描述。在以上对方法实施例的描述中所提及的细节,同样适用于本说明书实施例的装置的实施例。1 to 6 and 12, the method and apparatus for generating a multi-layer block chain structure according to the embodiments of the present specification are described above, and the trust points are described with reference to FIGS. 7 to 11 and 13 to 15. The update method and device are described. The details mentioned in the above description of the method embodiment are also applicable to the embodiment of the device in the embodiment of this specification.
本说明书实施例的多层块链式结构生成装置和信任点更新装置可以采用硬件实现,也可以采用软件或者硬件和软件的组合来实现。本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见。The multi-layer block chain structure generation device and the trust point update device in the embodiments of the present specification can be implemented by hardware, or can be implemented by software or a combination of hardware and software. The various embodiments in this specification are described in a progressive manner, and the same or similar parts among the various embodiments are referred to each other.
本说明书实施例的多层块链式结构生成装置和信任点更新装置可以采用硬件实现,也可以采用软件或者硬件和软件的组合来实现。以软件实现为例,作为逻辑意义上的装置,是通过其所在设备的处理器将存储器中对应的计算机程序指令读取到内存中运行形成的。在本说明书实施例中,多层块链式结构生成装置和信任点更新装置例如可以利用计算设备实现。The multi-layer block chain structure generation device and the trust point update device in the embodiments of the present specification can be implemented by hardware, or can be implemented by software or a combination of hardware and software. Taking software implementation as an example, as a logical device, it is formed by reading the corresponding computer program instructions in the memory into the memory by the processor of the device where it is located. In the embodiment of the present specification, the multi-layer block chain structure generating device and the trust point updating device can be realized by using a computing device, for example.
图16是根据本说明书的一个实施例的用于实现多层块链式结构生成方法或信任点更新方法的计算设备的结构框图。如图16所示,计算设备1600包括处理器1610、存储器1620、内存1630、通信接口1640和内部总线1650,并且处理器1610、存储器(例如,非易失性存储器)1620、内存1630、通信接口1640经由总线1650连接在一起。根据一个实施例,计算设备1600可以包括至少一个处理器1610,该至少一个处理器1610执行在计算机可读存储介质(即,存储器1620)中存储或编码的至少一个计算机可读指令(即,上述以软件形式实现的元素)。Fig. 16 is a structural block diagram of a computing device for implementing a multi-layer block chain structure generation method or a trust point update method according to an embodiment of the present specification. As shown in FIG. 16, the computing device 1600 includes a processor 1610, a memory 1620, a memory 1630, a communication interface 1640, and an internal bus 1650, and a processor 1610, a memory (for example, a non-volatile memory) 1620, a memory 1630, and a communication interface The 1640 are connected together via a bus 1650. According to one embodiment, the computing device 1600 may include at least one processor 1610 that executes at least one computer-readable instruction (ie, the aforementioned Elements implemented in software).
在一个实施例中,在存储器1620中存储计算机可执行指令,其当执行时使得至少一个处理器1610:基于交易数据生成多层块链式结构中的底层块链式层的区块;以及根据上层块链式层生成条件,基于底层块链式层生成上层块链式层,其中,根据上层块链式层生成条件,基于底层块链式层生成上层块链式层包括:确定底层块链式层中是否存在触发上层块链式层生成条件的基准区块;响应于底层块链式层中存在触发上层块链式层生成条件的基准区块,至少部分地基于该基准区块的区块信息,生成上层块链式层的对应上层区块。In one embodiment, computer-executable instructions are stored in the memory 1620, which, when executed, cause at least one processor 1610 to: generate blocks of the underlying block chain layer in the multi-layer block chain structure based on transaction data; and according to The upper block chain layer generation conditions are based on the lower block chain layer to generate the upper block chain layer, wherein, according to the upper block chain layer generation conditions, the upper block chain layer is generated based on the bottom block chain layer including: determining the bottom block chain Whether there is a reference block that triggers the generation condition of the upper block chain layer in the type layer; in response to the presence of a reference block in the underlying block chain layer that triggers the generation condition of the upper block chain layer, the area based at least in part on the reference block Block information to generate the corresponding upper block of the upper block chain layer.
在另一实施例中,在存储器1620中存储计算机可执行指令,其当执行时使得至少一个处理器1610:基于多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径;针对所述验证路径中的各个区块,验证该区块与该区块的前一区块之间的链路是否正确;以及当所述验证路径中的各个区块之间的链路均正确时,将所述目标底层区块更新为信任点。In another embodiment, computer-executable instructions are stored in the memory 1620, which when executed, cause at least one processor 1610 to: based on a multi-layer block chain structure, determine the verified underlying block and target indicated by the current trust point The verification path between the underlying blocks; for each block in the verification path, verify whether the link between the block and the previous block of the block is correct; and when each of the verification paths When the links between the blocks are all correct, update the target bottom block as a trust point.
应该理解,在存储器1620中存储的计算机可执行指令当执行时使得至少一个处理器1610进行本说明书实施例的各个实施例中以上结合图1到6和图12描述的各种操作和功能,或参照图7到11、13至15所描述的各种操作和功能。It should be understood that the computer-executable instructions stored in the memory 1620, when executed, cause at least one processor 1610 to perform the various operations and functions described above in conjunction with FIGS. 1 to 6 and 12 in the various embodiments of the embodiments of this specification, or Various operations and functions are described with reference to Figures 7 to 11 and 13 to 15.
根据一个实施例,提供了一种例如非暂时性机器可读介质的程序产品。非暂时性机器可读介质可以具有指令(即,上述以软件形式实现的元素),该指令当被机器执行时,使得机器执行本说明书实施例的各个实施例中以上结合图1到6和图12描述的各 种操作和功能,或参照图7到11、13至15所描述的各种操作和功能。According to one embodiment, a program product such as a non-transitory machine-readable medium is provided. The non-transitory machine-readable medium may have instructions (that is, the above-mentioned elements implemented in the form of software), which when executed by a machine, cause the machine to execute the various embodiments of the embodiments of this specification. The various operations and functions described in 12, or the various operations and functions described with reference to FIGS. 7 to 11 and 13 to 15.
具体地,可以提供配有可读存储介质的系统或者装置,在该可读存储介质上存储着实现上述实施例中任一实施例的功能的软件程序代码,且使该系统或者装置的计算机或处理器读出并执行存储在该可读存储介质中的指令。Specifically, a system or device equipped with a readable storage medium may be provided, and the software program code for realizing the function of any one of the above-mentioned embodiments is stored on the readable storage medium, and the computer or device of the system or device The processor reads and executes the instructions stored in the readable storage medium.
在这种情况下,从可读介质读取的程序代码本身可实现上述实施例中任何一项实施例的功能,因此机器可读代码和存储机器可读代码的可读存储介质构成了本发明的一部分。In this case, the program code itself read from the readable medium can implement the function of any one of the above embodiments, so the machine readable code and the readable storage medium storing the machine readable code constitute the present invention a part of.
可读存储介质的实施例包括软盘、硬盘、磁光盘、光盘(如CD-ROM、CD-R、CD-RW、DVD-ROM、DVD-RAM、DVD-RW、DVD-RW)、磁带、非易失性存储卡和ROM。可选择地,可以由通信网络从服务器计算机上或云上下载程序代码。Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tape, Volatile memory card and ROM. Alternatively, the program code can be downloaded from the server computer or the cloud via the communication network.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than in the embodiments and still achieve desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown in order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
上述各流程和各系统结构图中不是所有的步骤和单元都是必须的,可以根据实际的需要忽略某些步骤或单元。各步骤的执行顺序不是固定的,可以根据需要进行确定。上述各实施例中描述的装置结构可以是物理结构,也可以是逻辑结构,即,有些单元可能由同一物理实体实现,或者,有些单元可能分由多个物理实体实现,或者,可以由多个独立设备中的某些部件共同实现。Not all steps and units in the above processes and system structure diagrams are necessary, and some steps or units can be omitted according to actual needs. The order of execution of each step is not fixed and can be determined as needed. The device structure described in the foregoing embodiments may be a physical structure or a logical structure, that is, some units may be implemented by the same physical entity, or some units may be implemented by multiple physical entities, or may be implemented by multiple physical entities. Some components in independent devices are implemented together.
在整个本说明书中使用的术语“示例性”意味着“用作示例、实例或例示”,并不意味着比其它实施例“优选”或“具有优势”。出于提供对所描述技术的理解的目的,具体实施方式包括具体细节。然而,可以在没有这些具体细节的情况下实施这些技术。在一些实例中,为了避免对所描述的实施例的概念造成难以理解,公知的结构和装置以框图形式示出。The term "exemplary" used throughout this specification means "serving as an example, instance, or illustration", and does not mean "preferred" or "advantageous" over other embodiments. The detailed description includes specific details for the purpose of providing an understanding of the described technology. However, these techniques can be implemented without these specific details. In some instances, in order to avoid incomprehensibility to the concepts of the described embodiments, well-known structures and devices are shown in the form of block diagrams.
以上结合附图详细描述了本说明书实施例的实施例的可选实施方式,但是,本说明书实施例的实施例并不限于上述实施方式中的具体细节,在本说明书实施例的实施例的技术构思范围内,可以对本说明书实施例的实施例的技术方案进行多种简单变型,这些简单变型均属于本说明书实施例的实施例的保护范围。The above describes in detail the optional implementation manners of the embodiments of the embodiments of this specification with reference to the accompanying drawings. However, the embodiments of the embodiments of this specification are not limited to the specific details in the above-mentioned embodiments. Within the scope of the conception, a variety of simple modifications can be made to the technical solutions of the embodiments of the embodiments of the present specification, and these simple modifications all belong to the protection scope of the embodiments of the embodiments of the present specification.
本说明书实施例内容的上述描述被提供来使得本领域任何普通技术人员能够实现或者使用本说明书实施例内容。对于本领域普通技术人员来说,对本说明书实施例内容进行的各种修改是显而易见的,并且,也可以在不脱离本说明书实施例内容的保护范围的情况下,将本文所定义的一般性原理应用于其它变型。因此,本说明书实施例内容并不限于本文所描述的示例和设计,而是与符合本文公开的原理和新颖性特征的最广范围相一致。The foregoing description of the content of the embodiments of this specification is provided to enable any person of ordinary skill in the art to implement or use the content of the embodiments of this specification. It is obvious to a person of ordinary skill in the art that various modifications made to the content of the embodiments of this specification are obvious, and the general principles defined herein can also be used without departing from the scope of protection of the content of the embodiments of this specification. Apply to other variants. Therefore, the contents of the embodiments of this specification are not limited to the examples and designs described herein, but are consistent with the widest scope that conforms to the principles and novel features disclosed herein.

Claims (21)

  1. 一种用于更新多层块链式结构中的信任点的方法,所述多层块链式结构包括底层块链式层和至少一个上层块链式层,所述底层块链式层的区块基于交易数据生成,所述至少一个上层块链式层的上层区块是至少部分地基于该上层块链式层的下层块链式层中的基准区块的区块信息生成的,所述信任点指示所述底层块链式层中的块高最大的已验证底层区块,A method for updating trust points in a multi-layer block chain structure, the multi-layer block chain structure includes a bottom block chain layer and at least one upper block chain layer, the area of the bottom block chain layer The block is generated based on transaction data, and the upper block of the at least one upper block chain layer is generated based at least in part on the block information of the reference block in the lower block chain layer of the upper block chain layer. The trust point indicates the verified bottom block with the largest block height in the bottom block chain layer,
    所述方法包括:The method includes:
    基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径;Based on the multi-layer block chain structure, determine the verification path between the verified underlying block indicated by the current trust point and the target underlying block;
    针对所述验证路径中的各个区块,验证该区块与该区块的前一区块之间的链路是否正确;以及For each block in the verification path, verify whether the link between the block and the previous block of the block is correct; and
    当所述验证路径中的各个区块之间的链路均正确时,将所述目标底层区块更新为信任点。When the links between the blocks in the verification path are correct, the target bottom block is updated as a trust point.
  2. 如权利要求1所述的方法,其中,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径包括:The method of claim 1, wherein, based on the multi-layer block chain structure, determining the verification path between the verified bottom-layer block and the target bottom-layer block indicated by the current trust point comprises:
    在所述目标底层区块和所述已验证底层区块之间存在至少两个底层基准区块时,经由至少一个上层块链式层确定所述验证路径。When there are at least two bottom-level reference blocks between the target bottom-level block and the verified bottom-level block, the verification path is determined via at least one upper-level block chain layer.
  3. 如权利要求2所述的方法,其中,所述多层块链式结构中的各个块链式层中的相邻两个基准区块之间的第一区块数相等,所述验证路径所经过的上层块链式层的数量不超过所述第一区块数。The method according to claim 2, wherein the first block number between two adjacent reference blocks in each block chain layer in the multi-layer block chain structure is equal, and the verification path is The number of upper block chain layers passed does not exceed the number of the first block.
  4. 如权利要求2所述的方法,其中,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径包括:The method according to claim 2, wherein, based on the multi-layer block chain structure, determining the verification path between the verified bottom-layer block indicated by the current trust point and the target bottom-layer block comprises:
    基于第一区块数和第二区块数来确定所述验证路径,所述第一区块数是各个块链式层的相邻两个基准区块之间的区块数,所述第二区块数是所述目标底层区块与所述已验证底层区块之间的底层区块数。The verification path is determined based on the first number of blocks and the second number of blocks. The first number of blocks is the number of blocks between two adjacent reference blocks of each block chain layer. The number of two blocks is the number of bottom blocks between the target bottom block and the verified bottom block.
  5. 如权利要求4所述的方法,其中,所述各个块链式层的相邻两个基准区块之间的第一区块数是基于区块索引信息确定的,所述区块索引信息指示各个基准区块与所对应的上层区块的索引。The method according to claim 4, wherein the first number of blocks between two adjacent reference blocks of each block chain layer is determined based on block index information, and the block index information indicates The index of each reference block and the corresponding upper block.
  6. 如权利要求1所述的方法,其中,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径包括:The method of claim 1, wherein, based on the multi-layer block chain structure, determining the verification path between the verified bottom-layer block and the target bottom-layer block indicated by the current trust point comprises:
    基于区块索引信息确定所述验证路径,所述区块索引信息指示各个基准区块与对应 上层区块之间的索引。The verification path is determined based on block index information, and the block index information indicates the index between each reference block and the corresponding upper block.
  7. 如权利要求1所述的方法,还包括:The method of claim 1, further comprising:
    验证所述目标底层区块是否正确,Verify that the target underlying block is correct,
    当所述验证路径中的各个区块之间的链路均正确时,将所述目标底层区块更新为信任点包括:When the links between the blocks in the verification path are correct, updating the target bottom layer block to a trust point includes:
    当所述验证路径中的各个区块之间的链路均正确并且所述目标区块经过被确定为正确时,将所述目标底层区块更新为信任点。When the links between the blocks in the verification path are correct and the target block is determined to be correct, the target bottom block is updated as a trust point.
  8. 如权利要求7所述的方法,其中,验证所述目标底层区块是否正确包括:8. The method of claim 7, wherein verifying whether the target underlying block is correct comprises:
    从区块链系统中的多个全量节点处获取所述目标底层区块的多个目标底层区块信息;以及Obtain multiple target bottom-level block information of the target bottom-level block from multiple full nodes in the blockchain system; and
    当所述多个目标底层区块信息中存在不低于法定数量的一致的目标底层区块信息时,确定所述目标底层区块是正确的。When there is no less than a legal number of consistent target bottom block information in the multiple target bottom block information, it is determined that the target bottom block is correct.
  9. 如权利要求1所述的方法,其中,所述验证路径中的各个区块包括至少基于所述前一区块的区块信息生成的第一哈希值,验证该区块与该区块的前一区块之间的链路是否正确包括:The method of claim 1, wherein each block in the verification path includes a first hash value generated at least based on the block information of the previous block, and verifying the difference between the block and the block Whether the link between the previous block is correct includes:
    至少部分地基于本地获取的所述前一区块的区块信息进行哈希运算,以得到第二哈希值;Performing a hash operation based at least in part on the block information of the previous block obtained locally to obtain a second hash value;
    基于所述第二哈希值与所述第一哈希值之间的一致性,验证该区块与前一区块之间的链路是否正确。Based on the consistency between the second hash value and the first hash value, it is verified whether the link between the block and the previous block is correct.
  10. 如权利要求1-9中任一所述的方法,其中,所述目标底层区块的块高不小于将被执行SPV验证的待验证交易所在的待验证底层区块。The method according to any one of claims 1-9, wherein the block height of the target bottom layer block is not less than the bottom layer block to be verified where the transaction to be verified is to be verified by SPV.
  11. 一种用于更新多层块链式结构中的信任点的装置,所述多层块链式结构包括底层块链式层和至少一个上层块链式层,所述底层块链式层的区块基于交易数据生成,所述至少一个上层块链式层的上层区块是至少部分地基于该上层块链式层的下层块链式层中的基准区块的区块信息生成的,所述信任点指示所述底层块链式层中的块高最大的已验证底层区块,A device for updating trust points in a multi-layer block chain structure. The multi-layer block chain structure includes a bottom block chain layer and at least one upper block chain layer. The block is generated based on transaction data, and the upper block of the at least one upper block chain layer is generated based at least in part on the block information of the reference block in the lower block chain layer of the upper block chain layer. The trust point indicates the verified bottom block with the largest block height in the bottom block chain layer,
    所述装置包括:The device includes:
    验证路径确定单元,基于所述多层块链式结构,确定当前信任点所指示的已验证底层区块与目标底层区块之间的验证路径;The verification path determination unit, based on the multi-layer block chain structure, determines the verification path between the verified underlying block and the target underlying block indicated by the current trust point;
    链路验证单元,针对所述验证路径中的各个区块,验证该区块与该区块的前一区块之间的链路是否正确;以及The link verification unit, for each block in the verification path, verifies whether the link between the block and the previous block of the block is correct; and
    信任点更新单元,当所述验证路径中的各个区块之间的链路均正确时,将所述目标底层区块更新为信任点。The trust point update unit, when the links between the blocks in the verification path are correct, update the target bottom layer block to the trust point.
  12. 如权利要求11所述的装置,其中,验证路径确定单元在所述目标底层区块和所述已验证底层区块之间存在至少两个底层基准区块时,经由至少一个上层块链式层确定所述验证路径。The device of claim 11, wherein the verification path determination unit passes through at least one upper-level block chain layer when there are at least two bottom-level reference blocks between the target bottom-level block and the verified bottom-level block. Determine the verification path.
  13. 如权利要求12所述的装置,其中,各个区块链式层中的相邻两个基准区块之间的第一区块数相等,所述验证路径所经过的上层块链式层的数量不超过所述第一区块数。The device according to claim 12, wherein the number of first blocks between two adjacent reference blocks in each block chain layer is equal, and the number of upper block chain layers passed by the verification path Does not exceed the number of first blocks.
  14. 如权利要求12所述的装置,其中,验证路径确定单元基于第一区块数和第二区块数来确定所述验证路径,所述第一区块数是各个块链式层的相邻两个基准区块之间的区块数,所述第二区块数是所述目标底层区块与所述已验证底层区块之间的底层区块数。The apparatus of claim 12, wherein the verification path determination unit determines the verification path based on a first block number and a second block number, and the first block number is adjacent to each block chain layer The number of blocks between two reference blocks, and the second number of blocks is the number of bottom blocks between the target bottom block and the verified bottom block.
  15. 如权利要求14所述的装置,其中,所述各个块链式层的相邻两个基准区块之间的第一区块数是基于区块索引信息确定的,所述区块索引信息指示各个基准区块与所对应的上层区块的索引。The device of claim 14, wherein the first number of blocks between two adjacent reference blocks of each block chain layer is determined based on block index information, and the block index information indicates The index of each reference block and the corresponding upper block.
  16. 如权利要求11所述的装置,其中,验证路径确定单元基于区块索引信息确定所述验证路径,所述区块索引信息指示各个基准区块与对应上层区块之间的索引。11. The apparatus of claim 11, wherein the verification path determination unit determines the verification path based on block index information, and the block index information indicates an index between each reference block and a corresponding upper block.
  17. 如权利要求11所述的装置,还包括:The apparatus of claim 11, further comprising:
    目标底层区块验证单元,验证所述目标底层区块是否正确;The target bottom block verification unit verifies whether the target bottom block is correct;
    所述信任点更新单元当所述验证路径中的各个区块之间的链路均正确并且所述目标区块被验证为正确时,将所述目标底层区块更新为信任点。The trust point update unit updates the target underlying block as a trust point when the links between the blocks in the verification path are correct and the target block is verified as correct.
  18. 如权利要求17所述的装置,其中,所述目标底层区块验证单元包括:The apparatus of claim 17, wherein the target bottom layer block verification unit comprises:
    目标底层区块信息获取模块,从区块链系统中的多个全量节点处获取所述目标底层区块的多个目标底层区块信息;以及The target bottom block information acquisition module, which obtains multiple target bottom block information of the target bottom block from multiple full nodes in the blockchain system; and
    目标底层区块验证模块,当所述多个目标底层区块信息中存在不低于法定数量的一致的目标底层区块信息时,确定所述目标底层区块是正确的。The target bottom-level block verification module determines that the target bottom-level block is correct when there is no less than a statutory number of consistent target bottom-level block information in the multiple target bottom-level block information.
  19. 如权利要求11所述的装置,其中,所述验证路径中的各个区块包括至少基于所述前一区块的区块信息生成的第一哈希值,所述验路验证单元包括:11. The device of claim 11, wherein each block in the verification path includes a first hash value generated at least based on block information of the previous block, and the path verification verification unit includes:
    哈希运算模块,至少部分地基于本地获取的所述前一区块的区块信息进行哈希运算, 以得到第二哈希值;A hash operation module that performs a hash operation based at least in part on the block information of the previous block obtained locally to obtain a second hash value;
    链路验证模块,基于所述第二哈希值与所述第一哈希值之间的一致性,验证该区块与前一区块之间的链路是否正确。The link verification module verifies whether the link between the block and the previous block is correct based on the consistency between the second hash value and the first hash value.
  20. 一种计算设备,包括:A computing device including:
    至少一个处理器;以及At least one processor; and
    存储器,所述存储器存储指令,当所述指令被所述至少一个处理器执行时,使得所述至少一个处理器执行如权利要求1到10中任一所述的方法。A memory, where the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the method according to any one of claims 1 to 10.
  21. 一种机器可读存储介质,其存储有可执行指令,所述指令当被执行时使得所述机器执行如权利要求1到10中任一所述的方法。A machine-readable storage medium that stores executable instructions that when executed causes the machine to execute the method according to any one of claims 1 to 10.
PCT/CN2020/116042 2019-12-11 2020-09-18 Method and apparatus for updating trusted point in multi-layer blockchain structure WO2021114796A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911267099.0A CN111143381B (en) 2019-12-11 2019-12-11 Method and device for updating trust points in multi-layer block chain structure
CN201911267099.0 2019-12-11

Publications (1)

Publication Number Publication Date
WO2021114796A1 true WO2021114796A1 (en) 2021-06-17

Family

ID=70518083

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/116042 WO2021114796A1 (en) 2019-12-11 2020-09-18 Method and apparatus for updating trusted point in multi-layer blockchain structure

Country Status (2)

Country Link
CN (1) CN111143381B (en)
WO (1) WO2021114796A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111143381B (en) * 2019-12-11 2023-05-19 支付宝(杭州)信息技术有限公司 Method and device for updating trust points in multi-layer block chain structure
CN111159286B (en) * 2019-12-11 2023-05-16 支付宝(杭州)信息技术有限公司 Method and apparatus for generating multi-layer block chain structure

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790112A (en) * 2016-12-26 2017-05-31 清华大学深圳研究生院 A kind of method that the node operating system and data of integrated lightweight block chain update
CN109040133A (en) * 2018-09-27 2018-12-18 上海点融信息科技有限责任公司 The method, apparatus and storage medium of intelligent contract are installed in block chain network
US10320569B1 (en) * 2018-04-05 2019-06-11 HOTYB, Inc. Systems and methods for authenticating a digitally signed assertion using verified evaluators
US10474980B1 (en) * 2016-10-27 2019-11-12 Amazon Technologies, Inc. Secured delivery process utilizing manufactured temporary keys
CN111143381A (en) * 2019-12-11 2020-05-12 支付宝(杭州)信息技术有限公司 Method and apparatus for updating trust points in a multi-level blockchain structure

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107341660B (en) * 2017-05-27 2021-06-29 唐盛(北京)物联技术有限公司 Block chain bottom layer consensus mechanism and block chain system based on same
US10581613B2 (en) * 2017-06-09 2020-03-03 Ecole Polytechnique Federale De Lausanne (Epfl) Cryptographically verifiable data structure having multi-hop forward and backwards links and associated systems and methods
CN107945017B (en) * 2017-11-16 2021-11-12 成都赤乌软件技术有限公司 Hybrid chain accounting method based on multi-stage verification
CN109146484A (en) * 2018-08-31 2019-01-04 深圳付贝科技有限公司 Common recognition verification method, digging mine machine and block catenary system based on block chain
CN109493061B (en) * 2018-12-28 2021-03-23 合肥达朴汇联科技有限公司 Verification method and device for data of block chain, electronic equipment and storage medium
CN110147410B (en) * 2019-04-18 2020-08-04 阿里巴巴集团控股有限公司 Data verification method, system, device and equipment in block chain type account book
CN110347744B (en) * 2019-06-03 2020-07-24 阿里巴巴集团控股有限公司 Data storage method, device and equipment for multilayer block chain type account book

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10474980B1 (en) * 2016-10-27 2019-11-12 Amazon Technologies, Inc. Secured delivery process utilizing manufactured temporary keys
CN106790112A (en) * 2016-12-26 2017-05-31 清华大学深圳研究生院 A kind of method that the node operating system and data of integrated lightweight block chain update
US10320569B1 (en) * 2018-04-05 2019-06-11 HOTYB, Inc. Systems and methods for authenticating a digitally signed assertion using verified evaluators
CN109040133A (en) * 2018-09-27 2018-12-18 上海点融信息科技有限责任公司 The method, apparatus and storage medium of intelligent contract are installed in block chain network
CN111143381A (en) * 2019-12-11 2020-05-12 支付宝(杭州)信息技术有限公司 Method and apparatus for updating trust points in a multi-level blockchain structure

Also Published As

Publication number Publication date
CN111143381B (en) 2023-05-19
CN111143381A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
TWI740423B (en) System and method for providing privacy and security protection in blockchain-based private transactions
US10708060B2 (en) System and method for blockchain-based notification
TWI740378B (en) Method and device for transaction verification
WO2021135857A1 (en) Method and device for updating trusted node information
WO2021135757A1 (en) Method and apparatus for executing transaction correctness verification
CN115210741B (en) Partially ordered blockchain
WO2021184885A1 (en) Method and device for use in updating public key set at blockchain node
US20160344737A1 (en) Uniqueness and auditing of a data resource through an immutable record of transactions in a hash history
KR102404284B1 (en) Systems and methods for creating digital marks
US11126458B2 (en) Method, apparatus, and electronic device for resource allocation based on blockchain
WO2021135744A1 (en) Data synchronization method and device for blockchain nodes
KR20200106000A (en) System and method for implementing blockchain-based digital certificate
US10951417B2 (en) Blockchain-based transaction verification
KR20220088956A (en) Systems and methods for providing specialized proof of confidential knowledge
WO2021114796A1 (en) Method and apparatus for updating trusted point in multi-layer blockchain structure
US20220329411A1 (en) Blockchain processing offload to network device
WO2021143364A1 (en) Method and apparatus for acquiring transaction processing state in decentralized application cluster
WO2021135755A1 (en) Method and apparatus for sending response message for data request, and blockchain system
WO2021114926A1 (en) Method and device for use in generating multilayer blockchain structure
US20210406876A1 (en) Permissioned eventing in a decentralized database
CN111162970B (en) Method and device for testing decentralized application server in block chain system
US20200394470A1 (en) Efficient verification of maching learning applications

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20900458

Country of ref document: EP

Kind code of ref document: A1