On encoding private keys from Bitcoin-core as QR codes for use in paper wallets, other wallet software, etc …
Note: Breadwallet will not import the private key upon scanning the qr code. It will offer to transfer the funds in that address to your breadwallet keyring.
Breadwallet, an awesome open source iOS bitcoin SPV client, allows you to import a private key for use within breadwallet. So, if you’re a user of bitcoin-core, and want to be able to spend some of your funds you have there with breadwallet, you’ll need to create a QR code of your private key to scan it with breadwallet.
This tutorial uses qrencode, an open source string to QR converter. The source can be found here: https://github.com/fukuchi/libqrencode/
Alternatively, you can install qrencode on ubuntu/debian through repositories
sudo apt-get install qrencode
Then, as of bitcoin-core version 0.11.0 you’ll need to run
bitcoind rather than the GUI
bitcoin-qt. If you’re using an old version of bitcoin-core that does not have the
bitcoin-cli tool, you can get the latest version of bitcoin-core and extract it without having to verify the blockchain again or mess with wallet.dat – your
~/.bitcoin directory will remain unchanged.
Get the newest version of Bitcoin-core
tar -xzvf bitcoin-0.11.0-linux64.tar.gz
You should see the executables for the bitcoin-core suite here.
Run bitcoind and create your QR
Be sure you quit any versions of bitoin-qt or bitcoind that are already running, then start the bitcoin daemon
The & operator makes sure bitcoind detaches from your terminal so you can keep going.
Now you are ready to get a QR code for your desired address. Is your address is “addr”, you can generate a QR code of your private key without ever showing your private key on screen in plain text. Just do:
./bitcoin-cli dumpprivkey "addr" | qrencode -o ~/Desktop/Key.png
Or better yet, if you want to create a new address and QR-encode its private key,
./bitcoin-cli dumpprivkey $addr| qrencode -o
echo "private key dumped for: "$addr
The QR code should appear on your desktop. Below is a screen shot of me doing an example where I create a new address, and get a QR for its private key. Enjoy!
Note that if your wallet is password protected (which it really should be), you’ll need to first do
./bitcoin-cli walletpassphrase "your_password" 100
where the argument 100 means the wallet will allow all actions (like spending, or dumping keys) for 100 seconds. That should be plenty of time.