Inspiration
Carbon credits are supposed to pay people to protect forests. In practice, nobody can easily check them. The same hectare can back credits in several programmes, claims are verified by a consultant once every few years, and a forest that is cleared after issuance keeps its credits. Meanwhile, the people best placed to restore land, smallholder farmers in West Africa, are priced out by certification costs. I'm building from Benin, where agroforestry is growing fast and this gap is very visible. I wanted to see whether a ledger plus free satellite data could make a credit something you can check, not just trust.
What it does
TerraProof is a carbon registry whose rules are enforced by code, and whose evidence anyone can recompute:
One cell, one owner. A parcel is cut into geohash cells of about 38 × 19 m and written to the ledger. A smart contract rejects any overlapping claim, so double counting is impossible by construction. Two independent satellite signals. An oracle reads live Sentinel-2 imagery over the polygon and computes greenness (NDVI) and canopy moisture (NDMI), with cloud masking per pixel. A parcel is eligible only if both agree. This matters because forest replaced by green pasture keeps a high NDVI but loses its moisture signal. Evidence you can recompute. Each report lists the exact Sentinel-2 scenes it used, and its hash is anchored on-chain next to the credits. On the public proof page, a Recompute button re-downloads those scenes from the public archive, re-runs the decision and checks that the hash matches. Living credits. A weekly job compares every parcel with the same season one year earlier. A confirmed drop freezes it (no transfer, no retirement), confirmed loss revokes the credits, and a false alarm clears the flag. A quorum, but a fast brake. Issuing credits, revoking them or lifting a freeze needs several distinct verifiers to agree. Any single verifier can freeze. A share for the people who restore the land. A parcel can reserve a share of every issuance for a village fund or cooperative. The split is written into the contract and the owner cannot change it afterwards. Retire with proof. Buyers retire credits on-chain with a beneficiary and reason, and get a public proof page with a QR code.
How I built it
Smart contract: Solidity (OpenZeppelin ERC-1155, AccessControlEnumerable, Pausable) on Base Sepolia. A verifier quorum with single-use votes, a community share enforced at issuance, an emergency pause that never blocks freezing or revoking, and an on-chain per-cell issuance ceiling that bounds what a compromised oracle could ever mint. 30 Hardhat tests, including a randomised invariant test: supply conservation, the ceiling and cell uniqueness hold over 300 random operations. MRV oracle (v1): Next.js route handlers query Microsoft Planetary Computer (Sentinel-2 L2A). The decision logic is a pure function shared by the API and the benchmark, so what I measure is exactly what ships. Measured accuracy: a reproducible benchmark against the Hansen Global Forest Change dataset. Thresholds are calibrated on half of the sites and reported on the other half. Everything (scan, evaluation, per-site results) is in the repository. Web app: Next.js, React, Tailwind and Leaflet on satellite imagery, in English and French. One Registry interface has two back-ends: a browser simulation that applies the exact same rules as the contract (anyone can try it without a wallet, still on live satellite data), and an on-chain adapter for the deployed contract. Replay of a real clearing: the demo can replay a parcel that was really cleared in Mato Grosso, using the real Sentinel-2 history: credits are issued with the forest standing, then frozen from real imagery. Nothing is injected. Verified end to end: CI runs the contract tests, type-check, build and the offline benchmark on every push.
Challenges I ran into
A silent data bug. Since January 2022, Sentinel-2 scenes carry a +1000 offset on raw values. My first oracle ignored it, so NDVI was biased low: a dense forest read about 0.5 instead of 0.85. The benchmark exposed it, and the oracle now reads each scene's processing baseline and corrects it. NDVI alone is fooled. Many cleared forests turn into green pasture, so their NDVI stays high. Adding an independent moisture signal and calibrating the freeze rule on held-out data closed most of that gap. Turning a hand-drawn polygon into a deterministic set of cells, so two different drawings of the same land collide. Real-world friction: a public RPC capped eth_getLogs and silently broke the on-chain view, and sequential RPC calls made the first load take over 30 seconds. Switching RPC and reading in parallel brought it under 2 seconds. Being honest about the science. NDVI measures vegetation vigour, not carbon stock, and the app says so everywhere. Accomplishments that I'm proud of Double counting is blocked by the contract, not by policy. Credits that can be switched off when the forest disappears, and evidence that anyone can recompute instead of trusting me. A measured error rate published next to the product. On held-out Amazon sites (7 cleared, 7 intact, 15 ha each): the previous engine gave credits to 7 of 7 cleared sites; the new one wrongly accepts 1 of 7, accepts all 7 intact forests, freezes 6 of 7 cleared sites and raises no false alarm on the 7 intact ones. With so few sites the intervals are wide (1 of 7 wrongly accepted is a 3 to 51 % interval), so I present it as an order of magnitude. Finding and fixing my own bug before anyone relied on the numbers.
What I learned
Trust in carbon markets is a data-integrity problem as much as a financial one. A ledger alone doesn't fix it: it needs independent physical evidence tied to every unit, evidence that anyone can recompute, and an error rate published next to the product.
Limits, stated plainly Not validated in Benin or West Africa. I scanned two West-African tiles but could not find ground-truth sites: the forest there is too fragmented at the scale of a 15 ha window. The benchmark covers the Amazon only, and another biome may need its own calibration. Credits come from area × max(0, NDVI − 0.15) × 60 tCO₂e. This is a proxy, not a validated carbon methodology, and the benchmark validates presence and loss of standing vegetation, not the carbon quantity. The verifier quorum is real in the contract, but in this deployment all verifier keys sit on one server: it shows the mechanism, not independence. The upgraded contract (quorum, community share, pause) is not yet redeployed on Base Sepolia; the deployed one is the previous version. Simulate deforestation injects a synthetic loss and is labelled "simulated". Replay a real clearing is not simulated. No external security audit.
What's next
A registry of registries to catch double counting across Verra, Gold Standard and national registries. Peer-reviewed MRV methodologies (SAR for cloudy regions, allometry, ground truth, permanence buffers) and ground-truth sites in Benin. Independent verifiers run by different organisations, with staking and slashing. Low-cost onboarding for smallholders in West Africa (USSD / WhatsApp), and transparent units for Article 6 and COP31.
Built with
Solidity, Hardhat, OpenZeppelin, Next.js, React, TypeScript, Tailwind CSS, Leaflet, ethers.js, Sentinel-2, Microsoft Planetary Computer, Hansen Global Forest Change, Base Sepolia, Vercel, GitHub Actions
Built With
- base
- hardhat
- leaflet.js
- next.js
- react
- sentinel-2
- solidity
- typescript