Developing Blockchain & Smart Contracts
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.
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.
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.
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.
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.
Peer to peer investment part which enables people to invest Ethers into the battery insurance product:
Small part of the insurance contract, which calculates the price based on certain parameters, registers the policy and accepts the payment in Ethers:
There were few main challenges in this venture:
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.
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.
A sneak peak of designs for upcoming app.
Please take a look at our github: Aigang.Network Github
Would love to hear your comments or ideas for further development and possible integrations, contact me: [email protected]
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
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!