Skip to content

Commit b20118c

Browse files
authored
Update seeds-with-envelope.md
1 parent d6e0fad commit b20118c

1 file changed

Lines changed: 33 additions & 14 deletions

File tree

_pages/seeds-with-envelope.md

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ redirect_from:
1818

1919
## Overview
2020

21-
Cryptographic seeds are the heart of crypto asset control. [#SmartCustody](https://www.smartcustody.com/), one of Blockchain Commons' earliest initiatives, is all about keeping them safe. That's continued forward with resilience being a core [Gordian principles](https://developer.blockchaincommons.com/principles/). We're aware that loss of a seed or private key can be one of the most likely ways to lose a digital asset; Blockchain Commons is working to help developers and users to avoid that.
21+
Cryptographic seeds are the heart of crypto asset control. [#SmartCustody](https://www.smartcustody.com/), one of Blockchain Commons' earliest initiatives, was all about keeping them safe. That's continued forward, with resilience being a core [Gordian principles](https://developer.blockchaincommons.com/principles/). We believe that loss of a seed or private key is one of the most likely ways for the average user to lose a digital asset; Blockchain Commons is working to help developers and users to avoid that.
2222

2323
One of the major ways to keep a seed safe is encode it in a Gordian Envelope. Not only is it a well-known, well-specified format that should be readable into the far future, but it also allows for encryption, sharding, multiple permits, and in the future storage with [GSTP](/envelope/gstp/) and CSR [/csr/].
2424

25-
The following examples demonstrate how many of these techniques work using the [Rust envelope-cli](https://github.com/BlockchainCommons/bc-envelope-cli-rust). The [bytewords-cli](https://github.com/BlockchainCommons/bytewords-cli) and [cbor2diag](https://github.com/cabo/cbor-diag) are also used for a few minor examples, but not necessary to fully understand this tutorial. You don't necessarily want to engage in this digital-asset work with [envelope-cli], as a command line is not secure enough for most digital assets; but, as a reference app, [envelope-cli] shows what Envelopes can do for seeds, and how they work, and can also be used to generate sample envelopes for testing elsewhere.
25+
The following examples demonstrate how many of these techniques work using the [Rust envelope-cli](https://github.com/BlockchainCommons/bc-envelope-cli-rust). The [bytewords-cli](https://github.com/BlockchainCommons/bytewords-cli) and [cbor2diag](https://github.com/cabo/cbor-diag) are also used for a few minor examples, but they're not necessary to fully understand this tutorial (so if you don't have them, no problem).
26+
27+
⚠️ **Warning:** ⚠️ Do not work with real assets using envelope-cli. Because it's a command line, it's probably not secure enough for most digital assets; but, as a reference app, envelope-cli shows what envelopes can do for seeds and how they work. It can also be used to generate sample envelopes for testing elsewhere.
2628

2729
## Generating Seeds
2830

29-
Seeds and their associated private keys and public keys can all be generated using `seedtool-cli`, but this capability should be used solely for testing purposes. You'll ideally want a hardened offline wallet for generating your real seeds.
31+
Seeds and their associated private keys and public keys can all be generated using `seedtool-cli`, but this capability should be used solely for testing purposes.
32+
33+
(You'll ideally want a hardened offline wallet for generating your real seeds.)
3034

3135
```
3236
SEED=$(envelope generate seed)
@@ -44,24 +48,39 @@ ur:crypto-pubkeys/lftanshfhdcxldrlemtomeiarlnsfsdloybgzoeeecbyzctpjlmslenyuocheh
4448

4549
## Examining Seeds
4650

47-
Seeds are generated as `ur:seed`s, in accordance with the [crypto-seed CDDL](https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-006-urtypes.md#cryptographic-seed-seed).
48-
49-
[TBD: this is process]
50-
51-
bytewords -i minimal -o hex `echo $SEED | awk -F"/" '{print $2}'`
51+
Seeds are generated as `ur:seed`s, in accordance with the [crypto-seed CDDL](https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-006-urtypes.md#cryptographic-seed-seed). If you want to examine a seed more closely, you can do so by stripping off the `ur:seed` prefix. What's left is the CBOR of the seed, prepared per the CDDL.
52+
```
53+
SEED_CBOR=$(bytewords -i minimal -o hex `echo $SEED | awk -F"/" '{print $2}'`)
54+
echo $SEED_CBOR
5255
a10150d6df890a726b21b223ec3cc31d7950eb
56+
```
57+
In [CBOR](https://cbor.me/), that's:
58+
* a map [`a1`]
59+
* Whose first entry [`01`]
60+
* Is 16 bytes [`50`]
61+
* Which is the seed `d6df890a726b21b223ec3cc31d7950eb`
5362

54-
SEED_CBOR=$(bytewords -i minimal -o hex `echo $SEED | awk -F"/" '{print $2}'`)
63+
The cbor2diag utility will do that breakdown for you, which is why it's a convenient tool:
64+
```
65+
cbor2diag -x $SEED_CBOR
66+
{1: h'd6df890a726b21b223ec3cc31d7950eb'}
67+
```
68+
Per the CDDL, there could have been an optional creation date, name, or note, as map entries 2, 3, or 4, respectively, but there aren't in this simple example.
5569

56-
envelope subject type ur $SEED
57-
ur:envelope/tpsotantjzoyadgdtburldbkjpjeclprcnwpfnsrcakkgdwmprkgvlzc
70+
## Putting a Seed in an Envelope
71+
72+
The envelope-cli allows a seed to easily be placed in an envelope: you just define the seed you've generated as the subject of an envelope, using type `ur`:
73+
```
5874
SEED_E=$(envelope subject type ur $SEED)
75+
echo $SEED_E
76+
ur:envelope/tpsotantjzoyadgdtburldbkjpjeclprcnwpfnsrcakkgdwmprkgvlzc
77+
```
78+
### Examing a Seed Envelope
5979

60-
cbor2diag -x $SEED_CBOR
61-
{1: h'd6df890a726b21b223ec3cc31d7950eb'}
80+
The envelope-cli will directly output the CBOR of an envelope for you:
81+
d8c8d8c9d99d6ca10150d6df890a726b21b223ec3cc31d7950eb
6282

6383
% envelope format --type cbor $SEED_E
64-
d8c8d8c9d99d6ca10150d6df890a726b21b223ec3cc31d7950eb
6584

6685
SEED_E_CBOR=$(envelope format --type cbor $SEED_E)
6786

0 commit comments

Comments
 (0)