IOTA Hackathon: Open Car Charging Network (Part 1)

iPhone with PlugInBaby app

+++UPDATE+++

We’ve stirred much interest in the issuance of our XSC token at the IOTA hackathon in Gdansk. We therefore decided to prolong our rewards campaign for IOTA developers for 1 week:

If you’re a developer who committed code to advance the IOTA network during the month of November, you’ll be eligible. If you think you’re eligible you can request up to 250 XSC until Friday, 1 December 2017.

Fill out this form now! Show us that you’ve got the right stuff!
Develsoper Incentives Program: Claim XSC Rewards

For more information on the CSC Blockchain Evolution Incentive Scheme, click here and here.

+++UPDATE+++

The IOTA Hackathon took place from Nov 17 to Nov 19 in Gdansk, Poland. Software developers from all over Europe came together to put to test the IOTA Platform with various use cases. The event was sponsored by IOTA, Baltic Data Science (blockchain and big data service), Datarella (blockchain and big data consultancy) and Bright Inventions (mobile app development). Four teams of developers and software experts formed around various use cases and competed for the prize money of 4,200 IOTA. Here in “Part 1″ we summarize the idea iteration process for the contest’s winning team  „PlugInBaby” and the associated pivot that took place while defining the project topic. Part 2 describes the development and design of the project in more detail.

Defining the Need

Idea Consolidation
Idea Consolidation

We started the hackathon with a group brainstorming session followed by some informal voting and group building around the topics generated.

After narrowing the focus down to the topics, “Autonomous Agents” and “Decentralized Stack” the group focused on idea generation.  Any potential topic needed to utilize the special characteristics of IOTA (scalability, speed, zero transactions costs) while avoiding limitations such as the lack of a Turing complete language and smart contract capabilities.

Initial brainstorming considered applications in manufacturing, autonomous transportation, supply chain management and distributed sensor technology.  Eventually the basic idea of using IOTA as a distributed database allowing individuals or autonomous agents to identify free parking spaces in cities and also search for those spaces crystalized out of the brainstorming process.

Pizza Box Brainstorming
Pizza Box Brainstorming

After several hours of work on the concept and the potential implementations, we found structural problems with the plan. In our initial approach, the team imagined that individuals or autonomous agents/smart cars would identify free parking spaces, notify others of their presence by writing to the tangle and potentially be compensated for the service. A number of important questions were however left open with this topic.

Critical Questions that Lead to the Pivot:

  • Why should a system for finding free parking spaces be built using IOTA?
  • Wouldn’t another technology be more appropriate?
  • Why not use a blockchain which allows for smart contracts?
  • Would people really use such an app?

Pivot to an open car charging network

After several hours of discussion, the team still couldn’t adequately answer the above questions so we turned to another idea. Instead of logging free parking spaces, we would provide a link between an IoT network of decentralized charging stations and traditional or autonomous cars needing charging services.

Currently, electric charging infrastructure is almost always mediated by large corporations and organizations. This project seeks to change this.  The team drew inspiration from ElaadNL which built a Proof of Concept (PoC) Charging Station for electric cars running fully on IOTA. Their charger is built using off the shelf tech and could be adopted by individuals who wish to offer electricity from their private microgrid or solar installations. What’s missing in the ElaadNL implementation is a user-friendly way to select and navigate to the charging station.

ElaadNLPoC
ElaadNL IOTA Electric Car Charger PoC

The ElaadNL PoC app works on a “Pull” basis where the user has to enter a charger code to search for the status of a particular charger.  The team wanted to design something that would work on a “Push” basis and push the location of open chargers to users within the familiar confines of a google map interface.

The team envision a world in which individuals could take an open-source IoT charger kit and set up an IOTA-based charging station wherever they have access to power and a parking space. This could open up a whole new layer of community-based decentral charging.

Concept Doodle
A world where individuals leverage open source software and DIY hardware to decentralize the market for energy.

