Echo NFT Battle is a decentralized application (dApp) that allows users to mint unique Echo NFTs and battle them against each other on the Ethereum blockchain. Each Echo NFT has unique attributes, and users can engage in battles to determine the strongest Echo.
- Mint unique Echo NFTs with random attributes
- Battle your Echo NFTs against others
- View the winner of each battle
- Deployed Contract on Sepolia: https://sepolia.etherscan.io/address/0x9db635bf446ce4a7160a49d17ee69e8647a4cc66
- NFTs on Block Explorer: https://sepolia.etherscan.io/token/0x9db635bf446ce4a7160a49d17ee69e8647a4cc66
- Deployed Frontend: https://d6o.github.io/echoNFTs/
- Clone the repository:
git clone https://github.com/d6o/echoNFTs.git
cd echoNFTs
- Install dependencies:
npm install
- Create a
.env
file in the root directory and add your Infura project ID, private key, and Etherscan API key (if you want to validate the contract on it):
INFURA_PROJECT=your_infura_project_url
PRIVATE_KEY=your_private_key
ETHERSCAN_API_KEY=your_api_key
- Compile the smart contracts:
npx hardhat compile
- Deploy the smart contracts to the Sepolia test network:
npx hardhat run scripts/deploy.js --network sepolia
- Note the deployed contract address from the console output.
- Run the provided script to extract the ABI:
./extract-abi.sh
- Open
static/index.html
- Replace the contract address.
- Replace the ABI using the one from
abi/EchoNFT.json
.
- Start the Go server to serve the static files:
go run main.go
- Open
http://localhost:3000
in your browser with MetaMask installed. - Connect your wallet.
- Mint a new Echo NFT by entering a name and clicking "Mint".
- Select your Echo NFT and click "Battle" to engage in a battle.
- View the winner's token ID.
To simplify the workflow, you can use the provided Makefile
to manage the project. Here are the available commands:
- Compile the smart contracts:
make compile
- Deploy the smart contracts to Sepolia network:
make deploy
- Extract the ABI:
make extract-abi
- Start the Go server:
make start-server
- Clean the project directory:
make clean
- Display help:
make help
This project is licensed under the MIT License. See the LICENSE file for details.