Inspiration

As natural disasters such as hurricanes, floods, and earthquakes continue to increase in frequency, the need for insurance protecting against these events increases. After doing some research we found that access to these types of insurance policies is limited for many people in various locations around the world. We were inspired by the idea that a decentralized peer-to-peer insurance marketplace could be more accessible, more reliable, and cheaper for many people in need of insurance to protect against these natural disasters.

What it does

Our Chainlink hackathon submission aims to bring the catastrophe insurance market to the DeFi space through peer to peer insurance contracts. Our project allows users to purchase both sides of a binary insurance policy from a front facing website. These insurance policies are represented by two tokens, the A token and the B token, which correspond to a catastrophic event, such as an earthquake, either happening or not happening within a given timespan. These tokens can then be traded between users, allowing for efficient market-based pricing of the insurance. One type of user buys these tokens as a hedge against an earthquake and the other type buys the policy as an investment to collect the premium that is naturally priced in over the probability of the event. Once this happens or the contract has ended, users can redeem their tokens for DAI based on the outcome.

We used Chainlink to inform our smart contracts whether or not the insured event happened in the real world. We set up a Chainlink node to read an API endpoint that is updated using an “earthquake detector” which we simulated with an accelerometer on a Raspberry Pi.

We also have connected our protocol to 88mph in order to take advantage of their fixed rate yields. While our insurance contracts are active, the DAI collected from users is sent to 88mph where it accrues interest. Once the contract is over and users redeem their tokens for DAI, they receive extra DAI from the interest earned. This interest earned on the capital reserves mirrors the way insurance companies make money today, but because this is a p2p protocol we are able to pass on those earnings directly to the users.

How we built it

We built our project using the brownie testing framework and local as well as Rinkeby testnets. We used Chainlink to bring real world sensor data from our Raspberry Pi onto our smart contract. We did this by running our own Chainlink node, deploying our own Chainlink oracle contract, and hooking up a job to connect to a lambda function on AWS. The lambda function handles the Chainlink node’s API request to read the state value from a table in a DynamoDB database (which is updated through the same lambda by the Raspberry Pi). We accept payments in an ERC20 stablecoin, which we earn interest on using the 88mph protocol. Users can interact with our contract through a frontend web app built with react and web3.

Challenges we ran into

Neither of us had any experience with Brownie and only very limited experience with solidity before. We also had never worked with Raspberry Pi. Every step of the project involved learning these new technologies almost from scratch.

Coding dapps on the blockchain is completely different than normal apps… the permissioned system requires a different way of thinking that takes some time to adapt to.

Accomplishments that we're proud of

Not only were we able to deploy our smart contracts onto the Rinkeby testnet, but these contracts are integrated seamlessly with our own Chainlink node, our own real world data, our own frontend, and other protocols on the blockchain.

The complete system we built is actually functional and could theoretically be deployed on the mainet to handle real value. It feels amazing to have built this fully integrated end-to-end system.

What we learned

We learned a lot about the Ethereum network and using solidity to program smart contracts. Implementing a Chainlink node and oracle was also a completely new task we learned how to do. We had never built a smart contract complicated enough to need a deployment/testing framework like Brownie. Learning how to work together remotely to delegate, coordinate, and troubleshoot the necessary project components efficiently was also important. Overall, we had never built anything close to an end-to-end dapp but now we feel confident enough in the skills we learned to build even more ambitious projects in the future.

What's next for Shrub

For us, Shrub is more than just a hackathon project. We believe that the earthquake insurance system is broken, offering prohibitively expensive prices due to the 3rd party insurance company model. Peer-to-peer earthquake insurance not only promises to be cheaper, but it will also be easier to use and easier to access anywhere in the world. We plan on continuing the project by building on top of our current framework. We hope to raise funding, hire more team members, and launch our earthquake insurance product later this year. In the future, this framework will allow us to expand to other catastrophic events such as hurricanes, volcano eruptions, and sea level rise. We are determined to bring peer-to-peer catastrophic event insurance into the real world and create more fair and accessible coverage for all.

Share this project:

Updates