NUT-06: Deprecate amount in POST /split
#34
Merged
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.
The
amountfield inPOST /splitwas an unnecessary contraint on the split operation. Now, wallets can choose the amount distribitions of the inputs (proofs) and outputs (and thus returned promises) as they wish, as long as they sum up to the same value.Closes #32
Changes:
Wallets:
Wallets simply don't send the
amountfield with thePOST /splitrequest anymore. They receive a new object with the fieldpromisesfrom which they then need to separate the promises to keep (first elements) and send (last elements).Previously, they took these two sets of elements from the fields
fstandsndfrom the response. This is no longer the case! Note that wallets already should know how many elements of thepromisesresponse they need to slice to get the same as thefstandsndresponses because they have previously generated an array ofoutputsthat has the same distribution.Mints:
Mints now do no receive an
amountfield anymore. They can simply proceed as usual but remove any security checks that might have previously asserted that the distribution of amounts ofoutputsmust adhere to a certain pattern (for example perfectly decompose in powers of two). This is not necessary anymore. They MUST still check whether the sum ofproofsis equal to the sum ofoutputsand they SHOULD also check whether it equals the sum of generatedpromises(as a sanity check).PostSplitRequestBefore:
{ "proofs": Proofs, "outputs": BlindedMessages, "amount": int //deprecate }Now:
{ "proofs": Proofs, "outputs": BlindedMessages, }PostSplitResponseBefore:
{ "fst": BlindSignatures, "snd": BlindSignatures }Now:
{ "promises": BlindSignatures }Testing:
For wallet development, use this Nutshell testnut mint that runs on the branch
nut06/no_amount_in_splithttps://nut06.testnut.cashu.spaceTracking progress of NUT-06 update (please report):
Mints
Wallets
Ping: @BilligsterUser @gandlafbtc @clarkmoody @ngutech21 @gohumble @thesimplekid @KKA11010 @thunderbiscuit