@@ -224,6 +224,28 @@ _previewnet/keys/account1234.words_.) If the `-k SECP256K1` option is used, the
224
224
Secp256k1 key. A PEM file and .pass file are still created, but this algorithm doesn't support mnemonic keys, so the
225
225
` .words ` file is _ not_ created.
226
226
227
+ Yahcli now supports creating a new account with an existing key (either Ed25519 or Secp256k1) in PEM format. Use the
228
+ ` --keyFile ` and ` --passFile ` options–both required–to specify the path to the PEM file and its corresponding passphrase file.
229
+ These options supersede the key type option (` --keyType ` ) when specified, meaning there is no need to specify the key type
230
+ when using an existing key.
231
+
232
+ For example:
233
+
234
+ ```
235
+ $ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n previewnet -p 2 accounts create -d hbar -a 1 /
236
+ --memo "Created with existing key" /
237
+ --keyFile previewnet/keys/existing-account.pem /
238
+ --passFile previewnet/keys/existing-account.pass
239
+
240
+ ```
241
+
242
+ Note that the existing key ** is not moved or copied** to the target network's ` keys/ ` directory. Since yahcli typically
243
+ depends on the keys in the ` keys/ ` directory for subsequent operations, you will need to ensure that the imported key files
244
+ used to create the account (i.e. the PEM file and pass file) are placed in the appropriate ` keys/ ` directory with the
245
+ standard naming, ` accountXXX.pem ` and ` accountXXX.pass ` .
246
+
247
+ ```
248
+
227
249
# Updating system files
228
250
229
251
For this example, we will run against a `localhost` network since we will modify a system file.
@@ -233,25 +255,29 @@ The DER-encoded RSA public key of the node is in a file _node3.der_, and its TLS
233
255
in a file _node3.crt_. We place these files in the directory structure below.
234
256
235
257
```
258
+
236
259
localhost
237
260
├── keys
238
261
│ ├── account2.pass
239
262
│ ├── account2.pem
240
263
│ ├── account55.pass
241
264
│ └── account55.pem
242
265
└── sysfiles
243
- ├── certs
244
- │ └── node3.crt
245
- └── pubkeys
246
- └── node3.der
266
+ ├── certs
267
+ │ └── node3.crt
268
+ └── pubkeys
269
+ └── node3.der
270
+
247
271
```
248
272
249
273
We first download the existing address book,
250
274
251
275
```
276
+
252
277
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 2 sysfiles download address-book
253
278
Targeting localhost, paying with 0.0.2
254
279
Downloading the address-book...OK
280
+
255
281
```
256
282
257
283
Next we edit the newly-downloaded _localhost/sysfiles/addressBook.json_ and
@@ -262,49 +288,55 @@ we tell yahcli to compute their values from the _certs/node3.crt_ and _pubkeys/n
262
288
files, respectively.
263
289
264
290
```
291
+
265
292
...
266
- }, {
267
- "nodeId" : 3,
268
- "certHash" : "!",
269
- "rsaPubKey" : "!",
270
- "nodeAccount" : "0.0.6",
271
- "endpoints" : [ {
272
- "ipAddressV4" : "127.0.0.1",
273
- "port" : 50207
274
- }, {
275
- "ipAddressV4" : "127.0.0.1",
276
- "port" : 50208
277
- } ]
293
+ }, {
294
+ "nodeId" : 3,
295
+ "certHash" : "!",
296
+ "rsaPubKey" : "!",
297
+ "nodeAccount" : "0.0.6",
298
+ "endpoints" : [ {
299
+ "ipAddressV4" : "127.0.0.1",
300
+ "port" : 50207
301
+ }, {
302
+ "ipAddressV4" : "127.0.0.1",
303
+ "port" : 50208
304
+ } ]
278
305
...
306
+
279
307
```
280
308
281
309
And now we upload the new address book, this time using the address book admin `0.0.55` as the payer:
282
310
283
311
```
312
+
284
313
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 55 sysfiles upload address-book
314
+
285
315
```
286
316
287
317
Finally we re-download the book to see that the hex-encoded cert hash and RSA public key were uploaded as expected:
288
318
289
319
```
320
+
290
321
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 2 sysfiles download address-book
291
322
Targeting localhost, paying with 0.0.2
292
323
Downloading the address-book...OK
293
324
$ tail -17 localhost/sysfiles/addressBook.json
294
- }, {
295
- "nodeId" : 3,
296
- "certHash" : "0ae05bde15d216781a40e7bce5303bf68926f9440eec3cb20fabe9df06b0091a205fdea86911facb4e51e46c3890c803",
297
- "rsaPubKey" : "3636303839396438343537353933653537396565363861333263303630336535393936666162613530386439343438306333656236346463613538373835326461333830353730323933636535336564393932666465343835333234636162356433353565373438313334393534623139633231633366303863363161316535643965333530316334333234353937656334646538646435383866666266646434613566333634366262376335393830636264323164643634301216763393131336631636533313864636134616635373732323462646538396332633137336633666538643039326534623866383030373130376138643965323633333166353335356135383464383037373661306162636139326530303438646433373163666530353936656464366261303737303338313432383866313039613832383035383630363562376262663238353432303434376134343336383830633361393336613666666663646162313012153335633864666561306461306537353035383530346661396163333036396438653166643762623333343530663761346261303439310a",
298
- "nodeAccount" : "0.0.6",
299
- "endpoints" : [ {
300
- "ipAddressV4" : "127.0.0.1",
301
- "port" : 50207
302
- }, {
303
- "ipAddressV4" : "127.0.0.1",
304
- "port" : 50208
305
- } ]
306
- } ]
325
+ }, {
326
+ "nodeId" : 3,
327
+ "certHash" : "0ae05bde15d216781a40e7bce5303bf68926f9440eec3cb20fabe9df06b0091a205fdea86911facb4e51e46c3890c803",
328
+ "rsaPubKey" : "3636303839396438343537353933653537396565363861333263303630336535393936666162613530386439343438306333656236346463613538373835326461333830353730323933636535336564393932666465343835333234636162356433353565373438313334393534623139633231633366303863363161316535643965333530316334333234353937656334646538646435383866666266646434613566333634366262376335393830636264323164643634301216763393131336631636533313864636134616635373732323462646538396332633137336633666538643039326534623866383030373130376138643965323633333166353335356135383464383037373661306162636139326530303438646433373163666530353936656464366261303737303338313432383866313039613832383035383630363562376262663238353432303434376134343336383830633361393336613666666663646162313012153335633864666561306461306537353035383530346661396163333036396438653166643762623333343530663761346261303439310a",
329
+ "nodeAccount" : "0.0.6",
330
+ "endpoints" : [ {
331
+ "ipAddressV4" : "127.0.0.1",
332
+ "port" : 50207
333
+ }, {
334
+ "ipAddressV4" : "127.0.0.1",
335
+ "port" : 50208
336
+ } ]
337
+ } ]
307
338
}
339
+
308
340
```
309
341
310
342
## Uploading special files
@@ -318,44 +350,54 @@ is used for a software update ZIP, and file `0.0.159` for a telemetry upgrade ZI
318
350
To upload such artifacts, use the special files names as below,
319
351
320
352
```
353
+
321
354
$ tree localhost/sysfiles/
322
355
localhost/sysfiles/
323
356
├── softwareUpgrade.zip
324
357
└── telemetryUpgrade.zip
358
+
325
359
```
326
360
327
361
Then proceed as with any other `sysfiles upload` command,
328
362
329
363
```
364
+
330
365
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 58 sysfiles upload software-zip
331
366
...
332
367
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 58 sysfiles upload telemetry-zip
333
368
...
369
+
334
370
```
335
371
336
372
:repeat: Since `yahcli:0.4.1` you can add the `--restart-from-failure` option like,
337
373
338
374
```
375
+
339
376
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 58 sysfiles upload software-zip --restart-from-failure
377
+
340
378
```
341
379
342
380
If the hash of the file on the network matches the hash of a prefix of the bytes you're uploading, then yahcli will
343
381
automatically restart the upload after that prefix. For example,
344
382
345
383
```
384
+
346
385
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 58 sysfiles upload software-zip
347
386
Log level is WARN
348
387
Targeting localhost, paying with 0.0.2
349
388
.i. Continuing upload for 0.0.150 with 34 appends already finished (out of 97 appends required)
350
389
...
390
+
351
391
```
352
392
353
393
### Checking a special file hash
354
394
355
395
You can also directly check the SHA-384 hash of a special file with the `sysfiles hash-check` subcommand,
356
396
357
397
```
398
+
358
399
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 58 sysfiles hash-check software-zip
400
+
359
401
```
360
402
361
403
# Preparing an NMT software upgrade
@@ -366,9 +408,14 @@ SHA-384 hash of this ZIP must be given so the nodes can validate the integrity o
366
408
staging its artifacts for NMT to use. This looks like,
367
409
368
410
```
411
+
369
412
$ docker run -it -v $(pwd):/launch gcr.io/hedera-registry/yahcli:0.4.1 -n localhost -p 58 prepare-upgrade \
413
+
370
414
> --upgrade-zip-hash 5d3b0e619d8513dfbf606ef00a2e83ba97d736f5f5ba61561d895ea83a6d4c34fce05d6cd74c83ec171f710e37e12aab
371
- ```
415
+ >
416
+ > ```
417
+ >
418
+ > ```
372
419
373
420
# Launching an NMT telemetry upgrade
374
421
0 commit comments