Burn2Earn
Top quality project, Chainlink
✦ highlightMy first web3 project

- when
- Apr 2023 · 2 BC
- where
- Chainlink Spring · online
- made with
what it is
Burn2Earn is a fitness mobile app that pays users in tokens for their daily physical activity. The idea is to give people a tangible reason to keep working out: activity earns tokens, and tokens buy discount coupons and offers.
A user signs in with a Google account and consents to sharing fitness data, then connects a MetaMask wallet. The home dashboard shows a summary of the day's fitness data, the rewards page is where the day's tokens are claimed, and the coupons page is where they are spent.
The app reads steps, calories burnt and heart points from Google Fit and turns them into an amount of BuffTokens (ERC-20) that the user can mint once every 24 hours. BuffTokens are burned to claim BuffCoupons (ERC-1155), which represent discount coupons and offers.
how it's made
The app is written in React Native with TypeScript. It started on Expo and was moved to plain React Native after running into issues. Web3 functionality, including the MetaMask connection, goes through the thirdweb SDK.
Fitness data reaches the chain through Chainlink Functions. There are two JavaScript sources: RegisterAccount links a wallet address to a Gmail account using a DON-encrypted Google access token, and MintToken runs the algorithm that decides how many tokens the day's activity is worth. Google's API handles authentication and the Google Fit API supplies the metrics.
The contracts are written in Solidity on top of OpenZeppelin, built with Hardhat, and deployed on Polygon Mumbai: a BurnToEarn contract and a BuffCoupons contract. Coupons are claimed with a claimCoupon function that burns the token amount set for that coupon.
Romario worked on the contracts and on the Chainlink integration in the frontend, including encrypting the secrets in the byte format Chainlink Functions expects.



