Blockchain Engineer Project:
Carbon Credit Tokenization & Smart Contract API
π Project Overview
Welcome to the Blockchain Engineering challenge for Sustainity! π
This project will test your ability to write secure Solidity smart contracts, build an API for blockchain interactions, and optimize gas fees.
Your task is to develop a smart contract and a backend API that allows users to:
Mint, transfer, and burn carbon credit tokens on a blockchain.
Interact with the smart contract via an API (Node.js & TypeScript).
Ensure gas optimization and security best practices.
π οΈ Instructions
1. Smart Contract Development (Solidity)
Develop an ERC-20 or ERC-721 smart contract in Solidity.
Functions to implement:
mint(address to, uint256 amount) β Issues carbon credit tokens.
transfer(address to, uint256 amount) β Transfers credits between users.
burn(uint256 amount) β Retires credits from circulation.
Event logging for transparency (e.g., Minted, Burned, Transferred).
Optimize for gas efficiency (e.g., struct packing, minimizing storage writes).
Deploy the contract to an Ethereum testnet (Goerli or Polygon Mumbai).
β³ Time Estimate
This project is designed to be completed in 3-4 hours.
If youβre unable to complete all features, focus on core smart contract functionality and API integration.
π₯ Submission Guidelines
Push your code to GitHub (public repo) or send a ZIP file.
Include a README.md with setup instructions.
Provide a test script for interacting with the contract (e.g., using Hardhat or Foundry).
π Testnet Deployment Guide
β‘οΈ Deploy to Goerli or Polygon Mumbai testnet.
β‘οΈ Use Alchemy or Infura as the blockchain provider.
2. Backend API (Node.js & TypeScript)
Build a RESTful API that interacts with the smart contract using Ethers.js.
Implement the following API endpoints:
POST /mint β Calls the mint function on the smart contract.
POST /transfer β Transfers tokens between accounts.
POST /burn β Burns tokens.
GET /balance/:address β Fetches token balance for a given wallet address.
Use environment variables for private keys and blockchain RPC URLs.
3. Security & Best Practices
Implement access control (e.g., only authorized users can mint/burn).
Use ReentrancyGuard and SafeMath to prevent security issues.
Ensure gas-efficient contract design (e.g., avoid unnecessary storage writes).
β Bonus Tasks (Optional, if Time Permits)
β Handling Multiple Token Standards β Extend support for both ERC-20 (fungible tokens) and ERC-721 (non-fungible carbon credits).
β Dynamic Gas Optimization β Implement a gas estimation feature that automatically selects the lowest-cost blockchain transactions.
β User-Friendly Web UI β Create a simple React/Vue.js UI that allows users to interact with the contract via Metamask.