Generate AI-powered artwork from your mood descriptions and mint them as unique NFTs on the Arbitrum network.
This project contains 5 intentional bugs for learning purposes. Your task is to find and fix them all to make the app work!
| # | Hint | Difficulty |
|---|---|---|
| 1 | Check if the AI model name actually exists | ๐ข Easy |
| 2 | Look at URLs character by character... something looks Cyrillic ๐ | ๐ด Hard |
| 3 | JavaScript is case-sensitive. Check function names match the contract | ๐ก Medium |
| 4 | Config file path has a typo | ๐ข Easy |
| 5 | Solidity functions that only read data need a special keyword | ๐ก Medium |
โ Image generation failed: Invalid model
โ Failed to upload to IPFS: Network error
โ Minting failed: Function not found
โ Configuration validation failed
โ ๏ธ Contract compilation warning
Good luck! ๐
- ๐จ AI Image Generation: Uses DALL-E 3 to create stunning artwork from your mood descriptions
- ๐ IPFS Storage: Decentralized storage via Pinata for images and metadata
- โ๏ธ Arbitrum Network: Low gas fees and fast transactions on Ethereum L2
- ๐ฑ Interactive CLI: User-friendly command-line interface
- ๐ ERC-721 Standard: Fully compliant NFT smart contract
- Node.js 18+
- An Ethereum wallet with some ETH on Arbitrum (or Arbitrum Sepolia for testing)
- API keys for:
git clone <your-repo>
cd mood-nft-arbitrum
npm installCopy the example environment file and fill in your credentials:
# Windows
copy config.env.example config.env
# Mac/Linux
cp config.env.example config.envEdit config.env with your settings:
# Your wallet private key (without 0x prefix)
PRIVATE_KEY=your_private_key_here
# OpenAI API key
OPENAI_API_KEY=sk-your-openai-key
# Pinata credentials
PINATA_API_KEY=your_pinata_key
PINATA_SECRET_KEY=your_pinata_secret
# Contract address (after deployment)
CONTRACT_ADDRESS=your_contract_addressnpm run compileFor testnet (Arbitrum Sepolia):
npm run deploy:sepoliaFor mainnet (Arbitrum One):
npm run deployAfter deployment, copy the contract address to your .env file.
npm run mintRun the interactive CLI:
npm run mint- ๐จ Create new Mood NFT - Describe your mood and generate unique artwork
- ๐ View my NFTs - See all your minted Mood NFTs
- ๐ฐ Check wallet balance - View your ETH balance and current gas prices
- ๐ช Exit - Close the application
- "Peaceful Sunday morning with coffee, watching rain through the window"
- "Excited about new possibilities, like the first day of spring"
- "Nostalgic memories of childhood summers at the beach"
- "Focused determination, pushing through challenges"
mood-nft-arbitrum/
โโโ contracts/
โ โโโ MoodNFT.sol # ERC-721 NFT smart contract
โโโ scripts/
โ โโโ deploy.js # Deployment script
โโโ src/
โ โโโ index.js # Main CLI application
โ โโโ services/
โ โโโ imageGenerator.js # DALL-E image generation
โ โโโ ipfsUploader.js # Pinata IPFS upload
โ โโโ nftMinter.js # Blockchain interactions
โโโ test/
โ โโโ MoodNFT.test.cjs # Contract tests
โโโ generated_images/ # Locally saved images
โโโ hardhat.config.cjs # Hardhat configuration
โโโ package.json
โโโ README.md
npm test- Chain ID: 421614
- RPC:
https://sepolia-rollup.arbitrum.io/rpc - Explorer: https://sepolia.arbiscan.io
- Faucet: https://faucet.quicknode.com/arbitrum/sepolia
- Chain ID: 42161
- RPC:
https://arb1.arbitrum.io/rpc - Explorer: https://arbiscan.io
-
Get Sepolia ETH from a faucet:
-
Bridge to Arbitrum Sepolia:
Or use the Arbitrum Sepolia faucet directly:
Run npm run compile to compile the smart contract.
Make sure your wallet has enough ETH on the selected network.
Check that your .env file contains valid API keys.
- Check your OpenAI API key
- Ensure you have API credits
- Try simplifying your mood description
The MoodNFT contract is an ERC-721 compliant NFT with additional features:
- mintMoodNFT: Mint a new NFT with mood description and metadata URI
- getMood: Get the mood description for any token
- getMintTimestamp: Get when a token was minted
- getTokensByOwner: Get all tokens owned by an address
- getTotalMinted: Get total number of NFTs minted
- Arbitrum Documentation
- OpenAI DALL-E API
- Pinata Documentation
- OpenZeppelin Contracts
- Hardhat Documentation
- NEVER share your private key
- NEVER commit your
.envfile to git - Use a dedicated wallet for testing
- Start with testnet before using mainnet
MIT License - feel free to use this project for learning and personal use!
Made with โค๏ธ for the Web3 community