CPC H04L 9/50 (2022.05) [H04L 9/06 (2013.01)] | 16 Claims |
1. A blockchain consensus method, applied to a node in a blockchain system, the method comprising:
determining, from a plurality of sub-blockchains, a target sub-blockchain based on information in a block header of a target block, wherein the target block is a first target block generated by the node based on transaction data or a second target block obtained by synchronizing with other nodes;
adding the target block to the target sub-blockchain;
obtaining, from the plurality of sub-blockchains, a sequence of valid blocks for each of the plurality of sub-blockchains, wherein each sequence of valid blocks includes at least one valid block; and
globally ranking the obtained valid blocks based on a logical clock corresponding to each of the obtained valid blocks, to obtain a global blockchain,
wherein generating the first target block based on the transaction data comprises:
merging other field information in fields of the block header of the first target block excluding an auxiliary information field to obtain merged data, and hashing the merged data to obtain a package hash, wherein the other field information includes at least a global snapshot flag of the plurality of sub-blockchains, a transaction root hash of the transaction data, and a block hash of a longest-clock block pointed to by the first target block, wherein the longest-clock block pointed to by the first target block is a legal block with a largest logical clock detected by the node when generating the first target block;
processing the package hash using a verifiable delay function to obtain a verifiable output result;
determining the target sub-blockchain to which the first target block to be added, a corresponding parent block in the target sub-blockchain, and a corresponding parent block hash and a parent block proof based on the verifiable output result; and
obtaining the first target block based on the other field information, the verifiable output result, the parent block hash, the parent block proof, and the transaction data.
|