Repository navigation
NUT-03: Specify opt-in mint-rerandomized V2 swap outputs - #4
Draft
SatsAndSports wants to merge 3 commits into
Draft
SatsAndSports wants to merge 3 commits into
SatsAndSports wants to merge 3 commits into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Idea and motivation
This proposes an opt-in mint-rerandomized V2 swap. During a pre-signed multi-party swap, a participant can know another party's original blinded output. Mint-generated extra blinding lets the mint reserve and sign a fresh derived point, so a prior signature on the original point does not block execution. The wallet receives an ordinary, transferable proof afterward. A Spilman-style channel with non-interactive setup is one motivating application; this PR specifies the swap primitive, not a channel.
Specification
rerandomize: truein NUT-03 requires the existing P2PK/HTLCSIG_ALLspending condition. The request signs the original outputs under the separateCashu_SigAllRerandomized_v1domain: input fields and output amounts are length-framed; each output contributes the unframed 32-byteSHA256(original compressed B_). Ordinary swap/meltSIG_ALLandSIG_INPUTSare unaffected. The new transcript intentionally rejects signatures from the earlier framed-raw-point prototype under the same tag, without a fallback.tfrom fresh 32-byteRunderCashu_OutputRerandomization_secp256k1_v1. It reserves and signsB'_i = B_i + tG, retrying a conflicting/infinite derived point with freshRor failing without spending inputs.Ron all spent inputs commit atomically. Only after commit doesrerandomization_rappear in the response and spent-input NUT-07/NUT-17 state. NUT-09 restores the derived outputs after a lost response.P_i = C'_i - (r_i+t)A_i. The mint's DLEQ on(B'_i,C'_i)remains transferable using effective factor(r_i+t) mod n. Cancellation has negligible probability ~2⁻²⁵⁶ per output with independent factors; in that exceptional case, a wallet can transfer an ordinary proof without a DLEQ instead of encoding an invalid factor.nuts["3"].rerandomize: trueonly with durable atomic spent-input recovery and restorable signatures. The proposal adds NUT-03 vectors for scalar/point derivation, framing, tagged digest, Schnorr signature, order dependence and unblinding.The principle of extra mint blinding could be adapted to future BLS/V3 or NUTroot authorization, but only V2 secp256k1 swaps are specified here. Output hashing is now part of this isolated opted-in transcript; NUT-11 PR #404 proposes typed records and hashes for general SIG_ALL and is a separate decision.
Implementations and interoperability
Matching mint prototypes: CDK and Nutshell. An independent Rust HTTP/WebSocket driver exercised both mints (also containerized CDK): previously signed original output, P2PK/HTLC receiver and refund, duplicate/order rejection, two-input/two-output lost-response recovery after restart, transferable DLEQ, ordinary-proof spending, and NUT-17 proof-state updates. The driver tests the V2 swap mechanism, not a complete Spilman channel.
Validation and review
npx prettier@3.9.1 --check .andgit diff --checkpassed.SatsAndSports/nuts:main, intended for review before submitting an upstream NUTs PR. No upstream NUTs PR is opened by this branch.