Bitcoin Forum
September 14, 2025, 05:20:39 PM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to create Sheets of Keys with QR-codes  (Read 275 times)
LoyceV (OP)
Legendary
*
Offline Offline

Activity: 3794
Merit: 19859


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 16, 2025, 07:47:42 AM
Last edit: May 18, 2025, 06:28:23 PM by LoyceV
Merited by El duderino_ (27), Welsh (10), DaveF (5), digicoinuser (5), ibminer (5), Kazkaz27 (5), dkbit98 (2), MoparMiningLLC (2), Cricktor (2), GazetaBitcoin (1)
 #1

Based on Kazkaz27's topic (and challenge), I created a script to print QR-codes for addresses and their private keys in bulk.

Challenge
That $100 is still up for grabs (layout has to be good, keys must align). Maybe you can do it. I don’t doubt that you can. But I’ll tell you, if you do it correctly, securely and make it easy that would make you a much more capable person then most people in regards to this. I still say it’s not easy. I’d love to see someone complete this challenge. I’ve left a few comments like this in different posts of mine in the past. No one ever actually takes me up on the challenge, so I guess something is up with that😅. I’d love to send someone the $100.  🙌

Results
The QR-codes I created are for testnet4 (and all addresses on the first page have 1 testnet coin each).
PDF: loyce.club/other/print_two-sided.pdf (anyone who needs testnet4 coins: take some, but leave some for someone else)
Address list: loyce.club/other/addresses.txt (note: the last 200 addresses are not in the PDF, and the keys are lost)
Image loading... Image loading...
This was printed on a 600 dpi laser printer on normal Xerox paper. If I'd do it again, I'd make the text a bit larger, maybe find a better font, and place it a bit higher above the QR-code.

Script
I'm not sure how useful this is going to be, but I'll publish how I did it. I used testnet, but for a real application you'll need to take proper security measures to make absolutely sure there are no traces left anywhere on the system you use. Running Live Linux from RAM without storage is ideal, but you may need to install some packages before you can take away it's physical internet cable. There shouldn't be a Wifi connection, curtains should be closed and phone cameras shouldn't even be in the room. Wipe the system when you're done.
I didn't optimize this script for readability or performance. It's not meant for people who don't know what they're doing. Read the comments:
Code:
#!/bin/bash

# Inspiration: https://bitcointalk.org/index.php?topic=5543341.0
#sudo swapoff -a
#sudo apt install qrencode imagemagick img2pdf
#Install everything before going offline

echo "Don't just run a script you found on the internet! Check each line and see what it does!"; exit
mkdir /dev/shm/bitcoin; chmod 700 /dev/shm/bitcoin; cd /dev/shm # I use /dev/shm so nothing gets written to disk
~/bitcoin-26.1/bin/bitcoind -testnet -noconnect -deprecatedrpc=create_bdb -datadir=/dev/shm/bitcoin > /dev/null 2> /dev/null &
sleep 5 #wait a few seconds
~/bitcoin-26.1/bin/bitcoin-cli -named -testnet -datadir=/dev/shm/bitcoin createwallet qr descriptors=false # Note: I use an older version of Bitcoin Core so I don't have to deal with a descriptor wallet
for i in {1..2001}
do  addy[$i]=$(~/bitcoin-26.1/bin/bitcoin-cli -testnet -datadir=/dev/shm/bitcoin getnewaddress addy_$i legacy)
    privkey[$i]=$(~/bitcoin-26.1/bin/bitcoin-cli -testnet -datadir=/dev/shm/bitcoin dumpprivkey ${addy[$i]})
done
~/bitcoin-26.1/bin/bitcoin-cli -testnet -datadir=/dev/shm/bitcoin stop
rm -r /dev/shm/bitcoin

#Test:
echo ${addy[2001]}
echo ${privkey[2001]}
# You now have 2000 unseen legacy testnet addresses and private keys stored as shell variables.

