Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Latest commit

 

History

History
44 lines (31 loc) · 2.31 KB

committee-handover-flow.md

File metadata and controls

44 lines (31 loc) · 2.31 KB

Overview

A sidechain bridge contract has to know the committee of valid leader candidates to be able to post transactions from sidechain to main chain. The committee rotates between epochs deterministically, accordingly to an algorithm. The next committee is generated by a pseudorandom algorithm. It is signed off by the current committee during the handover phase near the end of the epoch by creating and signing a handover certificate. The next epoch committee should be signed by at least a configurable threshold of the current epoch committee members. Two-thirds is a secure value.

Initialization

The initialization of the committee is made of two actions:

  • posting on-chain messages to the CommitteeCandidateValidator script to register a sidechain committee member candidate
  • posting on-chain message to the CommitteeHashValidator script to set the initial committee members' public keys and a sidechain epoch when the sidechain starts

These actions are performed using trustless-sidechain CTL. Each sidechain is identified by a set of parameters: EVM sidechain id, EVM genesis block hash, genesis UTXO and required signatures threshold.

Submitting signature

Near the end of a sidechain epoch, in the handover phase, each block producer is expected to:

  • get a list of registered committee candidates for the next epoch and main-chain nonce for randomness seed
  • run algorithm to calculate the next committee
  • sign a transaction with the new committee signature
  • add this transaction as the first one in the produced block.

When the procedure is done, then relay can get these signatures from the sidechain node and post it to the main-chain CommitteeHashValidator script, where it will be validated and added to the chain.

TBD: write a paragraph that explains endpoints and commands when the flow is completed and tested.

Blocks validation

Each handover signature event has to be validated by other participants before they accept the block containing it. The following rules must be followed:

  • event is properly signed by one of current committee members
  • event has public keys of the next committee
  • event contains sidechain parameters matching this sidechain
  • event contains the proper epoch number.