What is a View Change?

Since the question comes up regularly, here’s an overview of what a “View Change” is. TL;DR at the bottom. If anything is still unclear, feel free to ask questions :slight_smile:

What is a View Change?

In Albatross for every block that needs to be produced, there is a list of currently active validators that may produce it. Initially the first validator from this list will be the block producer. Exactly this is a “view”: i.e. which validator is currently allowed to produce a block. We call this validator the “block producer”. If the first block producer doesn’t produce a block, the validators will perform a “View Change”. This means that they will first broadcast that they’re willing to do a View Change. Once more than 2/3 of signatures from active validators have been collected, the View Change is complete and the “View Number” will increase. Now the second validator from the list for the current block is active and the corresponding validator can produce a block.

Why do we need View Changes?

Albatross uses an optimistic approach, to produce blocks fast, when there is no malicious or otherwise faulty behavior. In the malicious case, where the block producer produces an invalid block, other validators will ignore it and we can assume they just never received a block. Now we have the same situation as if the current block producer went offline and therefore can’t produce a block. But we want to continue producing blocks, even if the current selected block producer is not available anymore. Thus any validator that doesn’t receive a valid block will, after some timeout (currently 10 seconds), broadcast a message, that says “I’m in for a View Change” . Once any validator sees this message from 2/3 of validators, they can assume that 2/3 of the active validators will also eventually see it and thus continue with the new view number. Therefore it’s safe for the validator to actually change to the next view number, because 2/3 will be on this view number too. As described earlier, after the view number is increased, the next block producer can be selected.

What is a Slot and a 2/3 Majority?

Until now I just referred to validators, as if any validator had 1 vote and the same chance to be selected a block producer. This is only a simplification. Their say in votes and probability to be selected for block producer must be proportional to the amount of NIM they staked. Otherwise, one could just split their NIM in as many small stakes as necessary. Thus we actually use slots to determine block producer and number of votes.

Every epoch has a fixed number of slots (currently 512). You can think of a slot as a lottery ticket. At the start of the epoch, validators will be randomly selected. Their probability to be selected is proportional to their stake, and every time they’re selected, they will receive one ticket. Then the validators will write their ID on their tickets and put them back into a box.

For each block and view number, a ticket is randomly drawn from this box. The validator ID on this ticket now determines who is allowed to produce the current block. After the block was produced, the ticket is put back into the box. Thus the probability to be selected as block producer is now proportional to the number of tickets you have.

In case we need to vote on something (e.g. a View Change), the validators will vote with their tickets. E.g. if Validator A has 120 tickets in the box, their vote that says “I’m in for a View Change” will count for 120 of the total 512 votes towards the 2/3 needed. The 2/3 of 512 total would be 342 needed votes. So after validator A voted, they would still need 342 - 120 = 222 votes from other validators. Say validator B and C also got 120 votes each and they vote for the view change. Then they’d have a total of 360 votes. This signals that more than 2/3 of slots are ready to change to the next view, which they’ll then do.


A View Change is a vote by the active validators to skip to the next block producer, if the current one didn’t produce a valid block in time.


Interesting read, keep us informed about Albatross.


Is it possible for one validator to receive all 512 slots in an epoch or even 2/3 of all slots?

Then they would have full control over both block production (assuming 100%) and view changes (assuming >2/3).

Yes, but you either need to have a lot of NIM or a lot of luck.
Imagine you have 25% of all staked NIM, the probability of you getting 342 slots (2/3 of 512) in any given epoch is 1 in 1.7 x 10^87. That’s a very, very, very small number (for comparison, there are 10^80 atoms in the observable Universe).
However, that number starts to improve drastically the closer you get to 66.66…%. At 50% of staked NIM your probability is 1 in 1.7 x 10^14. At 60% it is 1 in 4100, at 66% it is 1 in 28, etc.
So, if you want to have 2/3 of the validator slots you need to have close to 2/3 of all staked NIM.

Thanks for the answer, makes sense! Sounds like it’d only be feasible early on or through some sort of collusion. Maybe a possible way staking pools could abuse their power, but still yet to read the new info about staking pools.

Keep up the great work, and nice to meet you!