mkdir -p /dev/shm/bitcoin/addy/horizontal /dev/shm/bitcoin/privkey/horizontal; chmod 700 /dev/shm/bitcoin; cd /dev/shm/bitcoin
for i in {1..2000}
do  qrencode -o addy.png ${addy[$i]}
    convert addy.png -pointsize 12 -fill black -draw 'text 35,10 '\"addy\ $i\"'' -background white -gravity center -extent 175x175 addy/$i.png # Each QR-code gets a number printed, to confirm the address matches the private key on the other side
    echo ${addy[$i]} >> addresses.txt
    qrencode -o privkey.png ${privkey[$i]}
    convert privkey.png -pointsize 12 -fill black -draw 'text 30,10 '\"privkey\ $i\"'' -background white -gravity center -extent 175x175 privkey/$i.png     # Note: size 12 is a bit small after printing, and a different font may help too. Also: print the text a bit further from the QR-code
    rm addy.png privkey.png
done

# You now have 2000 QR-codes for addresses and their corresponding private keys.

horizontal=15
vertical=20
pages=$((2000/horizontal/vertical))
head -n $((horizontal*vertical*pages)) addresses.txt > tmp; mv tmp addresses.txt # I added this so the list of addresses isn't longer than the list of QR-codes
page=1
while [ $page -le $pages ]
do    line=1
      while [ $line -le $vertical ]
      do    j=$((1+horizontal*(line-1)+horizontal*vertical*(page-1)))
            convert +append $(while [ $j -le $((horizontal*line+horizontal*vertical*(page-1))) ]; do echo -n "addy/$j.png "; j=$((j+1)); done) addy/horizontal/$page\_$line.png
            j=$((horizontal*line+horizontal*vertical*(page-1)))
            convert +append $(while [ $j -ge $((1+horizontal*(line-1)+horizontal*vertical*(page-1))) ]; do echo -n "privkey/$j.png "; j=$((j-1)); done) privkey/horizontal/$page\_$line.png
            line=$((line+1))
      done
      line=1; convert -append $(while [ $line -le $vertical ]; do echo -n "addy/horizontal/$page""_$line.png "; line=$((line+1)); done) addy_$page.png
      line=1; convert -append $(while [ $line -le $vertical ]; do echo -n "privkey/horizontal/$page""_$line.png "; line=$((line+1)); done) privkey_$page.png
      page=$((page+1))
done
img2pdf --pagesize A4 $(page=1; while [ $page -le $pages ]; do echo -n "addy_$((page)).png privkey_$((page)).png "; page=$((page+1)); done) > print_two-sided.pdf
rm -r /dev/shm/bitcoin/addy /dev/shm/bitcoin/privkey /dev/shm/bitcoin/addy_*.png /dev/shm/bitcoin/privkey_*.png
exit  # the keys were still in shell memory

#Only 2 files remaining: the list of addresses, and the file to print (2-sided). Both are only stored on /dev/shm (a RAM drive)
#Note: while printing, the .ps-file probably gets written to /var/spool/cups. This is a risk for disk recovery software.
#Be aware of compromised QR-software. Both creator and verifier can give a different address. Check a few QR-codes to make sure they produce the desired key and address (then consider the scanned ones compromised).

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
Kazkaz27
Hero Member
*****
Offline Offline

Activity: 574
Merit: 522


PHYSICAL ₿ITCOINS™


View Profile WWW
May 16, 2025, 12:24:40 PM
Last edit: May 16, 2025, 12:43:54 PM by Kazkaz27
 #2

Dude awesome 👏

Great job on this.

I want to inspect them (Do Private Keys on the back line up perfectly with the corresponding QR Public keys on the front?).

I can even give you one of my sheets to inspect. I’ll try out your program (for fun). Not everyone has your talent.

Also please send me your BTC Address as you are the winner of this challenge🙌 you will be sent .001BTC

I have also included you in the Peanut Games. You have 1 ticket and a chance to win more Bitcoin. 🙏

Cheers! 🍻

 
 BitVIPCoins 
███████████████████████▄████▄▄▄▄▄
█████████████████████▄███████░░████▄▄
██████████████████████▀█▀█████████████▄▄
██████████████████████░█░░███████████████▄
███████████████████████▄▀█░█████████████████▄
████████████████▄▄█▄▀▄▀▄▀▄▀█████████████████████▄▄
████████████▄▄█▄▀▄▀▄▀▄▀▄▀▄▀▄▀██████████████▄▀▄▀▄▀▄▀▄▄
█████████▄█▄▀▄▀▄▀▄▀▄▀█████████████████████████▄▀▄▀▄▀█▄
███████▄█▄▀▄▀▄▀▄▀████████████████████████████████▄▀▄▀█▄▄
█████▄█▄▀▄▀▄▀███████████░██████████████████████████▄▀▄▀▄▀▄
███▄█▄▀▄▀▄▀███████████░█░░████████████▀▀░░░░▀▀█████████▄▀▄▀▄▀▄
░░▄▄▀▄▀▄▀████████▀░████▄████████▀▀░░░░░░░░░░░░▀▀█████████▄▀▄▀█▄
▄▄▀▄▀▄▀███████▀░░░░░▀████▀▀░░░░░░░░░░░░░░░░░░░░░░███████▄▀▄▀▄▀█▄
 
 REVOLUTIONIZING PHYSICAL BITCOINS 
███████████████████████████████████████
███████████████████████████████████████
██████▀▀█░░████████████████████████████
██████░░▀░░░░▀███▄░░███░░▌░▐░░░░░░░████
███░░░░░▄▄▄▄░░░███▄░░█░░▌░▐░░█▀░░█████
█████░░░███▀░░▄████▄░░▀░▐░░▌░░░░▄██████
█████▌░░░░░░░░░░████▄░░░▐░░▌░░▄████████
██████░░░████▄░░░████▄░░▌░░▌░░█████████
██████▌░░▀▀▀▀░░░██████▄▄▌░░▌░██████████
█████░░░░░▄░░▄▄█████████░░░████████████
████████░░█▄▄███████████▄░▄████████████
███████████████████████████████████████
███████████████████████████████████████
bitcoiner24h
Copper Member
Full Member
***
Offline Offline

Activity: 1025
Merit: 104

Decentralized Internet


View Profile
May 16, 2025, 12:38:50 PM
 #3

Good job, congratulations!  Cheesy

 
LoyceV (OP)
Legendary
*
Offline Offline

Activity: 3794
Merit: 19859


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 16, 2025, 01:03:53 PM
 #4

I want to inspect them (Do Private Keys on the back line up perfectly with the corresponding QR Public keys on the front?).
I printed a number to be absolutely sure I made no mistakes. I just tested it: I cut out addy117, swept the private key, and sent the balance back to the address on the other side. Then I swept the private key again to be sure it was funded again (and sent it back again for someone else to take). It worked, see mempool.space.

Quote
I can even give you one of my sheets to inspect.
No need, I trust they're aligned Smiley

Quote
I’ll try out your program (for fun). Not everyone has your talent.
Thanks Smiley

Quote
Also please send me your BTC Address as you are the winner of this challenge🙌 you will be sent .001BTC
Sent! Thanks Cheesy

Quote
I have also included you in the Peanut Games. You have 1 ticket and a chance to win more Bitcoin. 🙏
I had to look up VIP Bitcoin - Peanut 🥜 Games 🎁, as I don't visit this board a lot. Just a heads up: I never accept physical items for privacy reasons.

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
dkbit98
Legendary
*
Offline Offline

Activity: 2716
Merit: 8213


⚡ ₿ ⚡


View Profile WWW
May 16, 2025, 05:09:47 PM
 #5

Based on Kazkaz27's topic (and challenge), I created a script to print QR-codes for addresses and their private keys in bulk.
Easily earned 0.001 BTC 
That challenge was completed much quicker than I expected.
So are you selling this sheets of keys also as ''collectibles'' item, since you posted this in Collectibles board? Smiley

██████▄██▄███████████▄█▄
█████▄█████▄████▄▄▄█
███████████████████
████▐███████████████████
███████████▀▀▄▄▄▄███████
██▄███████▄▀███▀█▀▀█▄▄▄█
▀██████████▄█████▄▄█████▀██
██████████▄████▀██▄▀▀▀█████▄
█████████████▐█▄▀▄███▀██▄
███████▄▄▄███▌▌█▄▀▀███████▄
▀▀▀███████████▌██▀▀▀▀▀█▄▄▄████▀
███████▀▀██████▄▄██▄▄▄▄███▀▀
████████████▀▀▀██████████
 BETFURY ....█████████████
███████████████
███████████████
██▀▀▀▀█▀▀▄░▄███
█▄░░░░░██▌▐████
█████▌▐██▌▐████
███▀▀░▀█▀░░▀███
██░▄▀░█░▄▀░░░██
██░░░░█░░░░░░██
███▄░░▄█▄░░▄███
███████████████
███████████████
░░█████████████
█████████████
███████████████
███████████████
██▀▄▄▄▄▄▄▄▄████
██░█▀░░░░░░░▀██
██░█░▀░▄░▄░░░██
██░█░░█████░░██
██░█░░▀███▀░░██
██░█░░░░▀░░▄░██
████▄░░░░░░░▄██
███████████████
███████████████
░░█████████████
LoyceV (OP)
Legendary
*
Offline Offline

Activity: 3794
Merit: 19859


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 16, 2025, 05:17:32 PM
 #6

So are you selling this sheets of keys also as ''collectibles'' item, since you posted this in Collectibles board? Smiley
No, but someone on this board may be able to use it. It's kinda related to physical items, although it could be a cool micro-backup that's very easy to hide anywhere.

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
DaveF
Legendary
*
Offline Offline

Activity: 3962
Merit: 6892


Wheel of Whales 🐳


View Profile WWW
May 17, 2025, 01:43:26 PM
Last edit: May 17, 2025, 02:19:38 PM by DaveF
 #7

Good job Loyce

Side note, have to go dig it up but some coin maker years and yeas ago (Ravenbit? Silverwallet? don't remember) had some code that did something similar years ago. Didn't do the QR just the address on one side and the private on the other on a full sheet.

From a technical standpoint it's a tough decision. If you know the position of the missing characters you can recover a damaged private key.
Once a QR gets damaged beyond a certain point it's gone forever......

Edit: Since Kazkaz27 is paying a bounty I sent a donation in your name (well at least LoyceV) to a friend (and fellow BTC user) doing a charity event tomorrow.

https://www.gentlemansride.com/rider/JaimeCruz560865
Anyone with a prostrate feel free to kick in some $ too it's a good cause. v

-Dave

███████████▄
████████▄▄██
█████████▀█
███████████▄███████▄
█████▄█▄██████████████
████▄█▀▄░█████▄████████
████▄███░████████████▀
████░█████░█████▀▄▄▄▄▄
█████░█
██░█████████▀▀
░▄█▀
███░░▀▀▀██████
▀███████▄█▀▀▀██████▀
░░████▄▀░▀▀▀▀████▀
 

█████████████████████████
████████████▀░░░▀▀▀▀█████
█████████▀▀▀█▄░░░░░░░████
████▀▀░░░░░░░█▄░▄░░░▐████
████▌░░░░▄░░░▐████░░▐███
█████░░░▄██▄░░██▀░░░█████
█████▌░░▀██▀░░▐▌░░░▐█████
██████░░░░▀░░░░█░░░▐█████
██████▌░░░░░░░░▐█▄▄██████
███████▄░░▄▄▄████████████
█████████████████████████

█████████████████████████
████████▀▀░░░░░▀▀████████
██████░░▄██▄░▄██▄░░██████
█████░░████▀░▀████░░█████
████░░░░▀▀░░░░░▀▀░░░░████
████░░▄██░░░░░░░██▄░░████
████░░████░░░░░████░░████
█████░░▀▀░▄███▄░▀▀░░████
██████░░░░▀███▀░░░░██████
████████▄▄░░░░░▄▄████████
█████████████████████████
.
...SOL.....USDT...
...FAST PAYOUTS...
...BTC...
...TON...
LoyceV (OP)
Legendary
*
Offline Offline

Activity: 3794
Merit: 19859


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 17, 2025, 04:16:35 PM
 #8

From a technical standpoint it's a tough decision. If you know the position of the missing characters you can recover a damaged private key.
Once a QR gets damaged beyond a certain point it's gone forever......
QR-codes have built-in error correction, which can be increased to allow for more damage, but that comes at the cost of a larger QR-code. Or it can be abused by adding a logo inside the QR-code.
This is a nice read on recovering an incomplete QR-code.

A QR-code makes it much harder to sign a transaction offline. Most people would just use their regular phone for it, and if it works, that's very convenient. But the paranoid user in me would want to keep the keys online.

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!