Goal:

To build a simple, cheap, low powered device based on the ESP8266 WiFi chip which can connect to the Nano Callback System over websockets and monitor for any transactions to a particular Nano address. The device will parse any transactions to a particular address and depending on a criteria trigger an event (in this case turn on an LED). This project was created as a workshop at the Nano UK Meet-Up 2019.

Use Cases:

Transaction tracker (e.g. flash an LED when ever someone uses the Binance Hot Wallet)

Parking Meter — display a QR code for an address which the user scans, when the parking meter detects the transaction the countdown starts.

Storage Locker — display a QR code for an address, user scans it and sends funds to unlock the locker. User then deposits luggage, the locker could then be set to unlock only to another transaction from the users original address.

AirBnB Rental — unlocks door on receiving a Nano payment from a specific address.

USB Charger — trigger a relay to turn on a USB port, allowing someone to charge a device.

How Does It Work:

The ESP8266 connects to the predefined WiFi network, followed by a websocket connection to the Nano Callback Service.

It registers an address to be tracked. Whenever the Nano Callback Service detects a transaction with this address it forwards the block to the ESP8266.

The ESP8266 can read the block and depending on logic will turn the LED ON or OFF.

The ESP8266 does not actually process the send block, it is just triggered by the presence of confirmed block on the Nano network, it does not have access to the receiver’s private key. Therefore, payment processing will need to occur later on a different system which has access to the private key (perhaps a cloud server).

Components:

ESP8266 Development Board (e.g. https://www.amazon.co.uk/gp/product/B07M8Q38LK/)

MicroUSB Cable

Setup:

Download the Arduino IDE (not the Web Editor) and install. Install the drivers for the usb-serial converter (though depending on your OS this might already be installed). Go to the Arduino IDE Preferences:

4. Copy the following and paste into Additional Boards Manager URLs:

https://arduino.esp8266.com/stable/package_esp8266com_index.json

5. Go to Boards Manager to install the ESP8266 Environment

6. Other libraries to install: ArduinoJSON and WebSockets by Markus Sattler

7. Grab the example code:

8. Update TRACKING_ADDRESS with a particular address you want to track (current default is the binance hot wallet but you could set it any address — the only thing is to make sure you use xrb_ and not the nano_ prefix)

9. Set WIFISSID and WIFIPASS to your Wifi settings.

10. Make sure you’ve selected the particular ESP8266 model (there are lots)

11. Finally Flash

12. Once it’s flashed you can monitor/debug using the serial console. Make sure you change the baud to 115200 (often it defaults to 9600). If you miss the output you can reset the ESP8266 with the RST button on the development board.

Next Steps:

In theory you can now trigger any device with the ESP8266 and a Nano transaction. In the workshop we added an LED (and resistor) and connected it to GPIO5 (D1), changed the LED_PIN in the code and then made that flash. You can use the pins shown in the diagram.