Echo Dot (3rd Gen) - Smart speaker with Alexa - Charcoal

Use your voice to play a song, artist, or genre through Amazon Music, Apple Music, Spotify, Pandora, and others. With compatible Echo devices in different rooms, you can fill your whole home with music.

Buy Now

Wireless Rechargeable Battery Powered WiFi Camera.

Wireless Rechargeable Battery Powered WiFi Camera is home security camera system lets you listen in and talk back through the built in speaker and microphone that work directly through your iPhone or Android Mic.

Buy Now

IOTA — Empowering machines with wallets

0
205


Francesco Longo
IOTA, Telegram, Server, TP-Link Smart Plug, A lamp

Introduction.
Here I want to introduce the Proof of Concept for the “Empowering Machines with Wallets”, the 2nd IOTA Development Contest on “Hackster.io”. The main idea is to buy services paying with IOTA tokens. I took a smart-plug as example. This device can be turned on and turned off using some APIs through WiFi using a library written fore nodeJS. Basically I developed a server running on a Raspberry Pi that can be contacted using REST API that will provide the service (turn on the smart-plug) after receiving a POST request with attached an IOTA transaction hash. Once the server verify that the transaction exists and it is verified, the lamp is turned on for a specific amount of seconds depending on the predefined cost of electricity (for this sample I provide 1 second of the lamp for 1 IOTA). To simplify the interaction with the server, I developed a Telegram Bot that will take care of all the requests from a user. User will ask to the bot for the service, he will pay some IOTA token using the trinity mobile application (or whatever other IOTA wallet supporting IOTA) and then will use the bot to forward the transaction hash in order to demonstrate his payment. In this way the service can be simply accessed using any device (iOS, Android and Windows Phone mobile devices and PC of any OS) without installing/developing any other new application, just Telegram, a widespread messaging application (https://telegram.org/) and IOTA trinity wallet, application available for various platforms and OS (https://trinity.iota.org/).

IOTA — Empowering machines with wallets 1

General description of the PoC.
Basically, the idea of this PoC is to provide a service and pay for it using IOTA tokens. User wants to use a service and after understanding how much it costs (in IOTA) he pay for it to a specific IOTA wallet (created from the device he is asking for the service). The device offering a service has some logic on server side in order to provide the service to the user after he verify that the user pay and the transaction has been verified. This is only a PoC and has some limitations but this is just to provide a general idea of my project. Of course this can be improved.

Detailed description of the entire process.
Here it is described the complete process with technical details of all the components and action performed:

  1. A user, who wants to turn on the lamp attached to the smart-plug, contacts the Telegram bot. He starts the bot and then sends a message with the command with his request (e.g. “turn on the the lamp for 10 seconds”).
  2. The Telegram Bot perform a GET HTTP request to the server in order to get the IOTA address to be sent to the user. The user will use this address to perform the payment.
  3. The server use the IOTA Typescript library to generate a new address from the SEED of the smart-plug wallet and reply to the IOTA Bot.
  4. The Telegram Bot, once received the address from the server, replies to the user with the IOTA amount needed to provide the requested service. Supposing 1 seconds of electricity costs 1 IOTA, the bot will reply to the user the total amount of IOTA to be paid and the address X to which to send the payment (e.g. “send me 10 IOTA for 10 seconds to the address X”).
  5. The user will send the requested IOTA to the address X using the wallet he wants. Supposing he is using his mobile phone he use the trinity wallet application to send IOTA to the address. Both Telegram and trinity wallets applications are available for many devices and OS, so the user can contact the Bot from any device he wants. (e. g. “the user pay 10 IOTA to the address X”).
  6. The user sends another command to the bot in order to provide his transactions hash, as a receipt, of the just done transaction.
  7. The telegram Bot forward the transaction hash to the server.
  8. The server use the IOTA typescript library to check if the transaction is valid and verified.
  9. The server contacts the Bot in order to sent back an answer to the user to let him know that the transaction is valid and it is waiting for the validation.
  10. The Bot reply to the user (e.g. “payment received, service will be provided once the transaction will be verified”).
  11. The server, when the transaction has been verified, sends the command to the smart-plug in order to turn on the lamp. The server stats also a timer in order to provide the service for the paid amount of time.
  12. Once the smart-plug receive the command it turns on the lamp that is attached to.
  13. Once the timer expires, the server sends a command to the smart-plug to turn off the lamp.
  14. The smart-plug turned off, so the lamp turn off.



Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here