Tokenized Autonomous Vehicle Charging with Filament Blocklet

Filament's entry for the MOBI 2018 Grand Challenge demonstrates Filament's Blocklet technology in machine-to-machine application where an autonomous electric vehicle exchanges tokenized value for electric charging via an Ethereum Smart Contract.

Table of Contents

Introduction Process Overview Component Overview Process Details Hardware Requirements Team Members

Introduction

The Filament Blocklet USB Enclave provides host systems with blockchain-based identity and authentication services. The device installs in a standard Type A USB 2.0 host port and interfaces to a host device driver for configuration and subsequent operational services. The Blocklet USB Enclave incorporates a trusted execution environment that supports multiple enterprise blockchain platforms including Ethereum, Hyperledger Fabric, and BigchainDB.

In this demonstration, the autonomous electric vehicle is represented by a Roomba Create 2 programmable robot, and the electric charging station is represented by the Roomba’s docking station. Both the charging station and the vehicle have small low-powered computers that have Blocklet Enclaves attached and configured to work with Ethereum. No private keys are stored in the file system or on the computer's memory—all keys protected by Blocklet are unreproducible by any party. At each step of the blockchain interactions, the charging station and vehicle use Blocklet Enclaves to prove and authenticate their identity and the data being transmitted.

Process Overview

At the end of a work cycle, the vehicle will automatically seek out an electronic charging station to recharge its onboard battery.

The computer on the vehicle uses its Blocklet Enclave to initiate a payment channel with the Ethereum ledger using a Smart Contract. The Smart Contract defines a process to set up an escrow that allows tokenized transfer of funds at a fixed-rate based on kWh consumed.

This type of smart contract guarantees the vendor (charging station) will be paid for all electricity supplied. Conducting the transaction off-chain also saves both parties from incurring extra costs.

Once the charging station computer independently verifies that the initiated contract is intended for its Blocklet Enclave identity, the charging station signals that the vehicle is allowed to begin charging.

As the vehicle charges, micro-payments are transacted to the payment channel. Once charging is complete and the vehicle has left the station, the charging station finalizes the payment channel and receives the appropriate number of tokens that were placed in escrow.

Component Overview

In the provided package, the following code components are provided:

Vehicle

The vehicle scripts include:

Hardware Manager - Written in Python, this script manages the states that the vehicle is currently in, as well as detecting via Bluetooth LE Eddystone which charging station to initiate a contract. Ethereum Manager - Written in JavaScript, this set of scripts manages interactions with Blocklet Enclave, the Ethereum Smart Contract, and sending the charging station the contract information.

Payment Channel Smart Contract

The Smart Contract used by this demonstration was written by Matthew Di Ferrante and is licensed under GNU General Public License v3.0. Mr. Di Ferrante discusses the contract in detail in this article: "Ethereum Payment Channel in 50 Lines of Code". The code is available in this GitHub repository.

Charging Station

The charging station scripts include:

Hardware Manager - Written in Python, this script manages the states that the charger is currently in, broadcasting via Eddystone BLE the availability of the station for charging, and communicating the kWh consumed and contract finalization to the Ethereum Smart Contract. Ethereum Manager - Written in JavaScript, this set of scripts manages interactions with Blocklet Enclave and the Ethereum Smart Contract. Display UI - Written in JavaScript, this web UI displays the status of the charging station. Intended to be displayed full screen on a small, integrated display.

Optional - Private Ethereum Test Network

For ease of development and testing, a locally hosted private Ethereum test network can be set up for the charging station and vehicle to interact with. This private network can work in an accelerated proof of authority mode which utilizes the normal Ethereum primitives at a much faster and consistent rate.

Process Details

The Charging Station Hardware Manager broadcasts via Eddystone BLE its IP address and that is available for vehicles. Once the Vehicle Hardware Manager completes a work cycle, it searches for Eddystone BLE advertisements that indicate availability. Once it finds one that has a high signal strength, then it sends the received IP address to the Vehicle's Ethereum Manager. The Vehicle Ethereum Manager requests the Blocklet Enclave wallet address from the Charging Station Ethereum Manager and initiates a new payment channel to that address using a Smart Contract. Once the contract is instantiated, the Vehicle Ethereum Manager sends the new contract address to the Charging Station Ethereum Manager and signals to the Vehicle Hardware Manager to begin seeking the station. The Charging Station Ethereum Manager independently verifies that the contract is valid and that the vehicle has escrowed sufficient funds for a complete charge cycle, then signals to the Charging Station Hardware Manager that everything is in place for charging to begin. The Charging Station Hardware Manager enables the power supply for the vehicle charging station, thus enabling the IR beacon for the vehicle to find and begin physical docking to charge. Once the vehicle has found the station and physically docked, the Vehicle Hardware Manager periodically submits micropayments signed by Blocklet Enclave for the Vehicle Ethereum Manager to process. The charging station holds these micropayments in reserve until the full transaction is completed or times out. When the vehicle completes its charge cycle, it exits the station. The Charging Station Hardware Manager detects a power drop and signals to the Charging Station Ethereum Manager that it is time to finalize the contract. The Charging Station Ethereum Manager finalizes the contract with the ledger by submitting the highest micropayment with its agreement to the contract, and receives funds from the contract. Any remaining funds that were in escrow that were in excess of actual use are automatically returned to the vehicle's wallet. The Charging Station Hardware Manager broadcasts that it is available for docking, and the Vehicle Hardware Manager begins another work cycle.

Hardware Requirements

Vehicle

Roomba Create 2 Programmable Robot

Filament Blocklet USB Enclave

Raspberry Pi 3 Model B+

32 GB MicroSD Card

Voltaic V44 USB Battery Pack

Charging Station

Roomba Compact Base

Filament Blocklet USB Enclave

Raspberry Pi 3 Model B+

32 GB MicroSD Card

waveshare 3.5inch RPi LCD (B) 320x480 Resoution Touch Screen IPS TFT Display

AstroPrint Case for Raspberry Pi 3/3.5" Touchscreen

WeMo Insight Smart Plug

Optional - Private Ethereum Test Network

Intel NUC Kit

Team Members

The Filament team for the inaugural Mobi Grand Challenge include:

Eliot Landrum eliot@filament.com - Team Lead. Vehicle automation and team management.

Thomas Muldowney temas@filament.com - Blocklet and Ethereum integration.

Jake Ingman jake@filament.com - Charging station UI.

Paul Fechko paul@filament.com - Hardware customization.

Greg Ceponis greg@filament.com - Market application and implications.

Teresa Kloser teresa@filament.com - Submission video.

Ryan Bennet ryan@filament.com - Initial concept and technical plan.

The entire Filament crew has contributed in one way or another to the success of this project. Thanks to everyone at all of our offices for supporting this project.