The proof of stake algorithm of Dune is a complex operation.
This page is meant to explain it in a simple manner so you can understand how your delegations are used to bake new Dune tokens.
This article applies to the all bakers and the Dune protocol as a whole and it is not the terms of our service specifically.
For simplicity’s sake we will be using approximate time frames for blocks and cycles.
Getting familiar with basic terms
A block is a list of transactions and operations, a chain of blocks construct a blockchain. In Dune, a new block is baked about every 60 seconds.
The process of creating new blocks is called baking. the reward for creating a new block is 16DUN.
The process of verifying the blocks which other bakers have baked is called endorsement. The reward for endorsement is 2DUN.
A cycle is a collection of 4096 blocks. so it takes about 3 days to complete a cycle.
A roll is simply a collection of 10,000DUN of a baker’s own and delegated Dune 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.
In order to keep a record of bakers rolls, the Dune 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.
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!
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
When a delegation is made and it is confirmed on the blockchain, it adds to the rolls of the baker you 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 Dune 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 Dune 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.