I attempted a number of methods to get a Taproot handle from a Non-public Key with bitcoinlib, however I saved getting completely different addresses than these I get with Taproot wallets equivalent to Unisat and OKX Pockets.
Then, after a variety of makes an attempt, I discovered the command Handle.parse
and with it I attempted to get all of the parameters of my handle, with a purpose to replicate it.
With a lot shock, even when I create a category with the very same parameters and naturally similar non-public keys, the derived handle is completely different.
from bitcoinlib.keys import Key, Handle
# keys are for testing functions
private_key_hex = '25eee8288d42567475d1453843ce57b16b6ba5b6c0661cb2a439fff44c4d455d'
private_key_wif="KxVSwjuqNb6qe3KTLsHG5nYA3WFEqrjyKnGbwgHAreiWsqrwffuh"
ok = Key(private_key_wif)
#ok.information()
public_key_hex = '02fdf741bc2b1efe52873d748ca438798ad0133b25c388bc50423aed26df8ffbd7'
public_key_hex_uncompressed = '04fdf741bc2b1efe52873d748ca438798ad0133b25c388bc50423aed26df8ffbd7db6b1b700bd2475709f586d7a0105d29b0e4a3017b259e01bc32b220342ab33a'
addr = Handle.parse('bc1pfkde37d8chuqa6tgwvp7rwmtl7vvd20ql6g5433xxpdah30t7nushrsrlu')
print(addr.as_dict())
testAddr = Handle(
information = public_key_hex,
hashed_data = None,
prefix = 'bc',
script_type="p2tr",
compressed = None,
encoding = 'bech32',
witness_type="taproot",
witver = 1,
depth = None,
change = None,
address_index = None,
community = 'bitcoin',
network_overrides = None
)
print(testAddr)
I do not know if the issue is that bitcoinlib does not have bech32m encoding.
If anybody is aware of how you can resolve this subject or is aware of any workaround, it could be actually appreciated!