Inspiration (Problem Statement)

Say you own an ice cream shop on the coast and you are concerned that climate change may lead to flooding. Our application, Klade, allows you to get insurance for your shop on your terms using the power of Blockchain. Anyone in the world can buy and sell you insurance/derivatives via Klade. Opening up the market to the whole world allows more people to get protection from the increasingly volatile weather. A farmer in India can easily use Klade to get protection against prolonged droughts just as a businesswoman in Boston with a snow-plowing business can get protection against a low snowfall.

Often, the impacts of climate change disproportionately fall on lower income families/individuals. Part of what we hope to do with this project is give anyone, living anywhere, the ability to protect themselves effectively against a volatile and uncertain future.

Ethereum solves a lot of the security challenges of this project. We don’t keep custody of user’s money, but just provide a platform through which they can interact with Ethereum. Additionally, Ethereum allows our website to be global from the start as crypto is accessible anywhere.

What it does

Klade is a platform where anyone can list and trade a smart contract. A smart contract is a computer protocol intended to digitally facilitate and enforce the negotiation between two users. Our platform allows a businessperson or individual to open a contract and look for a counterparty. Additionally, investors and insurance companies can use the platform to find contracts they want to invest in. Anyone in the world can use the website; all they need is an Ethereum account. Klade is a platform both for investors looking to invest and trade weather derivatives/insurance and people looking for protection for their business or property.

We have written a standard form smart contract that can be used for a wide variety of "insurance-like" weather derivatives. These contracts call Provable, which is a smart contract library on Ethereum, to get API data into the contract and disperse returns accordingly.

Using ESRI’s Geo Data with ArcGis, we show users weather patterns including earthquakes, rain, floods and snow in their interested location.

How I built it

Klade is a light web-application written in Python with Flask, a microweb framework. At the back of this simple front-end lies a sophisticated, robust and efficient back-end. We initiate digital smart contracts with an industry-first format written in Ethereum’s specific language Solidity. We defined this standard format and used user inputs as parameters into that standard format.

GOOGLE MAPS/PLACES API : We are using Google APIs to fetch data on location and integrate the live autocomplete in our flask application with WTForms.

ESRI ARCGIS: We are using WebMap from ArcGis with layer data from USGS for Earthquakes, Rain, Hurricanes, Snow. Users can use the map to check the weather conditions in the location before listing the contract on the Create New Contract Page.

We used Metamask to connect to users’ Ethereum accounts and deploy contracts on their behalf.

We used the Etherscan API to get smart contracts for contracts that were already deployed to Ethereum, and also to check if contracts have been deployed yet. We used the Provable service to do API calls from the smart contracts and to check if certain weather events have occurred. Provable also allows you to verify that the data being given to the smart contract has actually come from the website it is supposed to have come from with a TLS notary proof.

ESRI was used to give prospective customers weather maps to help them decide on investments.

Check out our github for more details on the smart contract code.

Challenges We Ran into

There were a number of challenges integrating our system with Metamask, a chrome extension used among Ethereum users to connect to decentralized applications.

We had some difficulty finding a suitable API for the smart contracts. String parsing is quite challenging and costly in Solidity, so we had to find an API that would give us concise results.

For the front-end, we faced issues in intercepting Google Maps API, Geocoding API and the Places API response to integrate in our database schema. While ESRI’s Arcgis services integrated seamlessly in our application, we faced some difficulties finding the right documentation.

Accomplishments that I'm proud of

I am proud that we persevered through many frustrating challenges with Metamask integration and more broadly working with the crypto ecosystem. Ethereum has changed a lot over the last three years and documentation isn’t fully caught up, so often online resources had outdated information or incorrect information.

What I learned

We learned how to work with Arcgis to make high quality and information maps, adding layers of data with different views and search functionality that’s not available in other maps. Furthermore, we learned about using some Google APIs including the Places API and Google Maps API.

We learned more about smart contract development and the process of testing with Remix/Metamask. We can definitely apply lessons from this project on connecting to Metamask and interacting with Ethereum in any other decentralized applications.

What's next for Klade

After we get some sleep, we will do a deep dive into vulnerabilities of the platform. Then, we can open it up to Beta testers on the Ropsten Testnet, a system functionally similar to Ethereum but with fake Ether which has no real-world monetary value). Hopefully we will be able to improve the product during this time and catch any further security bugs before we connect to “main-net” Ethereum and allow real transactions to start!

Some additional features we would like to add include:

  1. Having the contract call multiple APIs to get confirmation on the weather.
  2. After a user connects to Metamask, have a page that shows the users all the contracts of our format they are currently a party in. Additionally, provide info such as the overall risk and expected return of their entire portfolio of weather derivatives along with graphs.
  3. Right now we only have created the “insurance-type” standard smart contract. In this smart contract format, one party pays a monthly premium and the other party pays a large amount in the case that some unlikely event occurs (for example a large earthquake or hurricane). This contract works well for a wide variety of different situations, but there are other cases which do not fit well with this format. We also want to introduce a “stability” form contract which will be another standard format of smart contract that we can use. I have already defined what this contract will generally look like, and it will follow something analogous to existing HDD (heating degree day) indices but also will incorporate weather features other than temperature such as rainfall/snowfall.
Share this project:

Updates