In this tutorial we will create a Bitcoin vending machine. Users will insert coins into the vending machine and receive Bitcoin to use on the Lighting network. We will keep this project simple so anyone can build a Bitcoin vending machine. Software development skills are not needed for this tutorial.
The goal of this project is to introduce more people to Bitcoin and help them understand its capabilities. We want to make the buyer experience simple, intuitive and fast. To implement this project we will use a sticker vending machine that accepts coins and dispenses instructions to claim Bitcoin.
Bitcoin vending machine process flow
A user will perform the following steps:
- Insert coins into the Bitcoin vending machine
- The vending machine will dispense Bitcoin claim instructions
- These instructions will detail how to download a wallet and claim Bitcoin
- User will follow instructions and Bitcoin will deposit into their wallet
Parts needed for a Bitcoin vending machine
For this project we will build a free sanding mechanical Bitcoin vending machine. It would be best to buy a vending machine that has a credit card reader but we could not find one at a price that we were willing to spend for this experiment. We will repurpose a mechanical sticker vending machine however you might find a different vending machine that fits this purpose. In order to create the vending machine we need the following components:
Bitcoin QR code vouchers for the machine
For this project we will have the machine dispense a QR code. This code will allow a user to claim Bitcoin for a one time transaction. In order to generate a QR code that supports withdrawals we will use LNbits. This is not an endorsement or sponsored post for LNbits. Remember blockchain is experimental so read all of the documentation on their website to understand the risks.
LNbits is a free open source Bitcoin lightning wallet. You can run LNbits for your personal account or offer a custodian solution for others. Each wallet has its own API keys and there is no limit to the number of wallets you can create. Extensions are available and enable extra functionality to LNbits so you can experiment with new technologies on the lightning network.
To get started with LNbits:
- Visit their website at https://legend.lnbits.com/
- Name your LNbits wallet and press the add a new wallet button
- The next page that appears is your wallet hosted by LNbits
- You can host LNbits software but for this project we are going to use their service
- It is important to bookmark this page and save it as a favorite
- Navigate around the page to learn the different components of LNbits
- Wallets – Create multiple wallets
- Extensions – Additional functionality to add to your wallet or application
- Transaction Details – History
- API information – Wallet id, keys, delete wallet, etc.
- Next click on Manage extensions and open LNURLw – to make LNURL withdraw links
- The LNURLw will allow you to make a withdrawal voucher QR code
- This feature allows you to create a voucher to use on the lightning network
- Select a wallet, configure how much Bitcoin can be withdrawn and how many times the voucher can be used
- After you create a voucher it will display in your wallet as a Withdraw link
- Select one of the withdraw links to display the QR code and withdrawal configuration information
- You can use this QR code in your vending machine
Now that you know how to use LNBits and the LNURLw extension you have the building blocks to create your Bitcoin vending machine vouchers.
Create instructions for the user
Now we want to create simple instructions that dispense from the vending machine. These instructions will explain how to download a Bitcoin wallet (if they do not have one) and how to claim Bitcoin. These instructions need to be intuitive and the experience needs to be user friendly.
Several Bitcoin Lightning wallets were evaluated for this project. Each wallet that we reviewed was available on Android / iPhone and all had similar capabilities. The team choose to use the Muun wallet for this project. This wallet has a very intuitive user interface and works well with LNbits withdrawal links. We will include information in our instructions on how to download the Muun wallet.
We want the instructions to explain how to:
- Download a Bitcoin wallet if you do not have one
- Open your Bitcoin wallet
- Scan the QR code to claim your Bitcoin
Below is a sample set of instruction that can be put in the vending machine. We want the instructions to be short and to the point. Finally combine these instructions with the QR code vouchers from LNbits.
Bitcoin vending machine
Now put the components together to finish the project.
- Create as many withdrawal vouches as you need
- Put one voucher on one set of instructions
- Insert the instructions in the cardboard inserts that are required for the sticker vending machine
- Fold the cardboard inserts and prepare to load them into the vending machine
- Load the vending machine with the cardboard inserts and lock it
- Create a professional Buy Bitcoin sign for your machine
- Place your machine in a location with foot traffic. Example home, office, store, etc.
Your final product is a Bitcoin vending machine that accepts coins and dispenses Bitcoin. This build did not require any software development and can be completed by anyone. This is a fun project to get more friends, family, patrons into Bitcoin.