Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an intermediate tuto for baking using a Ledger device #506

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

spalmer25
Copy link

@spalmer25 spalmer25 commented Jan 10, 2025

This PR adds an intermediate tutorial to present how to bake with a Ledger device.

It is presented all steps from the installation of the Ledger baking app of Tezos to security verifications.

Reference: Ledger maintainance announcement for Tezos Bakers

Copy link

vercel bot commented Jan 10, 2025

@spalmer25 is attempting to deploy a commit to the Trili Tech Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@ajinkyaraj-23 ajinkyaraj-23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will review once again when its complete.


:::note

You won't need `Ledger Live` for the rest of the tutorial.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You dont need to mention this note.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed !


## Download `Tezos Wallet (XTZ)`

The `Tezos Baking` application does not allow you to sign some operations used in this tutorial. You will also need the `Tezos Wallet (XTZ)` application to sign them.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrase it like , to sign operations to setup baking you need Tezos wallet app. No need to mention tezos baking does not allow ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed. I'll change it.

```

A validation from your Ledger device will be required.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a series of screenshots might help here. Not sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

In a new terminal, run:

```bash
octez-client -R 'tcp://localhost:7732' config update

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this end here? Need to complete the command and some text below

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command is complete.
I will add an explanatory text below.


In the `Tezos Baking` application, in order to avoid signing blocks or operations that could lead to double-baking, double-attesting or double-preattesting, checks are carried out on the blocks and operations whose signature has been requested.
These verifications require a High Watermark (HWM) to be stored in the RAM of your Ledger device. Saving information in RAM can be slow and can therefore slow down the performance of your device during baking.
You can disable this by disabling the `High Watermark` option in the `Settings` section of the `Tezos Baking` application. However, when this option is no longer active, it becomes possible to sign operations that would lead to double-baking, double-attesting or double-preattesting. You are therefore strongly advised not to deactivate this option if your block and operations provider does not also prevent double-baking, double-attesting and double-preattesting.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a wording we want, also incorrect.
THe HWM is stored in NVRAM (non-volatile memory) .
Refer to the wording i have put in word document.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I will use the text of the reference doc.

