A kiosk system which initiates blockchain transactions based on NFC tag
Inspired by NFC Wallet March 2024 https://drive.google.com/file/d/1Ph_7cQGZvrkj3zASVVKsac3wuu9phT2F/view
This project is in a chaotic early protoyping stage. This README is probably already obsolete because software moves faster than documentation! An early brainstorming document is here: https://docs.google.com/document/d/1bi9Xqc3jPMIKPmWmw_7Wpaw240WUTF4ko1_ypiXqWYI/edit
The prototype is built with a Raspberry Pi Zero W, which uses an Arm6 processor and runs a variant of Debian Linux. https://www.raspberrypi.com/products/raspberry-pi-zero-w/ This board includes Wifi for internet connectivity.
This code should be compatible with other more recent and somewhat larger Raspberry Pi boards (e.g. RPi 3B+) which have more powerful processors -- which may be useful for speedy blockhain crypto operations. The Raspberry Pi devices are designed to attach to a wide variety of peripherals, in our case an NFC reader and display. Big shout-out to Adafruit for peripheral harware and software support. https://www.adafruit.com/
PN532-based NFC reader peripheral, connected through serial port. https://www.adafruit.com/product/364
1.3-inch 240x240 color TFT display, connected through SPI. https://www.adafruit.com/product/4484
The processor board includes an HDMI port which can connect with larger display screens, and can also support touchscreen input. These features are not being used in the prototype.
This project uses loosely-coupled coprocessing where independent programs communicate through the nats.io publish/subscribe messaging framework. Separate processes handle NFC reading, display, and blockchain communication.
The nats.io messaging framework is designed to handle both local and wide-area-network messaging. In this project we are only using it locally within the kiosk processor. A local server daemon manages this. https://nats.io
nfcread.py communicates with the NFC reader peripheral over a serial port. When a tag is present, it publishes a message containing the tag serial number on the local.nfcread
channel. The message repeats until the tag is removed. If multiple tags are present, the PN532 chip will report them alternately.
nfcshow.py is connected to the TFT display. It listens on the local.nfcread
channel and displays the serial number as text at the top of the display. It also computes and displays (as a demo) a QR code representing the serial number.
antelope.py incorporates wharfkit tools https://wharfkit.com/ to interface with antelope (formerly eosio) blockchains. It listens for nats.io messages and takes actions such as reading a table or publishing a transaction to the public chain over wifi internet.
To be written
Raspberry Pi OS Lite Release date: March 15th 2024 based on Debian 12 (Bookworm) https://www.raspberrypi.com/software/operating-systems/
Server daemon sudo apt install nats-server
Python libraries pip3 install nats-py
JS libraries npm install nats
Adafruit CircuitPython https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
Adafruit NFC reader https://learn.adafruit.com/adafruit-pn532-rfid-nfc/python-circuitpython
Adafruit TFT display https://learn.adafruit.com/adafruit-mini-pitft-135x240-color-tft-add-on-for-raspberry-pi/python-setup
Greymass wharfkit npm install @wharfkit/session @wharfkit/wallet-plugin-privatekey @wharfkit/contract dotenv
At this time it is necessary to start each application manually
python3 nfcread.py &
python3 nfcshow.py &
node antelope.js