Skip to content

Help Bitcoin Public Key Why can't I convert the taproot public key through the private key? #1602

Answered by NicolasDorier
Xxxxxx-dot asked this question in Q&A
Discussion options

You must be logged in to vote

In NBitcoin

var privBytes = new byte[] { 0x7d, 0x48, 0x1e, 0x43, 0x55, 0xd5, 0x1c, 0x82,
0x4e, 0x8d, 0x02, 0xe6, 0x17, 0xd0, 0xe1, 0x88,
0xba, 0x97, 0x68, 0x5e, 0x55, 0xf8, 0x65, 0x57,
0xd1, 0xd8, 0x3d, 0x64, 0xd1, 0xc8, 0x95, 0x4b};
var key = new Key(privBytes);
Console.WriteLine("33 bytes pubkey: " + key.PubKey.ToHex());
var full = key.PubKey.GetTaprootFullPubKey();
Console.WriteLine("32 bytes output key: " + full.OutputKey.ToString());
Console.WriteLine("32 bytes internal key: " + full.InternalKey.ToString());

Result:

33 bytes pubkey: 028bd5ac9306da862cc9cd1b95ae4871dd27054e49774f6319221ab8dc262d9fd7
32 bytes output key: 9161099f0ea8b9bb631e318cb9ab0b1811319e1d2e7ac1aa68fcda9c5c85c4a3
…

Replies: 4 comments 13 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@Xxxxxx-dot
Comment options

@sipa
Comment options

sipa Sep 8, 2024
Maintainer

@Xxxxxx-dot
Comment options

@Xxxxxx-dot
Comment options

@Xxxxxx-dot
Comment options

Comment options

You must be logged in to vote
1 reply
@Xxxxxx-dot
Comment options

Comment options

You must be logged in to vote
2 replies
@Xxxxxx-dot
Comment options

@Xxxxxx-dot
Comment options

Answer selected by Xxxxxx-dot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #1601 on September 03, 2024 13:25.