Avatar DNA Chain
Create unique avatars with provenance-tracked traits minted as ERC-721 tokens.
NFT provenance mint· onchain authorship
Section · Onchain
full primer →The primitive.
Game designers mint each custom avatar creation as an ERC-721 token on Avalanche Fuji pointing at an IPFS CID, so authorship and timestamp are provable from a single Snowtrace link.
Why this primitiveNFT minting confirms original avatar trait ownership and prevents copying.
Kernel
an ERC-721 contract on Avalanche Fuji that mints a creator-owned token pointing at an IPFS CID, verified on Snowtrace
Drives the UI as
a 'mint to claim authorship' button that returns the tokenId, owner address, and Snowtrace link
Required keys.
METAMASK_PRIVATE_KEY
Exported from MetaMask. Fund on Avalanche Fuji via the Avalanche Fuji faucet.
open ↗AVALANCHE_FUJI_RPC_URL
Alchemy Avalanche Fuji HTTPS endpoint (or https://api.avax-test.network/ext/bc/C/rpc).
open ↗ETHERSCAN_API_KEY
Single Etherscan v2 key — covers Snowtrace (chainId 43113) with no extra key.
open ↗Add these in your Lovable project under Settings → Secrets before pasting the prompt below.
Appendix · Mega-prompt
The build prompt.
budget · 1 message
Paste into a fresh Lovable project. Make sure all five secrets above are set first. read the build strategy →
Build "Avatar DNA Chain" in ONE Lovable message. Single-page demo.
CONCEPT
Create unique avatars with provenance-tracked traits minted as ERC-721 tokens.
Discipline: Game Design & Interactive Media (custom avatar creation).
Onchain primitive: NFT provenance mint. Why this primitive: NFT minting confirms original avatar trait ownership and prevents copying.
5-CREDIT BUDGET (HARD LIMIT):
- ONE single-page app. No router, no Lovable Cloud, no database, no auth flows beyond Privy drop-in.
- ONE Solidity contract, <=80 lines, deployed to Avalanche Fuji (chainId 43113), verified on Snowtrace.
- Privy is always the auth + sponsored-tx layer (Google login, embedded wallet).
- Pinata/IPFS only if the idea genuinely needs to store a file or metadata.
- At most ONE AI call per user action (use Lovable AI Gateway with LOVABLE_API_KEY if AI is part of the idea).
- Skip tests, skip CI, skip docs pages. Ship the demo, nothing else.
STACK
- React + Vite single page (the index route).
- Privy embedded wallet wraps `<App />` in src/main.tsx:
// IMPORTANT: pass the real viem `avalancheFuji` Chain object — a { id, name } stub
// silently breaks Privy's chain transport (sponsored tx + smart-wallet client init).
import { avalancheFuji } from 'viem/chains';
<PrivyProvider appId={import.meta.env.VITE_PRIVY_APP_ID}
config={{ loginMethods:['google'], embeddedWallets:{ethereum:{createOnLogin:'users-without-wallets'}},
defaultChain: avalancheFuji, supportedChains: [avalancheFuji] }}>
- All txs via Privy `useSendTransaction` with `{ sponsor: true }` (zero-gas for the user).
- src/lib/pinata.ts uploads via `fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', { method:'POST', headers:{ Authorization: `Bearer ${import.meta.env.VITE_PINATA_JWT}` }, body: fd })`.
- Hardhat in /contracts (kept outside the Vite bundle). Install
`@nomicfoundation/hardhat-ethers` AND `@nomicfoundation/hardhat-verify` (>=2.x).
DO NOT install `@nomicfoundation/hardhat-toolbox` — it drags Hardhat 3 peers.
- hardhat.config.cjs — Avalanche Fuji + Etherscan v2 single-key:
require("@nomicfoundation/hardhat-ethers");
require("@nomicfoundation/hardhat-verify");
const pk = process.env.METAMASK_PRIVATE_KEY;
module.exports = {
solidity: { version: "0.8.24", settings: { optimizer: { enabled: true, runs: 200 } } },
networks: { avalancheFuji: {
url: process.env.AVALANCHE_FUJI_RPC_URL || "https://api.avax-test.network/ext/bc/C/rpc",
accounts: pk ? [pk.startsWith("0x") ? pk : "0x" + pk] : [],
chainId: 43113,
} },
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY, // single Etherscan v2 key covers Snowtrace
customChains: [{
network: "avalancheFuji", chainId: 43113,
urls: {
apiURL: "https://api.etherscan.io/v2/api?chainid=43113",
browserURL: "https://testnet.snowtrace.io",
},
}],
},
sourcify: { enabled: false },
};
- Deploy: `npx hardhat run scripts/deploy.cjs --network avalancheFuji`.
- Verify (run RIGHT AFTER deploy, no constructor args for these contracts):
`npx hardhat verify --network avalancheFuji <address>`
On success it prints "Successfully verified contract … on the block explorer"
and the source becomes readable at
`https://testnet.snowtrace.io/address/<address>#code`.
- Frontend reads: create a viem public client with the Avalanche Fuji RPC too —
`createPublicClient({ chain: avalancheFuji, transport: http(import.meta.env.VITE_AVALANCHE_FUJI_RPC_URL) })`
(import `avalancheFuji` from `viem/chains`).
Expose the RPC to the client by also setting VITE_AVALANCHE_FUJI_RPC_URL to the same value.
- Write the deployed address to `src/data/contract.json` so the UI links to
`https://testnet.snowtrace.io/address/<address>`.
CONTRACT (contracts/AvatarDNAChain.sol):
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
/// @title AvatarDNAChain
/// @notice ERC-721 provenance for: Create unique avatars with provenance-tracked traits minted as ERC-721 tokens.
/// @notice Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14
contract AvatarDNAChain is ERC721 {
uint256 public nextId;
mapping(uint256 => string) public cidOf;
constructor() ERC721("AvatarDNAChain", "AVATAR") {}
/// @notice Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14
function mint(string calldata cid) external returns (uint256 id) {
id = ++nextId; cidOf[id] = cid; _safeMint(msg.sender, id);
}
function tokenURI(uint256 id) public view override returns (string memory) {
return string(abi.encodePacked("ipfs://", cidOf[id]));
}
}
```
USER FLOW
1. Land on page -> 'Sign in with Google' (Privy) -> embedded wallet auto-provisioned on Avalanche Fuji.
2. After the user creates a custom avatar creation artefact, pin the file to IPFS via Pinata, then call `mint(cid)` on the deployed contract through Privy's sponsored transaction. Show tokenId, IPFS preview (`https://gateway.pinata.cloud/ipfs/<cid>`), and Snowtrace mint-tx link.
3. Footer renders: "Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14"
REQUIRED SECRETS (Lovable -> Project Settings -> Secrets):
- METAMASK_PRIVATE_KEY Avalanche Fuji deployer key. Fund it: https://build.avax.network/console/primary-network/faucet
(alt: https://build.avax.network/console/primary-network/faucet)
- AVALANCHE_FUJI_RPC_URL Alchemy Avalanche Fuji HTTPS endpoint (https://avax-fuji.g.alchemy.com/v2/<key>)
OR the public default https://api.avax-test.network/ext/bc/C/rpc. Create a free app: https://dashboard.alchemy.com/
- ETHERSCAN_API_KEY Single Etherscan v2 key — verifies on Snowtrace (chainId 43113) with no extra key.
Get: https://etherscan.io/myapikey
- PRIVY_APP_ID Google sign-in + sponsored tx. Enable Avalanche Fuji (43113) in your Privy dashboard.
Docs: https://docs.privy.io/llms-full.txt
- PINATA_JWT IPFS uploads (only if app pins media). Docs: https://docs.pinata.cloud/llms-full.txt
CREDIT (must appear in UI footer AND as NatSpec on every deployed contract):
Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14
Market sizing.
TAM
$4B
avatar customization market
SAM
$600M
indie avatar designers
SOM
$60M
blockchain avatar platforms
Indicative figures for hackathon pitches — refine with your own research before raising.
Adjacent entries.
game narrative design
Provenance Playbooks
Create branching story games with verifiable original story assets minted onchain.
pixel art creationPixel Provenance
Mint and verify original pixel art sprites as unique NFTs for games and assets.
game audio samplingSound Slice Chain
Securely mint and track original sound samples for interactive game soundtracks.
XR environment designVR Provenance Hub
Mint immersive VR environments as NFTs to ensure creator authenticity and ownership.