Skip to content

Commit dcf1773

Browse files
authored
docs: update demo docs for user registration (#721)
* docs: update demo docs for user registration * address comments
1 parent 0422038 commit dcf1773

File tree

1 file changed

+60
-18
lines changed

1 file changed

+60
-18
lines changed

book/src/zcash/ywallet-demo.md

+60-18
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ cargo run --release -- sign --tx-plan <tx_plan_path> --ufvk <ufvk> -o <tx_signed
117117

118118
The program will print a SIGHASH and a Randomizer.
119119

120+
121+
### Running the server
122+
120123
Now you will need to simulate two participants and a Coordinator to sign the
121124
transaction, and the FROST server that handles communications between them.
122125
It's probably easier to open four terminals.
@@ -128,36 +131,52 @@ run):
128131
RUST_LOG=debug cargo run --bin server
129132
```
130133

131-
In the second one, the Coordinator, run (in the same folder where key generation
132-
was run):
134+
### Registering users
135+
136+
In order to interact with the server, you will need to register users. For this
137+
guide we will need two. In a new terminal, run the following command for user
138+
"alice" (replace the password if you want):
133139

134140
```
135-
cargo run --bin coordinator -- -C redpallas --http -r -
141+
curl --data-binary '{"username": "alice", "password": "foobar10", "pubkey": ""}' -H 'Content-Type: application/json' http://127.0.0.1:2744/register
136142
```
137143

138-
And then:
144+
It will output "null". (The "pubkey" parameter is not used currently and should
145+
be empty.) Also register user "bob":
139146

140-
- It should read the public key package from `public-key-package.json`.
141-
- Type `2` for the number of participants.
142-
- Copy the session ID that is printed.
147+
```
148+
curl --data-binary '{"username": "bob", "password": "foobar10", "pubkey": ""}' -H 'Content-Type: application/json' http://127.0.0.1:2744/register
149+
```
143150

151+
You only need to do this once, even if you want to sign more than one
152+
transaction. If for some reason you want to start over, close the server and
153+
delete the `db.sqlite` file.
144154

145-
In the third terminal, Participant 1, run the following, replacing
146-
`<SESSION_ID>` with the session ID you have just copied:
155+
Feel free to close this terminal, or reuse it for the next step.
147156

157+
```admonish warning
158+
Do not use passwords that you use in practice; use dummy ones instead. (You
159+
shouldn't reuse passwords anyway!) For real world usage you would need to take
160+
more care to not end up writing the password to your shell history. (In real
161+
world usage we'd expect this to be done by applications anyway.)
148162
```
149-
cargo run --bin participant -- -C redpallas --http --key-package key-package-1.json -s <SESSION_ID>
150-
```
151163

152-
In the fourth terminal, for Participant 2, run the following, again replacing
153-
the session ID:
164+
### Coordinator
165+
166+
In the second terminal, the Coordinator, run (in the same folder where key
167+
generation was run):
154168

155169
```
156-
cargo run --bin participant -- -C redpallas --http --key-package key-package-2.json -s <SESSION_ID>
170+
export PW=foobar10
171+
cargo run --bin coordinator -- -C redpallas --http -u alice -w PW -S alice,bob -r -
157172
```
158173

159-
Go back to the Coordinator CLI:
174+
We will use "alice" as the Coordinator, so change the value next to `export PW=`
175+
if you used another password when registering "alice".
160176

177+
And then:
178+
179+
- It should read the public key package from `public-key-package.json`.
161180
- When prompted for the message to be signed, paste the SIGHASH printed by the
162181
signer above (just the hex value, e.g.
163182
``4d065453cfa4cfb4f98dbc9cff60c4a3904ed91c523b8ef8d67d28bea7f12ea3``).
@@ -169,9 +188,32 @@ If you prefer to pass the randomizer as a file by using the `--randomizer`
169188
argument, you will need to convert it to binary format.
170189
```
171190

172-
The protocol should run and complete succesfully. You should still be at the
173-
Coordinator CLI. It has just printed the final FROST-generated signature.
174-
Hurrah! Copy it (just the hex value).
191+
### Participant 1 (alice)
192+
193+
In the third terminal, Participant 1, run the following:
194+
195+
```
196+
export PW=foobar10
197+
cargo run --bin participant -- -C redpallas --http --key-package key-package-1.json -u alice -w PW
198+
```
199+
200+
(We are using "alice" again. There's nothing stopping a Coordinator from being a
201+
Partcipant too!)
202+
203+
### Participant 2 (bob)
204+
205+
In the fourth terminal, for Participant 2, run the following:
206+
207+
```
208+
export PW=foobar10
209+
cargo run --bin participant -- -C redpallas --http --key-package key-package-2.json -u bob -w PW
210+
```
211+
212+
### Coordinator
213+
214+
Go back to the Coordinator CLI. The protocol should run and complete
215+
succesfully. It will print the final FROST-generated signature. Hurrah! Copy it
216+
(just the hex value).
175217

176218
Go back to the signer and paste the signature. It will write the raw signed
177219
transaction to the file you specified.

0 commit comments

Comments
 (0)