rgottleber / functions-demo-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pokémon Battle SmartContract App with Chainlink Functions

Leverage the power of Chainlink Functions to battle Pokémon on the blockchain. This application allows users to select two Pokémon and initiate a battle via smart contracts.

Table of Contents

Overview

In this application, users select their favorite Pokémon to go head-to-head in a blockchain battle, with outcomes determined by Chainlink Functions.

Objective

To showcase the integration of Chainlink Functions in a gaming scenario where Pokémon engage in battles on the Ethereum blockchain.

Prerequisites

  • Familiarity with Ethereum and smart contracts.
  • MetaMask or another Ethereum wallet.
  • Ethereum (for gas fees) and test LINK tokens for Chainlink functions.

Setup & Deployment

  1. Clone the Repository

    git clone https://github.com/[your-github-username]/pokemon-battle-smartcontract.git
    cd pokemon-battle-smartcontract
  2. Install Dependencies

    npm install
  3. Set up Environment Variables

    Create a .env file in the backend directory and add the necessary configurations.

    PRIVATE_KEY=Your_Ethereum_Wallet_Private_Key
    POLYGONRPC_URL=Your_Infura_Key
    
  4. Deploy the SmartContract

    Remember to create subscription through Functions UI.

  5. Run the App Locally

    Go to frontend/. Update contract address and subscription id and run

    npm run deb
    

    This will launch the pokemon app on your local server, usually at http://localhost:3000/.

Screenshot 2023-10-25 at 8 16 09 AM

Usage

  1. Visit the deployed web app.
  2. Connect your Ethereum wallet (e.g., MetaMask).
  3. Select two Pokémon from the provided list.
  4. Click on the 'Battle on SmartContract' button.
  5. Approve the transaction in your Ethereum wallet.
  6. Watch as Chainlink Functions determine the battle outcome and display it on the app.

Contributing

Contributions, issues, and feature requests are welcome. Feel free to check issues page if you want to contribute.

License

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

About


Languages

Language:JavaScript 86.9%Language:CSS 7.2%Language:Solidity 5.8%Language:Shell 0.0%