Old Core wallet to Knots

This worked, didn’t need the other command, it rescanned the wallet or something with a loading bar, then I saw the notifications of the incoming transactions and I can see the funds, awesome, finally making progress.

Of course, now the nightmare will be having a bunch of transactions with no labels. They should really improve this and have the .json include the labels but it is what it is. So basically, I have to manually check one by one, and edit the label. It lets you edit the label easily on the GUI. How would the best way to go about it?

The problem is, you have the wallet.dat file on your safe airgap computer, cool, but you see 0.00 BTC, you just have the private keys. To see the funds, you do this whole process on a watch-only wallet, but you are only seeing the funds with no context (no labels). So I don’t see how I add the labels correctly, since the wallet.dat on the airgap computer lacks blockchain data, it cannot load the funds and show the labels… I mean, am I really going to need to copy the blocks folder into the airgap computer’s /.bitcoin and reindex the chain there? Because I cannot think of any other way. The other computer is only 1TB free space and the damn blocks folder is already 793GB, plus it’s HDD since to store files long term from what I have researched it’s better to use HDD since it has less degradation (as long as you are not using it a lot). Not a problem for this use case. However, im going to give an HDD a beating by verifying all the blocks and copying them there… so I need to think about how to proceed there.

We are talking years of transactions, each transaction properly labeled, and now im just going to get a bunch of transactions with no context, so I cannot use the funds like that.

Ok, we could run a loop to compile a custom JSON file containing addresses and labels on the airgapped computer (using listlabels and getaddressesbylabel). Something like:

# Add any other flags or paths you need for bitcoin-cli to work:
CLI="./bitcoin-cli -rpcwallet=your_airgap_wallet"

$CLI listlabels | jq -r '.[]' \
| while read -r L; do
  $CLI getaddressesbylabel "$L" \
  | jq -r --arg L "$L" 'keys[] | {addr: ., label: $L} | @json'
done > addr_labels.json

And then take that JSON file to the other computer and run another loop which reads from it and applies the labels to the watch-only wallet (using setlabel). Something like:

# Add any other flags or paths you need for bitcoin-cli to work:
CLI="./bitcoin-cli -testnet=1 -datadir=/home/epicpanda/software/.bitcoin -rpcwallet=testnet3_watchOnlyTestWallet"

# Apply labels line by line
while read -r line; do
  addr=$(jq -r '.addr' <<<"$line")
  label=$(jq -r '.label' <<<"$line")
  $CLI setlabel "$addr" "$label" 2>/dev/null || true
done < addr_labels.json

1 Like

Awesome, it worked, thanks. Now I can finally do some testing with PSBT on testnet before I try this process with the real deal. Hopefully the migration does not introduce any problems, since the migration step wasn’t replicated there. Im still considering downloading an old Bitcoin Core version and replicating a migration, but If I install like 0.8.x and I open it using existing blockchain files, is it going to take ages again to verify the existing block files? (and hopefully do not damage them in this process). What about the chainstate folder files? I just want to be able to log in Knots again without any surprises.

Something I’ve noticed is, in “Date” all transactions (except the first 2), the dates are like 20 minutes later on the watch-only compared to the other one with the private keys (which is online since I have both wallets on the same laptop to test this, later I will test with the airgap laptop now that I know the steps), I guess this just logs whenever the wallet gets the transactions notified, and you should watch on the mempool for the actual time.

Btw, do you know what “Enable PSBT controls” does on the GUI? I see “Coin Control” enables the “Coin Control” section easily, but since I never did a PSBT transaction, im not sure what this does.

I haven’t done this myself, but I think you will probably have to reindex when you go back to an older version (and then again if you upgrade it to the newer version). I know there is at least one update (maybe more) which changed the way the blockchain data is stored and indexed.

Not off hand. I would imagine that it adds interfaces to create unsigned transactions as PSBTs, load them to sign if keys are available, finalize, broadcast, etc. I really don’t use Knots as a wallet, though, so I can’t say what exact UI paths are are enabled.