The validator election process that Creditcoin implements involves three distinct steps: nomination, winner selection, and stake distribution.
In the first step validators mark themselves as candidates and nominators can decide to support them with their stake. One nominator can vote for up to 16 validators in the same election round.
Winning validators are selected by aggregating the total staked CTC that is supporting them (a nominator voting for 2 validators with 10 tokens gives 10 to each). The ones with the highest number of CTC backing them are elected and become part of the active set for the upcoming era.
While the staked tokens are counted multiple times to decide winners, they are then distributed between elected validators once the era begins. While there is no “right” way to distribute these tokens, Creditcoin uses a process called Phragmén to optimize for three things:
- Maximize total amount at stake
- Maximize stake behind the minimally staked validator
- Minimize the variance of stake among validators
By optimizing for these three things, Creditcoin’s NPoS system aims to ensure that validator rewards are as fairly distributed, based on staked CTC, as possible, given the non-linear stake to reward ratio.
Once the network decides on the active validator set, it decides who can produce blocks and when. Two different mechanisms are used to distribute block production slots: BABE and Aura.
BABE (Blind Assignment for Blockchain Extension) is the block production mechanism that runs between the validator nodes and determines the authors of new blocks. BABE assigns block production slots to validators according to stake and using a Verifiable Random Function. Slots are discrete units of time, approximately 15 seconds in length in Creditcoin. Validators participate in a lottery for every slot, which will inform whether or not they are the block producer candidate for that slot. Due to the specifics of the lottery, multiple or no validators can be selected for a slot, resulting in either a race condition or an empty slot (inconsistent block time).
Aura is a deterministic and much simpler process to distribute slots. Aura’s election mechanism is not private so it is not secure against an adaptive adversary. It can be targeted by DDOS attacks because validators for specific slots are known. Creditcoin uses Aura to fill empty slots generated by BABE.