Skip to content

Games with independent backends where game state is stored on chain via walrus on flow blockchain

Notifications You must be signed in to change notification settings

blockvished/chain-play-arcade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎮 Chain Play Arcade

A decentralized, competitive gaming platform combining on-chain logic, staking mechanics, and AI-powered post-match analysis.

License Next.js Solidity Foundry Node.js

Our smart contract is deployed on Flow testnet

Chain Play Arcade is an On-chain gaming ecosystem where players can compete in skill-based tournaments for real rewards. The platform leverages smart contracts for transparent and trustless event management, prize distribution, and game logic.


📖 Table of Contents


About The Project

We’re building a complete ecosystem for competitive gaming on the blockchain. Our platform is designed to be transparent, secure, and engaging for both event organizers and players.

Here’s the core gameplay loop:

  1. Admin Portal: Event organizers use a dedicated admin interface to create and define new games and tournaments directly on the blockchain. They can configure crucial parameters like prize pools, minimum stake amounts, and event durations through our GameHub and GameFactory smart contracts.

  2. Player Dashboard: Players can browse a list of tournaments, and we have to stake crypto to join a tournament after that, play button enables to play the game.

  3. Unique Gameplay: Our first featured game is a unique 4x4 Tic-Tac-Toe variant. To win, a player must align 4 of their marks in a row, column, or diagonal. The twist? Every 4th turn, your move from 4 turns prior is erased. This dynamic rule prevents draws and encourages strategic, forward-thinking play.

  4. Blockchain usecase: The state of gameplay is stored on walrus storage, and then its unique blobId is stored in the smartcontract to view the state of everygame of the event.

future scope (only frontend, smartcontract logic done)

  1. AI Post-Match Analysis: After each match, a comprehensive result sheet is generated (total moves, time played, move history). This data is fed to an autonomous AI agent hosted on AgentVerse, which provides a strategic analysis of the game, offering insights on how players could have improved their performance.

  2. Claim Rewards&NFTs: When a tournament's duration ends, the smart contract automatically calculates the final leaderboard and distributes the prize pool to the top-performing players. When claiming prizes unique NFT's will also be minted on the way .


✨ Partners integration:

  • Flow: We have deployed our whole Game logic and Gameplay smartcontracts on the flow testnet
  • Walrus: Used Walrus as storage paltform for our gamestate, which is crutial for our project idea. later published blobId on the blockchain for transparency and data retrieval
  • Provably Fair Gameplay: Game logic is executed on-chain for maximum transparency.
  • AI-Powered Strategic Analysis: Get personalized feedback on your gameplay from an AI coach.
  • Automated, Trustless Payouts: Winners are rewarded automatically from the prize pool.
  • Modern Web Interface: A sleek and responsive frontend built with Next.js and shadcn/ui.

🛠️ Tech Stack

This project is a full-stack dApp with three main components:

  • Blockchain (Smart Contracts)

    • Solidity: For writing the smart contracts.
    • Foundry: For compiling, testing, and deploying contracts.
    • OpenZeppelin: For secure, community-vetted contract standards (implied).
    • Walrus: Walrus for storing the game states in json.
    • Flow: Deployed on flow blockchain.
  • Frontend

    • Next.js: React framework for the user interface.
    • TypeScript: For type-safe code.
    • Wagmi & Ethers.js: For interacting with the blockchain (wallet connection, contract calls).
    • Tailwind CSS & shadcn/ui: For styling and UI components.
  • Backend

    • Node.js & Express.js: For handling off-chain logic, such as managing game sessions and communicating with the AI agent.

🚀 Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

Make sure you have the following installed on your machine:

Installation

  1. Clone the repository:

    git clone [https://github.com/blockvished/chain-play-arcade.git](https://github.com/blockvished/chain-play-arcade.git)
    cd chain-play-arcade
  2. Set up the Smart Contracts:

    cd smart_contracts
    forge install
    forge build
  3. Set up the Backend:

    cd ../backend
    npm install
  4. Set up the Frontend:

    cd ../frontend
    npm install
  5. Create Environment Variables: Create a .env.local file in the frontend directory and add the necessary environment variables.

    NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID="YOUR_WALLETCONNECT_PROJECT_ID"
    NEXT_PUBLIC_ALCHEMY_API_KEY="YOUR_ALCHEMY_API_KEY"
    # Add other contract addresses and backend API URLs as needed

How to Run Project

  1. Start a local node (optional, for testing): Open a terminal and run:

    anvil
  2. Deploy the Smart Contracts: In the smart_contracts directory, deploy your contracts using a Foundry script. Update the script with your desired parameters first.

    cd smart_contracts
    forge script script/GameHub.s.sol --rpc-url <YOUR_RPC_URL> --private-key <YOUR_PRIVATE_KEY> --broadcast
  3. Run the Backend Server: In a new terminal, navigate to the backend directory and start the server.

    cd backend
    npm run start # Or your dev script
  4. Run the Frontend Application: In another terminal, navigate to the frontend directory and start the development server.

    cd frontend
    npm run dev

    Open http://localhost:3000 in your browser to see the application.


🤝 Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📜 License

Distributed under the MIT License. See LICENSE for more information.

About

Games with independent backends where game state is stored on chain via walrus on flow blockchain

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •