bitcoin core pockets and python bitcoin-lib

I’ve a regtest
bitcoin setting with nodes and wallets. I am working bitcoind
and bitcoin-cli
, model v0.21.0.0
.
So in my node i created my pockets with a bitcoin-cli -regtest createwallet node1 "w1"
, my query is, how am i able to import my pockets into https://bitcoinlib.readthedocs.io/en/newest/supply/bitcoinlib.wallets.html ?
I assumed that I needed to export my grasp key, with one thing like:
bitcoin-cli dumpwallet /tmp/pockets.dump >/dev/null && grep "prolonged non-public masterkey" /tmp/pockets.dump
And dump a non-public key with:
bitcoin-cli -regtest dumpprivkey $(bitcoin-cli -regtest getnewaddress)
Then would simply matter of use them to create a brand new pockets like:
from bitcoinlib.wallets import Pockets, wallet_create_or_open, HDKey
# all information from regtest, no leak or so ever
private_keys = [
# priv key
"cPErqVBuHrWSAtqvRwHu3ZF9vbGJYnE3C1DmAL8RUgGLkRJsLh5y",
]
# regtest and testnet are the identical
# the imported_key is the grasp key extracted with dumpprivkey.
hd_key =
HDKey(import_key="tprv8ZgxMBicQKsPf98zVnDSA3CH5LvexysRGWq1MGUdR6xTLrky41yhJ3j4RaSdXDFHi7L6KWwoozYcHTufX3y75NxuyVu7oSQE7KsPXoXFAcx", community="testnet", key=private_keys[1], encoding="bech32")
w = wallet_create_or_open("node_1", keys=hd_key, community="testnet")
print(w.addresslist())
Which prints me an handle, however in a completely completely different format, stating with mxxxx
, as a substitute of bxxxx
.. which makes me uncertain if I am doing the correct factor.
Questions:
is that the correct technique to work with bech32 addresses? Are the mxxx
addresses bech32, or base58?