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

Conversation

spalmer25
Copy link
Contributor

@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
Contributor

@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.
Copy link
Contributor

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
Contributor 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.
Copy link
Contributor

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
Contributor 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.

Copy link
Contributor

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
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

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
Copy link
Contributor

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
Contributor 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.
Copy link
Contributor

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
Contributor 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`
Copy link
Contributor

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.

Copy link
Contributor

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.
Copy link
Contributor

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"

@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
Contributor

@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
Contributor

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
Contributor 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
docs/tutorials/bake-with-ledger/run-baker.md 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
docs/tutorials/bake-with-ledger/run-baker.md Show resolved Hide resolved
@spalmer25
Copy link
Contributor 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

@spalmer25
Copy link
Contributor Author

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

We definitely need to inform readers of this information, thank you!

@spalmer25 spalmer25 force-pushed the palmer@functori@tuto-running-baker-with-ledger branch from b4bca39 to 4279b22 Compare January 20, 2025 08:32
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.

LGTM! Go ahead and merge when you are ready, or tell me and I'll merge.

@spalmer25
Copy link
Contributor Author

LGTM! Go ahead and merge when you are ready, or tell me and I'll merge.

I have no other changes to make.
@ajinkyaraj-23 , @NicNomadic do you also agree to merge this MR.
I don't have the required permissions to merge. If everyone agrees, you can merge.

@NicNomadic
Copy link
Collaborator

@timothymcmackin can you approve please the deployment on Vercel, to see the rendering of this tutorial? I don't have the rights for that.

@NicNomadic
Copy link
Collaborator

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?

OK, let's consider that most of the pages concern the interaction between the Ledger apps and the Octez suite, and thereby this tutorial belongs to the Tezos docs. Only two pages deviate from this: install_app and setup_ledger; but they are quite small and co-locating them in the same tutorial (here) can make some sense, even though they could as well live in the ledger-app repo. Up to you @ajinkyaraj-23 to decide on that.

@ajinkyaraj-23
Copy link
Contributor

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?

OK, let's consider that most of the pages concern the interaction between the Ledger apps and the Octez suite, and thereby this tutorial belongs to the Tezos docs. Only two pages deviate from this: install_app and setup_ledger; but they are quite small and co-locating them in the same tutorial (here) can make some sense, even though they could as well live in the ledger-app repo. Up to you @ajinkyaraj-23 to decide on that.

We can commit to testing this tutorial for every major octez-release, we will always have resource to maintain ledger apps because they are critical piece of Tezos ecosystem as long as ledger is in use.

Regarding the placement, the tutorial in its detailed form is already present in the Ledger-app repo, but it does not have visibility and is overly technical for a newbie. This tutorial will serve a wider audience by keeping things simple. Just like setup DAL as a baker tutorial does not have any thing which is not present in tezos gitlab docs but it makes things very simple and straighforward and easy to find. I would use the same logic here for using ledger baking app and octez-signer with ledger.

@ajinkyaraj-23
Copy link
Contributor

LGTM! Go ahead and merge when you are ready, or tell me and I'll merge.

I also second this approval. But i would request a Vercel deployment first to test how the rendering would look on preview website. Who has the rights to do that?

@NicNomadic
Copy link
Collaborator

We can commit to testing this tutorial for every major octez-release, we will always have resource to maintain ledger apps because they are critical piece of Tezos ecosystem as long as ledger is in use.

Thanks!

Regarding the placement, the tutorial in its detailed form is already present in the Ledger-app repo, but it does not have visibility and is overly technical for a newbie. This tutorial will serve a wider audience by keeping things simple. Just like setup DAL as a baker tutorial does not have any thing which is not present in tezos gitlab docs but it makes things very simple and straighforward and easy to find. I would use the same logic here for using ledger baking app and octez-signer with ledger.

I agree, distilling a more digest form is one valid reason to include this in the Tezos docs, so let's go for it.

@NicNomadic
Copy link
Collaborator

LGTM! Go ahead and merge when you are ready, or tell me and I'll merge.

I also second this approval. But i would request a Vercel deployment first to test how the rendering would look on preview website. Who has the rights to do that?

Tim does, see my message above
.
(Unfortunately github doesn't group conversations into threads, when they are not associated to a changed line 😞)

Copy link

vercel bot commented Jan 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-staging ✅ Ready (Inspect) Visit Preview Jan 21, 2025 11:24am

@timothymcmackin
Copy link
Collaborator

I've approved the vercel deployment and run it a few times. It throws an error I don't understand:
Screenshot 2025-01-21 at 6 29 47 AM

I've run the tests and build locally and it's fine so I suggest we merge. I deployed a preview version manually here; it will not update automatically:
https://timothymcmackin.github.io/previews/docs/ledger/tutorials/bake-with-ledger

@ajinkyaraj-23
Copy link
Contributor

ajinkyaraj-23 commented Jan 21, 2025 via email

@spalmer25 spalmer25 requested a review from NicNomadic January 21, 2025 15:01
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.

LGTM

@timothymcmackin
Copy link
Collaborator

LGTM. Go ahead and merge or ask me to.

@ajinkyaraj-23
Copy link
Contributor

@timothymcmackin could you please merge it?

@timothymcmackin timothymcmackin merged commit c0150bb into trilitech:main Jan 21, 2025
1 of 3 checks passed
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