Skip to content

NEP-649: Deterministic ML-DSA-65 Key Derivation from BIP-39 Seeds (SLIP-0010) - #649

Open
vsavchyn-dev wants to merge 14 commits into
near:masterfrom
vsavchyn-dev:feat/mldsa-derivation
Open

NEP-649: Deterministic ML-DSA-65 Key Derivation from BIP-39 Seeds (SLIP-0010)#649
vsavchyn-dev wants to merge 14 commits into
near:masterfrom
vsavchyn-dev:feat/mldsa-derivation

Conversation

@vsavchyn-dev

@vsavchyn-dev vsavchyn-dev commented Jul 30, 2026

Copy link
Copy Markdown

@vsavchyn-dev vsavchyn-dev changed the title init NEP-649: Deterministic ML-DSA-65 Key Derivation from BIP-39 Seeds (SLIP-0010) Jul 30, 2026
@vsavchyn-dev vsavchyn-dev self-assigned this Jul 30, 2026
Comment thread neps/nep-0649.md Outdated
Comment thread neps/nep-0649.md
Comment thread neps/nep-0649.md
Comment thread neps/nep-0649.md
Comment thread neps/nep-0649.md Outdated

@birchmd birchmd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work on this NEP @vsavchyn-dev ! I only have a few minor comments.

Comment thread neps/nep-0649.md Outdated
2. Split I into two 32-byte sequences, I<sub>L</sub> and I<sub>R</sub>.
3. The returned child node secret k<sub>i</sub> is I<sub>L</sub>. The returned chain code c<sub>i</sub> is I<sub>R</sub>.

The HMAC-SHA512 function is specified in [RFC 4231](https://datatracker.ietf.org/doc/html/rfc4231).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The HMAC-SHA512 function is also used in the Master Key Generation section above. The citation for the function should appear after its first usage, instead of here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Comment thread neps/nep-0649.md

Account discovery is out of scope (see [Scope](#scope)). However, wallets that discover accounts via the existing Ed25519 flow are encouraged to check if the same seed phrase produces Ed25519 and ML-DSA-65 keys. Note that wallets might need to compute ML-DSA-65 hash per [NEP-645] for discovering the account. Additionally, it is worth checking if the key has a `FullAccess` permission to allow for a full usage of account.

### Master Key Generation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: can Generation and Derivation be used interchangeably?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

In this section, I tried to follow the SLIP-10 paper, which stated Master Key Generation. I think by definition Generation and Derivation can be used interchangeably: HMAC-SHA512 generates a hash, but at the same time, the hash is derived from the domain-separator seed and mnemonic. However, in the context of this NEP, you are right; it is confusing to write Generation anywhere except parts with mention of ML-DSA.KeyGen, as we derive the seed to generate ML-DSA key.

Following this, I just wrote "Master key derivation MUST..." instead of "Master key generation MUST..." (70cf84f), everything else in the paper already states things properly.

Comment thread neps/nep-0649.md Outdated
- Wallets MUST accept any valid [BIP-39] mnemonic (12-24 words) for recovery.
- The default path to derive ML-DSA-65 key from MUST be the same as Ed25519 recovery path.

Also, wallets MAY generate a new [BIP-39] mnemonic for ML-DSA-65 keys, at the cost of a second backup and loss of single-mnemonic recovery. See [Mnemonic as a security bottleneck](#mnemonic-as-a-security-bottleneck) on why the new mnemonic MUST be from 18 to 24 words.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I initially thought there was a discrepancy between the minimum length of 18 here and 12 above, but then I realized the difference is in the accepted minimum for a user-provided mnemonic vs a new mnemonic generated by the wallet. I think this could be made a little more clear (it is clearer in the security section below, but should also be clear here).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I merged this whole paragraph into a list and reworded it a bit - it should be more clear now: e8664ae#diff-e514832a368228580b962a3a87f14be3812d43f9682fba381e6de8e4cc3f991cR66-R70

@vsavchyn-dev
vsavchyn-dev marked this pull request as ready for review August 27, 2026 16:13
@vsavchyn-dev
vsavchyn-dev requested a review from a team as a code owner August 27, 2026 16:13
@vsavchyn-dev

Copy link
Copy Markdown
Author

@near/nep-moderators I believe this nep is ready for the review - markdown-link-check is unrelated to this NEP.

Additionally, @darioush, I am curious if this NEP have any significant implications for nearcore? I want to ensure that the ML-DSA key recovery logic and ML-DSA key pair generation + storage of public key I've proposed is perfectly in sync with the protocol's implementation of post-quantum signatures. For instance, maybe I need to mention that per NEP-645, storing ML-DSA key only is available with enabled protocol feature?

@gagdiez

gagdiez commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

thanks @vsavchyn-dev, this NEP is ready for review. @walnut-the-cat could you help by selecting two SME to give their review?

Maybe Simon and Darioush, who reviewed the original ML-DSA-65 NEP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: NEW

Development

Successfully merging this pull request may close these issues.

4 participants