IOTA Hackathon

Posted by Łukasz on 20 Nov 2017.

This weekend was an adventure! I went to Gdańsk to participate in the IOTA Hackathon – 2 days of intense Internet of Things + Blockchain (but not really) hacking action with a team of great and creative people from all over Europe. The event was sponsored by a couple of companies: IOTA, Baltic Data Science, Datarella, Crowdstart Capital and Bright Inventions. But what is IOTA and how it actually works? How did the event go? What we created? Let’s find out!

If you want more news about the event, check the #iotahack on social media.

So do tell me… what is IOTA?

As the Internet-of-Things keep expanding, the need for interoperability and sharing of resources become a necessity. IOTA enables companies to explore new business-2-business models by making every technological resource a potential service to be traded on an open market in real time, with no fees.

~ Taken from IOTA website

IOTA is taking the blockchain technology to the next level with introducing the Tangle. In theory it allows you to send fast micro-transactions between users, while keeping a secure environment. Allowing value 0 transactions makes it perfect for P2P messaging and makes it a great way to communicate between IoT devices. I’m not an expert on the subject, so I won’t go into technical details, but here are some main features of IOTA:

If you are interested in the subject of “how it works” you might want to see the IOTA Whitepaper.

PlugInBaby – Hackathon first place

I was part of the PlugInBaby team that won the Hackathon. After 24h we provided a working solution for a distributed electric car charging system using the IOTA tangle. My main task was to connect our system with the python IOTA APIs, which worked out quite well thanks to the great support of IOTA people on Slack (that were there for us for the whole weekend).

PlugInBaby allows vendors to add their charging stations to our system with a specified name, location and charging cost. The payments they receive are done by IOTA tangle transactions and depend on how long the client was charging their car.

The client on the other hand gets a mobile app, that shows him the positions of nearby charging stations. Each station is marked green or orange, depending on their curent status: Free or Occupied. Once he selects which price fits him the best, he moves to the charging station and plugs the car in. Once he approves the charging request, the action begins and goes until canceled or battery is fully charged. Then the payment is issued and he can move on.

How it works?

As I said before, I was responsible for the backend. I’ll show you how accessing the tangle works and some of the methods that were used to create this application. We were doing everything on the test network, so if you want to get your adress, seed and test IOTA tokens, please go visit the generator site. You can also use the Tangle Explorer to see, if your transactions are actually working. The code I post here will be simplified, so you need to catch exceptions and stick it into functions yourself.

On how to install IOTA lib for python go to the official IOTA python repo.

Testnet nodes

Testing the connection

First of all, we need to create an Iota object and pass it one of the Testnet nodes and our generated seed. Then we can use the get_node_info() function to read some data about the node we connected to – hash, neighbours etc.

api = Iota(url, seed)
node_info = api.get_node_info()"Node information: {info}".format(info=node_info))


To send a transaction (doesn’t matter if it will be free or paid), we need to use the send_transfer() function. Here is a short description of the variables:

            message=TryteString.from_string("Hello world!"),
   inputs=[Address("YOURADDRESS", key_index=0, security_level=2)]

Get your balance

response = self.__api.get_balances([Address(address)])
   "Wallet balance: {balance}".format(balance=response["balances"][0])

Tell me what you think!