Skip to content

NUT-29: Fix batch minting signature message separator#375

Open
a1denvalu3 wants to merge 2 commits into
cashubtc:mainfrom
a1denvalu3:fix-nut-29-batch-minting
Open

NUT-29: Fix batch minting signature message separator#375
a1denvalu3 wants to merge 2 commits into
cashubtc:mainfrom
a1denvalu3:fix-nut-29-batch-minting

Conversation

@a1denvalu3

Copy link
Copy Markdown
Contributor

Summary

  • Update msg_to_sign for NUT-29 batch minting to include proper colon separators between the quote ID and the blinded messages (e.g. quote_id:B_0:B_1).
  • Clarify that the outputs are UTF-8 encoded hex strings.
  • Update test vectors in tests/29-tests.md to reflect the new msg_to_sign and signature validation rule.

@robwoodgate robwoodgate 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.

Length as a separator may be better as it precludes use of the separator and assures injectivity - eg:

msg = b"Cashu_MintQuoteSig_v1"                       // DST
      ‖ len32(quote_id) ‖ quote_id                   // quote_id = UTF-8 bytes
      ‖ for each output i (in request order):
            len32(amount_i) ‖ amount_i               // amount_i = canonical minimal big-endian
          ‖ len32(B_i)      ‖ B_i                    // B_i = 33-byte secp / 48-byte BLS compressed point

might be safer?

@robwoodgate

Copy link
Copy Markdown
Contributor

As an addition, we should do the same for NUT-20 message aggregation due to the variable B_ lengths between SECP and BLS.

@robwoodgate

This comment was marked as outdated.

robwoodgate added a commit to cashubtc/cashu-ts that referenced this pull request May 26, 2026
Revert NUT-20 to its retro-compatible message; NUT-29 batch minting now uses its
own domain-separated, length-framed message committing to each output's amount and
point (cashubtc/nuts#375).
robwoodgate added a commit to cashubtc/cashu-ts that referenced this pull request May 26, 2026
Revert NUT-20 to its retro-compatible message; NUT-29 batch minting now uses its
own domain-separated, length-framed message committing to each output's amount and
point (cashubtc/nuts#375).
robwoodgate and others added 2 commits June 7, 2026 22:34
…7 quote ids

Replace the legacy `quote || B_0 || ... || B_(n-1)` mint-quote signature message
with a domain-separated, length-framed, amount-committing `msg_to_sign`. This is a
breaking change: mints no longer accept the legacy message. The message does not
commit the keyset `id`, so a wallet can re-target a rotated keyset without a new
signature.

- NUT-04: quote ids MUST be a UUIDv7.
- NUT-20: define the hardened `msg_to_sign` (replaces the concatenation).
- NUT-29: each locked quote is signed independently per NUT-20 over the
  consolidated outputs; mixed-method batches are rejected.
- tests/20-test.md: hardened-message test vector.
@a1denvalu3 a1denvalu3 force-pushed the fix-nut-29-batch-minting branch from 1225c9b to 91abdbb Compare June 7, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants