To VRF or not to Vote?

To VRF or not to Vote?

Urtho
Urtho

VRF voting on Algorand

Algorand uses VRF as the base for fast and decentralized consensus.
On each round, only selected nodes know it is their time to propose or vote while all other nodes can confirm and quickly verify such proposals and votes. Each proposal fights with around 20 other proposals each round and the winning one with the lowest hash is chosen in two rounds of voting.

Algorand accounts take part in consensus by registering online on a dedicated participating node. While the process of onlining an account is fairly straightforward, some things remain unclear:

  • What is the frequency of my votes?
  • When exactly does my node start and stop voting?
  • When is it safe to shut my node down?
  • Can I stop my participation by draining my account?
  • Can I confirm the number of my soft/cert votes?

Let’s do some tests and answer all of them.

How many votes to expect

Proposal frequency

The proposal frequency is directly proportional to the fraction of the account stake vs. the total online stake. Over longer periods of time, an account with an average of 0.01% of the total online stake can expect to be the winning proposer for 0.01% of rounds.

A large-scale observation of mainnet proposal frequency across Q2’2023 shows 1:1 correlation for accounts that had no technical issues with their nodes.

Example: With 1.8B Algo online the rate of proposals for an account with 10,000 Algo is going to be around 4 per month.

All of the winning proposals are written down to the ledger and can be accessed using explorers, or node API.

Voting frequency

Account voting power is proportional to the stake fraction but the frequency of voting has a non-linear correlation because of the underlying cryptographic sortition algorithm.

Soft and cert voting steps have different “voting frequency curves” that depend on both stake fraction and required voting committee size. Accounts with over 0.15% stake have per round soft-vote freq close to 1. This means that they vote almost every round — just with an assigned weight that is proportional to the stake fraction.

soft voting per round frequency

cert voting per round frequency

As the voting process is probabilistic the observed frequency matches the expected frequency only over sufficiently many samples (number of rounds)

A one-week mainnet soft voting performance observation

Example: With 1.8B Algo online the rate of soft voting for an account with 10,000 Algo is going to be around 1 per 60 rounds. An account with over 1M Algo is going to soft vote every round but with more and more weight — relative to its stake fraction.

Vote frequency is lagging …

When you online an account or increase your stake the network is only going to “notice” this after 320 rounds. Sames goes for decreasing the stake, marking your account offline, and closing out the account.

The ground rule is : your voting frequency/power always changes 320 rounds after the transaction that introduced the change gets committed to the ledger.

Participation also stops when your registration key expires — but this time exactly at the lastVotingRound from your registration transaction.

Fun fact: the account’s online flag does not clear itself once your key expires. It clears as soon as there is any transaction activity on your account. There is an off-chain bot maintained by Algonode that detects expired keys and sends a 0.000001 Algo transaction with a note to both clear the online flag and notify the user that his account no longer participates.

This simple set of rules has the following non-obvious effects:

  • Your node continues to vote for 320 rounds (~17 minutes) after you offline your account
  • You have to renew your registration earlier than 320 rounds before it expires to make sure it votes without interruptions.
  • You have to check both the online flag and the last registration key’s expiration round to make sure that an account is really participating
  • You can have accounts, nowhere to be seen in the ledger, casting votes for up to 17 minutes after their deletion
  • Registering a new participation key invalidates the previous one — there is no support for overlapping keys

Where are my votes?

Soft votes are propagated by relays irrelevant of their timing but do not get recorded into the blockchain. Only off-chain solutions can capture and report soft voting performance using node logs or telemetry. The tools section has links to existing projects that do exactly that.

Each node, due to network propagation delays, receives the cert votes in a different order but once the sum of verified vote weights gets above the 75% threshold the round is concluded and written down in the ledger. Each node decides for itself and does not synchronize the decision with others. This makes Algorand fast but also makes it impossible to tell whose votes certified which block as nodes have different sets of recorded votes.

This might create a statistical bias in the vote certification record if proposing stake is concentrated in one geographical area. Users with slower nodes, congested network, or just far away from most proposers are going to have a lower number of cert votes recorded across nodes. It is therefore normal to see a big discrepancy between the number of casted and recorded certification votes.

Tools worth checking out


Acknowledgments

I would like to thank the Voi chain, an Algorand-based app chain, for allowing me to be a 🐋 long enough to collect timing data for this article.