Epoch-based cross-chain verification
Various aspects of the subject technology relate to systems, methods, and machine-readable media for message verification in a blockchain platform. The technology includes assigning to each newly proposed block of a first blockchain both a latest secondary-chain block height and an epoched secondary-chain block height. The system determines whether a proposed block seals a current epoch based on an epoch-duration threshold. When a block seals the epoch, the next block is assigned an updated epoched secondary-chain block height equal to the latest secondary-chain block height of the sealing block, and the system advances to a next epoch. When the block does not seal the epoch, the next block inherits the epoched secondary-chain block height of the proposed block. Message verification in the next block is performed using a validator set, fixed for the duration of the epoch, obtained from the second blockchain at the assigned epoched secondary-chain block height.
1 . A computer-implemented method for verifying messages in a blockchain system, the method comprising:
receiving a proposed block on a first blockchain, the proposed block including (i) a latest secondary-chain block height and (ii) an epoched secondary-chain block height associated with a second blockchain;
determining whether the proposed block seals a current epoch by comparing a timestamp of the proposed block with an epoch duration threshold;
in response to determining that the proposed block is a sealing block of the current epoch:
(i) assigning a next block an updated epoched secondary-chain block height equal to the latest secondary-chain block height included in the sealing block, and
(ii) advancing to a next epoch; and
verifying one or more messages included in the next block using a validator set obtained from the second blockchain at the epoched secondary-chain block height assigned to the next block, wherein all blocks within an epoch are verified against a same validator set.
2 . The computer-implemented method of claim 1 , further comprising identifying the latest secondary-chain block height, the epoched secondary-chain block height, an epoch number, a minimum epoch duration, and an epoch start time from a block header of the proposed block.
3 . The computer-implemented method of claim 1 , wherein the epoch duration threshold is computed as an epoch start time plus a minimum epoch duration parameter defined by a virtual machine associated with the first blockchain.
4 . The computer-implemented method of claim 1 , further comprising monotonically increasing, for each newly proposed block, a latest secondary-chain block height pointer corresponding to a most recent secondary-chain block height observable by the first blockchain at a timestamp of the newly proposed block.
5 . The computer-implemented method of claim 1 , wherein the sealing block is included in the current epoch and the next block is included in the next epoch.
6 . The computer-implemented method of claim 1 , further comprising obtaining, at a block height corresponding to the epoched secondary-chain block height, a validator set recorded on the second blockchain.
7 . The computer-implemented method of claim 1 , wherein the latest secondary-chain block height is set by a block builder.
8 . The computer-implemented method of claim 1 , further comprising, in response to determining that the proposed block does not seal the current epoch, assigning to the next block the epoched secondary-chain block height included in the proposed block.
9 . The computer-implemented method of claim 1 , wherein advancing to the next epoch further comprises:
incrementing an epoch number; and
assigning the incremented epoch number to the next block.
10 . The computer-implemented method of claim 1 , further comprising:
performing a single lookup of a next validator set from the second blockchain at the updated epoched secondary-chain block height assigned to the next epoch;
storing the next validator set for a duration of the next epoch; and
verifying blocks proposed for the duration of the next epoch using the stored next validator set.
11 . A system for verifying messages in a blockchain system, comprising:
one or more processors; and
a memory comprising instructions stored thereon, which when executed by the one or more processors, causes the one or more processors to perform:
receiving a proposed block on a first blockchain, the proposed block including (i) a latest secondary-chain block height and (ii) an epoched secondary-chain block height associated with a second blockchain;
determining whether the proposed block seals a current epoch by comparing a timestamp of the proposed block with an epoch duration threshold;
in response to determining that the proposed block is a sealing block of the current epoch:
(i) assigning a next block an updated epoched secondary-chain block height equal to the latest secondary-chain block height included in the sealing block, and
(ii) advancing to a next epoch;
in response to determining that the proposed block does not seal the current epoch, assigning to the next block the epoched secondary-chain block height included in the proposed block; and
verifying one or more messages included in the next block using a validator set obtained from the second blockchain at the epoched secondary-chain block height assigned to the next block, wherein all blocks within an epoch are verified against a same validator set.
12 . The system of claim 11 , further comprising stored sequences of instructions, which when executed by the one or more processors, cause the one or more processors to perform identifying the latest secondary-chain block height, the epoched secondary-chain block height, an epoch number, a minimum epoch duration, and an epoch start time from a block header of the proposed block.
13 . The system of claim 11 , wherein the epoch duration threshold is computed as an epoch start time plus a minimum epoch duration parameter defined by a virtual machine associated with the first blockchain.
14 . The system of claim 11 , further comprising stored sequences of instructions, which when executed by the one or more processors, cause the one or more processors to perform monotonically increasing, for each newly proposed block, a latest secondary-chain block height pointer corresponding to a most recent secondary-chain block height observable by the first blockchain at a timestamp of the newly proposed block.
15 . The system of claim 11 , wherein the sealing block is included in the current epoch and the next block is included in the next epoch.
16 . The system of claim 11 , further comprising stored sequences of instructions, which when executed by the one or more processors, cause the one or more processors to perform obtaining, at a block height corresponding to the epoched secondary-chain block height, a validator set recorded on the second blockchain.
17 . The system of claim 11 , wherein the latest secondary-chain block height is set by a block builder.
18 . The system of claim 11 , wherein advancing to the next epoch further comprises stored sequences of instructions, which when executed by the one or more processors, cause the one or more processors to perform:
incrementing an epoch number; and
assigning the incremented epoch number to the next block.
19 . The system of claim 11 , further comprising stored sequences of instructions, which when executed by the one or more processors, cause the one or more processors to perform:
prefetching, using a single lookup operation, of a next validator set from the second blockchain at the updated epoched secondary-chain block height assigned to the next epoch;
storing the next validator set for a duration of the next epoch; and
verifying blocks proposed for the duration of the next epoch using the stored next validator set.
20 . A non-transitory computer-readable storage medium comprising instructions stored thereon, which when executed by one or more processors, cause the one or more processors to perform operations for verifying messages in a blockchain system, comprising:
receiving a proposed block on a first blockchain, the proposed block including (i) a latest secondary-chain block height and (ii) an epoched secondary-chain block height associated with a second blockchain;
determining whether the proposed block seals a current epoch by comparing a timestamp of the proposed block with an epoch duration threshold;
in response to determining that the proposed block is a sealing block of the current epoch:
(i) assigning a next block an updated epoched secondary-chain block height equal to the latest secondary-chain block height included in the sealing block, and
(ii) advancing to a next epoch;
in response to determining that the proposed block does not seal the current epoch, assigning to the next block the epoched secondary-chain block height included in the proposed block; and
verifying one or more messages included in the next block using a validator set obtained from the second blockchain at the epoched secondary-chain block height assigned to the next block, wherein all blocks within an epoch are verified against a same validator set.