I’ve been struggling with exporting my private key from bitcoin-qt a little bit, so now when I successfully done it, I’m going to describe those steps here. I had old wallet.dat and switched to Electrum wallet, but after MININGCO.ETF closure I received some funds into my old wallet, so there was need to get them out. First I was trying to use PyWallet, but without any success. So I did it with CLI access to bitcoin-qt wallet. Here we go:

  1. Download and unpack bitcoin-qt wallet,
  2. move wallet.dat to ~/.bitcoin directory,
  3. create bitcoin.conf in ~/.bitcoin directory and define rpcuser= and rpcpassword= in it,
  4. run ‚bitcoind -server‘ in terminal,
  5. unlock the wallet for 60 seconds like ‚read -s wp; ./bitcoin-cli walletpassphrase „$wp“ 60; unset wp‘,
  6. and finally dump private key ‚./bitcoin-cli dumpprivkey 1MyBitcoinAddress‘, which is written directly to terminal,
  7. lock the wallet ‚./bitcoin-cli walletlock‘.

Now it’s possible to copy private key and import it into Electrum or another wallet software (or give it to someone :)).