- Foundry installed
- A wallet with some ETH for testing
# Copy the example environment file
cp .env.example .env
# Edit .env with your values
nano .envRequired values in .env:
PRIVATE_KEY: Your wallet's private key (without 0x prefix)RPC_URL: Your blockchain RPC endpoint
If testing locally:
# Start Anvil local testnet
anvilThis will give you test accounts with ETH.
# Compile contracts
forge build
# Deploy to your chosen network
forge script script/DeployCarbonERC6551System.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast# Make the demo script executable
chmod +x interactive_carbon_erc6551_demo.sh
# Run the interactive demo
./interactive_carbon_erc6551_demo.shThe demo will:
- Deploy all contracts
- Mint sample carbon project NFTs
- Create batches with token-bound accounts
- Demonstrate transferring projects to batch accounts
- Show batch operations and redemption
Each step shows both the raw cast command and a human-readable explanation of what's happening.
- If you get "command not found" errors, make sure Foundry is installed and in your PATH
- If transactions fail, check that your wallet has sufficient ETH
- If contracts aren't found, make sure deployment completed successfully
Enjoy exploring the ERC6551 carbon credit system! 🌱