Kalau mau lebih general dan walletnya bisa dipakai dimana saja, seperti di electrum, maka lebih baik tidak mencentang Descriptor Wallet, soalnya nanti tidak tidak dapat private key kalau dicentang Descriptor Wallet-nya. oya, tidak hanya legacy address, tapi juga segwit jika opsi Descriptor Wallet tidak dicentang (malah lebih prefer ke segwit pas create wallet awal)
Jangan salah, Descriptor wallet juga memiliki private key dan bahkan extended private key disetiap derivation path-nya.
Ya, bahkan lebih kompleks cara untuk mendapatkannya :)
Diturunkan melalui Master private keys yang didapat melalui
listdescriptors true.
Note that only the master private key used in a descriptor will be allowed to be exported from descriptor wallets. This is because descriptor wallets will be using unhardened derivation for the child keys and there is a known issue where having the parent xpub and a child key derived with unhardened derivation will allow the parent xprv to be computed. So to be clear to users that what they are doing is potentially unsafe, we will only allow exporting the master private key (it is more obviously unsafe when you have the master private key as users are unlikely to know about this weakness and may think that giving out child keys and the parent xpub is safe).
-Ava Chow-
Unfortunately,
dumprivkey or
dumpwallet commands aren't supported by descriptor wallets.
Your option is to export the parent descriptor of that address and then use a tool that can derive the private key of that address from its master private key.
Here's the procedure (
requires https://github.com/iancoleman/bip39):
- Start Bitcoin Core, preferably on an offline machine and enter the command getaddressinfo "bc1address" and take note of the address' "parent_desc" and "ischange" values.
- Next, enter the command listdescriptors true and find the (private) descriptor with the matching script type
of your address' parent descriptor. (your address' should be "wpkh")
But there'll be at least two desc with that script type, so based from your address' "ischange" value of 'true' or 'false', pick the descriptor with "internal" of the same value. - From the correct descriptor, copy it's master private key which is the long "xprv" key. Do not include the script type and '(' before and '/' after it.
- Now open your iancoleman's BIP39 tool in an offline machine and paste your xprv key in "BIP32 Root Key".
- Scroll down a bit and select the correct script type: BIP44 for legacy, BIP49 for Nested-SegWit and BIP84 for Native Segwit.
- The default should be already correct for receiving addresses (internal: false), else, change the internal/external path from '0' to '1'.
- Scroll-down to the derived addresses and it should be there along with its private key.
- If your address' "address_index" is more than 20, you should derive more addresses in BIP39 tool by using the button: "Show ___ more rows" below the address list for it to show.
Agan bisa mendapatkan Private Key dari descriptor wallet, namun untuk step-stepnya agak rumit (ane sendiri pernah mempraktekkannya) ;D
- Pertama-tama bukan console di Bitcoin core, dan gunakan perintah
walletpassphrase "password-agan" 600 jika wallet agan memiliki enkripsi passphrase
- Selanjutnya gunakan
getaddressinfo "address_yang_dimaksud"- Catat jenis script address pada bagian parent descriptor ("parent_desc") berjenis apa : pkh, wpkh, sh atau tr
- Catat hdkeypath-nya
- Selanjutnya gunakan argumen
listdescriptors true- Dari hasilnya cari descriptor ("desc") yang memiliki jenis script address (pkh, wpkh, sh atau tr) sama dengan "parent_desc" yang sebelumnya agan catat
- Dan pastikan memiliki hdkeypath yang sama pula
- Catat extended private key (xprv key) yang dimaksud
- Download BIP39 Tool (Mnemonic Code Converter)
https://github.com/iancoleman/bip39/releases dan jalankan secara offline (matikan jaringan internet)
- Masukan xprv key pada kolom BIP32 Root Key di BIP39 Tool
- Done, agan akan menemukan private key dari address di descriptor wallet tersebut
Saya baca disini:
https://github.com/bitcoin/bitcoin/pull/21500 ada pull request mengenai "
wallet, rpc: add an option to list private descriptors".