How to Find Public Key for Taproot Address

1 reply 73 views
im_falconNewbie
Posts: 53 · Reputation: 20
#1Apr 11, 2024, 01:11 AM
Hey everyone, I need some help figuring out how to get my wallet's public key for a specific address. From what I gather, the scriptPubKey doesn’t show the public key for Taproot addresses anymore. Using bitcoin-cli commands like validateaddress and getaddressinfo doesn’t give me the pubKey either. The addresses I’m working with are just receive addresses and I haven't done any transactions yet, so I can't pull it from there. Right now, my only option seems to be dumping the private key, importing it into bitcoin-js, and then pulling the pubKey, but that feels kinda sketchy... any better ideas?
3 Reply Quote Share
0xChadNewbie
Posts: 186 · Reputation: 3
#2Apr 11, 2024, 07:20 AM
You’re diving into Taproot, huh? Sounds like you’ve got a descriptor wallet. How are you exporting the private key though? Just curious. To get that public key, try using getaddressinfo. Look for the extended public key in "parent_desc" and check the derivation path for the internal/external chain index. The number after the slash tells you if it's a receiving (0) or change (1) address. Don’t forget to check the "address_index" in the descriptor too. Then, you can use bitcoin-js or a similar tool to derive the public key from the xpub. Example command: getaddressinfo Hope that helps!
1 Reply Quote Share

Related topics