@spalmer25 spalmer25 force-pushed the palmer@functori@tuto-running-baker-with-ledger branch from e91e9b9 to cfd18d4 Compare January 13, 2025 14:54
@spalmer25 spalmer25 marked this pull request as ready for review January 13, 2025 15:39
In this tutorial, we'll look at:
- how to install the Tezos baking application on your Ledger device
- how to configure your Ledger device so that the [Ledger baking application of Tezos](https://github.com/trilitech/ledger-app-tezos-baking) works properly
- how to launch a baker daemon by signing from your Ledger device using `octez-signer`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to use an external signer (octez-signer) while running your baker for enhanced protection

docs/tutorials/bake-with-ledger.md Outdated Show resolved Hide resolved
docs/tutorials/bake-with-ledger/install-app.md Outdated Show resolved Hide resolved
docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved
docs/tutorials/bake-with-ledger/setup-ledger.md Outdated Show resolved Hide resolved
```

A validation from your Ledger device will be required.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved
docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved
docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved

:::note Warning

This step is not necessary to be able to bake. However, if the HWM is not initialized, the first level encountered in an operation or block to be signed will be used as the initialization level. For this first operation or block, double baking, double-attesting or double pre-attesting will not be detected. It is therefore **strongly recommended** to at least initialize the HWM with the level of the block at the head of the chain.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont give extra information. make it compulsory for the user.

LIne 30 to 36 can be replaced by
"Always reset HWM to highest block value before starting to bake. The highest block can be obtained from Tzkt"

Co-authored-by: Ajinkya  <[email protected]>
@spalmer25 spalmer25 force-pushed the palmer@functori@tuto-running-baker-with-ledger branch from 9c9a8a9 to 6d92a85 Compare January 14, 2025 15:32
Copy link

@ajinkyaraj-23 ajinkyaraj-23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thanks

Copy link
Collaborator

@NicNomadic NicNomadic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the page run-baker complements the existing tutorial written by Tim (run a node in 5 steps), @timothymcmackin will review this to make sure the content integrates well.

An orthogonal discussion is: these pages seem to belong to document the "Ledger support" product, so I assume you're committed to maintain them with every evolution of your code base, right? For that purpose, I wonder whether it would not be safer to keep all this doc in the repos of these products (https://github.com/trilitech/ledger-app-tezos-baking and https://github.com/trilitech/ledger-app-tezos-wallet), and only refer to them in docs.tezos.com?

docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved
@ajinkyaraj-23
Copy link

As the page run-baker complements the existing tutorial written by Tim (run a node in 5 steps), @timothymcmackin will review this to make sure the content integrates well.

An orthogonal discussion is: these pages seem to belong to document the "Ledger support" product, so I assume you're committed to maintain them with every evolution of your code base, right? For that purpose, I wonder whether it would not be safer to keep all this doc in the repos of these products (https://github.com/trilitech/ledger-app-tezos-baking and https://github.com/trilitech/ledger-app-tezos-wallet), and only refer to them in docs.tezos.com?

I believe the baking app tutorial will not change much as the app is expected to be phased out after BLS signatures are introduced ( No timeline yet). Therefore its alright if they are here.

Copy link
Collaborator

@timothymcmackin timothymcmackin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a little tricky for people to follow because they have to switch between two tutorials to get it to work, but it may be doable. After we merge this I'll add a note to the other tutorial to remind you to set up your Ledger before you start that tutorial. A few other comments:

  • What do I do if I want to use a separate consensus key as in the baker tutorial?
  • In the intro, recommend that you add a section that explains the relationship between this tutorial and the main baker tutorial. Something like: Follow this tutorial before setting up your baker with the tutorial "Run a Tezos node in 5 steps." This tutorial will tell you when to switch to that tutorial and what changes to make so the baker you set up will use the accounts on your Ledger device."

docs/tutorials.mdx Outdated Show resolved Hide resolved
docs/tutorials/bake-with-ledger.md Outdated Show resolved Hide resolved

A Ledger device is a physical wallet provided by [Ledger](https://www.ledger.com). Its main purpose is to store the holder's private keys without ever disclosing them.

Applications can be installed on your Ledger device so that you can take advantage of the many features of the blockchain without any entity having direct access to your private key.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may not be clear why this is relevant without mentioning that Tezos is one of the applications. Maybe something like "Ledger devices support many blockchains by installing applications, such as an application to manage Tezos accounts and keys and an application to allow a Tezos baker to use keys on the Ledger."

docs/tutorials/bake-with-ledger.md Outdated Show resolved Hide resolved
Comment on lines 28 to 29
- You need Ledger device.
- Baker program needs to run constantly, so you need a computer / cloud vm which can run without interruptions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- You need Ledger device.
- Baker program needs to run constantly, so you need a computer / cloud vm which can run without interruptions.
- A Ledger device
- A computer or cloud VM that can run without interruptions, because the baker program must run persistently
- The latest version of the Octez suite, including the `octez-signer` program

Do we need to list supported Ledger devices here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Ledgers support the 2 Tezos apps, but I think we should add the list of supported devices.
If future Ledgers are developed, which we have not supported in our applications, the reader should be informed.

docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved
octez-signer set ledger high watermark for my_ledger_key to <LEVEL>
```

On your Ledger device, you should see a screen sequence similar to:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I have to approve this with my Ledger or is this signed automatically?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to approve on your Ledger. I will also insert this information.

docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved
docs/tutorials/bake-with-ledger/run-baker.md Outdated Show resolved Hide resolved
"highwatermark": { "round": 0, "level": 107096 } } ] }
```


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe finish with a little summary here? "Now the baking daemon is running and using the Ledger to sign consensus (baking) operations. You can leave the baker running and check on it by looking at the block numbers at the end of the .tezos-client/NetXnHfVqm9iesp_highwatermarks file."

@spalmer25
Copy link
Author

  • What do I do if I want to use a separate consensus key as in the baker tutorial?

If you want to use a consensus key, then unlike what is currently written in the tutorial, the baking key is not the ledger key. The Ledger key will be used as the consensus key. The only command line that changes in the tutorial is:

octez-client import secret key my_baker remote:tz...

And should be:

octez-client import secret key consensus_key remote:tz...

I will modify the section run-baker#set-up-a-baker-account to explain this.

@NicNomadic
Copy link
Collaborator

An orthogonal discussion is: these pages seem to belong to document the "Ledger support" product, so I assume you're committed to maintain them with every evolution of your code base, right? For that purpose, I wonder whether it would not be safer to keep all this doc in the repos of these products (https://github.com/trilitech/ledger-app-tezos-baking and https://github.com/trilitech/ledger-app-tezos-wallet), and only refer to them in docs.tezos.com?

I believe the baking app tutorial will not change much as the app is expected to be phased out after BLS signatures are introduced ( No timeline yet). Therefore its alright if they are here.

Still, if you want to place them here, can you commit testing all the tutorial at every major Octez release, at least the pages using Octez tools? We don't have enough resources in the doc squad to do that.

Also, on a more conceptual level, the architecture of the ecosystem documentation separates the Tezos-wide docs (on docs.tezos.com) from docs of each product, such as Octez, LIGO, etc. So conceptually, is this tutorial more than the doc of the Ledger apps?

@spalmer25 spalmer25 force-pushed the palmer@functori@tuto-running-baker-with-ledger branch from c192bdd to 19ccfab Compare January 16, 2025 11:19
@timothymcmackin
Copy link
Collaborator

Maybe mention that you should use a UPS to keep your Ledger active and logged-in during power outages? That's mentioned here: https://opentezos.com/node-baking/baking/persistent-baker/#running-tezos-binaries-as-services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants