LoraWAN and IOTA: Proof of Concept of storing data in real time in the Tangle

The LoraWAN device I used bought at AliExpress → Link to the device
The gateway at the ElaadNL premises
The data received from the LoraWAN device in The Things Network dashboard
The transaction can be found using TheTangle.org → Transaction
The LoraWAN device with antenna and FTDI programmer
var ttn = require("ttn")var usePowSrvIO = require('iota.lib.js.powsrvio')let IOTA    = require('iota.lib.js');
let seed = 'PLWYXEQISUOXOJCDJ9JBCA9GMPMYBOEPDXRBWVQYXOEDUGSW9AGXTPODSZOJJSAR9GGUMMFXFNQUCWDPK';
let iota = new IOTA({
'host': 'http://node04.iotatoken.nl:14265',
'port': 14265

});
usePowSrvIO(iota, 5000, null)var appID = "lorawanstoredinthetangle";
var accessKey = "ttn-account-v2.met4bmyI7lGOgTGNKSWpWvCy62aGlKx0OXyV3RrRRv4";
ttn.data(appID, accessKey)
.then(function (client) {
client.on("uplink", function (devID, payload) {
console.log("Received uplink from ", devID)
console.log(payload)
let messageTrytes = iota.utils.toTrytes(JSON.stringify(payload));
var transfer = [
{
'address': 'LORAWANTOTHETANGLELORAWANTOTHETANGLELORAWANTOTHETANGLELORAWANTOTHETANGLELORAWANTOLWXETXGEW',
'value': 0,
'tag': 'LORAWANANDIOTA',
'obsoleteTag': 'LORAWANANDIOTA',
'message': messageTrytes
}
]
iota.api.sendTransfer(seed, 4, 14, transfer, function(e, bundle) {
if (e) throw e;
console.log("Successfully sent your transfer: ", bundle);
})
})
})
.catch(function (error) {
console.error("Error", error)
process.exit(1)
})

🥕🥕🥕🥕🥕🥕🥕🥕🥕🥕🥕🥕🥕🥕

Keep in mind that this proof of concept doesn’t cover full end to end integrity of the data. Adding an additional digital signature at the LoraWAN devices to the message would solve that part. Making use of Masked Authenticated Messaging (MAM) would even make it better and secure!

--

--

Cyber security, smart grids, electric vehicles, distributed ledger technology, hardware. Owner of Innoshift B.V. Articles on personal title.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Harm van den Brink

Harm van den Brink

633 Followers

Cyber security, smart grids, electric vehicles, distributed ledger technology, hardware. Owner of Innoshift B.V. Articles on personal title.