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:

  1. Mint, transfer, and burn carbon credit tokens on a blockchain.

  2. Interact with the smart contract via an API (Node.js & TypeScript).

  3. 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.