CN109672733B - Account book synchronization method and device based on DAG block chain - Google Patents

Account book synchronization method and device based on DAG block chain Download PDF

Info

Publication number
CN109672733B
CN109672733B CN201811561762.3A CN201811561762A CN109672733B CN 109672733 B CN109672733 B CN 109672733B CN 201811561762 A CN201811561762 A CN 201811561762A CN 109672733 B CN109672733 B CN 109672733B
Authority
CN
China
Prior art keywords
block
transaction
sequencing
sequence
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811561762.3A
Other languages
Chinese (zh)
Other versions
CN109672733A (en
Inventor
吴小川
干泽俊
朱博亨
买提阿布都拉·奥布力喀斯木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baibao Shanghai Technology Co ltd
Shanghai Zhongan Information Technology Service Co ltd
Original Assignee
Baibao Shanghai Technology Co ltd
Zhongan Information Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Baibao Shanghai Technology Co ltd, Zhongan Information Technology Service Co Ltd filed Critical Baibao Shanghai Technology Co ltd
Priority to CN201811561762.3A priority Critical patent/CN109672733B/en
Publication of CN109672733A publication Critical patent/CN109672733A/en
Application granted granted Critical
Publication of CN109672733B publication Critical patent/CN109672733B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • 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]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The disclosure discloses an account book synchronization method and device based on DAG block chain, wherein the method comprises the following steps: receiving a sequence block ID of a first sequence block stored by a first block chain node, wherein the first sequence block is the sequence block with the highest sequence number value of the sequence block IDs stored by the first block chain node; determining whether the sequencing block ID of a second locally stored sequencing block is smaller than the sequencing block ID of the first sequencing block, wherein the second sequencing block is the sequencing block with the highest sequence number value of the sequencing block ID stored locally; sending a first synchronization request to a first blockchain node if the sequencing block ID of the second sequencing block is determined to be less than the sequencing block ID of the first sequencing block; and receiving an order block corresponding to the first synchronization request and a transaction block. The disclosure discloses a method for realizing high-speed recovery and synchronization of accounts of a block chain based on DAG by block chain nodes, which improves data transmission efficiency and reduces transmission time and transmission cost.

Description

