Introduction to Baking/Validating

Dune’s blockchain uses LDPOS (Liquid Delegatable Proof Of Stake) to perform its consensus (inherited from Tezos’ consensus algorithm). Dune does not have a static list of validators (called bakers). Anybody with enough coins can set up a baking infrastructure.

Before we see how to bake on Dune Network, here is small overview and terminology.

Levels and Cycles

In Dune Network, each level correspond to the addition of a block in the main chain. There is currently a new block (level) at most each minute on the mainnet (at most every 30 second on the testnet). A cycle is list of 4096 blocks (levels). It takes at least 2 days, 20 hours and 16 minutes to accomplish a cycle on the mainnet while it only requires (at least) 1 day, 10 hours and 8 minutes on the testnet.

The Notion of Rolls

To setup a baker, you need to understand a few things and terms about Dune Network. The first one is about stake: to be able to bake, you should have rolls: 10,000 DUN equal one roll. The number of blocks you’ll bake and the number of endorsements you’ll make is proportional to the number of rolls you have.

Rolls Snapshots

In order to determine future baking rights, the blockchain regularly takes snapshots of all roll owners. More precisely, at each cycle N, snapshots of accounts’ staking balances are taken. At cycle N+2, one of these snapshots is randomly selected and used to determine baking rights for (future) cycle N+7. That is: who will bake (resp. endorse) at each level and with which priority for cycle N+7.

Declaring Your Address as a Baker

To become a baker, you must declare yourself as a delegate with the dune-client command as follows:

$ ./dune-client register key <my-baker-key> as delegate

This command is also given in baking infrastructures pages. Once a new address is registered as a delegate, it’ll take 7 cycles for it to start effectively baking/endorsing as explained above (Rolls Snapshots section).

Delegated Contracts/Accounts

Instead of setting-up a baker, some people may just want to delegate their $DUN coins to some baker. A list of bakers offering a delegation service is given on DunScan. Of course, you can choose a baker not listed on this page. Delegating will allow you to earn rewards while keeping a full, exclusive and safe access to your coins. The delegation process is explained in this page.

Deposits and Rewards

Each time a baker produces a block or an endorsement, he will make a security deposit (512 $DUN for a block and 64 $DUN for an endorsement, but this may be lower during rampup period). The deposit is taken from the baker’s (available) balance. A produced block (resp. endorsement) of priority 0 that is included in the main chain is rewarded 16 $DUN (resp. 2 $DUN). Deposits, rewards and fees are frozen for a period of 5 cycles before they are added to the baker’s available balance.

If a baker is denunciated for double-baking or double-endorsing at some cycle, he’ll lose all the frozen deposits, rewards and fees of the cycle in which he double-baked/endorsed.

Available, Frozen, Evaluated and Staking Balance

The available balance of a baker is the amount of $DUN he has on his dn, and which could be transferred or deposited. The frozen balance is the amount of deposits, rewards and fees of the dn address that are currently frozen. The evaluated balance is the sum of available and frozen balance.

A staking balance of a baker is the sum of its evaluated balance with the balances of all contracts/accounts that are delegated to him. This balance is taken into account when determining the number of rolls of each baker, as explained above.

Note

If a staking balance is updated during a cycle N (a new contract/account is delegated, a delegated contract/account’s balance is modified, or a delegation has been canceled), the changes will influence baking/endorsing power of the baker at cycle N+7 (approx. 20 days) as explained above.

Over-delegation

Over-delegation happens when a baker’s staked balance is too big compared to his own available (or evaluated) balance. More precisely, it’s advised a have a ratio evaluated balance / staking balance at least equal to 0.1. This means that 10% of the staking balance should be on the baker’s dn address to be able to deposit bounds when baking or endorsing. The current limit is actually rather close to 8%. But, it’s better to have some margin as delegations change and some bakers may miss their baking slots.

Baker’s tasks

A baker/validator performs three main tasks:

  • Baking: creating a new block including a set of operations and injecting it in the network;

  • Endorsing: operation of “stamping” a block that has been created and injected

  • Accusing: if some baker B double-bakes (creates two blocks at the same level) or double-endorses (creates two endorsements for two different blocks at the same level), a baker can include an evidence and earn a part of the deposits lost by B.

These tasks are performed by three different programs called dune-baker-<PROTO>, dune-endorser-<PROTO>, and dune-accuser-<PROTO>, where <PROTO> is the current protocol (004-Pt24m4xi at the time of writing this doc). The baker itself must be run on the same computer as the Dune node.