Closed MarcoDotIO closed 6 months ago
Update:
Seems like the documentation is out of date. Here's the way to derive valid bitcoin addresses:
from bitcoinlib.wallets import *
w1 = wallet_create_or_open(name="test2002", network='testnet')
pubkey = w1.get_key().key()
addr = Address("{pubkey}", encoding='bech32', script_type="p2wpkh", network="testnet")
print("Wallet address: ", addr.address)
Closing, but considering adding some additional documentation to clear things up.
Hello there,
I am having some issues with creating valid Bitcoin addresses with the given SDK. Here is my test code:
And any addresses from the get_key() function are not valid (e.g., they aren't prefixed with bc1 for mainnet, tb1 for testnet). Was something changed in a newer version?
Here's an example of the above output: mfvFzusKPZzGBAhS69AWvziRPjamtRhYpZ