Help with generating Taproot addresses

5 replies 80 views
farm23Member
Posts: 1 · Reputation: 84
#1May 12, 2019, 12:13 AM
Hey all. I'm kinda lost with this taproot address thing. How do I turn a hexadecimal private key into a taproot address using Python? I tried using the bech32m library but the address I got isn't right. Can someone break down the process for me? Thanks!
2 Reply Quote Share
tom_forkMember
Posts: 2 · Reputation: 127
#2May 12, 2019, 01:01 AM
From what I’ve gathered, maybe you should convert your private key to a wallet format first. Try using version 0 on your desktop or mobile. Here are some steps that could help you: Step 1:... Step 2:... Step 3:... Hopefully this helps after you run through it!
3 Reply Quote Share
0xGangMember
Posts: 49 · Reputation: 222
#3May 12, 2019, 02:24 AM
Check this out, might help you out: https://example-link.com
2 Reply Quote Share
Posts: 185 · Reputation: 37
#4May 12, 2019, 06:46 AM
That link mainly talks about handling Taproot in wallets. Not really answering how to derive the addresses from a private key using Python. I’m not a Python guru, but it seems like you need to convert your private key to a public one first with some elliptic curve magic, then use a Taproot library. 😅
2 Reply Quote Share
Posts: 1 · Reputation: 14
#5May 12, 2019, 11:18 AM
Totally agree, it’s tricky to derive Taproot addresses. It involves x-only public keys and Bech32m encoding. Here’s a Python snippet using the bitcoinutils library. It converts a WIF private key into a Taproot address: ```python from bitcoinutils.setup import setup from bitcoinutils.keys import PrivateKey setup('testnet') wif_privkey = 'cPeon9fBsW2Bxw...' ``` Make sure your format is correct!
0 Reply Quote Share
Posts: 185 · Reputation: 37
#6May 12, 2019, 05:30 PM
Just a heads up, you should wrap your code in [code] tags. It can get messed up by the BBcode interpreter otherwise. I’ve seen it happen before, especially with certain characters. Better safe than sorry!
4 Reply Quote Share

Related topics