-
Notifications
You must be signed in to change notification settings - Fork 40
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
[bug] Message signed with ordinal address doesn't work for some users #155
Comments
thanks for the issue raised @elRaulito , we'll look into this |
@elRaulito could you please send through an example signature, address and message that was signed when you encounter this again. I can't reproduce on my side unfortunately. |
Hey @victorkirov here you are, I can provide you even other users that are facing same issue this following message:
Generating the signature: |
Could you send me the exact string? Or do you JSON.strigify an object each time on verify? If that's the case, you might be running into an ordering issue: |
@victorkirov yes we are using JSON.stringify however if that is the case shouldn't it it be for every user? since keys are the same Also we are doing JSON.stringify on both frontend signing and on backend on verification shouldn't it work in case of reordering? |
No, JSON.stringify doesn't guarantee the order that keys will be stringified in. You could get different results each time you call it, but you could also get the same. Cross system/platform for frontend and backend would mean you're even more likely to get different orders. That would explain why it's only failing sometimes, since it's changing the message. You can either stringify once and pass that string message around, or rather use a format that guarantees the order to remain consistent (e.g. add your items in a specific order into an array and stringify that). |
But would that explain why it's failing always for same users? |
It could. If the stringify function on the user's machine always produces X and the function on your server always produces Y, then the messages will always be different. |
Yes, however when they created a new wallet the error disappeared |
Ah, ok, sorry, I missed that. In that case the client platform remains the same 🤔 It's definitely something to consider as you should never rely on the order of JS object keys, but there may be something else going on here. I'll try to reproduce it on my end as well. |
I've just run a script that generates a seed phrase, then uses our code to get details for the taproot address for that seed, sign the above message, then verify the message. It ran 28000 times without failure. I'm thinking maybe our signature may not be the problem. |
Thanks a lot @victorkirov I guess time to debu JSON.stringify more Will let you know |
Is there an existing issue for this?
SATS-CONNECT Version
2.4.0
Current Behavior
At first we thought it was an issue with bip322-js so we opened an issue with them
ACken2/bip322-js#12
However seems that the signature we got:
AUBeB9HL+fbcTrVOSwzZvSn/oDluEckq0st4YMgr0nelFOT1qpA9HiohI6uGNDQnu47YUbFHWM0CrkiT7VdWf6Na
of the user
bc1pvnkl5kgyjnr33yn5myvlqvw0nahnrqx2mj6a8j4ggpy09gvt3pdq4nf2sl
is not validWe have faced this issue a lot lately and apparently only few users are not able to make it work, the code is always the same on our platform
could it be something related to the 02/03 byte in front of ordinal public key that is not used?
Is there a way for us to test with a user that his signature is working fine on xverse?
Users were able to use the platform creating a new wallet on xVerse, so the issue is related to the address itself
Expected Behavior
Signature message verified with bip322-js
Steps To Reproduce
Try to create a limit order at fluidtokens
If your address is not signing the message in a correct way you'll get the error
This error seems to be for a 20% of our users
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: