An open API service indexing awesome lists of open source software.

https://github.com/capybara003/web3-battle-game

Avax Gods is a Web3 multiplayer NFT card game built on the Avalanche blockchain, where players battle using unique NFT cards in a decentralized gaming experience. ๐Ÿš€๐Ÿƒ
https://github.com/capybara003/web3-battle-game

avalanche avax battleship-game blockchain casino dapp game nft nftcard wallet web3

Last synced: about 1 year ago
JSON representation

Avax Gods is a Web3 multiplayer NFT card game built on the Avalanche blockchain, where players battle using unique NFT cards in a decentralized gaming experience. ๐Ÿš€๐Ÿƒ

Awesome Lists containing this project

README

          

# **๐Ÿ”ฅ Avax Gods - Online Multiplayer Web3 NFT Card Game**
![Gameplay](https://i.ibb.co/4P2C08x/image.png)

Welcome to **Avax Gods**, an immersive **Web3-powered multiplayer NFT card game** built on the **Avalanche blockchain**! ๐Ÿƒโšก This game lets players battle in a **decentralized** environment, trade unique NFT cards, and experience the power of smart contracts in gaming.

## **๐Ÿš€ Ready to build and play? Letโ€™s dive in!**

---

## **๐Ÿ› ๏ธ Setting Up the Web3 Environment**

To deploy and interact with the smart contract, follow these steps carefully:

### **๐Ÿ“Œ Step 1: Navigate to the Web3 Directory**
Move into the Web3 folder where the smart contract and blockchain logic are stored:
```sh
cd web3
```

### **๐Ÿ“Œ Step 2: Initialize Hardhat**
Set up **Hardhat**, the Ethereum development environment, by running:
```sh
npx hardhat
```
- Select **TypeScript** when prompted (`y โ†’ typescript โ†’ enter โ†’ enter`).
- This sets up a project with TypeScript support for better security and development experience.

### **๐Ÿ“Œ Step 3: Install Dependencies**
You'll need several dependencies to work with smart contracts and blockchain interactions:

๐Ÿ”น **OpenZeppelin Contracts** for secure smart contract development:
```sh
npm install @openzeppelin/contracts dotenv @nomiclabs/hardhat-ethers
```
๐Ÿ”น **Hardhat Development Toolbox** to ease contract deployment and testing:
```sh
npm install --save-dev "hardhat@^2.12.0" "@nomicfoundation/hardhat-toolbox@^2.0.0"
```

---

## **๐Ÿ”— Connecting Your Wallet to Avalanche Testnet**

### **๐Ÿ“Œ Step 4: Install Core Wallet Extension**
For seamless interaction with the **Avalanche blockchain**, install [Core Wallet](https://chrome.google.com/webstore/detail/core/agoakfejjabomempkjlepdflaleeobhb), a **Metamask alternative** designed for Avalanche dApps.

### **๐Ÿ“Œ Step 5: Enable Testnet Mode**
After installing Core Wallet:
1. Open the **Core extension**.
2. Click the **hamburger menu (โ˜ฐ) in the top left**.
3. Navigate to **Advanced Settings**.
4. Turn on **Testnet Mode** to interact with the Fuji test network.

### **๐Ÿ“Œ Step 6: Fund Your Wallet with AVAX**
You need testnet AVAX tokens to deploy and interact with the smart contract.
1. Visit the [AVAX Faucet](https://faucet.avax.network/).
2. Enter your wallet address and request **free testnet AVAX**.

---

## **๐Ÿ”‘ Setting Up Private Keys Securely**

### **๐Ÿ“Œ Step 7: Create a `.env` File**
To securely store your private key, create a **.env** file inside the `web3` directory:
```sh
touch .env
```
Inside `.env`, add your **PRIVATE_KEY**:
```sh
PRIVATE_KEY=your_private_key_here
```

### **๐Ÿ“Œ Step 8: Extract Your Private Key from Core Wallet**
1. Open **Core Wallet** โ†’ Click โ˜ฐ (menu).
2. Go to **Security & Privacy** โ†’ Click **Show Recovery Phrase**.
3. Enter your password and copy the **mnemonic phrase**.
4. Go to [wallet.avax.network](https://wallet.avax.network/) โ†’ Click **Access Wallet**.
5. Select **Mnemonic Key Phrase** โ†’ Paste your recovery phrase.
6. In the sidebar, go to **Manage Keys** โ†’ **View C-Chain Private Key**.
7. Copy your private key and paste it into the `.env` file.

๐Ÿ”ด **WARNING**: Never share your **private key**โ€”treat it like your password!

---

## **๐Ÿ“œ Deploying the Smart Contract**

### **๐Ÿ“Œ Step 9: Copy the Required Files**
- **`hardhat.config.ts`** โ†’ Configuration file for Hardhat.
- **`deploy.ts`** โ†’ Deployment script.
- **`AvaxGods.sol`** โ†’ The actual smart contract.

### **๐Ÿ“Œ Step 10: Compile the Smart Contract**
Ensure there are no syntax errors before deployment:
```sh
npx hardhat compile
```
If everything is correct, youโ€™ll see a success message confirming compilation.

### **๐Ÿ“Œ Step 11: Deploy to Avalanche Fuji Testnet**
Run the following command to deploy your smart contract:
```sh
npx hardhat run scripts/deploy.ts --network fuji
```
After deployment, copy the **contract address** displayed in the terminal.

---

## **๐Ÿ“‚ Integrating the Smart Contract with the Frontend**

### **๐Ÿ“Œ Step 12: Move the Compiled Contract JSON File**
Once the contract is deployed, move the compiled **AVAXGods.json** file into the frontend:
```sh
mv artifacts/contracts/AVAXGods.json frontend/contract
```

### **๐Ÿ“Œ Step 13: Link the Contract Address in the Frontend**
Open `/contract/index.js` in the frontend and paste the **contract address** you copied earlier.

---

## **๐ŸŽฎ Youโ€™re Ready to Play!**

๐Ÿš€ Now your **Avax Gods** NFT card game is fully deployed on the **Avalanche Fuji Testnet**! Players can **battle, trade NFTs, and experience decentralized gaming** like never before.

๐Ÿ’ก Want to customize the game? Modify the **Solidity smart contract** and **React frontend** to add new features!

๐Ÿ’ฌ If you run into any issues, feel free to ask for help or contribute to the project!

**Happy coding, and may the best player win!** ๐Ÿƒ๐Ÿ”ฅ