Baking
Baking is the process of creating new blocks in the Tezos blockchain. Bakers are daemons complementary to Tezos nodes that cooperate to achieve consensus about the next block to add. Bakers validate pending operations, package them into a block, sign the block, propose the new block to other nodes, and verify that the blocks that other bakers propose are valid.
Baker daemons are run on behalf of user accounts. By extension, bakers also denote the users running baker daemons on behalf of their user accounts.
The baking process
The baking process includes many steps that Tezos users and developers don't need to think about, but at a basic level, baking a block follows these steps:
- The protocol selects in advance a list of bakers for each block to create in a cycle, which is a certain number of blocks.
- It also selects a list of bakers to act as validators. These bakers are responsible for validating the blocks that other bakers create and publishing attestations that the block is valid.
- The first baker on the list has a certain amount of time to create the next block. It packages pending operations into a block, signs it, and distributes it to the validators and other nodes.
- If the first baker doesn't publish a block in time, the next baker on the list has a certain amount of time to bake a block, and so on until a block is created.
- The validators verify the block and publish their attestations in future blocks.
- The next list of bakers create the next block, until the end of the cycle.
Becoming a baker
To become a baker, you must create an account to act as a delegate, which is an account that is authorized to bake blocks and attest blocks that other accounts bake, and also to receive delegations from other accounts (as explained later). Delegates temporarily stake tez as a security deposit to ensure that they are acting according to the rules of the protocol. There is a delay of a certain number of cycles from the moment when the tez are staked until the delegate can begin baking. Similarly, when bakers stop baking, their stake is unlocked after a certain number of cycles. While it is locked, the security deposit may be slashed by the protocol if the baker misbehaves (e.g., proposes or attests two different blocks for the same level).
A delegate participates in consensus in proportion to their baking power: the more baking power a delegate has, the more likely it is to be selected to bake or to validate blocks and thus receive the rewards. The baking power of a delegate is computed from the amounts of tez owned by its own and by all the accounts that delegate to it, knowing that non-staked tez are weighted half as much as staked tez in the sum.
The delegate must have a baking power of at least 6,000 tez to be allowed to bake.
A delegate also participates in governance in proportion to their voting power. The voting power of a delegate is similar to the baking power except that no distinctions is made between staked and non-staked tez.
Bakers must run at least one Tezos node and a baker daemon to go with it. These daemons must run at all times with a stable power source and internet connection, because periods of inactivity for a baker entail losses of rewards, and eventually being marked as inactive and temporarily excluded from baking.
Delegating to a baker
If you don't have enough tez to become a baker or don't want to run a baking node, you can choose a baker as your delegate, which makes you a delegator. The delegate doesn't have control over your tez and you can spend your tez at any time or withdraw your delegation, but half of the tez that you delegate counts toward the baking power of the delegate. Also, delegated tez increase the voting power of your baker: a delegate's voting power is the sum of its own tez plus the tez delegated to it.
In exchange, delegates may share some part of their rewards with you, in proportion to the amount of tez that you currently have. Check your delegate's conditions for distributing rewards.
Delegating incurs no risk for the delegator: the delegate has no control over the tez and the delegator is not punished if the delegate misbehaves.
Staking with a baker
If you want to get a bigger share of your delegate's rewards, you can temporarily stake any amount of tez from your account on behalf of your baker. All the tez you stake contribute to the baker's security deposit, and are locked under the same conditions as the baker's own staked tez, hence are slashed if the baker misbehaves. In exchange of agreeing to temporarily lock these tez and sharing the risks with your delegate, you get a bigger share of the delegate's rewards.
Later on, you may choose to unstake part or all of the staked tez, that will be unlocked after a certain delay.
To stake tez, you start by delegating to a baker's account, then you stake a certain amount of your tez to the baker. Thus, you can earn staking rewards on some frozen tez while leaving some delegated tez liquid for immediate use.
References
To start delegating and staking, use the app at https://stake.tezos.com.
For more information about the different options to participate to the Tezos network (baking, staking, or delegating), see Running Octez in the Octez documentation.
For full details about baking, see Node and Baking on opentezos.com.