From a47177da4c9189a27aba1c7b781993a5f24e7a40 Mon Sep 17 00:00:00 2001 From: Conrado Gouvea Date: Wed, 10 Apr 2024 12:02:49 -0300 Subject: [PATCH] docs: update demo section to match current code (#632) * update demo docs * update mdbook-admonish --- book/book.toml | 4 +- book/mdbook-admonish.css | 39 +++++++++++-------- book/src/zcash/ywallet-demo.md | 69 ++++++++++++++++++---------------- 3 files changed, 61 insertions(+), 51 deletions(-) diff --git a/book/book.toml b/book/book.toml index 5fdedd32..e95c664f 100644 --- a/book/book.toml +++ b/book/book.toml @@ -9,9 +9,9 @@ title = "The ZF FROST Book" [preprocessor.admonish] command = "mdbook-admonish" -assets_version = "3.0.0" # do not edit: managed by `mdbook-admonish install` +assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install` [output] [output.html] -additional-css = ["./mdbook-admonish.css"] +additional-css = ["./mdbook-admonish.css", "book/mdbook-admonish.css"] diff --git a/book/mdbook-admonish.css b/book/mdbook-admonish.css index e0a33655..45aeff05 100644 --- a/book/mdbook-admonish.css +++ b/book/mdbook-admonish.css @@ -1,20 +1,4 @@ @charset "UTF-8"; -:root { - --md-admonition-icon--admonish-note: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-abstract: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-info: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-tip: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-success: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-question: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-warning: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-failure: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-danger: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-bug: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-example: url("data:image/svg+xml;charset=utf-8,"); - --md-admonition-icon--admonish-quote: url("data:image/svg+xml;charset=utf-8,"); - --md-details-icon: url("data:image/svg+xml;charset=utf-8,"); -} - :is(.admonition) { display: flow-root; margin: 1.5625em 0; @@ -71,6 +55,8 @@ a.admonition-anchor-link::before { padding-inline: 4.4rem 1.2rem; font-weight: 700; background-color: rgba(68, 138, 255, 0.1); + print-color-adjust: exact; + -webkit-print-color-adjust: exact; display: flex; } :is(.admonition-title, summary.admonition-title) p { @@ -86,6 +72,8 @@ html :is(.admonition-title, summary.admonition-title):last-child { width: 2rem; height: 2rem; background-color: #448aff; + print-color-adjust: exact; + -webkit-print-color-adjust: exact; mask-image: url('data:image/svg+xml;charset=utf-8,'); -webkit-mask-image: url('data:image/svg+xml;charset=utf-8,'); mask-repeat: no-repeat; @@ -119,6 +107,25 @@ details[open].admonition > summary.admonition-title::after { transform: rotate(90deg); } +:root { + --md-details-icon: url("data:image/svg+xml;charset=utf-8,"); +} + +:root { + --md-admonition-icon--admonish-note: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-abstract: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-info: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-tip: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-success: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-question: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-warning: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-failure: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-danger: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-bug: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-example: url("data:image/svg+xml;charset=utf-8,"); + --md-admonition-icon--admonish-quote: url("data:image/svg+xml;charset=utf-8,"); +} + :is(.admonition):is(.admonish-note) { border-color: #448aff; } diff --git a/book/src/zcash/ywallet-demo.md b/book/src/zcash/ywallet-demo.md index cf349155..d5537fcb 100644 --- a/book/src/zcash/ywallet-demo.md +++ b/book/src/zcash/ywallet-demo.md @@ -3,15 +3,6 @@ This tutorial explaing how to run the FROST demo using Ywallet that was [presented during Zcon4](https://www.youtube.com/watch?v=xvzESdDtczo). -## Information - -1. The Trusted Dealer journey -2. RedPallas -3. YWallet -4. Sprout -5. [Sapling](https://docs.rs/reddsa/0.5.1/reddsa/sapling/index.html) -6. [frost-ed25519 crate](https://crates.io/crates/frost-ed25519) - Ywallet supports [offline signing](https://ywallet.app/advanced/offline_signature/), which allows having a view-only account that can generate a transaction plan, which can be signed by @@ -58,11 +49,11 @@ cd frost-zcash-demo/ cargo run --bin trusted-dealer --features redpallas ``` -Answer the prompts with `2` (minimum number of signers), `3` -(maximum) and empty, pressing enter to submit each. - -A bunch of information will be printed. Copy and paste them somewhere to use -them later, or leave the terminal open. +This will by default generate a 2-of-3 key shares. The public key package +will be written to `public-key-package.json`, while key packages will be +written to `key-package-1.json` through `-3`. You can change the threhsold, +number of shares and file names using the command line; append `-- -h` +to the commend above for the command line help. ```admonish info If you want to use DKG instead of Trusted Dealer, instead of the command above, @@ -104,12 +95,11 @@ take a bit to compile. It will show a bunch of warnings which is normal. cargo run --release --bin sign --features dotenv -- -g ``` -When prompted for the `ak`, paste the `verifying_key` value that was printed in -the previous part, inside the Public Key Package. For example, in the following -package +When prompted for the `ak`, paste the `verifying_key` value that is listed +inside the Public Key Package in `public-key-package.json`. For example, in the +following package ``` -Public key package: {"verifying_shares": ...snip... ,"verifying_key":"d2bf40ca860fb97e9d6d15d7d25e4f17d2e8ba5dd7069188cbf30b023910a71b","ciphersuite":"FROST(Pallas, BLAKE2b-512)"} ``` @@ -177,42 +167,55 @@ In the first one, the Coordinator, run (in the same folder where key generation was run): ``` -cargo run --bin coordinator --features redpallas +cargo run --bin coordinator --features redpallas -- --cli ``` And then: -- Paste the JSON public key package generate during key generation (it's a single - line with a JSON object). +- It should read the public key package from `public-key-package.json`. - Type `2` for the number of participants. -- Paste the identifier of the first participant, you can see it in the Secret - Share printed during key generation. If you used trusted dealer key - generation, it will be +- Paste the identifier of the first participant, you can see it in + `key-package-1.json`. If you used trusted dealer key generation, it will be `0100000000000000000000000000000000000000000000000000000000000000`. -- Paste the second identifier, e.g. - `0200000000000000000000000000000000000000000000000000000000000000`. -- When prompted for the message to be signed, paste the SIGHASH printed by the - signer above (just the hex value, e.g. - ``4d065453cfa4cfb4f98dbc9cff60c4a3904ed91c523b8ef8d67d28bea7f12ea3``). + Create a new terminal, for participant 1, and run: ``` -cargo run --bin participant --features redpallas +cargo run --bin participant --features redpallas -- --cli --key-package key-package-1.json ``` And then: -- Paste the Secret Share printed during key generation (or Key Package if you - used DKG). - Copy the SigningCommitments line and paste into the Coordinator CLI. -Do the same for participant 2. +Go back to the coordinator and: + +- Paste the second identifier, e.g. + `0200000000000000000000000000000000000000000000000000000000000000`. + +Create a new terminal, for participant 2, and run: + +``` +cargo run --bin participant --features redpallas -- --cli --key-package key-package-2.json +``` + +And then: + +- Copy the SigningCommitments line and paste into the Coordinator CLI. +- When prompted for the message to be signed, paste the SIGHASH printed by the + signer above (just the hex value, e.g. + ``4d065453cfa4cfb4f98dbc9cff60c4a3904ed91c523b8ef8d67d28bea7f12ea3``). You should be at the Coordinator CLI. Paste the Randomizer generated by the signer before and copy the Signing Package line that it was printed by the Coordinator CLI before the Randomizer prompt. +```admonish warning +If you prefer to pass the randomizer as a file by using the `--randomizer` +argument, you will need to convert it to binary format. +``` + Switch to participant 1 and: - Paste the Signing Package