-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update baker tutorial to use consensus keys (#498)
* Fix step numbering * Add messages for no attestation rights * Using a consensus key * Changing the consensus key * Not necessarily every level * typo * Unstake everything * Unstake delay * Typo * More about why you would or would not want to use a consensus key * DAL not required * sometimes called "manager" account Co-authored-by: NicNomadic <[email protected]> * typo * receive rights even if the baker daemon is not running Co-authored-by: NicNomadic <[email protected]> * optional step Co-authored-by: NicNomadic <[email protected]> * if you set one Co-authored-by: NicNomadic <[email protected]> * Handle error about empty data dir * Refactor setting up and funding accounts * Port accessible for layer 1 node * clean up the directory as the error message indicates. * Move installation for curl * This section is no longer helpful * COrrect default port --------- Co-authored-by: NicNomadic <[email protected]>
- Loading branch information
1 parent
6aaab9a
commit 3831686
Showing
6 changed files
with
128 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,96 @@ | ||
--- | ||
title: "Step 2: Set up a baker account" | ||
title: "Step 2: Set up baker accounts" | ||
authors: Tezos core developers, Tim McMackin | ||
last_update: | ||
date: 19 August 2024 | ||
date: 9 January 2025 | ||
--- | ||
|
||
The baker needs a user account that stakes tez. | ||
In this section, you use the Octez client to create an account, register it as a delegate, and stake tez with it. | ||
In this section you use the Octez client to set up two accounts for your baker: | ||
|
||
1. Create or import an account in the Octez client. | ||
- The baker key itself (also called the manager key) stakes tez and registers as a delegate | ||
- The consensus key is the key that the baker uses to sign attestations, which are generally referred to as _consensus operations_ | ||
|
||
## Why set up a consensus key? | ||
|
||
Using a separate consensus key is not required but it is good security practice. | ||
Signing consensus operations incurs no fees, so you can set up a consensus key with no tez. | ||
You can generate and use this key on a remote machine that runs the baker and keep the baker key with your staked tez in a more secure location to reduce risk to your funds. | ||
This prevents you from having to move private keys between machines, which is inherently dangerous. | ||
|
||
If the consensus key is compromised or lost, you can create a new consensus key and switch the baker to it without changing how your tez is staked and delegated and without moving your delegators and stakers to a new account. | ||
In this way you can avoid transferring or backing up the consensus key or you can store it in a Key Management System (KMS) or Hardware Security Module (HSM) where no one has access to its private key. | ||
|
||
However, the consensus key can drain the liquid (unstaked) tez from the baker key, so you must keep the consensus key secure like all other keys. | ||
|
||
For more information about consensus keys, see [Consensus key](https://tezos.gitlab.io/user/key-management.html#consensus-key) in the Octez documentation. | ||
|
||
## Creating the accounts | ||
|
||
In this section, you use the Octez client to create these accounts and set them up for baking. | ||
|
||
1. Create or import an account in the Octez client to be the baker account (sometimes called the "manager" account). | ||
The simplest way to get an account is to use the Octez client to randomly generate an account. | ||
This command creates an account and associates it with the `my_baker` alias: | ||
|
||
```bash | ||
octez-client gen keys my_baker | ||
``` | ||
|
||
The address of the generated account can be obtained with the following command: | ||
You can get the address of the generated account with this command: | ||
|
||
```bash | ||
octez-client show address my_baker | ||
``` | ||
|
||
At this point, the balance of the `my_baker` account is still zero, as you can see by running this command: | ||
You can check the balance of the account with this command: | ||
|
||
```bash | ||
octez-client get balance for my_baker | ||
``` | ||
|
||
1. Get at least 6,000 tez from the Ghostnet faucet. | ||
1. Stake at least 6,000 tez with the account, saving a small liquid amount for transaction fees. | ||
Staked tez is temporarily frozen and cannot be spent, so you need some unstaked tez to pay transaction fees. | ||
|
||
The account must stake tez to get consensus and DAL rights. | ||
To get tez, use the Ghostnet faucet linked from https://teztnets.com/ghostnet-about to send tez to the baker account. | ||
You can check how much you have staked by running this command: | ||
|
||
Running a baker requires staking at least 6,000 tez, but the more tez it stakes, the more rights it gets and the less time it has to wait to produce blocks and make attestations. | ||
However, be aware that, for protecting abuses of the faucet, getting such amounts of tez from the faucet may take a long time (e.g. more than one hour). Consequently, some individual requests may occasionally time out or fail and need to be relaunched. | ||
```bash | ||
octez-client get staked balance for my_baker | ||
``` | ||
|
||
1. Verify that the faucet sent the tez to the account with the same `get balance` command: | ||
If you need to stake more, pass the amount to the `stake` command, as in this example: | ||
|
||
```bash | ||
octez-client get balance for my_baker | ||
octez-client stake 6000 for my_baker | ||
``` | ||
|
||
If the balance still shows 0, the local node may not be ready yet. | ||
In this case you can temporarily use the public RPC endpoint. | ||
If you are using a testnet and need tez to stake, you can get tez from the testnet faucet. | ||
For example, if you are using Ghostnet, use the Ghostnet faucet linked from https://teztnets.com/ghostnet-about to send tez to the baker account. | ||
|
||
Running a baker requires staking at least 6,000 tez, but the more tez it stakes, the more rights it gets and the less time it has to wait to produce blocks and make attestations. | ||
However, be aware that getting large amounts of tez from the faucet may take a long time (sometimes more than one hour) to prevent abuse of the faucet. | ||
Consequently, some large requests may time out or fail and need to be resubmitted. | ||
|
||
When the account receives its tez, it owns enough stake to bake but has still no consensus or DAL rights because it has not declared its intention to become a baker. | ||
|
||
1. Register your account as a delegate by running the following command: | ||
1. (Optional) Set up a separate account to be the consensus key. | ||
This command creates an account and associates it with the `consensus_key` alias: | ||
|
||
```bash | ||
octez-client register key my_baker as delegate | ||
octez-client gen keys consensus_key | ||
``` | ||
|
||
1. Stake at least 6,000 tez, saving a small amount for transaction fees, by running this command: | ||
This account does not need any tez. | ||
|
||
1. Register the baker account as a delegate and set its consensus key (if you set one) by running the following command: | ||
|
||
```bash | ||
octez-client stake 6000 for my_baker | ||
octez-client register key my_baker as delegate with consensus key consensus_key | ||
``` | ||
|
||
Now the account has staked enough tez to earn the right to make attestations, including attestations that data is available on the DAL. | ||
However, it does not receive these rights until the baking daemon is running and a certain amount of time has passed. | ||
If you are not using a consensus key, omit the argument `with consensus key consensus_key`. | ||
|
||
Now the baker account has staked enough tez to earn the right to make attestations, including attestations that data is available on the DAL. | ||
If you set up a consensus key, that key is authorized to sign consensus operations on behalf of the baker account. | ||
However, the accounts do not receive these rights until a certain amount of time has passed. | ||
|
||
While you wait for attestation rights, continue to [Step 3: Run an Octez DAL node](/tutorials/join-dal-baker/run-dal-node). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.