Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix up key derivation chart #2968

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/protocol/src/protocol/addresses_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ flowchart BT
subgraph SK[Spending Key]
direction LR;
ask;
seed;
spend_key_bytes;
end;

seed --> ask;
seed --> nk;
BIP44(BIP44 Seed Phrase) --> spend_key_bytes;
BIP39(Legacy Raw BIP39) --> spend_key_bytes;

spend_key_bytes --> ask;
spend_key_bytes --> nk;

ask --> ak;

Expand Down
14 changes: 9 additions & 5 deletions docs/protocol/src/protocol/addresses_keys/spend_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ PBKDF2 with:
* `mnemonic` concatenated with an index used as the salt, i.e. the
default spend authority is derived using the salt `mnemonic0`

TODO: describe new BIP44 derivation and change raw BIP39 derivation to be described as "legacy".

The root key material for a particular spend authority is the 32-byte
`seed` derived as above from the seed phrase. The `seed` value is used to derive
`spend_key_bytes` derived as above from the seed phrase. The `spend_key_bytes` value is used to derive
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to eliminate references to seed; I think it's confusing since although it's the "seed" of the Penumbra-specific part of the key heirarchy, it's not necessarily the seed in the sense of the seed phrase (i.e., the ultimate root of capability).


* $\mathsf{ask} \in \mathbb F_r$, the *spend authorization key*, and
* $\mathsf{nk} \in \mathbb F_q$, the *nullifier key*,
Expand All @@ -20,12 +22,14 @@ personalization `label`, key `key`, and input `input`. Define
`from_le_bytes(bytes)` as the function that interprets its input bytes as an
integer in little-endian order. Then
```
ask = from_le_bytes(prf_expand("Penumbra_ExpndSd", seed, 0)) mod r
nk = from_le_bytes(prf_expand("Penumbra_ExpndSd", seed, 0)) mod q
ask = from_le_bytes(prf_expand("Penumbra_ExpndSd", spend_key_bytes, 0)) mod r
nk = from_le_bytes(prf_expand("Penumbra_ExpndSd", spend_key_bytes, 0)) mod q
```

The *spending key* consists of `seed` and `ask`. When using a hardware wallet
or similar custody mechanism, the spending key remains on the device.
The *spending key* consists of `spend_key_bytes` and `ask`. (Since `ask` is
derived from `spend_key_bytes`, only the `spend_key_bytes` need to be stored,
but the `ask` is considered part of the spending key). When using a hardware
wallet or similar custody mechanism, the spending key remains on the device.

The spend authorization key $\mathsf{ask}$ is used as a `decaf377-rdsa` signing
key.[^1] The corresponding verification key is the *spend verification key*
Expand Down
Loading