Migrating an old wallet to Bitcoin Knots and setting up a 2-laptop airgap

16 replies 145 views
DarkSeedSenior Member
Posts: 209 · Reputation: 1423
#1Jun 9, 2022, 08:17 AM
So, if I want to move my old wallet from 2013 into a Bitcoin Knots wallet, do I need to change the wallet format, or is it good to go as is? I'm asking because Bitcoin Core makes you update the wallet format. Right now, it’s easy with "File->Restore" but eventually they’ll phase out the old wallets, and then you’ll have to jump through more hoops because of the new descriptor wallet. My plan is to run two Bitcoin Core instances, one offline and one online, and use the PSBT file to transfer the signed transaction to the online wallet. But since I’m also interested in using Bitcoin Knots, I’m curious about how to manage this with that software. If anyone has insights, hit me up.
3 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#2Jun 9, 2022, 08:34 AM
I've tested this and it's pretty much the same. It has the same options to Restore and Migrate; PSBT workflow is also the same. The "extra stuff" is just one step after restore: migrate. (at least in the current version) I'd recommend to do this now if you're planning to do that later though, since you wont be able to directly restore a legacy wallet in the next version of Bitcoin Core. That's when you'll have to do more extra steps. What isn't clear is if Knots will follow Core's removal of legacy wallet. (which is now merged and will be applied to the next release)
3 Reply Quote Share
alt21Senior Member
Posts: 398 · Reputation: 1732
#3Jun 9, 2022, 12:01 PM
Alright, that's exactly my chance for grabbing fresh knowledge. Since Knots is a Core's fork, can't they simply follow totally separated paths? And if so, shouldn't Knots notify (via Github) about their intentions in matters like this? In short, what I 'm asking is, what is the process of Knots taking action and doing commits that are relevant to what Core does? If Core has a feature A, that they wanna merge in the upcoming release, what does Knots need to do about it?
2 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#4Jun 11, 2022, 06:28 AM
I'm also not sure, as the context of that quote implies. The only clue that I found is it's mainly based from development in Core rather than directly to Knots. (check reference) And the main developer is asking on how to to make its development more visible and not much reliant on the reference client. Maybe we'll see a related PR or issue a few days/weeks from now. Ref: github.com/bitcoinknots/bitcoin/discussions/128
0 Reply Quote Share
alt21Senior Member
Posts: 398 · Reputation: 1732
#5Jun 11, 2022, 11:12 AM
Thanks. What surprised me is that I don't see any approved PR, by any member and I 'm only seeing commits by Luke. Am I wrong? Anyway, it's better to discuss it in another thread, perhaps I 'll open one within the week.
3 Reply Quote Share
DarkSeedSenior Member
Posts: 209 · Reputation: 1423
#6Jun 11, 2022, 11:30 AM
So there is a "migrate" option? you just click "restore", then click "migrate" and you are set? And to create the watch-only wallet, what is the workflow compared to Core? I remember reading a tutorial but im not sure now, you have to dumpprivkeys or something, but I don't get it since I only want to export the public keys into the watch-only wallet. As for legacy support, I think they should keep it. Make things as backwards compatible as possible.
0 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#7Jun 12, 2022, 12:35 AM
Yes, you should see the restored wallet's name in Migrate. But take note that if the wallet contains a lot of private keys that are not derived from an HDkey, it could take a while for the migrate to finish. And also, your wallet will now start to use new active descriptors for the new addresses that you'll request but it will still retain its old keys. Yes same as Core. Basically; create a descriptor wallet with "disable private keys" option, them import your public descriptors (with xpub) to it via importdescriptors command. You can easily test this by installing the software itself and start it in RegTest (--regtest) and preferably pointed to a temp datadir (--datadir=<path>). As for the tutorial, here's one by TraChang: /index.php?topic=5392824.0 (for HD descriptor wallets) If you want it to have all four available script types, you must also import the receiving and change descriptors of the other three script types from the cold-storage wallet. But for old wallets with "Just a Bunch of Keys" this will be a tedious task as you'll have to import each public key as single key descriptor, Example single key descriptors (should show in listdescriptors after migrate): pkh(03544894cbe2a7bed80948846d41d46ab37ea9cb437bd2581011108bee120fc67c) pkh(02146dd1c325050cc6869eff1dd88208d222e74c374aad9753bbbf2a8441bd2ed9) pkh(03957f7bd48709d8fdcf326425ef16ff677472bb6f0a0ec96ac263e96b7eb743d3) example import to watch-only wallet: For each of the descriptors' checksum in the import command above (e.g.: #p6xx8tek), I just did the "lazy method" of putting a placehodler of "#00000000" and let Core/Knots show me the correct checksum in respective order. Then I edit those placeholders with the correct checksum. Lastly, if you're doing it by batch, once you import the last descriptor, replace \"timestamp\": \"now\" with \"timestamp\": 0 for it to rescan. Alternatively, use rescanblockchain command.
4 Reply Quote Share
DarkSeedSenior Member
Posts: 209 · Reputation: 1423
#8Jun 13, 2022, 09:30 PM
What would happen if I used Bitcoin Knots to run the online node but use Sparrow wallet to manage private keys and craft the transactions (to be broadcasted on the Bitcoin Knots node)? I mean, since it's an old wallet.dat, will Sparrow wallet software have any problems? I still haven't tried with Knots btw. I just installed Debian and will try tomorrow syncing the Bitcoin Knots online node and then I have to install Debian again on another laptop for the offline airgap cold storage and decide if I use Knots of Sparrow for this. I assume I will end up using Knots. Im just not sure yet I understand all the steps. Is there someone that did a video tutorial or at least a tutorial of this process somewhere showing the different steps when using an old wallet format?
3 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#9Jun 14, 2022, 12:01 AM
Do you mean use Bitcoin Knots as server? If so, there shouldn't be any issue for using Knots in place of Core as "Bitcoin Core" server option. Just enable "Bitcoin RPC server" option in the settings or add "server=1" to your bitcoin.conf file so it will create a '.cookie' file that Sparrow requires. This is where the question became confusing, do you mean loading the old wallet.dat to Sparrow? Because you mentioned a wallet.dat file, yet, you intended to use Sparrow as the wallet and Knots as server. The actual auto-setup that will happen is, Sparrow will create a descriptor wallet named "cormorant" in Knots for you that will contain your Sparrow wallet's watch-only descriptors (containing xpubs). Any other old/new wallets it already has will not be affected nor required by using it as server for Sparrow.
6 Reply Quote Share
DarkSeedSenior Member
Posts: 209 · Reputation: 1423
#10Jun 14, 2022, 04:10 AM
No, let's forget about Sparrow and keep things as basic as possible without adding additional layers of complexity (and for me having to trust another software is just that). Let's recap, this is what I want: 1) Laptop 1: Bitcoin Knots, fully synced. I need a watch-only wallet to broadcast transactions 2) Laptop 2: Bitcoin Knots, no blockchain, airgap. Wallet with keys sits there. I need to make the old 2013 wallet work there. Then create the watch-only wallet for the Laptop 1. I need to learn how to use PSBT, so I can send a transaction from Laptop 2 to 1, using the GUI with Coin Control to select utxos. For this, I want to use testnet coins first. I will need to see how testnet works, I think I used it ages ago but don't remember. Anyway, so how do I do this? In this thread there is some convoluted way where im going to need to go key by key? wtf. There is no other way? It's a 2013 wallet, but was used until 2015, so im not sure if it was converted to HD by the 2015 Core version which I think it was around when HD was introduced, or its just the same wallet. I also hope I can get the keys with their descriptions, since they are named to identify the source of funds (or where coins were sent at). I need to know what im doing here and I don't have a clear gameplan yet of how to proceed.
2 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#11Jun 14, 2022, 08:57 AM
Do this: Open Bitcoin Core (GUI)Select the wallet in the drop-down menu if you have multiple wallets loaded.Check the HD icon on the lower-right-hand side of Bitcoin Core, it's crossed-out if the selected wallet isn't HD. For non-HD wallet; no, there's not other way but to import each public key to the watch-only wallet since those aren't derived from a single master key. For HD wallet, you'll just need to import the parent descriptors (that has xpub) to the watch-only wallet.
3 Reply Quote Share
DarkSeedSenior Member
Posts: 209 · Reputation: 1423
#12Jun 14, 2022, 02:31 PM
But if you use the Migrate option, doesn't it convert it to HD format? or the existing keys will still be non-HD derived so you would still need to manually import each existing public key? I mean if I import the .json file (Import on the GUI or command importdescriptors) after doing the Migrate process, I will get what exactly? Im just concerned it may not import all the public keys. Or if you use the Migrate option it will work even with the oldest keys? Because im not sure if in 2015 Core converted the wallet to HD. I remember some sort of updating of the wallet format, but I think the actual wallet.dat file was never update. So I think the wallet is non HD. So if it's a non-HD wallet, the Migrate option will not work? what then? Im assuming it just converts it to a modern HD wallet with descriptors, so I can just use that new converted wallet file and I can export this as a watch-only wallet easily, with the option listdescriptors false enabled so no private key stuff is exported.
5 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#13Jun 16, 2022, 11:02 PM
Both are true. It'll set an HD key to be used for its new active HD descriptors (for your new addresses). And the previous loose keys are converted to single-key descriptors like: pkh(WIF) or combo(WIF). Of course, the new HD parent descriptors can't be related to your old non-HD keys. If you're interested on an alternative, there's a way to skip that: Copy an updated blockchain to the offline machine, reindex your offline Bitcoin Core, rescan for txns, then create, sign & export the transaction to the online node. To do that, simply copy your own online Bitcoin Node's "blocks" folder (you may exclude the "index" folder inside) to an external drive and paste it to the offline machine's node's datadir. Then start your offline Node with --reindex and it'll create its own index and chainstate directories. (this will take hours to finish, but it will not fully sync since it's offline). With a blockchain, even offline, you can load and rescan your wallet up to the last available block and create a transaction there. (manually set the fee) Just export it to the online machine once it's signed to be broadcasted. After you spent the bitcoins from the old wallet, create a new wallet so that you can set-up a normal cold-storage setup or create it prior to use as the recipient.
4 Reply Quote Share
DarkSeedSenior Member
Posts: 209 · Reputation: 1423
#14Jun 17, 2022, 12:05 AM
But basically, if I use Migrate on the 2013 wallet, then can't I just export what I need for the watch-only wallet using importdescriptors false which should output a list of all your public addresses' descriptors so you can safely copy this data into a .json file, encrypt it, put it an USB and copy it into the online laptop where you have create a fresh watch-only wallet, and then use importdescriptors [filename.json]. Then rescan and the watch-only wallet should be working? I did consider this, since it's the only way you could be able to actually see your funds are there in your offline laptop. There is something upsetting about seeing 0.00 BTC there, even tho the private keys are there, since the watch-only wallet supposedly should be matching all of your existing private keys with the public keys watch-only descriptors there. And I assume, that since the wallet was migrated with the Migrate option, it is now an HD wallet for any new addresses generated from this point, meaning that the .json file you exported and then imported into the online watch-only wallet, guarantees that you can create new receiving addreses on the offline laptop which will match them on the online wallet (however im not sure how this exactly works). And now with all this migrating stuff of wallets and so on, im a bit paranoid you would screw up at some point. If I could have the actual blockchain on the offline wallet, when signing the PSBT, it would be nice seeing your funds there. Im really going to need to test with testnet coins but the thing is the wallet would be a modern version 28 wallet so I wouldn't encounter the initial migrate step. Either way I need to get comfortable with the flow of how this works when monitoring and sending transactions with the 2 laptop setup. As of right now it's not clear to me. I think I should actually keep another copy of the blockchain on the offline laptop, because I don't want to have 0.00 BTC here. But of course, this is very annoying to maintain, since you have to spend double the time validating blocks which is increasingly slower with all this spam crap on the blockchain, plus I only have additional 1TB drives which given the current size of the blockchain may not last very long. Also you open this attack of vector of constantly sending files with your USB pendrive to keep the blocks up to date. I mean if you have linux on both machines and only use them for this task is unlikely anything on the USB leaks specially if you encrypt it but it's one of those things. Please let me know if im missing something. I have seen different step by step tutorials and each time someone mentions something different. For instance, apparently listdescriptors false will not accurately have the stuff in order and you need to edit the json file to properly import it or something.
2 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#15Jun 17, 2022, 04:41 AM
You probably meant: "listdescriptors false" Yes, that's if you already know which descriptors to pick, otherwise you may miss one with associated UTXO if you wont export all since it's offline and not synced. You can download an old version of Bitcoin Core (pre-descriptor), start it with datadir pointing to your preferred temporary test datadir. Even if it's done in the same machine, that shouldn't interfere with your current setup unless you overwrite something by using the same directories.
0 Reply Quote Share
DarkSeedSenior Member
Posts: 209 · Reputation: 1423
#16Jun 17, 2022, 05:23 AM
Yeah, I meant listdescriptors false. I don't understand what you mean to. What does it mean that I may "miss one with associated UTXO"? And doesn't this command export all? It gives you every single public key descriptor so you can then put this into a .json file and import it into the watch only wallet. Could you see if this is correct? someone mentioned these steps to do it: So what I was saying about the .json file is this: So apparently, there is a problem when you use listdescriptors false to get the output that you copypaste into a .json file to then import this into the watch-only wallet? Why isn't there a way to just generate a .json file ready to be imported in the watch-only wallet? Looks like this is not properly implemented since you shouldn't need to be copypasting things around and even tweaking things because they don't match the expected import format. Yeah but that means I have to redownload the blockchain and spend a ton of time again on this, on an old version which probably means even slower. And I would need a version that's older than the oldest one on that list, probably 0.8.6. And syncing the blockchain is so damn slow on my laptop, so I would need to leave my desktop syncing at night again.. what a nightmare.
1 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#17Jun 17, 2022, 09:42 AM
I thought you only need to create an old non-HD wallet.dat to test if your plan will work? Because if so, you'll just have to start old Bitcoin Core in testnet, generate a few addresses (send some tBTC4 although its testnet3), close it and get that "wallet.dat" file from the custom --datadir that you set. There's no need to sync that old version, once you have your sample wallet.dat (you can rename it), use its copy in your intended setup (with the latest versions installed). Then in your latest version, launch it in --testnet4, that wont take days to sync and it will not interfere with your mainnet files. Also add walletcrosschain=1 to your bitcoin.conf file under [testnet4] tag for it to load the old testnet wallet.dat file. (don't forget to restart if it's set in the conf file) That will enable you to test "Restore" and "Migrate" on an old non-empty wallet.dat file.
3 Reply Quote Share

Related topics