Account book synchronization method and device based on DAG block chain
Technical Field
The present disclosure belongs to the field of blockchain technology, and in particular, to a method for synchronizing ledger based on a DAG blockchain and an apparatus for synchronizing ledger based on a DAG blockchain.
Background
A block chain system with a Directed Acyclic Graph (DAG) structure is implemented as a distributed ledger, provides a stronger concurrent processing capability compared with a conventional chain block chain, and is a leading-edge technology of the distributed ledger.
In a DAG-based blockchain, the next block (transaction block or sequence block) needs to link one or more known predecessor blocks (e.g., transaction block or sequence block) in the generation process, and the hash value of the two predecessor blocks is included in the block header, so that the whole ledger exhibits a mesh structure. The linking action may be performed concurrently, and the same front tile may be linked by multiple rear tiles simultaneously. All operating nodes in the network have a complete copy of the DAG-based blockchain, thereby enabling ledger structural consensus.
However, in existing DAG-based blockchains, when any newly added blockchain link point does not have a complete blockchain copy, restoration and synchronization from neighboring nodes is required. Because the block chain based on the DAG is a one-way structure, according to the generation mode of the block chain, the next block records the hash value of the previous block, but the previous block does not record the hash value of the next block, and the whole network is not strictly ordered, so that the recovery work of the DAG account book is difficult.
In the prior art, the ledger restoration of a block chain based on a DAG mainly adopts a recursive mode to trace back and obtain a preposed transaction. And after the block chain link point receives the latest block in a broadcasting mode, judging whether the preposed transaction of the transaction is acquired locally. If not, the transaction is requested from the neighboring node. If it has been obtained, the predecessor of that predecessor is recursively checked until the creation block (i.e., the first sequenced block) is traced. Because of the unidirectional link, post-transactions cannot be obtained in bulk from the creation block, and no significant area in the network is available for division and bulk transmission, the recovery of the ledger involves a lot of round-trip communications for a completely new node, which takes a lot of time.
Disclosure of Invention
Since the block chain based on the DAG in the current market basically adopts a recursive tracing manner to perform tracing acquisition of the preposed transaction, for a brand-new node, the recovery of the book involves a lot of round-trip communication, and a lot of time is consumed.
In view of the above problem, a first aspect of the present disclosure provides a ledger synchronization method based on a DAG blockchain, where the DAG blockchain includes a plurality of transaction blocks and one or more sequence blocks, each transaction block directly refers to another transaction block or sequence block, each sequence block directly refers to a transaction block or another sequence block, each sequence block determines the transaction block directly referred to by the sequence block and a part of the transaction blocks indirectly referred to by the sequence block, the sequence block includes at least a sequence block ID, and the sequence block ID of each sequence block is a sequence number sequentially increasing in a generation time order, and the method includes:
Receiving a sequence block ID of a first sequence block stored by a first blockchain node, wherein the first sequence block is the sequence block with the highest sequence number value of the sequence block IDs stored by the first blockchain node;
determining whether a sequencing block ID of a second locally stored sequencing block is less than a sequencing block ID of the first sequencing block, wherein the second sequencing block is the sequencing block with the highest sequence number value of the locally stored sequencing block IDs;
sending a first synchronization request to the first block chain node in the case that the sequencing block ID of the second sequencing block is determined to be smaller than the sequencing block ID of the first sequencing block, wherein the first synchronization request at least comprises a request for obtaining all sequencing blocks stored in the first block chain node and larger than the sequencing block ID of the second sequencing block and all transaction blocks determined by the sequencing blocks;
an ordering block corresponding to the first synchronization request and a transaction block are received.
According to a first aspect of the disclosure, after receiving the sequencing block and the transaction block corresponding to the first synchronization request, the method further comprises:
determining whether the highest received sequencing block ID is equal to the sequencing block ID of the first sequencing block;
In an instance in which it is determined that the highest received sequenced block ID is less than the first sequenced block ID, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks greater than the highest received sequenced block ID and all its identified transaction blocks;
an ordering block corresponding to the second synchronization request and a transaction block are received.
According to the first aspect of the disclosure, in case that the ordered block ID of the first ordered block stored by the first blockchain node is changed, the method further comprises:
after receiving the sequencing block corresponding to the first synchronization request and the transaction block, determining whether the highest sequencing block ID received is equal to the sequencing block ID of the latest first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the sequenced block ID of the newest first sequenced block, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks larger than the highest received sequenced block ID and all transaction blocks determined therefor;
An ordering block corresponding to the second synchronization request and a transaction block are received.
According to the first aspect of the present disclosure, in a case where the sequential block ID of the second sequential block is the same as the sequential block ID of the first sequential block, the method further comprises:
generating a first bit array with the length of m aiming at all first-class transaction blocks stored locally, wherein the first-class transaction blocks are transaction blocks which are not determined by a sequencing block, m is more than or equal to 10000 and less than or equal to 100000, and m is an integer;
receiving a second bit array of length m from the first blockchain node, wherein the second bit array is a bit array generated for all first-class transaction blocks stored in the first blockchain node;
determining whether the first bit array is identical to the second bit array;
in the event that it is determined that the first array of bits is different from the second array of bits, determining one or more first type transaction blocks that are stored by the first block link point but not locally stored;
sending a third synchronization request to the first blockchain node, wherein the third synchronization request at least comprises a request to obtain one or more transaction blocks of a first type stored in the first blockchain node but not locally stored;
Receiving a transaction block corresponding to the third synchronization request.
According to the first aspect of the present disclosure, generating the first bit array or the second bit array of length m for all the first type transaction blocks further comprises:
for each first-class transaction block stored locally or in a chain node of the first block, performing k hash function operations by using the first-class transaction block to obtain k hash values: h1(x)、H2(x),…,Hk(x) Where k is 5 ≦ 10 and k is an integer, x is a block or block hash of the transaction block, and 0 ≦ Hy(x) M (y ═ 1,2, …, k and H ≦ my(x) Is an integer);
generating a source bit array with the length of m, and numbering each bit of the source bit array according to the sequence to form a bit sequence number;
determining the bit sequence number equal to each hash value of each transaction block of the first type;
setting a value of a bit of the source bit array corresponding to the determined bit sequence number to 1 to generate a first bit array or a second bit array of length m.
According to the first aspect of the disclosure, in the event that the first bit array is determined to be different from the second bit array, determining that the first block link point stored but not locally stored transaction block further comprises:
Comparing the value of each bit in the first bit array with the value of the corresponding bit in the second bit array to take the bit sequence number corresponding to the bit with different value existing between the two as the difference bit sequence number;
determining one or more hash values stored in the first blockchain node but not locally stored based on the differential bit sequence number;
determining a first type transaction block stored in the first blockchain node but not stored locally based on the one or more hash values and all hash values of each first type transaction block stored in the first blockchain node.
According to the first aspect of the present disclosure, in a case where any transaction block locally stored does not find a transaction block or a sequence block directly or indirectly referenced thereto, or any sequence block locally stored does not find a transaction block or a sequence block directly or indirectly referenced thereto, the method further includes:
determining the block hash of the transaction block or the sequencing block which is not found and is directly or indirectly referenced based on the head information of the transaction block or the sequencing block which is stored locally;
generating a fourth synchronization request based on the block hash;
Transmitting the fourth synchronization request to the first block link point;
where the first block link point stores a transaction block or sequencing block corresponding to the fourth synchronization request, receiving the respective transaction block or sequencing block from a first block chain node.
In view of the above problem, a first aspect of the present disclosure provides an ledger synchronization apparatus based on a DAG blockchain, where the DAG blockchain includes a plurality of transaction blocks and one or more sequence blocks, each transaction block directly refers to another transaction block or sequence block, each sequence block directly refers to a transaction block or another sequence block, each sequence block determines the transaction block directly referred to by the sequence block and a part of the transaction blocks indirectly referred to by the sequence block, the sequence block includes at least a sequence block ID, and the sequence block ID of each sequence block is a sequence number sequentially increasing in a generation time order, the apparatus including:
a processor; and
a memory for storing instructions that, when executed, cause the processor to:
receiving a sequence block ID of a first sequence block stored by a first blockchain node, wherein the first sequence block is the sequence block with the highest sequence number value of the sequence block IDs stored by the first blockchain node;
Determining whether a sequencing block ID of a second locally stored sequencing block is less than a sequencing block ID of the first sequencing block, wherein the second sequencing block is the sequencing block with the highest sequence number value of the locally stored sequencing block IDs;
sending a first synchronization request to the first block chain node in the case that the sequencing block ID of the second sequencing block is determined to be smaller than the sequencing block ID of the first sequencing block, wherein the first synchronization request at least comprises a request for obtaining all sequencing blocks stored in the first block chain node and larger than the sequencing block ID of the second sequencing block and all transaction blocks determined by the sequencing blocks;
an ordering block corresponding to the first synchronization request and a transaction block are received.
According to a second aspect of the disclosure, after receiving the sequencing block and the transaction block corresponding to the first synchronization request, the instructions when executed cause the processor to further perform the following:
determining whether the highest received sequencing block ID is equal to the sequencing block ID of the first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the first sequenced block ID, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks greater than the highest received sequenced block ID and all its identified transaction blocks; and
An ordering block corresponding to the second synchronization request and a transaction block are received.
According to a second aspect of the disclosure, in the event that a change occurs in an ordered block ID of a first ordered block stored by the first blockchain node, the instructions when executed cause the processor to further perform the following:
after receiving the sequencing block corresponding to the first synchronization request and the transaction block, determining whether the highest sequencing block ID received is equal to the sequencing block ID of the latest first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the sequenced block ID of the newest first sequenced block, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks larger than the highest received sequenced block ID and all transaction blocks determined therefor; and
an ordering block corresponding to the second synchronization request and a transaction block are received.
According to a second aspect of the disclosure, in the case that the sequential block ID of the second sequential block is the same as the sequential block ID of the first sequential block, the instructions when executed cause the processor to further perform the following:
Generating a first bit array with the length of m aiming at all first-class transaction blocks stored locally, wherein the first-class transaction blocks are transaction blocks which are not determined by a sequencing block, m is more than or equal to 10000 and less than or equal to 100000, and m is an integer;
receiving a second bit array of length m from the first blockchain node, wherein the second bit array is a bit array generated for all first-class transaction blocks stored in the first blockchain node;
determining whether the first bit array is identical to the second bit array;
in the event that it is determined that the first array of bits is different from the second array of bits, determining one or more first type transaction blocks that are stored by the first block link point but not locally stored;
sending a third synchronization request to the first blockchain node, wherein the third synchronization request includes at least a request to obtain one or more transaction blocks stored in the first blockchain node but not locally stored;
receiving a transaction block corresponding to the third synchronization request.
According to a second aspect of the present disclosure, generating the first bit array or the second bit array of length m for all the first type transaction blocks further comprises:
For each first-class transaction block stored locally or in a chain of nodes of the first block, performing k hash function operations on the first-class transaction block to obtain k hash values: h1(x)、H2(x),…,Hk(x) Where k is 5 ≦ k ≦ 10 and k is an integer, x is a block or block hash of the transaction block, and 0 ≦ Hy(x) M ≦ m (y ≦ 1,2, …, k and Hy(x) Is an integer);
generating a source bit array with the length of m, and numbering each bit of the source bit array according to the sequence to form a bit sequence number;
determining the bit sequence number equal to each hash value of each transaction block of the first type;
setting a value of a bit of the source bit array corresponding to the determined bit sequence number to 1 to generate a first bit array or a second bit array of length m.
According to a second aspect of the disclosure, in an instance in which it is determined that the first bit array is different from the second bit array, determining that the first block link point stored but not locally stored transaction block further comprises:
comparing the value of each bit in the first bit array with the value of the corresponding bit in the second bit array to take the bit sequence number corresponding to the bit with different value existing between the two as the difference bit sequence number;
Determining one or more hash values stored in the first blockchain node but not locally stored based on the differential bit sequence number;
determining transaction blocks stored in the first blockchain node but not stored locally based on the one or more hash values and all hash values of each transaction block of the first class stored in the first blockchain node.
According to a second aspect of the disclosure, in a case where any transaction block stored locally does not find locally the transaction block or the sequencing block to which it directly or indirectly refers, or any sequencing block stored locally does not find locally the transaction block or the sequencing block to which it directly or indirectly refers, the instructions when executed cause the processor to further perform the following operations:
determining the block hash of the transaction block or the sequencing block which is not found and is directly or indirectly referenced based on the head information of the transaction block or the sequencing block which is stored locally;
generating a fourth synchronization request based on the block hash;
transmitting the fourth synchronization request to the first block link point; and
where the first tile link point stores a transaction or sequencing tile corresponding to the fourth synchronization request, receiving the respective transaction or sequencing tile from a first tile chain node.
The account book synchronization method and device based on the DAG block chain can add the sequencing blocks generated periodically into the DAG based block chain, so that the blocks positioned in different sequencing block intervals can be defined in sequence, and the transactions in the same sequence can be synchronized in batch; in addition, for the blocks after the latest sequencing block, the method for account increment synchronization based on the bloom filter is provided by the disclosure, so that the high time and communication cost of recursive acquisition transaction are avoided, and the performance of block synchronization is greatly improved.
Drawings
The features, advantages and other aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description in conjunction with the accompanying drawings, in which several embodiments of the present disclosure are shown by way of illustration and not limitation, wherein:
FIG. 1 is a flow diagram of one of the embodiments of a ledger synchronization method based on a block chain of DAGs in accordance with the present disclosure;
FIG. 2 is a flow diagram of a second embodiment of a ledger synchronization method based on DAG blockchains in accordance with the present disclosure;
FIG. 3 is a schematic diagram of a structure of a DAG-based blockchain according to the present disclosure; and
fig. 4 shows a schematic diagram of an ledger synchronization device based on DAG blockchains in accordance with the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and systems according to various embodiments of the present disclosure. It should be noted that each block in the flowchart or block diagrams may represent a module, a segment, or a portion of code, which may comprise one or more executable instructions for implementing the logical function specified in the respective embodiment. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As used herein, the terms "include," "include," and similar terms are to be construed as open-ended terms, i.e., "including/including but not limited to," meaning that additional content can be included as well. The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment," and so on.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate. For the connection between the units in the drawings, it is only for convenience of description that at least the units at two ends of the connection are in communication with each other, and is not intended to limit the inability of communication between the units that are not connected.
Embodiments of the present disclosure focus primarily on the following technical issues: all running nodes in the DAG-based blockchain network have a complete copy of the DAG ledger, so that structural consensus of the ledger can be achieved. When a node does not have a full copy, restoration and synchronization from neighboring nodes is required. Since DAG is a one-way graph structure, according to the way it is generated, the next block (e.g., transaction block or sequencing block) records the hash value of the previous block (e.g., transaction block or sequencing block), but the previous block does not record the hash value of the next block, and the whole network is not strictly ordered, making the restoration work for the DAG ledger difficult.
To address the above issues, the present disclosure enables transaction blocks located within different sequencing block regions to be determined (i.e., have the same transaction height) and enables transaction blocks having the same transaction height to be batch synchronized by adding regularly generated sequencing blocks to a DAG-based blockchain. For blocks (e.g., transaction blocks) after the latest sequencing block, the present disclosure also proposes a bloom filter-based ledger increment synchronization method, which avoids the high time and communication cost of recursively acquiring transactions, and greatly improves the performance of block (or ledger) synchronization.
Fig. 1 illustrates an exemplary flow diagram of a ledger synchronization method based on a DAG blockchain.
In the disclosure, the DAG-based blockchain includes a plurality of transaction blocks and one or more sequence blocks, and each transaction block directly refers to other transaction blocks or sequence blocks, each sequence block directly refers to a transaction block or other sequence blocks, each sequence block determines the transaction block directly referred to by the sequence block and a part of the transaction blocks indirectly referred to by the sequence block, the sequence block includes at least a sequence block ID, and the sequence block ID of each sequence block is a sequence number sequentially increasing according to a generation time sequence.
As shown in fig. 3, in the structure of the DAG-based blockchain, the following block (e.g., transaction block or sequence block) needs to link one or more known previous blocks (e.g., transaction block, sequence block and/or creation block) in the generation process, and the header information of the general block includes the hash value of the two previous blocks, so that the whole ledger exhibits a mesh structure. In the present disclosure, the header information of the transaction block includes at least transaction height, transaction type, source account information, destination account information, and the like, in addition to the hash value of its two preceding blocks.
In the present disclosure, the network periodically generates and broadcasts a sequence block by common consensus (for example, Power of Working (PoW), rights of interest (Power of stamp, PoS), Delegated rights of interest (DPoS), Practical Byzantine Fault Tolerance (PBFT), etc.); the head information of the sequence block at least comprises transaction height, sequence block ID which is strictly and orderly increased, transaction sequence and other information besides the hash value of two front blocks. In this disclosure, the first block in the DAG-based chain of blocks is referred to as a genesis-block, which is a sequenced block with sequence number 0 of the sequenced block ID.
In fig. 3, a sequence block with a sequence number of 0 (i.e., a creation block) and sequence blocks Seq1, Seq2, Seq3 (the sequence block IDs of which are 1, 2, 3, respectively) can be seen, and each sequence block can perform a deterministic operation on a part of transaction blocks, for example, as shown in fig. 3, the sequence block Seq1 determines a plurality of transaction blocks in the area (1) so that the transaction height (i.e., the sequence block ID) of the sequence block Seq1 is the same as the transaction height of each transaction block determined by the sequence block Seq 1; the sequence block Seq2 identifies a plurality of transaction blocks in the region (2) such that the transaction height (i.e. the sequence block ID) of the sequence block Seq2 is the same as the transaction height of each transaction block identified by it; the sequence block Seq3 identifies a plurality of transaction blocks in region (3) such that the transaction height (i.e., the sequence block ID) of sequence block Seq3 is the same as the transaction height of each transaction block identified by it.
In this embodiment, any blockchain node (which may be referred to as a "local blockchain node" in this disclosure) may implement the method shown in fig. 1, specifically as follows:
step 110: an ordering block ID of a first ordering block stored by a first blockchain node is received. Wherein the first sequence block is a sequence block with a highest sequence number value of sequence block IDs stored by the first blockchain node.
For example, when a first block chain node stores therein a sequence block whose sequence block ID is equal to 0,1,2,3,4,5, respectively, the first sequence block is a sequence block whose sequence block ID is 5.
Step 120: it is determined whether the sequencing block ID of the second sequencing block stored locally is less than the sequencing block ID of the first sequencing block. Wherein the second sequence block is a sequence block with a highest sequence number value of a locally stored sequence block ID.
For example, when a sequence block whose sequence block ID is equal to 0,1,2, or 3 is stored in the local block chain node, the second sequence block is a sequence block whose sequence block ID is 3.
Step 130: in the event that it is determined that the sequencing block ID of the second sequencing block is less than the sequencing block ID of the first sequencing block, a first synchronization request is sent to the first blockchain node. Wherein the first synchronization request includes at least a request to obtain all sequenced blocks stored in the first blockchain node that are larger than the sequenced block ID of the second sequenced block and all transaction blocks for which it has been determined.
For example, in the above embodiment, the first synchronization request sent by the local blockchain node to the first blockchain node includes the sequence blocks whose sequence block IDs 4 and 5 are requested to be obtained and all transaction blocks determined by the sequence blocks.
Step 140: an ordering block corresponding to the first synchronization request and a transaction block are received.
In the present disclosure, a local blockchain node may issue a plurality of first synchronization requests in sequence in order of the sequenced block IDs. For example, in the above embodiment, the first synchronization request first issued by the local blockchain node includes only the sequence block whose sequence block ID is 4 and its identified transaction block; in the case of receiving the corresponding sequence block and its identified transaction block, the first synchronization request reissued by the local blockchain node includes only the sequence block and its identified transaction block requesting to obtain a sequence block ID of 5, and then the corresponding sequence block and its identified transaction block are received from the first blockchain node.
After step 140, the blockchain node also performs the following operations:
first, it is determined whether the highest received sequencing block ID is equal to the sequencing block ID of the first sequencing block.
Second, in the event that it is determined that the highest received sequenced block ID is less than the sequenced block ID of the first sequenced block, a second synchronization request is sent to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks larger than the highest received sequenced block ID and all transaction blocks it determines.
Third, an ordering block and a transaction block corresponding to the second synchronization request are received.
The above steps are used in this disclosure to ensure that the local blockchain node can synchronously obtain all sequenced blocks and corresponding transaction blocks stored in the first blockchain but not stored in the local blockchain node.
In addition, in the case where the sequence block ID of the first sequence block stored in the first block chain node is changed, the block link point may further perform the following steps:
first, after receiving the sequencing block corresponding to the first synchronization request and the transaction block, it is determined whether the highest sequencing block ID received is equal to the sequencing block ID of the latest first sequencing block.
Second, in the event that it is determined that the highest received sequenced block ID is less than the sequenced block ID of the newest first sequenced block, a second synchronization request is sent to the first blockchain node, wherein the second synchronization request includes at least all sequenced blocks that are requested to obtain greater than the highest received sequenced block ID and all transaction blocks that it determines.
For example, when the sequence block ID of the first sequence block stored by the first blockchain node is 7, and the highest sequence block ID received by the local blockchain node is 5 after step 140, the local blockchain node needs to send a second synchronization request to the first blockchain node to request the sequence block with sequence block ID of 6,7 and the determined transaction block.
Finally, an ordering block and a transaction block corresponding to the second synchronization request are received.
The embodiment disclosed in fig. 1 is a process where there is a difference in sequencing block ID sequence numbers between a local block link point and a first block link point, such that the local block chain nodes are all synchronized to obtain the corresponding blocks of the first block chain node. The disclosed embodiments can avoid the high time and communication costs of acquiring blocks in a recursive manner.
As shown in fig. 2, when the sequence block ID of the second sequence block is the same as the sequence block ID of the first sequence block, the incremental synchronization block needs to be implemented by using a bloom filter technique, and the local blockchain node specifically performs the following steps:
step 210: a first bit array of length m is generated for all transaction blocks of a first type stored locally. Wherein the first type transaction block is a transaction block that has not been committed by the sequencing block, 10000 ≦ m ≦ 100000 and m is an integer.
In this disclosure, generating the first bit array or the second bit array of length m for all of the first type transaction blocks further comprises:
firstly, for each transaction block of a first type stored locally or in a chain node of the first block, performing k hash function operations agreed in advance by using the transaction block of the first type to obtain k hash values: h 1(x)、H2(x),…,Hk(x) Where k is 5 ≦ 10 and k is an integer, x is a block or block hash of the transaction block, and 0 ≦ Hy(x) M (y ═ 1,2, … k and H ≦ my(x) Is an integer).
Second, a source bit array of length m is generated and each bit of the source bit array is numbered in order to form a bit sequence number.
In the present embodiment, each bit initial setting value in the generated source bit array is set to 0.
Third, the bit sequence number equal to each hash value of each transaction block of the first type is determined.
Fourth, a value of a bit corresponding to the determined bit sequence number in the source bit array is set to 1 to generate a first bit array or a second bit array of length m.
For example, the hash values of a certain first type transaction block in a certain blockchain node are respectively 0,3,5,7,300, and the hash values of another first type transaction block are respectively 1,25,100,107,300, so that the 0 th bit, 3 rd bit, 5 th bit, 7 th bit, 300 th bit, 1 st bit, 25 th bit, 100 th bit, 107 th bit of the generated bit array are all 1.
The present disclosure employs a combination of hash functions and bloom filter techniques to enable determination of each particular first-type transaction block stored by any blockchain node (e.g., first blockchain node or local blockchain node).
Step 220: receiving a second array of bits of length m from the first blockchain node. Wherein the second bit array is a bit array generated for all first type transaction blocks stored in the first blockchain node.
Step 230: determining whether the first array of bits is the same as the second array of bits.
Step 240: determining one or more first type transaction blocks that are stored by the first block link point but not locally stored, if it is determined that the first bit array is different from the second bit array.
The method specifically comprises the following steps:
first, the value of each bit in the first bit array is compared with the value of the corresponding bit in the second bit array, so that the bit sequence number corresponding to the bit having a different value existing between the two is used as the differential bit sequence number.
Secondly, one or more hash values stored in the first blockchain node but not locally stored are determined based on the differential bit sequence number and all hash values of each transaction block of the first type stored in the first blockchain node.
Finally, a first type transaction block stored in the first blockchain node but not stored locally is determined based on the one or more hash values and all hash values of each first type transaction block stored in the first blockchain node.
For example, bits 0, 1, 3, 5, 7, 25, 100, 107, and 300 in the first bit array are respectively equal to 1, and bits 0, 1, 3, 5, 7, 25, 100, 107, 251, 295, and 300 in the second bit array are respectively equal to 1; it can be determined that the difference bit sequence numbers of the first bit array and the second bit array are bits 251 and 295. Then checking which one or more first type transaction blocks stored in the first blockchain node have a hash value equal to 251 or 295; in the event that one or more corresponding first type transaction blocks are found, it is determined that these first type transaction blocks are first type transaction blocks that are not stored by the local blockchain node.
Step 250: sending a third synchronization request to the first blockchain node. Wherein the third synchronization request comprises at least a request to obtain one or more transaction blocks of the first type stored in the first blockchain node but not stored locally.
Step 260: receiving a transaction block corresponding to the third synchronization request.
The first blockchain node obtains its transaction blocks that are not stored but are stored in the local blockchain node from the local blockchain node in a manner similar to steps 220-260.
The bloom filter based delta synchronization DAG-based block chain block technology disclosed by the present disclosure can significantly reduce the number of times and size of message traffic in the delta synchronization process. For example, when 10000 blocks not stored by the local blockchain node (n is 10000) need to be synchronized, if k is 8 hash functions, only 558,962 bits (68KB) need to be transmitted, that is, information on whether the first block link point owns each block can be transmitted to the local blockchain node, and the false positive rate (i.e., the probability of a block which is not stored but is considered to be stored) is less than 0.00001%, and the specific algorithm is as follows:
p=pow(1-exp(-k/(m/n)),k);
Wherein, p is false positive rate; n-the number of blocks that need to be synchronized; m-the length of the bit array.
And, the false negative rate (i.e., the probability of a block that is itself stored but is considered to be not stored) is 0. Compared to the existing common synchronization strategy, according to the case of a network structure (e.g., block chain based on DAG), at least log2(10000) -1-12 times, and at most 9999 times are required to be communicated back and forth; the missing transaction of 99.99999% can be obtained by only carrying out 1 round trip communication in the method.
In addition, in the present disclosure, when any transaction block locally stored does not find a transaction block or a sequence block directly or indirectly referenced by it locally, or any sequence block locally stored does not find a transaction block or a sequence block directly or indirectly referenced by it locally, the block link node performs the following steps:
first, based on locally stored header information of transaction blocks or sequenced blocks, a block hash of a transaction block or sequenced block that is not found and to which it refers directly or indirectly is determined.
Second, a fourth synchronization request is generated based on the block hash.
Again, the fourth synchronization request is sent to the first block link point.
Fourth, where the first block link point stores a transaction block or sequencing block corresponding to the fourth synchronization request, the respective transaction block or sequencing block is received from a first block chain node.
In the above embodiment, for the block that the local blockchain node still cannot be synchronized after the full synchronization and the incremental synchronization, the traditional recursive trace-back method is continuously adopted to synchronize the block from the first blockchain node.
Fig. 4 illustrates a schematic block diagram of ledger synchronization device 400 based on a DAG blockchain. The account synchronization device 400 includes at least a processor 410 and a memory 420, wherein the memory 420 has stored therein instructions that, when executed by the processor 410, cause the processor 410 to:
receiving a sequence block ID of a first sequence block stored by a first blockchain node, wherein the first sequence block is the sequence block with the highest sequence number value of the sequence block IDs stored by the first blockchain node;
determining whether a sequencing block ID of a second locally stored sequencing block is less than a sequencing block ID of the first sequencing block, wherein the second sequencing block is the sequencing block with the highest sequence number value of the locally stored sequencing block IDs;
Sending a first synchronization request to the first block chain node in the case that the sequencing block ID of the second sequencing block is determined to be smaller than the sequencing block ID of the first sequencing block, wherein the first synchronization request at least comprises a request for obtaining all sequencing blocks stored in the first block chain node and larger than the sequencing block ID of the second sequencing block and all transaction blocks determined by the sequencing blocks;
an ordering block corresponding to the first synchronization request and a transaction block are received.
In one embodiment consistent with the present disclosure, after receiving the sequencing block and the transaction block corresponding to the first synchronization request, the instructions when executed cause the processor 410 to further perform the following:
determining whether the highest received sequencing block ID is equal to the sequencing block ID of the first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the first sequenced block ID, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks greater than the highest received sequenced block ID and all its identified transaction blocks; and
An ordering block corresponding to the second synchronization request and a transaction block are received.
In one embodiment consistent with the present disclosure, in the event that the ordered block ID of the first ordered block stored by the first blockchain node changes, the instructions when executed cause the processor 410 to further perform the following:
after receiving the sequencing block corresponding to the first synchronization request and the transaction block, determining whether the highest sequencing block ID received is equal to the sequencing block ID of the latest first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the sequenced block ID of the newest first sequenced block, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks larger than the highest received sequenced block ID and all transaction blocks determined therefor; and
an ordering block corresponding to the second synchronization request and a transaction block are received.
In one embodiment consistent with the present disclosure, in the case that the sequential block ID of the second sequential block is the same as the sequential block ID of the first sequential block, the instructions when executed cause the processor to further perform the following:
Generating a first bit array with the length of m aiming at all first-class transaction blocks stored locally, wherein the first-class transaction blocks are transaction blocks which are not determined by a sequencing block, m is more than or equal to 10000 and less than or equal to 100000, and m is an integer;
receiving a second bit array of length m from the first blockchain node, wherein the second bit array is a bit array generated for all first-class transaction blocks stored in the first blockchain node;
determining whether the first array of bits is the same as the second array of bits;
in the event that it is determined that the first array of bits is different from the second array of bits, determining one or more transaction blocks stored by the first block link point but not stored locally;
sending a third synchronization request to the first blockchain node, wherein the third synchronization request at least comprises a request to obtain one or more transaction blocks of a first type stored in the first blockchain node but not locally stored;
receiving a transaction block corresponding to the third synchronization request.
In one embodiment according to the present disclosure, generating the first bit array or the second bit array of length m for all the first type transaction blocks further comprises:
For each first-class transaction block stored locally or in a chain node of the first block, performing k hash function operations by using the first-class transaction block to obtain k hash values: h1(x)、H2(x),…,Hk(x) Where k is 5 ≦ 10 and k is an integer, x is a block or block hash of the transaction block, and 0 ≦ Hy(x) M, y 1,2, … k and Hy(x) Is an integer;
generating a source bit array with the length of m, and numbering each bit of the source bit array according to the sequence to form a bit sequence number;
determining the bit sequence number equal to each hash value of each transaction block of the first type;
setting a value of a bit of the source bit array corresponding to the determined bit sequence number to 1 to generate a first bit array or a second bit array of length m.
In one embodiment consistent with the present disclosure, in an instance in which the first bit array is determined to be different from the second bit array, determining that the first block link point stored but not locally stored transaction block further comprises:
comparing the value of each bit in the first bit array with the value of the corresponding bit in the second bit array to take the bit sequence number corresponding to the bit with different value existing between the two as the difference bit sequence number;
Determining one or more hash values stored in the first blockchain node but not locally stored based on the differential bit sequence number;
determining transaction blocks stored in the first blockchain node but not stored locally based on the one or more hash values and all hash values of each transaction block of the first class stored in the first blockchain node.
In one embodiment consistent with the present disclosure, in the case where any transaction block stored locally does not find its directly or indirectly referenced transaction block or sequencing block locally, or any sequencing block stored locally does not find its directly or indirectly referenced transaction block or sequencing block locally, the instructions when executed cause the processor to further perform the following:
determining the block hash of the transaction block or the sequencing block which is not found and is directly or indirectly referenced based on the head information of the transaction block or the sequencing block which is stored locally;
generating a fourth synchronization request based on the block hash;
transmitting the fourth synchronization request to the first block link point; and
where the first tile link point stores a transaction or sequencing tile corresponding to the fourth synchronization request, receiving the respective transaction or sequencing tile from a first tile chain node.
The ledger synchronization method and apparatus based on DAG blockchain disclosed herein add a plurality of sequencing blocks in the DAG blockchain to facilitate topologically ordered splitting of the blockchain (i.e., defining transaction blocks directly referenced by a certain sequencing block and partial transaction blocks indirectly referenced). The method aims at different transaction blocks and sequencing blocks stored in different blockchain nodes to carry out full-quantity synchronization or adopt a bloom filter technology to carry out mutual increment synchronization, thereby greatly improving the performance of block synchronization.
Alternatively, the above-described ledger synchronization method can be implemented by a computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for carrying out various aspects of the present disclosure. The computer-readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, a punch card or an in-groove raised structure such as with instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be interpreted as a transitory signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or an electrical signal transmitted through an electrical wire.
The above description is only an alternative embodiment of the present disclosure and is not intended to limit the embodiment of the present disclosure, and various modifications and changes may be made to the embodiment of the present disclosure by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the embodiments of the present disclosure should be included in the scope of protection of the embodiments of the present disclosure.
While embodiments of the present disclosure have been described with reference to several particular embodiments, it should be understood that embodiments of the present disclosure are not limited to the particular embodiments disclosed. The embodiments of the disclosure are intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

Claims (12)

1. A DAG-based blockchain ledger synchronization method, wherein the DAG-based blockchain includes a plurality of transaction blocks and one or more sequence blocks, and each transaction block directly references another transaction block or sequence block, each sequence block directly references a transaction block or another sequence block, each sequence block determinizes the transaction block directly referenced by the sequence block and a part of the transaction block indirectly referenced by the sequence block, the sequence block includes at least a sequence block ID, and the sequence block ID of each sequence block is a sequence number sequentially increasing in a generation time order, the method comprising:
Receiving a first sequence block ID of a first sequence block stored by a first block chain node, wherein the first sequence block is the sequence block with the highest sequence number value of the sequence block IDs stored by the first block chain node;
determining whether a sequencing block ID of a locally-stored second sequencing block is smaller than a sequencing block ID of the first sequencing block, wherein the second sequencing block is the sequencing block with the highest sequence number value of the locally-stored sequencing block IDs;
sending a first synchronization request to the first block chain node in the case that the sequencing block ID of the second sequencing block is determined to be smaller than the sequencing block ID of the first sequencing block, wherein the first synchronization request at least comprises a request for obtaining all sequencing blocks stored in the first block chain node and having a sequencing block ID larger than that of the second sequencing block and all transaction blocks determined by the sequencing blocks;
receiving a sequence block and a transaction block corresponding to the first synchronization request;
under the condition that the sequencing block ID of the second sequencing block is the same as that of the first sequencing block, generating a first bit array with the length of m for all the first transaction blocks stored locally, wherein the first transaction blocks are transaction blocks which are not determined by the sequencing blocks, 10000 is less than or equal to m less than or equal to 100000, and m is an integer;
Receiving a second bit array of length m from the first blockchain node, wherein the second bit array is a bit array generated for all first-class transaction blocks stored in the first blockchain node;
determining whether the first array of bits is the same as the second array of bits;
in the event that it is determined that the first array of bits is different from the second array of bits, determining one or more first type transaction blocks that are stored by the first block link point but not locally stored;
sending a third synchronization request to the first blockchain node, wherein the third synchronization request at least comprises a request to obtain one or more transaction blocks of a first type stored in the first blockchain node but not locally stored;
receiving a transaction block corresponding to the third synchronization request.
2. The ledger synchronization method of claim 1, wherein after receiving a sequencing block and a transaction block corresponding to the first synchronization request, the method further comprises:
determining whether the highest received sequencing block ID is equal to the sequencing block ID of the first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the first sequenced block ID, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks greater than the highest received sequenced block ID and all its identified transaction blocks;
An ordering block corresponding to the second synchronization request and a transaction block are received.
3. The ledger synchronization method of claim 1, wherein, in the event of a change in a sequential block ID of a first sequential block stored by the first blockchain node, the method further comprises:
after receiving a sequencing block corresponding to the first synchronization request and a transaction block, determining whether the highest sequencing block ID received is equal to the sequencing block ID of the latest first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the sequenced block ID of the newest first sequenced block, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks larger than the highest received sequenced block ID and all transaction blocks determined therefor;
an ordering block corresponding to the second synchronization request and a transaction block are received.
4. The ledger synchronization method of claim 1, wherein generating a first bit array or a second bit array of length m for all first type transaction blocks further comprises:
for each first-class transaction block stored locally or in a chain node of the first block, performing k hash function operations by using the first-class transaction block to obtain k hash values: h _1(x), H _2(x), …, H _ k (x), where 5 ≦ k ≦ 10 and k is an integer, x is a block or block hash of the transaction block, and 0 ≦ H _ y (x) ≦ m (y 1,2, …, k and H _ y (x) is an integer);
Generating a source bit array with the length of m, and numbering each bit of the source bit array according to the sequence to form a bit sequence number;
determining the bit sequence number equal to each hash value of each transaction block of the first type;
setting a value of a bit corresponding to the determined bit sequence number in the source bit array to 1 to generate a first bit array or a second bit array of length m.
5. The ledger synchronization method of claim 4, wherein, in an instance in which the first array of bits is determined to be different from the second array of bits, determining the first block chain node stored but locally non-stored transaction block further comprises:
comparing the value of each bit in the first bit array with the value of the corresponding bit in the second bit array to take the bit sequence number corresponding to the bit with different value existing between the two as the difference bit sequence number;
determining one or more hash values stored in the first blockchain node but not locally stored based on the differential bit sequence number;
determining a first type transaction block stored in the first blockchain node but not stored locally based on the one or more hash values and all hash values of each first type transaction block stored in the first blockchain node.
6. The ledger synchronization method of claim 1, wherein in case any transaction block stored locally does not find locally a transaction block or a sequencing block to which it directly references or indirectly references, or any sequencing block stored locally does not find locally a transaction block or a sequencing block to which it directly references or indirectly references, the method further comprises:
determining the block hash of the transaction block or the sequencing block which is not found and is directly or indirectly referenced based on the head information of the transaction block or the sequencing block which is stored locally;
generating a fourth synchronization request based on the block hash;
transmitting the fourth synchronization request to the first block link point;
where the first tile link point stores a transaction or sequencing tile corresponding to the fourth synchronization request, receiving the respective transaction or sequencing tile from a first tile chain node.
7. An ledger-based blockchain ledger synchronization apparatus, wherein the DAG-based blockchain includes a plurality of transaction blocks and one or more sequence blocks, and each transaction block directly references another transaction block or sequence block, each sequence block directly references the transaction block or other sequence block, each sequence block determinizes the transaction block directly referenced by the sequence block and a part of the transaction block indirectly referenced by the sequence block, the sequence block includes at least a sequence block ID, and the sequence block ID of each sequence block is a sequence number sequentially increasing in a generation time order, the apparatus comprising:
A processor; and
a memory for storing instructions that, when executed, cause the processor to:
receiving a sequence block ID of a first sequence block stored by a first blockchain node, wherein the first sequence block is the sequence block with the highest sequence number value of the sequence block IDs stored by the first blockchain node;
determining whether a sequencing block ID of a second locally stored sequencing block is less than a sequencing block ID of the first sequencing block, wherein the second sequencing block is the sequencing block with the highest sequence number value of the locally stored sequencing block IDs;
sending a first synchronization request to the first block chain node in the case that the sequencing block ID of the second sequencing block is determined to be smaller than the sequencing block ID of the first sequencing block, wherein the first synchronization request at least comprises a request for obtaining all sequencing blocks stored in the first block chain node and larger than the sequencing block ID of the second sequencing block and all transaction blocks determined by the sequencing blocks;
receiving an order block and a transaction block corresponding to the first synchronization request;
under the condition that the sequencing block ID of the second sequencing block is the same as that of the first sequencing block, generating a first bit array with the length of m for all the first-class transaction blocks stored locally, wherein the first-class transaction blocks are transaction blocks which are not determined by the sequencing blocks, 10000 is less than or equal to m less than or equal to 100000 and m is an integer;
Receiving a second bit array of length m from the first blockchain node, wherein the second bit array is a bit array generated for all first-class transaction blocks stored in the first blockchain node;
determining whether the first array of bits is the same as the second array of bits;
in the event that it is determined that the first array of bits is different from the second array of bits, determining one or more first type transaction blocks that are stored by the first block link point but not locally stored;
sending a third synchronization request to the first blockchain node, wherein the third synchronization request includes at least a request to obtain one or more transaction blocks stored in the first blockchain node but not locally stored;
receiving a transaction block corresponding to the third synchronization request.
8. The ledger synchronization device of claim 7, wherein after receiving a sequencing block corresponding to the first synchronization request and a transaction block, the instructions when executed cause the processor to further perform the following:
determining whether the highest received sequencing block ID is equal to the sequencing block ID of the first sequencing block;
In an instance in which it is determined that the highest received sequenced block ID is less than the first sequenced block ID, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks greater than the highest received sequenced block ID and all its identified transaction blocks; and
an ordering block corresponding to the second synchronization request and a transaction block are received.
9. The ledger synchronization device of claim 7, wherein, in the event of a change in an ordered block ID of a first ordered block stored by the first blockchain node, the instructions when executed cause the processor to further perform the following:
after receiving a sequencing block corresponding to the first synchronization request and a transaction block, determining whether the highest sequencing block ID received is equal to the sequencing block ID of the latest first sequencing block;
in an instance in which it is determined that the highest received sequenced block ID is less than the sequenced block ID of the newest first sequenced block, sending a second synchronization request to the first blockchain node, wherein the second synchronization request includes at least a request to obtain all sequenced blocks larger than the highest received sequenced block ID and all transaction blocks determined therefor; and
An ordering block corresponding to the second synchronization request and a transaction block are received.
10. The ledger synchronization device of claim 7, wherein generating a first bit array or a second bit array of length m for all first type transaction blocks further comprises:
for each first-class transaction block stored locally or in a chain node of the first block, performing k hash function operations by using the first-class transaction block to obtain k hash values: h _1(x), H _2(x), …, H _ k (x), where 5 ≦ k ≦ 10 and k is an integer, x is a block or block hash of the transaction block, and 0 ≦ H _ y (x) ≦ m (y 1,2, …, k and H _ y (x) is an integer);
generating a source bit array with the length of m, and numbering each bit of the source bit array according to the sequence to form a bit sequence number;
determining the bit sequence number equal to each hash value of each transaction block of the first type;
setting a value of a bit of the source bit array corresponding to the determined bit sequence number to 1 to generate a first bit array or a second bit array of length m.
11. The ledger synchronization device of claim 10, wherein, in an instance in which the first array of bits is determined to be different from the second array of bits, determining the first block chain node stored but locally non-stored transaction block further comprises:
Comparing the value of each bit in the first bit array with the value of the corresponding bit in the second bit array to take the bit sequence number corresponding to the bit with different value existing between the two as a difference bit sequence number;
determining one or more hash values stored in the first blockchain node but not locally stored based on the differential bit sequence number;
determining transaction blocks stored in the first blockchain node but not stored locally based on the one or more hash values and all hash values of each transaction block of the first class stored in the first blockchain node.
12. The ledger synchronization device of claim 7, wherein in the event that any transaction block stored locally does not find locally a transaction block or a sequencing block to which it directly or indirectly refers, or any sequencing block stored locally does not find locally a transaction block or a sequencing block to which it directly or indirectly refers, the instructions when executed cause the processor to further perform the following:
determining the block hash of the transaction block or the sequencing block which is not found and is directly or indirectly referenced based on the head information of the transaction block or the sequencing block which is stored locally;
Generating a fourth synchronization request based on the block hash;
transmitting the fourth synchronization request to the first block link point; and
where the first tile link point stores a transaction or sequencing tile corresponding to the fourth synchronization request, receiving the respective transaction or sequencing tile from a first tile chain node.
CN201811561762.3A 2018-12-20 2018-12-20 Account book synchronization method and device based on DAG block chain Active CN109672733B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811561762.3A CN109672733B (en) 2018-12-20 2018-12-20 Account book synchronization method and device based on DAG block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811561762.3A CN109672733B (en) 2018-12-20 2018-12-20 Account book synchronization method and device based on DAG block chain

Publications (2)

Publication Number Publication Date
CN109672733A CN109672733A (en) 2019-04-23
CN109672733B true CN109672733B (en) 2022-06-07

Family

ID=66144956

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811561762.3A Active CN109672733B (en) 2018-12-20 2018-12-20 Account book synchronization method and device based on DAG block chain

Country Status (1)

Country Link
CN (1) CN109672733B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111861459A (en) * 2019-04-28 2020-10-30 常州一仙智能科技有限公司 Iota account book optimization system and method based on DPoS consensus algorithm
CN110362633B (en) * 2019-07-23 2023-12-05 腾讯科技(深圳)有限公司 Block data storage method, device, computer equipment and storage medium
US11336455B2 (en) 2019-09-25 2022-05-17 International Business Machines Corporation Consensus protocol for blockchain DAG structure

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815330A (en) * 2016-12-29 2017-06-09 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain expanded along Spatial Dimension
CN106897351A (en) * 2016-12-29 2017-06-27 北京瑞卓喜投科技发展有限公司 The generation method and system of directed acyclic pattern block chain
CN108351882A (en) * 2015-08-28 2018-07-31 斯沃尔德斯股份有限公司 Method and apparatus for the distributed data base in network
CN108769154A (en) * 2018-05-15 2018-11-06 北京工业大学 Date storage method based on directed acyclic graph and distributed account book
CN108765151A (en) * 2018-05-11 2018-11-06 深圳市恋上互联网技术有限公司 A kind of method of commerce based on block chain
CN108984789A (en) * 2018-08-15 2018-12-11 赵东洋 Method, apparatus, storage medium and the electronic equipment of distribution book keeping operation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108351882A (en) * 2015-08-28 2018-07-31 斯沃尔德斯股份有限公司 Method and apparatus for the distributed data base in network
CN106815330A (en) * 2016-12-29 2017-06-09 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain expanded along Spatial Dimension
CN106897351A (en) * 2016-12-29 2017-06-27 北京瑞卓喜投科技发展有限公司 The generation method and system of directed acyclic pattern block chain
CN108765151A (en) * 2018-05-11 2018-11-06 深圳市恋上互联网技术有限公司 A kind of method of commerce based on block chain
CN108769154A (en) * 2018-05-15 2018-11-06 北京工业大学 Date storage method based on directed acyclic graph and distributed account book
CN108984789A (en) * 2018-08-15 2018-12-11 赵东洋 Method, apparatus, storage medium and the electronic equipment of distribution book keeping operation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ByteBall中DAG交易数据同步算法详解;Alan During;《BBFans》;20181209;1-4页 *

Also Published As

Publication number Publication date
CN109672733A (en) 2019-04-23

Similar Documents

Publication Publication Date Title
CN109672733B (en) Account book synchronization method and device based on DAG block chain
CN109377232B (en) DAG-based block chain transaction sequencing method and device
CN109391645B (en) Block chain lightweight processing method, block chain node and storage medium
US20180123714A1 (en) Method, Device, and System for Sending and Receiving Code Block Data Stream
CN103268251B (en) A kind of Parallel Discrete Event Simulation method for synchronizing time dammed based on time stamp
CN111026511A (en) Block chain parallel system and method based on transaction data partition-inter-chain fusion
CN110147204B (en) Metadata disk-dropping method, device and system and computer-readable storage medium
CN103379032A (en) Acquisition method and device for cross-domain end-to-end route and secondary route computation element
CN108985740B (en) Method for realizing high-performance consensus algorithm
CN109544344B (en) Block chain transaction processing method and equipment based on DAG
CN110659284A (en) Block sequencing method and system based on tree graph structure and data processing terminal
CN100579133C (en) Method for generating ID symbol
CN110838072A (en) Social network influence maximization method and system based on community discovery
CN109658249A (en) A kind of block chain performance optimization method
CN108282531A (en) A kind of uniqueness ID generation methods based on distributed system
CN109041010A (en) Vehicle-mounted Delay Tolerant Network data forwarding method based on semi-naive Bayes classifier
CN109739684A (en) The copy restorative procedure and device of distributed key value database based on vector clock
CN109976942A (en) A kind of data backup and resume method, backup server and source server
CN104503868B (en) Method of data synchronization, device and system
CN109766724A (en) Data evidence storing method based on block chain
CN106095850A (en) A kind of data processing method and equipment
CN113807851A (en) Block chain expandability realization method and system based on fragmentation
CN104008116A (en) File synchronization method and electronic device
CN114756385B (en) Elastic distributed training method under deep learning scene
CN109360096B (en) Public chain-based private chain accounting method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20210915

Address after: Room 201, building a, No.1 Qianwan 1st Road, Shenzhen Hong Kong cooperation zone, Qianhai, Shenzhen, Guangdong 518066

Applicant after: ZHONGAN INFORMATION TECHNOLOGY SERVICE Co.,Ltd.

Applicant after: Baibao (Shanghai) Technology Co.,Ltd.

Address before: 518052 Room 201, building A, 1 front Bay Road, Shenzhen Qianhai cooperation zone, Shenzhen, Guangdong

Applicant before: ZHONGAN INFORMATION TECHNOLOGY SERVICE Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20240227

Address after: Room 1179, W Zone, 11th Floor, Building 1, No. 158 Shuanglian Road, Qingpu District, Shanghai, 201702

Patentee after: Shanghai Zhongan Information Technology Service Co.,Ltd.

Country or region after: China

Patentee after: Baibao (Shanghai) Technology Co.,Ltd.

Address before: Room 201, building a, No.1 Qianwan 1st Road, Shenzhen Hong Kong cooperation zone, Qianhai, Shenzhen, Guangdong 518066

Patentee before: ZHONGAN INFORMATION TECHNOLOGY SERVICE Co.,Ltd.

Country or region before: China

Patentee before: Baibao (Shanghai) Technology Co.,Ltd.

TR01 Transfer of patent right