Skip to content

simple spin to win game made with web3 js, SwisstronikPlugin and solidity plus metamask

Notifications You must be signed in to change notification settings

Hussseinkizz/lotto-spin

Repository files navigation

Lotto Spin - Incomplete

Welcome to the **Lotto Spin ** game, a decentralized, emoji-themed spin-to-win game. This project demonstrates the integration of Web3.js, Solidity smart contracts, MetaMask, and the Swisstronik Plugin. Players can stake ETH, guess an emoji, spin the wheel, and potentially win based on their guess. The game operates on the Ethereum blockchain.

Features

  • Blockchain Integration: Interact with Ethereum smart contracts using Web3.js.
  • Emoji-based Game: Guess the correct emoji after each spin to win.
  • Real-Time Wallet Interaction: Connect and authenticate with MetaMask.
  • Swisstronik Plugin: Utilizes Swisstronik for enhanced blockchain functionality.
  • Stake & Winnings: Manage your ETH stake and track your winnings.

How to Set Up the Project

  1. Clone the Repository:

    git clone https://github.com/your-username/lotto-spin.git
    cd lotto-spin
  2. Install Dependencies:

    npm install
  3. Configure MetaMask: Ensure that MetaMask is connected to a test network and you have some test ETH in your account.

  4. Start the Application:

    npm start

    The app will be available at http://localhost:3000.

How to Play

  1. Connect MetaMask: Click the "Connect Wallet" button to authenticate with MetaMask.

  2. Stake ETH: Enter the amount of ETH you wish to stake and start the game.

  3. Select an Emoji: Choose an emoji (πŸŽ‰, πŸ€, πŸ’Ž, or πŸ‡) to guess.

  4. Spin the Wheel: Click "Spin" and wait for the result. The game will randomly select an emoji.

  5. Check Result: If the selected emoji matches the result, you win!

  6. End Game or Withdraw: At any point, you can stop the game or withdraw your winnings.

Technology Stack

  • Frontend: React.js for UI
  • Blockchain Interaction: Web3.js for blockchain communication
  • Smart Contracts: Solidity smart contract for managing game logic
  • Wallet: MetaMask for user authentication and transaction signing
  • Plugin: SwisstronikPlugin for enhanced blockchain functionality
  1. Game Logic:

    • startGame(): Starts a new game by interacting with the smart contract.
    • spin(): Spinning mechanism that selects a random emoji and checks for a win.
    • stopGame(): Ends the game and resets the state.
    • getWinnings(): Withdraws the player's winnings.
  2. UI Interaction: Players interact through a user-friendly interface that allows them to input their stake, choose an emoji, and spin the wheel.

Disclaimer

Lotto Spin operates on a test network and uses test ETH only. This project is for demonstration purposes to showcase blockchain integration with games and is not intended for real-world use.

Enjoy the game and feel free to explore the code and smart contract logic!

About

simple spin to win game made with web3 js, SwisstronikPlugin and solidity plus metamask

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published