clerkb-lumos-integrator
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

clerkb

Clerkb implements Proof of Authority mechanism on Nervos CKB for layer 2 solutions. It is designed as 2 components working together:

  • 2 smart contracts used as lock scripts on CKB to validate logic on chain.
  • A TypeScript based module for integrating PoA into your generator code.

The name comes from a combination of clerk, and CKB.

Design

A PoASetup construct specifies the behavior of clerkb:

export interface PoASetup {
  identity_size: number;
  round_interval_uses_seconds: boolean;
  identities: Array<HexString>;
  aggregator_change_threshold: number;
  round_intervals: number;
  subblocks_per_round: number;
}

One is free to specify the configurations here:

  • The number of aggregators is determined by identities array. Clerkb is designed to support at most 255 aggregators.
  • Each item in identities array contains the identity for one unique aggregator. The identity is represented as lock script hashes, or prefix of lock script hashes. Clerkb leverages the same technique as owner locks in sUDT: an aggregator can unlock a cell governed by the PoA lock, as long as current transaction has an input cell, whose lock script hash is identical to the aggregator identity specified in identitites array.
  • Each aggregator can issue L2 blocks in its own designated round. All the aggregators take turns having their own rounds. This is denoted by the order in identitites array. When the last aggregator in identitites array expires its round, the first aggregator in the array starts its round again.
  • A round is capped in 2 ways:
    • subblocks_per_round determines how many layer 2 blocks can be issued per round
    • round_intervals determines the interval length of a round. Based on the value of round_interval_uses_seconds, the interval can either be expressed using seconds, or layer 1 blocks.
  • The PoA setup can also be upgraded dynamically on chain. At least agreements(expressed via owner lock technique) from aggregator_change_threshold aggregators must be collected to update the PoA setup.

Readme

Keywords

none

Package Sidebar

Install

npm i clerkb-lumos-integrator

Weekly Downloads

7

Version

0.4.0

License

MIT

Unpacked Size

60.1 kB

Total Files

19

Last publish

Collaborators

  • xxuejie