Building Peer to Peer Insurance prototype on Ethereum blockchain in one weekend. Possible?

6,815 reads

A few weeks ago my team and I had a very interesting experience participating in a hackaton where we decided to bring our idea written in the white paper about peer to peer IoT insurance on blockchain to life.

reactions

Team and idea

Business developer, smart contract developer (me), iOS developer and designer gathered to a tech hub with a mission to implement the prototype and prove that fully autonomous insurance can work on a blockchain. At the beginning, we had a lot of ideas what can be insured: from drones to Tesla, from smart home windows to car shared among peers on the go. However, the main focus was on the blockchain and smart contracts’ part to put an insurance policy on the blockchain and make it work. That’s why we chose phone battery as a use case for our insurance. Battery wear level data is simple to retrieve and track via app and it does not require time-consuming integrations which obviously would take too much time for one weekend.

reactions

Technical architecture and implementation

As we were only two people writing actual code, we decided to keep iOS app separate from Ethereum client logic, as there was no fast way to use some external library to connect app directly to Ethereum. We came up with a solution to implement a middle layer between Ethereum and iOS app. A Node.JS server, which will interact with smart contracts in Ethereum, issue new accounts and store account information. Main purpose for it was to act as a forwarder with as less logic as possible.

reactions

This enabled us to develop an app separately without deeply thinking about whole Ethereum API logic, and simply interact with the Rest API via HTTP protocol. Therefore, we had two separate tracks: me — writing smart contracts and a forwarder, a colleague — building iOS frontend and implementing API calls to forwarder. For faster testing and demonstration we implemented and deployed forwarder to Azure, where backend was connected to a TestRPC Ethereum client running on the same Ubuntu server as a forwarder.

reactions

Insurance policy as a smart contract

I would like to share some parts of the smart contract solidity code, which was written to showcase the peer to peer investment and insurance part of the contract.

reactions

Peer to peer investment part which enables people to invest Ethers into the battery insurance product:

reactions

Small part of the insurance contract, which calculates the price based on certain parameters, registers the policy and accepts the payment in Ethers:

reactions

Challenges

There were few main challenges in this venture:

reactions

Lack of documentation and answers on the web. Solidity and Web3js is quite a new thing in the software development world. It means that whole community, tools, libraries are not that matured yet comparing to other languages and frameworks. Googling some issue usually leads to some forum with the guy having same question and no answers proposed. iOS strict rules for accessing battery information. During the weekend we realised that if we want to release application to appstore, we won’t be able to get iPhones battery wear level directly. However, for local testing and demo purposes, it was okey. For further development, we found out that it will be possible to calculate and estimate battery wear level according to other public battery information provided by iOS development toolkit. Time. The time was pretty strict and we had to rush to have a working prototype. To make it faster we had to take architectural decisions on the go and keep everything as simple as possible. This led to pretty weak security and code quality, which will be definitely improved in the near future.

The result

At the end of the weekend we had an iOS application where users can check their battery wear level, get the price for the battery insurance, insure, initiate the claim and get paid. The best part is that everything is fully autonomous and connected to Ethereum blockchain. Therefore, it does not need any intermediary and people can insure, invest and get paid without any insurance middleman.

reactions

Future plans

We got a huge interest about our app during that weekend. Therefore the next step is to connect the application to Ethereum Ropsten Testnet. Also, we found out that Android allows to retrieve more data about battery and do that in a legal way. That’s why we have a deadline to build fully functioning Android and iOS app by the middle of July and have those apps publicly available for download to showcase that P2P IoT insurance on blockchain is really possible. New designs are ready, development is in progress, hype within the team is huge, so we have all the needed components to make it happen.

reactions

A sneak peak of designs for upcoming app.

reactions

Please take a look at our github: Aigang.Network Github

reactions

Would love to hear your comments or ideas for further development and possible integrations, contact me: lukas@aigang.network

reactions

Our team believes in fully automated insurance! Therefore, I would like to invite you to meet us and find out more about our project: Aigang.network

reactions

Enjoyed the article? Please let me know that by recommending it to others by clicking green heart below. Click follow, if you want to get more insights on blockchain, smart contracts, insurance and IoT very soon!

reactions

Tags