Instant M2M Payments with Raiden
We are excited to release a demo showcasing IoT machine to machine (M2M) micro payments using Raiden. The demo shows how fast ERC-20 token transfers can be and gives a general overview of the setup. This is one of the very first solutions providing instant payments without any intermediaries.
The Demo Setup
In this video, you see a model train with a nanopi microcomputer on top. The train must pay for each round trip. The camera of the nanopi scans a barcode that has the payment credentials encoded for every orbit and pays for the next round. Red and green lights underneath the rails indicate for what part of the rail track the train has paid. The receivers are chosen randomly since with Raiden you can pay anyone in the network including people you do not have a direct channel with. This is demonstrated in the network topology in the middle of the screen, where you see who has a channel with whom and what path is taken to pay a certain receiver. All these shows that Raiden payments are decentralized and fully independent of any third party services or platform.
Flow Diagram
The Code
The code has a minimal setup and includes only ~100 lines which makes it easy to implement and use. The major part of the code is needed to control the power supply of the train, encoding, and decoding of the barcodes, and communication with the ultrasound sensor. If you would like to know more, please check out this GitHub repository.
The Hardware
- Minitrix taurus starter kit model train with additional rails
- Nano Pi Duo 2, mounted on top of the train
- Nano Pi Camera to scans barcodes
- Anker powerbank to power the nanopi
- USB cable that sticks in the powerbank on one side and soldered to the nanopi on the other side
- 65 inch flat screen with HDMI connection
- Glas prism to reflect barcode from flat screen into the camera of the nanopi
- UDOO x84 ultra to control the rail tracks power supply, measure train round trips, show graphics on flatscreen, and run the receiver Raiden nodes
- Ultrasonic sensor HC-SR04 to detect when the train completes an orbit
- Selfmade circuit board to control voltage at the rail tracks and enable the UDOO to switch the power on and off with an analog signal from an GPIO pin (Pseudo circuit diagram)
The circuit board is powered by a 9V battery. The small signal switching transistor (2N2219A) on the right hand side closes the circuit if the UDOOs GPIO pin is set to HIGH. Therefore the UDOO can turn on the power by setting the GPIO pin to HIGH. A simple switch parallel to the switching transistor allows closing the circuit to power on the train independent of the UDOO. The additional resistor “R” can be used to control the speed of the train. An increased resistance will reduce the speed of the train (the original model was designed with an analog train).
Conclusion
To sum up, Raiden makes M2M immediate payments at minimal cost real. In this demo set-up, it takes only ~170ms to finalize a transaction, no matter if it is a direct or a multi-hop transfer. Besides, the transfers are fully decentralized and autonomous, there is no need for any third-party service or platform. The technology can already be implemented in IoT devices or any device with a Unix operating system. We are looking forward to hearing your feedback. Reach out to us at contact@raiden.network.
This Project was partly funded by the iBlockchain project (16KIS0905)
Disclaimer: Please note, that even though we do our best to ensure the quality and accuracy of the information provided, this publication may contain views and opinions, errors and omissions for which the content creator(s) and any represented organization cannot be held liable.
The wording and concepts regarding financial terminology (e.g. “payments”, “checks”, “currency”, “transfer” [of value]) are exclusively used in an exemplary way to describe technological principles and do not necessarily conform to the real world or legal equivalents of these terms and concepts.