Inspiration
My girlfriend and I live in Peru in a city called Piura. It is a desert so there is normally hardly any rainfall but recently there was extremely heavy rainfall and it caused a lot economic problems. The supply chains slowed down due to landslides and flooding and many people's houses were badly damaged. Someone we know personally suffered greatly and was forced to abandon their house. I figured that Chainlink functions could help me design a system to assist people who are subjected to these unfortunate circumstances through no fault of their own.
What it does
The application allows people to select an area however large they want (but are mathematically incentivised to select a smaller area) in any part of the world. Then they select a quantity of rainfall to protect against. For this, they will be paid out proportionally to the risk they take. A higher amount of rainfall protected against (for example 20mm) results in a higher cost for the user, but also a higher payout given the difference between what they insured for and the actual quantity of rainfall that occurred in that 24 hours period.
How I built it
This project was built with Hardhat and NextJS and makes use of a couple of APIs; Open-Mateo, and Google Maps. I had a partner for the first day or two but then was forced to work on it by myself. I just worked on it after work everyday and on weekeneds for the duration of the hackathon. It implements Chainlink pricefeeds, Chainlink VRF and Chainlink Functions.
Challenges I ran into
Initially I wanted to create a weather application that could insure against all types of weather (including temperature, snowfall and earthquakes). However, the mathematical modelling part of the project took much longer than expected and took several days (including writing the code to estimate the cost of insurance). I also wanted to include the Koppan climate scale as a way to add weights to the algorithm and spent far too long trying to make it work, but as this part of the project started to eat into the time-frame, I was forced to move on and adopt a different approach that was largely based on historical rainfall data. I also spent quite a lot of time trying to get it to work with Chainlink Automation but ended up conceding since it was also taking too much time, and so opted for a purely pull-mechanism approach. Coding the smart contracts and learning how to use Chainlink functions wasn't easy since most of my testing involved working with lots of input variables that were chaing all the time (since it was a time-based project that had different results). Another unforseen problem that I had to overcome was trying to get the time codified properly and working in the smart contract onchain so that it was in sync and stored on the blockchain and was useable by the API.
Accomplishments that I'm proud of
I'm very proud of the frontend. I tried to design it as best as I could so that it could work on mobile. I went into this project knowing hardly any frontend development and am extremely pleased with it. I feel like I have produced somthing that is interactive and fun to play around with and have learned an enormous amount about frontend libraries and frameworks.
What I learned
I learned all about NextJS, React and how to use Wagmi. I learned about Tailwind and components and context in react. I also learned a how to use Chainlink services and Chainlink Functions, which I strongly believe will be a game changer for DeFi apps and blockchain apps as a whole. The ability to come to a consensus on any kind of data offchain and then deliver it on-chain is revolutionary!
What's next for Parametric Rainfall Insurance Application
I will continue to work on it in my free time. Developing the rest of the weather policy creation methods and with the end goal to deploy it on mainnet when Chainlink functions comes out of beta.
Please feel free to check out the github repo below.
Demonstration Video:
Built With
- hardhat
- javascript
- nextjs
- react
- solidity
- typescript

Log in or sign up for Devpost to join the conversation.