Delegation Explained

Tezos Baking & Delegation Explained

Tezos proof of stake algorithm is a complex operation, in this article we try to explain it in a simple manner so you can understand how your delegations would be used to bake new Tezos tokens.
Please note that this article applies to the all bakers and Tezos protocol as a whole and it is not the terms of our service specifically.
For the sake of simplicity we will be using approximate time frames for blocks and cycles.
If you are willing to get a more detailed and technical explanation, you can read this article: http://doc.tzalpha.net/whitedoc/proof_of_stake.html

First lets get familiar with some basic terms:
Block:
A block is a list of transactions and operations, a chain of blocks construct a blockchain. In Tezos, a new block is baked about every 60 seconds.
Baking:
The process of creating new blocks is called baking. the reward for creating a new block is 16XTZ.
Endorsement:
The process of verifying the blocks which other bakers have baked is called endorsement. The reward for endorsement is 2XTZ.
Cycle:
A cycle is a collection of 4096 blocks. so it takes about 3 days to complete a cycle.
Roll:
A roll is simply a collection of 10,000XTZ of a baker’s own and delegated Tezos tokens. The more rolls a baker owns, a higher chance it is given to bake or endorse a new block and get rewarded for it.
Roll snapshot:
In order to keep a record of bakers rolls, the tezos blockchain takes a snapshot of current rolls every 256 blocks (approximately 5 hours) and records it in the blockchain for further usage. in a cycle (3 days), 16 snapshots are taken and recorded.
Baking Right:
It is the process of deciding which bakers are allowed to bake or endorse and how much priority they are given for these tasks. Baking Rights are calculated based on roll snapshots of 7 cycles (21 days) before!
Preserved Cycles:
It is the number of cycles in which the bakers security deposit and rewards are frozen. Currently it is 5 cycles which is approximately 15 days.

Baking Process Explained:

Now lets deliberate on a hypothetical delegation process and see how it works:
When a delegation is made and it is confirmed on the blockchain, it adds to the rolls of the baker whom the tokens are delegated to. But there are a few important points here to keep in mind:
  • The delegation is made somewhere in the middle of the current cycle (3 days), if you remember there are 16 roll snapshots taken in each cycle, so depending on where the cycle is right now, the delegation may not be recorded in some of the previous roll snapshots of the current cycle. Now here it gets tricky, when baking rights are being calculated, one of these 16 roll snapshots is chosen randomly ! so if you are unlucky and one of the roll snapshots is chosen that your delegation is not recorded in , you would lose the profit of that cycle (3 days) completely.
  • The delegation will not be used in calculating baking rights until 7 cycles (21 days) later. in other words there is a 7 cycle (21 days) lag in awarding the profits. So if you delegate your Tezos tokens to a baker today, he will not get any profits for it until 7 or 8 cycles later (8 if you are unlucky and your delegation is not recorded in chosen roll snapshot).
  • After 7 or 8 cycles later the profits of your delegation are coming in but they are locked for another 5 cycles (15 days).
  • So after a delegation is made, you can expect the profits coming in 12-13 cycles later (36-39 days).
Now lets assume that you delegate X Tezos tokens to a baker for 15 days and then cancel the delegation, in a worst case scenario you may lose the first cycle and last cycle of roll snapshots and actually get the profit for 3 cycles (9 days). If you are lucky your delegation will be included in all of selected roll snapshots and you would get the profit of all 5 cycles. As we explained before your profit becomes available in 12 cycles.

As you can see, the accounting of baking is somewhat complex and both timing of delegation and luck play a role. Although if you delegate longterm, these random factors do not matter anymore and are negligible.