Skip to content

anushkasomani/flowppies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

29 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Flowppies - AI-Generated NFT Pets on Flow Blockchain

01

๐ŸŒŸ Overview

Flowppies is an innovative Web3 gaming platform that combines AI-generated NFT pets with interactive gameplay on the Flow blockchain. Users can create, train, and battle unique digital companions in a gasless environment powered by Flow's native VRF (Verifiable Random Function) and sponsored transaction system.

Live Site Demo Video Evolve Pet Endpoint

โœจ Key Features

๐ŸŽจ AI-Powered Pet Generation

  • AI Image Creation: Powered by Google's Gemini 2.0 Flash with advanced image generation capabilities
  • Custom Art Styles: Choose from multiple styles including Pixel Art, Watercolor, 3D Render, Anime, and more
  • Dynamic Backstories: AI-generated lore that evolves with your pet's journey
  • Unique Attributes: Each pet has distinctive traits including Happiness, Power, Level, and Multiplier stats

๐ŸŽฒ Flow's Native VRF Integration

Token Tails uses Flow's Verifiable Random Function (VRF) - a feature exclusive to Flow blockchain.

How It Works:

  • Battle Outcomes: 70% pet stats + 30% cryptographic randomness
  • Zero Cost: Free randomness (costs $10+ on other chains)
  • Instant Results: No waiting for oracles
  • Provably Fair: Mathematical proof of fairness

Implementation:

// Get random number from Flow's native VRF
(bool ok, bytes memory data) = cadenceArch.staticcall(
    abi.encodeWithSignature("revertibleRandom()")
);
uint64 randomNumber = abi.decode(data, (uint64));

// Calculate fair battle outcome
uint256 pet1Power = pet1Stats + (randomNumber % 1000);
uint256 pet2Power = pet2Stats + ((randomNumber / 1000) % 1000);

โšก Gasless Experience

  • Sponsored Transactions: All gas fees covered by Flow Wallet
  • Seamless Onboarding: No need to acquire native tokens for new users
  • Ultra-Low Costs: When fees apply, they're minimal on Flow EVM

๐Ÿ† Interactive Gameplay

  • Pet Training: Feed and train pets to increase their stats

  • Battle System: Engage in PvP battles with stake-based rewards

  • Evolution Mechanics: Level up pets to unlock new abilities and appearances

  • Leaderboard: Compete for top rankings based on pet performance

    03

๐Ÿ—๏ธ Technical Architecture

Frontend Stack

  • Framework: Next.js 14 with React 18
  • Styling: Tailwind CSS for responsive design
  • Web3 Integration: RainbowKit with wagmi for wallet connectivity
  • UI Components: Custom components with Framer Motion animations

Blockchain Infrastructure

  • Network: Flow Testnet & Mainnet
  • Smart Contracts: Solidity-based ERC721 implementation with custom battle mechanics
  • VRF Integration: Flow's native randomness beacon for fair randomness
  • Gas Sponsorship: Flow Wallet's automatic fee coverage

Storage & AI

  • Decentralized Storage: Irys Network for NFT metadata and images
  • AI Generation: Google Gemini 2.0 Flash for image and backstory creation
  • Metadata Standards: ERC721-compliant with evolving attributes

Project Stack Overview

Category Component Details
Frontend Stack Framework Next.js 14 with React 18
Frontend Stack Styling Tailwind CSS for responsive design
Frontend Stack Web3 Integration RainbowKit with wagmi for wallet connectivity
Frontend Stack UI Components Custom components with Framer Motion animations
Blockchain Infrastructure Network Flow Testnet & Mainnet
Blockchain Infrastructure Smart Contracts Solidity-based ERC721 implementation with custom battle mechanics
Blockchain Infrastructure VRF Integration Flow's native randomness beacon for fair battle outcomes
Blockchain Infrastructure Gas Sponsorship Flow Wallet's automatic fee coverage
Storage & AI Decentralized Storage Irys Network for NFT metadata and images
Storage & AI AI Generation Google Gemini 2.0 Flash for image and backstory creation
Storage & AI Metadata Standards ERC721-compliant with evolving attributes

Project Architecture

WhatsApp Image 2025-07-06 at 03 24 26_f103800a

๐ŸŽฎ How to Play

1. Connect Your Wallet

  • Install Flow Wallet extension
  • Connect to the application
  • All transaction fees are automatically sponsored!

2. Create Your Pet

  • Navigate to the Generate page

  • Describe your desired pet

  • Choose an art style

  • Let AI generate your unique companion

    02

3. Train and Care

  • Feed your pet to increase Happiness (+5) and Power (+1)

  • Train your pet for enhanced Power (+5) and Happiness (+1)

  • Watch your pet's multiplier grow with each interaction

    04

4. Battle Other Pets

  • Create battles between any two pets
  • Stake Flow tokens on your favorite
  • Outcomes determined by 70% stats + 30% Flow VRF randomness
  • Winners receive rewards distributed automatically

5. Evolution System

  • Level up pets when they reach sufficient points
  • Unlock new backstory chapters
  • Enhance visual appearance and abilities

๐Ÿ“ Project Structure

flowppies/
โ”œโ”€โ”€ app/                          # Next.js app directory
โ”‚   โ”œโ”€โ”€ api/                      # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ generate-backstory/   # AI backstory generation
โ”‚   โ”‚   โ”œโ”€โ”€ image/                # Gemini image generation
โ”‚   โ”‚   โ””โ”€โ”€ irys/                 # Decentralized storage
โ”‚   โ”œโ”€โ”€ components/               # React components
โ”‚   โ”œโ”€โ”€ battle/                   # Battle interface
โ”‚   โ”œโ”€โ”€ generate/                 # Pet creation
โ”‚   โ”œโ”€โ”€ showcase/                 # NFT gallery
โ”‚   โ””โ”€โ”€ leaderboard/              # Rankings
โ”œโ”€โ”€ contract/                     # Smart contracts
โ”‚   โ””โ”€โ”€ DynamicNFT.sol           # Main NFT contract
โ”œโ”€โ”€ utils/                        # Utilities and configs
โ””โ”€โ”€ lib/                          # Shared libraries

๐Ÿ”ง Smart Contract Features

Core NFT Functionality

  • ERC721 Standard: Full NFT compliance with metadata storage
  • Dynamic Attributes: Stats that change based on interactions
  • Mutable Metadata: Evolving backstories and characteristics
  • Ownership Tracking: Secure pet ownership and transfer

Battle System

  • Battle Creation: Any user can create battles between pets
  • Stake Management: Users can stake Flow tokens on battle outcomes
  • VRF Resolution: Cryptographically fair battle resolution
  • Reward Distribution: Automatic payout to winners (60% to stakers, 30% to creator, 10% to platform)

Gas Optimization

  • Efficient Minting: Optimized contract deployment and execution
  • Batch Operations: Support for multiple actions in single transactions
  • Event Logging: Comprehensive event emission for frontend tracking

๐ŸŒ Live Demo

๐Ÿ“Š Key Statistics

  • Zero Gas Fees: All transactions sponsored by Flow Wallet
  • Instant Randomness: No oracle delays for battle resolution
  • Scalable: Flow's architecture supports high-throughput gaming
  • Decentralized Storage: All metadata stored on Irys/IPFS

๐Ÿ”’ Security Features

  • Verifiable Randomness: Cryptographically secure battle outcomes
  • Immutable Ownership: Blockchain-secured pet ownership
  • Decentralized Metadata: No single point of failure for pet data
  • Audited Libraries: Built on OpenZeppelin's secure contracts

๐ŸŒŸ Why Flow Blockchain?

Developer Benefits

  • Native VRF: Built-in randomness without external oracles
  • Gas Sponsorship: Eliminate user friction with sponsored transactions
  • High Performance: Designed for mainstream adoption and gaming
  • EVM Compatibility: Deploy Solidity contracts seamlessly

User Benefits

  • No Gas Worries: Play without managing native tokens
  • Instant Transactions: Fast block times and finality
  • Fair Gameplay: Provably random battle outcomes
  • True Ownership: Decentralized NFT storage and metadata

๐ŸŽฏ Target Audience

  • Web3 Gamers: Users seeking engaging blockchain-based gaming experiences
  • NFT Collectors: Collectors interested in unique, evolving digital assets
  • AI Enthusiasts: Users fascinated by AI-generated content and narratives

๐Ÿš€ Flowppies Setup & Installation Guide

๐Ÿ“‹ Prerequisites

Before setting up Flowppies, ensure you have the following installed on your system:

  • Node.js (v18.0.0 or higher)
  • npm or yarn package manager
  • Git
  • Flow Wallet browser extension

๐Ÿ› ๏ธ Installation Steps

1. Clone the Repository

git clone https://github.com/anushkasomani/flowppies.git
cd flowppies

2. Install Dependencies

Choose your preferred package manager:

Using npm:

npm install

Using yarn:

yarn install

3. Environment Configuration

Create a .env file in the root directory and add the following environment variables:

# Required: Google Gemini AI API Key
GEMINI_API_KEY=your_gemini_api_key_here

# Required: Private key for contract deployment and Irys uploads
PRIVATE_KEY=your_private_key_for_contract_deployment

# Optional: Project name (defaults to "Flowppies")
NEXT_PUBLIC_PROJECT_NAME=project_name

4. Development Server

Start the development server:

npm run dev
# or
yarn dev

About

https://flowppies-rosy.vercel.app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors