Open AlexSSD7 opened 3 years ago
Oh, ok. Why only legacy addresses are being generated then?
You probably need to specify the key scope to use: https://github.com/btcsuite/btcwallet/blob/master/waddrmgr/scoped_manager.go#L154
How to do that? (I'm running the daemon via CLI, not calling it from the code FYI)
I'm not very familiar with the CLI. What command are you using exactly?
./btcwallet --testnet --btcdusername xxx --btcdpassword xxx -u xxx -P xxx
getnewaddress
RPC method generates a legacy address, not P2SH segwit or native bech32 address.
{
"jsonrpc": "1.0",
"result": "n12UeNcL4ruCiHbmgEgieAwXVbFNZrobQh",
"error": null,
"id": 1
}
Yes, you're right. It looks like the functionality to generate SegWit addresses was only added to the internal DB but never exposed to the RPC interface.
Oh, okay. Thank you.
Also I had no idea that I can use btcwallet
programmatically without running the actual CLI daemon.
Yes: https://github.com/btcsuite/btcwallet/search?q=bip49&type=code https://github.com/btcsuite/btcwallet/search?q=bip84&type=code