Blog

Jun 24, 2019

Algorand Rewards - A Technical Overview

By: Yossi Gilad, Head of Systems Research & Chief Technology Officer, Algorand

This post is intended to help explain how rewards are implemented in the Algorand source code and the corresponding effect on token holders.  For questions around rewards philosophy or amounts, please visit the Algorand Foundation.

Given that Algorand Inc developed the Algorand blockchain protocol, we are in a unique position to give insight into how the rewards mechanism was implemented.  This post will take you through how rewards are calculated, how they are paid out, how rewards data appears, and some practical implications of our implementation.

Definitions

  • Minimum Earning Unit (MEU) - The amount of stake that must be in a user’s address to be eligible to earn rewards. - The MEU is currently 1 Algo
  • User Earning Units (UEU) - A discrete number calculated by dividing a user’s stake  by the MEU
  • Total Earning Units (TEU) A discrete number calculated by summing all UEUs in the system
  • Rewards Pool The amount of stake in Algorand address 737777777777777777777777777777777777777777777777777UFEJ2CI that is used solely for paying out rewards when earned. The Algorand Foundation is responsible for funding this address
  • Rewards Period The number of blocks between per block rewards calculations.  The rewards per block during each Rewards Period is fixed until it is recalculated to begin a new Rewards Period.  The Rewards Period is currently set to 500K blocks.

Overview

  • All addresses that contain a MEU or more will receive rewards.
  • The Algorand Foundation deposits a set amount of tokens to the Rewards Pool for a specific Rewards Period (see here)
  • The number of tokens in the Rewards Pool then divided by the number of blocks in the Rewards Period to determine the fixed per block reward amount for the Rewards Period
  • As each block is written to the blockchain, the per block reward amount is then split across all token holders based on the amount of stake they have compared to the total stake.
  • An individual’s share of the per block reward amount can change based on gaining or losing tokens. 
  • These rewards are accrued in the Algorand network and are claimed by a specific account when a transaction that involves the specific account is confirmed. Addresses involved in a transaction are: the sender, the recipient, and close-remainder-to address (if it exists).

How rewards are calculated

The fixed reward per block is calculated as (Rewards Pool / Rewards Period).

- Note that this calculation happens only once per Reward Period, at its start 

TEU is calculated at each block by summing all UEUs in the system at that block.

Each user’s reward for each block is calculated as (UEU/TEU) * fixed reward per block. This calculation is executed every block for every user to take into account changing account balances.

How rewards are disbursed

The minimum divisible unit of an Algo is a microAlgo (10^-6). We calculate rewards every block and there are blocks where an account with the MEU will not have earned a full microAlgo from that block’s rewards. Therefore, the Algorand protocol adds to an account’s pending rewards as soon as a MEU gains one full microAlgo in rewards. To keep track of rewards that should have been distributed in previous blocks, but were not due to the rewards amount being less than a microAlgo, the block header maintains the ``frac’’ field. The value in the previous block’s frac field gets added to the rewards granted by a block, so eventually, even these smaller leftover rewards would get distributed.

Reward distribution time. The Algorand protocol calculates rewards at every block, but it might take several blocks until a MEU accrues a full micro-Algo allowing rewards to be added to all eligible accounts. The distribution time is a function of the TEU in the system. When all tokens are in circulation, the TEU would be at most 10B. Assume that 20 algos are rewarded at every block, then it would take 500 blocks to accumulate 1 micro-Algo per earning unit. With blocks generated every 5 seconds, rewards are disbursed every 500 * 5 seconds = 41 minutes.

Example. Let us walk through a simple example to explain the Algorand rewards protocol:

Assume that TEU is 10M, and that each block distributes 1 Algo in rewards.

Since 1 Algo/10M is less than a micro-Algo, the reward field in the header would not initially increase. Instead, for each of the first 9 blocks, the frac field recorded in headers would increase from 0 to 9. At the 10th block, 10 algos would be disbursed (9 algos from the ``frac’’ header, the remainder from previous blocks and 1 Algo that the 10th block rewards). The block header in the 10th block would, therefore, have the ``earn’’ field set to 1, meaning that every whole earning unit gets 1 micro-Algo. The ``frac’’ field would be set to 0 since there are no leftover rewards.

Pulling rewards data from the Algorand Blockchain

Each block contains the following fields and can be queried using the SDKs, curl or the REST API (for example /v1/block/{round}

  • Reward: The amount of microAlgos per MEU earned since genesis
  • Rate: The total reward amount for that block
  • Frac: The minimum divisible unit of Algos is a microAlgo (10^-6). However, because we calculate rewards every block there are cases where an account with the MEU will not have earned a full microAlgo. This field holds that number until it reaches a full microAlgo and is disbursed to users

The details of pending rewards, claimed rewards and balance for an account are available to query. This can be done using the SDKS, curl or the REST API. All of these make use of the REST path /v1/account/{address}

When you query an account you will find four rewards and balance related fields.

  1. Amount: The number indicates a users balance + unclaimed pending rewards
  2. Amountwithoutpendingrewards: This number indicates a users balance without unclaimed pending rewards
  3. Pendingrewards: This number indicates the unclaimed pending rewards
  4. Rewards: This number indicates the total rewards this account has earned over time

As rewards are claimed when transactions occur, the rewards claimed from that transaction are also available to query. This can be done using the SDKs, curl or the REST API (for example /v1/account/{address}/transaction/{txid}). 

When you query a transaction you will find three rewards related fields.  

  1. closerewards (optional): Integer CloseRewards is the amount of unclaimed pending rewards applied to the CloseRemainderTo account as part of this transaction. format: uint64
  2. torewards (optional): Integer ToRewards is the amount of unclaimed pending rewards applied to the To account as part of this transaction. format: uint64
  3. fromrewards (optional): Integer FromRewards is the amount of pending rewards applied to the From account as part of this transaction. format: uint64

Unclaimed pending rewards are claimed by an address when that address is contained within a transaction’s To, From, or Close parameters.  That means it is impossible to transact without claiming any unclaimed pending rewards first. If there are unclaimed pending rewards to claim, they will be noted in the transaction and available when you query that transaction.

Algorand Inc. and its affiliates are separate, independent entities from the Algorand Foundation.  Algorand Inc. is currently a service provider to the Algorand Foundation with respect to its blockchain protocol development.  

For more Algorand news and updates - subscribe to our Newsletter: