-
Notifications
You must be signed in to change notification settings - Fork 52
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-10: Spending conditions #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slowly taking a look at this. Don't take this as a final comment but rather an opening of my round of questions 😆. Also I like the split between the NUT-10 and other nuts specifying different kinds of standard secrets.
So my first question is this: is there a reason to need all proofs to be of the same kind (line 28)? If there is then let's add that information here. If not, then it might be a good thing to remove that requirement. I was thinking of someone who needs to pay 100 sat but only has a 64 sat token P2PK and a 50 sat "normal" token. As is, they would not be able to make that payment in one go, and would need to redeem the P2PK token first for a normal token, and then combine that normal token with the other one. Feels like an extra round trip we might be able to remove? Let me know if I'm missing something.
Just making sure I have the right mental modelThe way I think of secrets after reading this and #40 is basically the following: secrets can be of different types, which could be conceptualized as variants on an enum. For now this NUT simply implies the existence of this enum and of potential new enum variants. Something like: enum class Secret {
SIMPLE
} NUT-11 basically adds the P2PK type, which means a mint that implements it might think of its accepted secrets like so: enum class Secret {
SIMPLE,
P2PK,
} Under this workflow, a mint would attempt to parse a secret into one of its accepted types (are there potential attacks there? you'd need to make sure that any given secret can only be parsed as one of those types, excluding the Simple type), and if it cannot deserialize the string into any of its "special" types, then interpret the secret at being of type "simple" or whatever you'd call it. Am I roughly on the right track here? A few thoughts
{
"id": "DSAl9nvvyfva",
"amount": 2,
"type": "SIMPLE"
"secret": "S+tDfc1Lfsrb06zaRdVTed6Izg",
"C": "0242b0fb43804d8ba9a64ceef249ad7a60f42c15fe6d4907238b05e857527832a3"
},
{
"id": "1cCNIAZ2X/w1",
"amount": 8,
"type": "P2PK",
"secret": '["P2PK",{"nonce": "5d11913ee0f92fefdc82a6764fd2457a","data": "026562efcfadc8e86d44da6a8adf80633d974302e62c850774db1fb36ff4cc7198",}]',
"C": "02250a37a56b78e66674f7f063e6abd3d9345f8761fb90cac0293108910a8c27a3",
"p2pksigs": [
"c43d0090be59340a6364dc1340876211f2173d6a21c391115adf097adb6ea0a3ddbe7fd81b4677281decc77be09c0359faa77416025130e487f8b9169eb0c609"
]
} |
Thank you for sharing your thoughts!
Not really! Since every
That is absolutely correct.
This is also correct. To confirm that your secret is constructed correctly, you might have to test it with a local parser. To guarantee correct script execution, you might have to test it against a development mint and hope that the production mint is doing the same. This should be no problem however with a closed ecash system.
I'm not sure of this. The reason why it works so well with the secret is that it is committed to with the mint's blind signature. Sure, the secret itself could again commit to something else, but that's what we already do with the witness data that fulfill this secret's conditions. Wallets typically store additional data with a if proof.secret.kind == secrets.SIMPLE_KIND:
... |
This is a NUT describing the structure of the well-known
Secret
object that can encode more complex spending conditions. This was previously part of #40 but has been refactored into two separate NUTs, the latter only describing P2PK.