Inspiration

The journey of greenGuardians began when Connor was wrapping up a project for detecting different crops for his capstone. While he proposed the idea of combining IoT and blockchain technology, his idea resonated with Alex and Hiba. The team further discussed the potential problems that blockchain could solve. They recognized that when it comes to other organizations aiming to improve the environment in different regions, there can be doubts about trusting the data provided solely by the local government. Additionally, many individuals are eager to contribute to the well-being of the Earth by donating to environmental organizations. However, they often struggle to verify if these organizations genuinely align their words with their actions. In light of these discussions, they realized the need for a reliable data platform. It was then that greenGuardians came into existence.

What it does

greenGuardians is a dynamic IoT sensor aggregation platform that collects, processes, and stores environmental data from various IoT sensors in a database. This data is then transferred to the Interplanetary File System (IPFS) at set intervals, providing a comprehensive snapshot of the latest data for a specific area. The platform enables users to create campaigns with ideal environmental thresholds, which in turn allows for the collection of funding for environmental improvement projects. A unique aspect of our platform is the unlocking of funds based on the progress of a project as measured by sensor data. This mechanism ensures projects are accountable, transparent, and resources are effectively utilized.

The platform consists of three main smart contracts: the Fundraising Contract, the Upkeep Contract, and the Oracle Contract. The Fundraising Contract allows users to create campaigns specifying ideal environmental thresholds (humidity, soil moisture, sunlight, and temperature) and generate funding for environmental improvement projects. The Upkeep Contract is responsible for monitoring new campaigns and their checkpoints, verifying the initial, middle, and end conditions, and checking if funds should be unlocked based on the sensor data. The Oracle Contract stores the latest sensor value for each campaign, allowing the fundraising contract to see the latest data.

How we built it

We built the backend using Python and timescaledb and created the external adapter using JavaScript. Our backend aggregates data into a time series database with specific information for each device, including ID, all sensor values, and GPS location. Our backend then periodically aggregates the data and pushes a snapshot of average values to IPFS. When requested through the upkeep contract, our external adapter retrieves the latest IPFS hash and sends the sensor data back our Oracle. The fundraiser contract can then see the sensor data for specific campaign IDs that are now stored in the Oracle.

Our fundraising contract allows people to set up campaigns for environmental projects. These campaigns use sensor values and predetermined thresholds to unlock funds at specific checkpoints throughout the duration of the project (start, middle, end). In the future we plan to build a more robust aggregation system, with specific intervals for different types of sensors, campaign specific aggregation and location tracking.

The Chainlink Job Spec is a crucial part of our project, as it defines the structure and flow of data between the smart contracts and the external adapter. It is responsible for decoding the incoming request, parsing the data, and submitting the transaction to the blockchain.

The Upkeep Contract is designed to monitor new campaigns and their checkpoints, verifying the initial, middle, and end conditions, and checking if funds should be unlocked based on the sensor data. It also ensures that a campaign needs to reach its target funding amount before any funds can be released.

The Fundraiser Contract is responsible for managing the campaigns and their funding. It allows users to create campaigns, contribute funds, and withdraw funds based on the progress of the project as measured by sensor data. The contract also includes a refund function that allows contributors to get their money back if the campaign doesn't reach its target.

The Oracle Contract stores the latest sensor value for each campaign, allowing the fundraising contract to see the latest data. The data gets sent to the oracle contract with an external adapter and a job set up through our Chainlink node. This job parses the incoming request to check the campaign ID and passes this information to our external adapter, which can check our database for the latest IPFS hash on this campaign.

Challenges we ran into

A major challenge we've been grappling with involves finalizing the logic for how funds should be unlocked. Currently we are using a threshold level set by the campaign creator, but we envision a more robust system where deeper analysis can be done to check if projects are meeting their specific goals. We are striving to create a fair, transparent, and practical method that aligns with the dynamic nature of environmental projects. Another challenge we are facing pertains to the backend. We're working on building a system to store campaign IDs and record geographical areas via GPS coordinates, which requires dealing with real-world spatial data. Ensuring security for the smart contracts and handling live sensor data also presents its unique challenges.

We initially started building arduino boards with sensors to try and test live data, but towards the end of the hackathon we did not have enough time to finish this integration.

We do plan on improving on our implementation after the hackathon. We plan to create a more robust aggregation system to handle different types of data and different levels of resolution. We also plan to work on our smart contract security and logic to ensure funds are locked and safe. This includes improving the logic for determining campaign thresholds and success. Currently we are using hardcoded thresholds, but this system could also be improved to be more dynamic.

Also, due to the limited time of the hackathon, the plant growth monitor feature is not fully implemented at this stage. Nevertheless, the database has been created, and the development of the associated data analysis code is scheduled for the upcoming weeks.

Accomplishments that we're proud of

Successfully connecting our backend to the blockchain and being able to publish the latest data on-chain is an accomplishment we're particularly proud of. We have also managed to create a transparent system for unlocking funds based on the progress of environmental projects, ensuring accountability and effective resource management.

What we learned

We realized the potential of Chainlink and its suite of technologies, some of which we hadn't previously explored. We also learned about the intricacies of bringing live off-chain data on-chain. Equally important, we honed our team collaboration skills and learned how to effectively meet tight deadlines.

What's next for greenGuardians

  1. Expanding Analysis Features: We plan to incorporate more analysis features spanning various ecosystems, allowing for a more comprehensive understanding of the environment and helping identify areas that require urgent attention or conservation efforts.

  2. Leveraging Satellite Data: We aim to integrate satellite data and remote sensing technologies to enhance our platform's capabilities. This will enable us to:

    • Monitor large-scale environmental factors, such as deforestation, urbanization, and land use changes.
    • Detect and track natural disasters, like wildfires, floods, and hurricanes, to support disaster response and recovery efforts.
    • Assess the health of ecosystems and habitats, identifying areas in need of restoration or protection.
    • Estimate carbon sequestration potential and monitor carbon sinks, such as forests and wetlands.
  3. Improving our implementations We plan to study and improve our logic/security for our backend and smart contracts. This will ensure campaign funds are secure and available for projects when needed.

Built With

Share this project:

Updates