https://ift.tt/3enl2W3 a stupid wallet backup script for unencrypted descriptor wallets

Made a stupid wallet backup script for unencrypted descriptor wallets

https://ift.tt/3qludMk


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://ift.tt/3szXN36) 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://ift.tt/3mxOHAh) 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://ift.tt/3qj2Y4U) 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://ift.tt/32xwGuH)
* [How to make all 7 wallet formats from one BIP39 seed-mnemonic](
https://ift.tt/3EaKDN3)
* [How to make a Taproot wallet using the importdescriptors command](
https://ift.tt/3p3pxtG)
* [How to dump a descriptor wallet using sqlite-utils](
https://ift.tt/3HX8guT)
* [The four types of Bitcoin Core wallets, and how to make them](https://ift.tt/2ZSc5Ao)
* [How are P2TR addresses created from a pubkey](https://ift.tt/3oqfFLi)

View Reddit by brianddkView Source

Cryptocurrency

Get In Touch