-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add new tutorial page on seed generation and fixes (#561)
* docs: address documentation feedback * docs: add create seed tut * docs: refine seed gen doc * docs: empty [skip ci] * Update docs/docusaurus/secrets/seed-generation.md Co-authored-by: Yurii Shynbuiev - IOHK <[email protected]> --------- Co-authored-by: Yurii Shynbuiev - IOHK <[email protected]>
- Loading branch information
1 parent
7ce5c99
commit 3d7696b
Showing
3 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Creating a PRISM agent wallet seed | ||
|
||
## Introduction | ||
|
||
PRISM agent utilizes a hierarchical-deterministic key derivation algorithm for managing PRISM DIDs, | ||
which follows the BIP32 standard. In order to generate the required keys, | ||
BIP32 uses a master binary seed serving as the root of the derivation tree, | ||
and all other keys are derived from this seed. | ||
Given that the PRISM agent employs BIP32, it expects a 64-byte binary seed as input. | ||
Various methods exist for generating a byte sequence, each serving different purposes. | ||
|
||
PRISM agent does not have any opinion on how the seed should be generated as long as a valid hex string is provided. | ||
However, it is strongly recommended to use high entropy for generating the master seed. | ||
PRISM agent allows customizing the wallet seed by using the environment variable `WALLET_SEED`. | ||
The variable must contain a 64-byte value encoded in hexadecimal format. | ||
|
||
### 1. Static seed | ||
|
||
PRISM agent expects any valid 64-byte input for a wallet seed. | ||
Any static 128-character hexadecimal string can be used to simplify the testing. | ||
|
||
For example | ||
|
||
```sh | ||
# Any of these are valid | ||
WALLET_SEED=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | ||
WALLET_SEED=11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 | ||
WALLET_SEED=0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a | ||
``` | ||
__Note: Do not use method this in production.__ | ||
|
||
### 2. Simple dynamic seed | ||
|
||
Users have the option to create a random hexadecimal string of a desired length using scripting languages | ||
like Bash or Python. An example of a Bash script is shown below. | ||
|
||
```bash | ||
WALLET_SEED=$(tr -dc a-f0-9 </dev/urandom | head -c 128 ; echo '') | ||
``` | ||
This approach is suitable for basic testing scenarios requiring dynamically generated seeds. | ||
However, for production use, it is advisable to employ a reputable implementation of BIP39 | ||
with a high level of entropy. (Refer to the details below for further information.) | ||
|
||
|
||
### 3. Use BIP39 implementation to generate a seed (recommended) | ||
|
||
The [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#user-content-From_mnemonic_to_seed) | ||
protocol can be utilized to generate a BIP32 master seed, offering a human-friendly approach to seed management. | ||
Instead of noting down a seemingly random hexadecimal string, | ||
users can write down their mnemonic phrase, making it more convenient to keep track of them. | ||
|
||
By using BIP39, users have options to choose a mnemonic phrase length as well as a passphrase. | ||
There are many tools for generating a BIP39 seed including but not limited to: | ||
- <https://iancoleman.io/bip39/> (use the BIP39 seed field which provides a 128-chars hex string) | ||
- [BIP39 - implementations section](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#other-implementations) also provides a list of implementations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters