The environmental impact of Ethereum hasn't gone unnoticed. A single Ethereum transaction consumes the same amount of electricity that a U.S. household does in a whole day ( Many Ethereum users, given the chance, would gladly pay a premium to be able to offset said footprint. We, as a team, set out to enable these enviromentally conscious users to fulfill their green destiny.

What it does

CarbonGuilt is a dApp built on top of Ethereum that (with the help of a Metamask plugin) tracks the amount of gas you spend in your transactions. It then estimates (based on that gas, and using calculations with data from various sources and Chainlink to aggregate it) your carbon footprint on the chain and gives you the option of transferring ETH to one out of a curated list of projects/organizations dedicated to offset carbon emissions. Users who offset their carbon emissions in this way are rewarded by CarbonGuilt with GuiltFree (GIFT) tokens, an ERC20 token which represents 1 tonne of CO2. This amazing token grants you bragging rights and peace of mind at the same time!

How we built it

We built an API using node.js that scrapes an assortment of energy consumption and carbon emission data from different sources, and then used the Chainlink framework to access it on-chain in a decentralized and reliable manner.

Our smart contracts (and dApp) use this data to calculate the user's carbon footprint based on the amount of gas accumulated by the Metamask plugin. The user can then decide to pay ETH to a project of his choice (from a curated list managed by a registry smart contract) in order to offset this footprint.

Once a payment is done, the user receives an amount of GIFT tokens representing the amount of CO2 they have offset (depending on the chosen project), and the plugin is signaled to reduce the accumulated gas guilt by the appropriate amount.


The UI was built using react and typescript. Interaction with the smart contracts was done via javascript (web3 and ethers.js). The Metamask plugin was built using their snap feature. The dApp uses ENS to list the beneficiary projects in a user-friendly manner and then converts their ENS addresses to Ethereum addresses.

Smart Contracts

Smart contracts were written in Solidity, and the oracles used Chainlink to fetch and aggregate data from the offchain node API.

Energy consumption API

Written in node.js, using cheerio to scrape, needle for requests and express for the endpoints.

Challenges we ran into

  • Integrating with the experimental Metamask version was very complicated. At first we intended the plugin to handle most of the heavy lifting, but making it communicate with smart contracts proved difficult and cumbersome. We decided to move the brunt of the work to a dApp and have the plugin only be concerned with accumulating spent gas. Every web3.js version we tried had a different set of compatibility issues (either with the plugin or with Metamask itself).
  • The Chainlink integration was tricky as well, but we managed to overcome the hurdles in the end.
  • Estimating a decent approximation of carbon emissions per gas unit was no easy task either, especially since the relevant data is not readily availble (at least not dynamically). For example, we had to write a service that pings a node to calculate the average gas spent by transactions in the last 500k blocks. We relied heavily on the data provided by and the methodology proposed by, with a few additions of our own.

Accomplishments that we're proud of

  • Setting an ambitious goal and managing to achieve it in a short period
  • Leveraging various new technologies successfully
  • Coming up with an exciting idea for a project that we could all get behind, with the added benefit of it being something that contributes to society in some manner

What we learned

  • Ethereum is a wonderland of unstable libraries (just kidding, we already knew that)
  • There is an iguana species that uses its blue tongue to fool predators into thinking it's venomous
  • Madagascan cockroaches are surprisingly not as gross as people would think
  • Having an animal therapy room at a hackathon is a great idea
  • Wei to ETH calculations are TOUGH when you're sleep deprived
  • Each of us spent some time working outside of our respective comfort zones, so each of us gained working knowledge of areas beyond our expertise

What's next for CarbonGuilt

  • We could extend our reliance on Chainlink to allow beneficiary projects to provide us with API urls (instead of fixed rates) to calculate their carbon credit prices based on efficiency
  • We could extend our array of data sources (again leveraging the capabilities of Chainlink) to get more reliable carbon footprint calculations
  • We could improve the UI
  • We could add more capabilities to the plugin, like historic data on carbon credit prices/gas emission coefficients at the time of each offsetting transaction
  • We could explore ways to provide more utility to the GIFT token, making it tradeable
  • We could define a standard for beneficiary projects to connect to our protocol
  • We could add support for stable coins
  • We could use other tools and APIs so that when a user first installs the plugin, their total accumulated spent gas from genesis is calculated (instead of just starting to count from the point where they installed the plugin)

Built With

+ 4 more
Share this project: