This project allows you to generate and deploy a collection of 10,000 unique pixel art NFT avatars with BTB Finance branding on the Base network.
This repository contains:
- A pixel avatar generator script that creates 10,000 unique NFTs with metadata
- Tools to upload your collection to IPFS
- Smart contracts and deployment scripts for the Base network
- Node.js (v16+)
- NPM or Yarn
- An Ethereum wallet with Base Sepolia ETH for testing, or Base Mainnet ETH for production
- A Storacha Network account for IPFS uploads
- Clone this repository:
git clone https://github.com/your-username/pixel-avatars-nft
cd pixel-avatars-nft- Install dependencies:
npm install- Create a
.envfile in the root directory with your private key:
PRIVATE_KEY=your_private_key_here
.env file to GitHub!
Edit the generate_pixel_avatars.js file to customize your avatar collection:
- Colors: Modify the
pastelColor()function to change the color palette - Traits: Edit the arrays for various traits (eyes, headwear, etc.)
- Rarity: Adjust the
rarityTiersarray to change the distribution - Metadata: Update the collection name and descriptions
Example customization:
// Change background colors
function pastelColor() {
// For a blue-themed collection:
const hue = 180 + Math.floor(Math.random() * 60); // 180-240 = blue range
return `hsl(${hue}, 70%, 85%)`;
}
// Change rarity distribution
const rarityTiers = [
{ name: 'Mythic', quantity: 50 }, // Rarer mythics (50 instead of 100)
{ name: 'Divine', quantity: 200 }, // Fewer divine
// ... other tiers
];Run the generator script:
node generate_pixel_avatars.jsThis will create:
pixel_output/images: 10,000 PNG avatar imagespixel_output/metadata: 10,000 JSON metadata files
The script automatically:
- Assigns rarity tiers to avatars
- Calculates rarity scores and ranking
- Creates rich metadata with traits, BTB Finance branding, and lore
npm install -g @storacha/cli- Create an account at Storacha Network if you don't have one
- Log in to the CLI:
storacha login --email your@email.com- Create a new space in the Storacha console or use an existing one
storacha upload pixel_output/images --metadata pixel_output/metadata --space your-space-idSave the IPFS CID that's returned after the upload is complete. You'll need this for your smart contract.
Edit the nft.sol contract constructor to use your IPFS URI:
_baseTokenURI = "ipfs://YOUR_CID_HERE/";Or you can set it after deployment using the setBaseURI function.
npm run compileThe default network is Base Sepolia testnet. For mainnet deployment, edit hardhat.config.js and change the default network.
npm run deployThis will:
- Deploy the BTBFinanceNFT contract to the chosen network
- Generate 50 random addresses (for demonstration purposes)
- Airdrop one NFT to each of these addresses
- Save deployment information to
deployment-info.json
Check the contract on:
- Base Sepolia: https://sepolia.basescan.org/address/YOUR_CONTRACT_ADDRESS
- Base Mainnet: https://basescan.org/address/YOUR_CONTRACT_ADDRESS
After deployment, you need to:
- Deploy or use an existing BTB token contract
- Connect it to your NFT contract:
npx hardhat run scripts/set-payment-token.js --network base-sepoliaThe generator creates avatars with these traits:
- Background color and pattern
- Body color and shape
- Eye color and style
- Hair color and style
- Headwear (cap, crown, helmet, etc.)
- Face accessories
- Rarity tier (Mythic, Divine, Celestial, etc.)
- Character class (Warrior, Mage, Rogue, etc.)
Each NFT includes rich metadata:
- Basic info (name, description, image)
- Attributes (visual traits)
- BTB Finance branding
- Character lore and story arcs
- Special traits based on character class
- Compatible items
- Rarity information
For issues or questions, please open a GitHub issue or contact the BTB Finance team.
- Never share your private key or .env file
- For real airdrops, replace the random address generation with your actual distribution list
- Consider using a hardware wallet for production deployments