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

NUT-06: Deprecate amount in POST /split #34

Merged
merged 3 commits into from
Jul 8, 2023

Conversation

callebtc
Copy link
Contributor

@callebtc callebtc commented Jun 29, 2023

The amount field in POST /split was 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 amount field with the POST /split request anymore. They receive a new object with the field promises from 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 fst and snd from the response. This is no longer the case! Note that wallets already should know how many elements of the promises response they need to slice to get the same as the fst and snd responses because they have previously generated an array of outputs that has the same distribution.

Mints:

Mints now do no receive an amount field anymore. They can simply proceed as usual but remove any security checks that might have previously asserted that the distribution of amounts of outputs must 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 of proofs is equal to the sum of outputs and they SHOULD also check whether it equals the sum of generated promises (as a sanity check).

PostSplitRequest

Before:

{
  "proofs": Proofs,
  "outputs": BlindedMessages,
  "amount": int //deprecate
}

Now:

{
  "proofs": Proofs,
  "outputs": BlindedMessages,
}

PostSplitResponse

Before:

{
  "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_split

https://nut06.testnut.cashu.space

Tracking progress of NUT-06 update (please report):

Mints

Wallets

Ping: @BilligsterUser @gandlafbtc @clarkmoody @ngutech21 @gohumble @thesimplekid @KKA11010 @thunderbiscuit

@thesimplekid
Copy link
Collaborator

Cashu-crab updated in cashubtc/cdk@e8303fc, mint handles both with and without amount and responds accordingly, wallet chooses which to follow. Will deprecate amount fully after transition.

@gandlafbtc
Copy link
Collaborator

gandlafbtc commented Jun 30, 2023

If the amount is not sent anymore, mints that haven't upgraded yet will error, right? Shouldn't we keep the amount in the request, at least till most mints have upgraded?

@callebtc
Copy link
Contributor Author

If the amount is not sent anymore, mints that haven't upgraded yet will error, right? Shouldn't we keep the amount in the request, at least till most mints have upgraded?

Same as @thesimplekid, I've upgraded Nutshell to be backwards compatible (has two different responses depending on whether amount is sent or not). I will add the same to LNbits and we should be relatively good. Only issue will be clients that have upgraded but want to talk to old mints but there will always be pain!

@thunderbiscuit
Copy link
Collaborator

I'm not there yet so all good on my end! (not sure if the cashu-kotlin item above was intended for me? if so you can check it off).

@ngutech21
Copy link
Collaborator

Moksha mint and wallet upgraded ngutech21/moksha@d0d39f5

All changes are backwards compatible. I will remove the deprecated code, after all the other implementations have upgraded as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NUT-06: Deprecate amount field on PostSplitRequest
5 participants