BREAKING NEWS! Coin.fyi has been acquired by VC firm Morningstar Ventures. Read more

Bitcoin
$42,400.32 0.22%
BTC · 3w

Made a stupid wallet backup script for unencrypted descriptor wallets

In my attempt to learn Taproot with Bitcoin Core, I started poking around at the descriptor wallets, and how to make them. One thing that is interesting is that they can't really be backed up in v22.0. [PR#21500](https://github.com/bitcoin/bitcoin/pull/21500) fixes this, but it's not released yet. But thanks to [@achow101](https://bitcoin.stackexchange.com/a/111371/5750) I got the bits I need to make a crappy backup utility. Unfortunately I didn't port over any of the `CCrypter` class, so I can't decrypt encrypted wallets. But if you make a descriptor wallet and keep it unencryupted, you can run this python, or a lower level [sqldump.py](https://github.com/brianddk/reddit/blob/468ee66/python/sqldump.py) to pull out the private key data. After that, you can encrypt it without concern. Or I suppose you could just wait for the next release with PR#2100 in it. Anyway, here's [sql-privkey.py](https://github.com/brianddk/reddit/blob/df58b55/python/sql-privkey.py) that will rebuild your `tprv` BIP32 key from your `tpub` descriptors. It's hardcoded for testnet right now, but it would be trivial to add mainnet to it. I also did a few address derivations since "How to make P2TR addresses" was one of my original questions. The code requires the bitcoin-core functional test libraries, as well as pycoin and sql-utils. ### References These are some other questions and answers that filled in my gaps of knowlege. * [Script to list all commands and configs to create / use the 7 wallet formats]( https://github.com/brianddk/reddit/blob/010934f/python/hdseed.py) * [How to make all 7 wallet formats from one BIP39 seed-mnemonic]( https://www.reddit.com/r/Bitcoin/comments/r5g0ws/howto_ways_to_use_12_word_seeds_bip39_in_bitcoin/) * [How to make a Taproot wallet using the importdescriptors command]( https://www.reddit.com/r/Bitcoin/comments/r37ky5/howto_create_and_use_a_taproot_wallet_on_testnet/) * [How to dump a descriptor wallet using sqlite-utils]( https://www.reddit.com/r...
Continue on self.Bitcoin
Recent News
BTC +0.22% · valkyriecryptocurrency.com · 8h

Is This the Year bitcoin Goes Green?

Bitcoin, the world’s largest cryptocurrency, has a well-established history of negative environmental impact, and this reputation has carried broadly ac...