Skip to content

Latest commit

 

History

History
147 lines (83 loc) · 4.9 KB

File metadata and controls

147 lines (83 loc) · 4.9 KB

Avax Gods - Online Multiplayer Web3 NFT Card Game

image

Description -> Web3 based battle game.

Run this project

How to setup locally?

To run this project locally, follow these steps.

Prerequisites

  1. Install Git
  2. Install Node.js version "v18.16.0" for this dapp, use nvm for better management of node versions.
  3. Install Yarn (optional)
  4. Install Metamask
  5. Create RPC API Enpoint for Avalanche Test Network Fuji(C-chain)

Please follow screenshots

image

image

image

image

image

  1. Add Custom Network RPC

    1. Fuji url: '[https://app.zeeve.io/shared-api/avax/100eff9d918b3e643441492c6aa5b2794dbffa7326e42e5d/]

      Fuji's C-Chain: (https://app.zeeve.io/shared-api/avax/3fa74ad9c39f971208a9fe279896372d3ccf05c05dad07c0/ext/bc/C/rpc)'

    2. Chain Id: 43113

  2. Fund your wallet from the Avax Faucet

Application Setup Steps

1. Clone the project locally, change into the directory, and install the dependencies:
git clone https://github.com/Zeeve-App/sample-dapps.git

cd sample-dapps/dapps/project_web3_battle_game
Instructions on setting up the Web3 part of the project
  1. cd web3
  1. npm install

  2. Create a .env file and specify a PRIVATE_KEY variable.

  3. To get to the private key, do the following steps:

    1. Click on the identicon in the top right.
    2. Select the account you'd like to export.
    3. On the account page, click on the menu (three dots) in the upper right corner, and then on the "Account Details" button.
    4. Click “Export Private Key”.
    5. To access your private key, you'll now need to enter your wallet password. Once you've done so, click “Confirm” to proceed.
    6. Your private key will now be revealed. Click to copy it, and save it somewhere safe. (Note: we aren't showing it in the below screenshot for obvious reasons -- but yours will be there.)
    7. Click “Done” to close the screen.

Get Private Key

and update .env file

  1. Compile the contract by running the npx hardhat compile command

  2. To deploy to Fuji Avalanche test network, update the configurations located in hardhat.config.ts to use a private key and, deploy to a private RPC like Zeeve.

    Go to Zeeve RPC endpoint

    image

    Click on View Chains and copy HTTPS e.g. for reference and update config file. https://app.zeeve.io/shared-api/avax/3fa74ad9c39f971208a9fe279896372d3ccf05c05dad07c0/ext/bc/C/rpc

import dotenv from 'dotenv';
import '@nomiclabs/hardhat-ethers';

dotenv.config();

export default {
  solidity: {
    version: '0.8.16',
    settings: {
      viaIR: true,
      optimizer: {
        enabled: true,
        runs: 100,
      },
    },
  },
  networks: {
    fuji: {
      url: 'https://app.zeeve.io/shared-api/avax/3fa74ad9c39f971208a9fe279896372d3ccf05c05dad07c0/ext/bc/C/rpc',
      gasPrice: 225000000000,
      chainId: 43113,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
}
  1. Deploy the smart contract on the Fuji test network by running the npx hardhat run scripts/deploy.ts --network fuji command

Move the /artifacts/contracts/AVAXGods.json file to the /contract folder on the frontend application client Copy the address of the deployed contract from the terminal and paste it into the /src/contract/index.js file of the frontend application client

Instructions on setting up the client part of the project
  1. cd client

  2. npm install

  3. npm run dev