Do robots dream of Crypto?

Bogdan Djukic
Anyl
Published in
5 min readMay 8, 2018

Introduction

There are several emerging trends in the robotics industry that excite me when I think about how our future might look like once robots increase their presence in our daily lives. Trends like application of Deep Learning in robotics, decrease in costs of electric components and improvements of developer tools will certainly contribute to the wider robot adoption (both in industrial and consumer markets).

Two new concepts in robotics, among others, which I find particularly interesting are swarm robotics and Robot-as-a-Service. The importance of swarm robotics aligns with the recent prediction from IDC which says that collaborative robotic scenarios will take 30% of the robotics market by the end of 2018. Another study found that by year 2020, 30% of robotics market will be based on Robot-as-a-Service (RaaS) based on pay-as-you-go scheme.

Robotics meets Blockchain

A relatively recent scientific paper called The blockchain: a new framework for robotic swarm systems explores some very futuristic scenarios by combining the concept of swarm robotics and blockchain which could potentially revolutionize many industrial applications.

Applying blockchain private/public key infrastructure and its decentralized traits to swarm robotics would result in agents being able to reach consensus without a centralized authority.

Crypto currencies are at the moment the most common application on the blockchain. Enabling swarm agents to exchange value between each other or with third parties using crypto currencies opens up whole new set of possibilities. This novel idea falls under new emerging concept called Sensing-as-a-Service (S2aaS) where robots exchange data they gather with the data requestors. You can imagine a future with decentralized marketplaces, where supply offered by robots meets demand. All of this new economic model would be powered by the blockchain stack.

What can be done now?

In case you are already working on a robotic project (or you plan to start one) and you would like to explore the possibilities of blockchain, you might find the whole effort a bit challenging. Given that robotic systems are usually a constrained environments, running a full node of your blockchain of choice would not be possible. Other alternatives include “outsourcing” private key ownership to centralized authority (which is not recommended solution due to security issues) or running a light node (which might not be possible if your robot is running on a low-level embedded system).

In my previous article, I was writing about building a lightweight embedded wallet for Ethereum.

Particle Photon — good candidate for running Ethereum hardware wallet

The wallet itself was running on a Particle Photon which is an embedded device with 1MB flash and 128Kb of RAM and it was able to broadcast current temperature to the Ethereum full node. Let’s see how we can reuse some of that project bits and empower your robot project to interact with blockchain ecosystem.

Robot Operating System & Blockchain

This time around, we’ll use the same embedded wallet library I’ve developed for Particle Photon and expose it as a node for Robot Operating System (ROS). ROS represents a robotic middle-ware which is working as a publisher/subscriber model. It is definitely one of the most common standards in the industry. Particle Photon’s low foot-print makes it ideal for robotic projects.

I’ll showcase a demo where the current (fake) GPS location coordinates of the robot are being stored on the Ethereum Smart Contract.

We would need several ROS nodes (not to be confused with blockchain nodes!) in order to have end-to-end scenario working (they are marked in circles in the photo down below):

  1. Fake GPS data node
  2. Ethereum transaction signing node (running on Particle Node)
  3. Transaction counter node
  4. Smart Contract executor node
The overview of ROS nodes and related topics visualized by the rqt_graph tool

The Ethereum Smart Contract which is storing the most current GPS location (using “[xCoordinate]:[yCoordinate]” format) of the agent is rather simple:

Ethereum Smart Contract for storing current robot coordinates published by ROS node

The workflow starts with the fake GPS node acting as a publisher and emitting the coordinates. Meanwhile, the Ethereum transaction signing node (which is running on Particle Photon) would subscribe to the Transaction counter node and ask for the most recent transaction count since it needs that number to set the correct nonce. Once the nonce is set, it will get the most recent fake GPS location, sign the transaction and send it to the Smart Contract executor node which is waiting for this information as a subscriber. The Smart Contract executor will pass the signed transaction via RESTful call to INFURA which exposes Ethereum full nodes. At the very end of this workflow, the Smart Contract (GpsManaher.sol) will store the most current fake GPS location of the agent.

One thing to bear in mind when using ROS library for Particle Node is the size of the default buffers in ros.h. I have increased the default INPUT_SIZE and OUTPUT_SIZE buffers to 1024 in order to handle bigger size messages which are required to fit the raw signed transactions.

Hold the agent (and its creator) accountable

Once robots become more common in our societies, the imminent legislation will be put in place (think about the ongoing legislation regarding self-driving cars). Saving agent’s states in transparent way for perception, mapping, planning and object detection will be mandatory in order to have the complete audit of potential misbehaving and unexpended behaviour of the agent.

Conclusion

In this blog post we covered new emerging trends in the robotics and how those trends can be implemented using blockchain. More concretely, we used Particle Photon embedded device as a hardware wallet for Ethereum to store current GPS location of an agent on the blockchain.

You can find the code for the whole project on my GitHub profile:

--

--

Bogdan Djukic
Anyl
Editor for

ex-Skyper, half-marathon runner, charity hacker and self-driving car technology enthusiast.