-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adaptor Signature #3
Comments
Try adding a key tweak The signature can be aggregated without Hopefully that works. |
Hi @cmdruid I tried running a quick experiment can you check and verify whether this is a correct approach.
I changed the
And I changed the implementation for
These changes were directly made to the node_modules file, and it's giving weird result sometimes it passes the signature test for MuSig2 as well as @noble/curve library. But sometimes it give that signatures are wrong for the same set of values. |
The signatures will randomly pass/fail because the parity of The group pubkey has tweaking fully implemented using an accumulator to track parity and negation. You can specify a number of tweaks when generating the group pubkey, when signing, and when doing signature aggregation. So you could add a tweak to the group pubkey and sign with it, but keep the tweak secret so the aggregate signature will be missing the tweak. (you can still add the tweak later). I have the accumulator implemented for tweaking the nonce value, but I did not add an interface for supplying nonce tweaks in the main |
Hi @cmdruid, Thank you for taking the time to review my issues. I've been following resources on implementing DLC and noticed that they all tweak the nonce, which is why I was trying the same approach. If you have any example code demonstrating how to use group public key tweaking to achieve similar results, it would be very helpful. Additionally, could you guide me on how to resolve the following issue?
Like how can we handle negation and will I need to made changes everywhere.
I tried adding above logic it did not work. |
I have looked into this some more, and came to the conclusion that in order to do this properly, I have to integrate it into the nonce aggregation step. I hacked together a rough prototype in the development branch. I should have it done in a day or two. |
Thank you for looking into this further. I will check the development branch. |
The updated changes are live in the development branch. Check out the test case here: https://github.com/cmdruid/musig2/blob/development/test/src/dlc.test.ts Basically you can pass an array of public keys in the You can verify the un-tweaked signature S and tweaked R values are correct with the Once all the secret values are known, you can add them to the signature using the Let me know if you have any questions or run into issues. |
Hi @cmdruid , I have tested the code. It is performing correctly. Thanks for the help! |
Hi @cmdruid I tried implementing a DLC prototype using the adaptor signature implementation but I some signature still pass/fails randomly. Oracle Implementation using
DLC implementation:
Structure of
|
If the signature works some of the time but fails randomly (likely 50%) then there is still a parity issue somewhere. I will review the code and get back to you. In the meantime for the |
Tried making above changes to Oracle's code, but it fails in 1/6 testcases. I believe the issue is with Oracle implementation.
The testcase where it fails:
|
I think I found the issue. In my code I am expecting the adapter key to have an even-y coordinate, and in my test case this will always be true because I am using a key generation method that negates keys by default. However in practice the adapter key can be either parity, and I am not checking the secret to negate it. I have pushed a fix for this to the development branch. Let me know if this solves the issue! |
I test the mentioned testcase with the new changes, it's still giving invalid signature. It might be an issue with my oracle implementation.
|
Hi, I have been wondering if there is any way to modify the library to implement Adaptor Signature, where an adaptor point (T where
T = t * G
) will be used with the combined nonce to make the signature invalid. But once the adaptor secret (t) is revealed we can add it to the combined signatures' = s + t
to make it a valid BIP340 signature. Similar to the public key tweaking mentioned in the image.My ultimate goal is to achieve DLC using this.
The text was updated successfully, but these errors were encountered: