Dunkelheit

Generating QR Codes for Crypto

published on

If you run a blog or a website or have any kind of online presence then you should be accepting crypto donations.

I will not explain why you should accept crypto here because this article exists. Please read it.

Crypto Addresses

You don’t need to use third party platforms to do this.

All you need is your address and you are good to go. In this example I will be assuming that you have custody of your crypto wallet(s) and don’t use fiat-crypto™️ platforms.

For this example I will be using a Monero address but the same method will work for all cryptocurrencies that use a single-string address. Which all two of the important ones do.

Requirements

First of all you are going to want to know your Crypto receive address.

It should look like this for Monero: 87ukrCxsbK79rQbGwutzTmE4RDPiayn3xK5JT63iiSks5Q9TMCsXzUibXEea1q6x6ij6u2UDxzXpNBU5bP4u8Wz34esoLRG

Secondly you are going to want to install the python-qrcode package. It is available under this name on Arch and Debian based distros. It can also be found here.

Now that you have these two tools you are ready to go.

Generating the QR code.

Input the following into your terminal:

qr "<your crypto address>" > xmr.png

Replacing <your crypto address> with your actual address.

For me this would look like this:

qr "87ukrCxsbK79rQbGwutzTmE4RDPiayn3xK5JT63iiSks5Q9TMCsXzUibXEea1q6x6ij6u2UDxzXpNBU5bP4u8Wz34esoLRG" > xmr.png

You will now have a png image file in your current directory. You can now use this on your website.

For an example of it in use see this page.

Why Use This Program?

You may be considering using an online QR code generator. But any code running on someone else’s hardware cannot be trusted with something as sensitive as this.

If you are an advanced user you can use this tool with optimisation options or you can output your QR code to an SVG instead. You can use this in combination with other QR code optimisation tools to minimize the file size if that is a concern.

Tips

Only two cryptocurrencies actually matter these are Bitcoin and Monero. All other cryptos are gambling or memes (or a dangerous combination of both). Not financial advice.

You should always give the user the option to donate with the address itself too. In fact its a good idea to provide the address with the QR code so that they can verify the QR resolution.

It may be a good idea to create a minimalist solution to allow the user to expand the page with the given QR codes if you plan to include them on other pages on your site. This is only relevant if your site doesn’t accommodate for this in its design anyway.