IOTA Proof of Concept, store MQTT messages on the tangle.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
WALKTHROUGH.md
app.js
app.json
package.json

README.md

iota-mqtt-poc

IOTA Proof of Concept, service that stores MQTT messages on the tangle.

Background

IOTA Javascript Library Hello World Tutorial

Requirements

Make sure you have Node.js and the Heroku Toolbelt installed.

Node Packages

Using iota.lib.js to connect to IOTA tangle. Open Source

Using MQTT.js as MQTT client. Open Source

Using Async to handle queues. Open Source

Using node-cleanup to properly close connections on exit. Open Source

Using url to parse full URL. Open Source

Cloning & Running locally

git clone git@github.com:nicoschtein/iota-mqtt-poc.git # or clone your own fork
cd iota-mqtt-poc
npm install
heroku local

Environmental Variables

MQTT

  • MQTT_FULL_URL
    • MQTT Broker connection url with optional user/password parameters.
    • Example: 'mqtt://[user:pass@]localhost:1883'
  • MQTT_CLIENT_PREFIX
    • Prefix to use on the MQTT client ID, followed by an 8-char string (pseudo)randomly generated using Math.random() .
    • Example: 'iota_poc_' resulting in iota_poc_3bc3eb87
  • MQTT_TOPIC
    • MQTT Topic to subscribe to, with support for # and +.
    • Example: '/devices/+'

IOTA

  • IOTA_HOST
    • Host of the IOTA Node to be used. IP and host names supported.
    • Example: 'http://127.0.0.1' or 'http://localhost'
  • IOTA_PORT
    • Port of the IOTA Node to be used.
    • Example: 14265
  • IOTA_ADDRESS
    • IOTA Address to send the transactions to.
    • Example: '999999999999999999999999999999999999999999999999999999999999999999999999999999999'
  • IOTA_SEED
    • IOTA Seed for sending the transactions from.
    • Example: '999999999999999999999999999999999999999999999999999999999999999999999999999999999'
  • IOTA_TAG
    • IOTA Seed for bundling transactions. Maximum of 13 ascii chars.
    • Example: ’iota-mqtt-poc’

Setting Environmental Vars

Locally using .env file.

Create a new file named .env and place it on the root directory, next to package.json.

MQTT_FULL_URL = 'mqtt://[user:pass@]localhost:1883'
MQTT_CLIENT_PREFIX = 'iota_poc_'
MQTT_TOPIC = '/devices/+'
IOTA_HOST = 'http://127.0.0.1'
IOTA_PORT = 14265
IOTA_ADDRESS = '999999999999999999999999999999999999999999999999999999999999999999999999999999999'
IOTA_SEED = '999999999999999999999999999999999999999999999999999999999999999999999999999999999'
IOTA_TAG = 'iota-mqtt-poc'

Remotely using Heroku Toolbet

Requires an existing Heroku App, see “Deploying to Heroku” for more info

For each var use command config:set to set the values, if the value is already set it will be replaced.

...
heroku config:set IOTA_HOST='http://127.0.0.1'
heroku config:set IOTA_PORT=14265
...

To view current state of your vars:

heroku config

Deploying to Heroku (Optional)

heroku create
git push heroku master

Open remote App

heroku open