The project, so conceived was well matched with the strengths of IOTA. Scalability and transaction speed would be needed due to continual improvements in the speed of charging and the fact that the search mechanism of the system would have to operate very quickly to guarantee a good user experience. A system with zero transactions costs was also judged to be appropriate for the type of microtransactions that need to occur between a car and a smart charger enabling real-time pricing for electricity.

We owe a shout out to ElaadNL for their PoC. The existence of such charger allowed us to think in a modular fashion and abstract away the charger component to focus instead exclusively on the building a system to find the chargers and transact with them.

IOTA Hackathon winning team “PlugInBaby!”. Team members (from left to right): Yoon Kim, Andrew Young, Rebecca Johnson, Lukasz Zmudzinski, Dominik Harz, Alexei Zamyatin, Linna Wang, Nicolas S – and the moderator Michael Reuter of Datarella to the far right

 Here is an overview of all reports on the IOTA Hackathon’s projects:

1st place – “PlugInBaby”:

…describes the idea and the pivot of the project
Team “PlugInBaby”: Open Car Charging Network (Part 2)
…describes the technical level and provides resources

2nd place – “Freedom Pass”:
Team Freedom Pass: Fraud Detection (Part 1)
…describes the high level of the project
Team Freedom Pass: Fraud Detection (Part 2)
…describes the technical level of the project

IOTA Hackathon – Lessons Learned: Fraud Detection (Part 2)

This is the second installment in the posts about the experiences that Team Freedom made during the IOTA Hackathon. In the first post, Kira set the stage and explained the current issues of the London Freedom Pass. In this post, we’ll get a bit more detailed with regards to how we built the project.

DISCLAIMER: Even though the project is called „Fraud Detection“ the technological focus is very much on IOTA and not at all on machine learning-methodologies or data science, as one would commonly associate with fraud detection and prevention.

After we’d narrowed the scope down sufficiently to what we thought would be achievable during a hackathon, we started getting familiar with the IOTA tangle. We followed this tutorial for making a simple transaction, written only a few weeks earlier but already with some modifications required. After having gotten ourselves familiar with the general concepts of the Tangle (much accelerated by a presentation and Q&A by Chris Dukakis of IOTA) we connected to a testnet node and started issuing transactions.

Before we get into the details of the project, I’ll make a short comment about the decision whether to run a full node, the IOTA Reference Implementation (IRI) or to connect to pre-existing nodes. In short, to run the IRI, one needs a complete Java Runtime Environment, which is one of the reasons why IOTA can’t be run on an IoT device at this point. Each node connected to the tangle exposes an HTTP API through which transactions can be issued. To set up an instance of the IRI, one has to acquire the addresses of the already connected nodes in the tangle. The recommended way to do this is by asking people in the slack-channel #nodesharing. Because of the above restrictions and our requirements in time, we didn’t think it would be necessary to run our own node.

Back to the task of solving the problem of fraud in the application process for the Freedom Pass in London boroughs. We settled for the JavaScript library since it does a lot of the heavy lifting on top of the API and is by far the best-documented library. (The winning team used the mostly undocumented Python library and still managed to interact fairly smoothly with the tangle). The iota.lib.js implements both the standard API, some useful functionality like signing, unit conversion and reading from the tangle. In our project, we had set out to supply the following interactions between the tangle and our users:

  1. Register Doctor as a seed on the tangle
  2. Register Applicant as a seed on the tangle
  3. Perform a transaction for each certificate between the issuing Doctor to the Applicant.
  4. Verify that a certificate was registered on the tangle given a Doctor and an Applicant
  5. Read information off of the tangle about outgoing transactions from all Doctors

Given the above functionality, how could we leverage the existing IOTA library in the best way possible? Well, since smart contracts or most types of advanced transactions aren’t really possible on IOTA (yet), we will need some off-tangle processing, storage, and UI.

For this, we implemented a backend and some wrapping to process the information from the applications. The server-side was written using Node.JS and the express-framework. To model the logic and structure of the database, we used MongoDB and mongoose. The MongoDB contained a simple key-value store, saving relevant applicant information. One could imagine that is could be upgraded to a graph-model to better mirror the tangle structure and to be able to more efficiently analyze connections between Doctors and Applicants, however, that was out-of-scope during the ~30h of coding we had.

In order for the user to interact with the tangle in an easy way, we built a small web-frontend. It allows the user to enter information about an application such as the national insurance number of an Applicant, postal code of the Doctor and Applicant, phone numbers, etc. At this stage, four things need to happen: 1. The information is saved in the MongoDB-collection, 2. Seeds for the Applicant and Doctor are created based on an aggregate of identifying information, 3. New test tokens are generated and sent to the Doctor’s account and 4. An IOTA transaction is issued from the Doctor to the Applicant.

To save the information into a MongoDB-collection a controller instantiates and returns a new model containing the just entered data. It passes it on to the server.jswho handles the HTTP-requests from the client.

There is no dedicated IOTA API-call for generating seeds, but they do supply a command line command for generating a random seed. We made our seeds relatable to the private information by concatenating the private key with the national insurance number for the Applicants and the Doctor’s ID for the Doctors. After the seed was generated, a fresh address is created for each new transaction.

To make the functions from the iota.lib.js a bit more usable, we wrapped the existing callbacks-based structure in Promises. This allowed our code to become a bit more asynchronous than it is ‚out-of-the-box‘.

Here is an overview of the architecture:

Once the data and the transactions are issued, the next step is to provide a way of viewing the existing applications and certificates. So we created a second page of the UI for listing all applications with relevant information read from the MongoDB-collection. This doesn’t, however, provide such a great way of finding the main type of fraud that we were considering, namely Applicants reusing information about Doctors. This makes it look like a single Doctor issued an unreasonable amount of certificates. A pretty easy case to catch, one would think, but considering it is a completely analog process done by on paper in different boroughs by different administrators, it sums up to quite a large amount of faked applications. This is the type of fraud we focussed on in our processing.

So how can we in a user-friendly way flag cases that should be investigated? We chose the simplest option and created a second view of the UI where each Doctor in the system is listed along with the number of certificates they’ve, supposedly, issued. The list is sorted by the number of certificates issued. Here one could imagine making it a bit smarter by including the date the certificate was issued and creating a more differentiated metric of certificates per time unit, but it wasn’t in scope this time around.  If a Doctor issued more than 10 certificates, they were highlighted in red. A very simple but potentially efficient way of communicating to the user that something needs to be investigated. Of course, the number 10 was completely arbitrary and could have been chosen differently. In fact, to decide that number, one would have to, first of all, analyze historical data.

To sum up, Team Freedom had a lot of fun and learned tons about IOTA, ideation, cooperation, and creation in a short time-frame. We managed to build a functioning Proof of Concept for how IOTA can be used for the secure issuing of medical certificates in order to prevent and detect fraud. The application to the Freedom Pass was done so that it would be easier to understand what was being done and why. But that does in no way mean that the base structure cannot be used for other purposes, in fact, it was written specifically to be general enough that it is also interesting in other areas.

Is this the only way that the problem could have been solved? No. Was it the easiest way of solving it? Absolutely not. However, we believe that only by experimenting and utilizing one of the few scalable and future-resistant distributed ledger solutions can we achieve applicability. There is, generally speaking, almost no distributed ledger application that could not have been done without the use of a distributed ledger, but it would have incurred great financial, organizational or trust costs. IOTA is a very cost-effective and scalable solution, but with the caveat that it is still in its infancy.

Freedom!

 Here is an overview of all reports on the IOTA Hackathon’s projects:

1st place – „PlugInBaby“:

…describes the idea and the pivot of the project
Team „PlugInBaby“: Open Car Charging Network (Part 2)
…describes the technical level and provides resources

2nd place – „Freedom Pass“:
Team Freedom Pass: Fraud Detection (Part 1)
…describes the high level of the project
Team Freedom Pass: Fraud Detection (Part 2)
…describes the technical level of the project