-
Notifications
You must be signed in to change notification settings - Fork 62
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
Taproot address format #361
Comments
Hey @EricDLee-sz 👋 Would you mind sharing the code used to generate your output? I can't get a sense of what's going wrong with just test vectors. |
Absolutely, here
Noted that I have drag the Bech32m from another of your repo too. Let say if we want to verify the test vectors by using this BTW I have tried to use |
Thanks for the additional info. Maybe there is more of your implementation missing because based on my understanding, the private key should actually be let privateKeyBytes = try! "41F41D69260DF4CF277826A9B65A3717E4EEDDBEEDF637F212CA096576479361".bytes
let privateKey = try! secp256k1.Schnorr.PrivateKey(dataRepresentation: privateKeyBytes)
let pub = privateKey.xonly // cc8a4bc64d897bddc5fbc2f670f7a8ba0b386779106cf1223c6fc5d7cd6fc115 |
Thank you for you guide, yes, you are right, I got the wrong private key last time and able to generate But seems I still need some steps to reach the final Bech32m encode address and I have no clues about that. Should I use |
Here is my correction, the lengh of the output is equal to
|
Yep! Tweaking is required for BIP86 to get the Updated code: let privateKeyBytes = try! "41F41D69260DF4CF277826A9B65A3717E4EEDDBEEDF637F212CA096576479361".bytes
let privateKey = try! secp256k1.Schnorr.PrivateKey(dataRepresentation: privateKeyBytes)
let internalKey = privateKey.xonly // cc8a4bc64d897bddc5fbc2f670f7a8ba0b386779106cf1223c6fc5d7cd6fc115
let tweakHash = try! SHA256.taggedHash(
tag: "TapTweak".data(using: .utf8)!,
data: Data(internalKey.bytes)
)
let outputKey = try! internalKey.add(tweakHash.bytes) // a60869f0dbcf1dc659c9cecbaf8050135ea9e8cdc487053f1dc6880949dc684c |
Thank you very much for the fast update, I can finally generate taproot address and I can see you also update unit test already. Cheer~ |
One more tiny question, is that |
Glad to help! No, the This swift package is open to improvements. Ideally, we'd want to maintain the API flexibility that libsecp256k1 already provides. I'm not sure an |
Hey bro, Im excited about using your lib to generate Taproot address and It did work for my case.
But as I reading Vectors from bip86 https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki I found that the output address is not equal to the expected one, could you help to advice?
My output is
bc1qxr25l5xagg9xuhudxcj0tu6g9jhr2rme6hc82wl4hmhectv34u7qpnecln
The text was updated successfully, but these errors were encountered: