Celo uses a Byzantine Fault Tolerant consensus protocol to agree on new blocks to append to the blockchain. The instances of the Celo software that participate in this consensus protocol are known as validators. More accurately, they are active validators or elected validators, to distinguish them from registered validators which are configured to participate but are not actively selected.
Celo's proof-of-stake mechanism is the set of processes that determine which nodes become active validators and how incentives are arranged to secure the network.
The first set of active validators are determined in the genesis block. Thereafter at the end of every epoch, a fixed number of blocks fixed at network creation time, an election is run that may lead to validators being added or removed.
In Celo's Validator Elections, holders of the native asset, CELO, may participate and earn rewards for doing so. Accounts do not make votes for validators directly, but instead vote for validator groups.
Before they can vote, holders of CELO move balances into the Locked Gold smart contract. Locked Gold can be used concurrently for: placing votes in Validator Elections, maintaining a stake to satisfy the requirements of registering as a validator or validator group, and also voting in on-chain Governance proposals. This means that validators and groups can vote and earn rewards with their stake.
Unlike in other proof-of-stake systems, holding Locked Gold or voting for a group does not put that amount 'at risk' from slashing due to the behavior of validators or validator groups. Only the stake put up by a validator or group may be slashed.
Most of Celo's proof-of-stake mechanism is implemented as smart contracts, and as such can be changed through Celo's on-chain Governance process.
Accounts.sol manages key delegation and metadata for all accounts including Validators, Groups and Locked Gold holders.
LockedGold.sol manages the lifecycle of Locked Gold.
Validators.sol handles registration, deregistration, staking, key management and epoch rewards for validators and validator groups, as well as routines to manage the members of groups.
Election.sol manages Locked Gold voting and epoch rewards and runs Validator Elections.
In Celo blockchain:
consensus/istanbul/backend/pos.go is called in the last block of the epoch to process validator uptime scores and make epoch rewards.