🍀 This project is a simple decentralized counter application (DApp) that demonstrates how to build a full-stack DApp using Next.js, Web3.js, Hardhat, and Polygon zkEVM. Users can interact with the counter by incrementing and decrementing its value through a user-friendly interface. 🍀
💻 Frontend:
Next.js - A React-based framework for server-rendered applications.
⛓️ Blockchain Interaction:
Web3.js - A JavaScript library for interacting with Ethereum-based blockchains.
📜 Smart Contracts:
Hardhat - A Rust-based smart contract development framework for writing, testing, and deploying contracts.
💜 Blockchain Network:
Polygon zkEVM - A Layer 2 Ethereum-compatible scalable network, utilizing zero-knowledge rollups for efficient and secure transactions.
- Node.js (>= 14.x.x)
- Yarn (>= 1.22.x)
- Hardhat CLI
-
🛠️ Clone the repository:
git clone https://github.com/Polygon-Advocates/zkevm-dapp.git && cd zkevm-nextjs-counter-dapp
-
🛠️ Install the frontend dependencies:
cd frontend && yarn install
-
🛠️ Compile and deploy the smart contract:
cd ../backend && Hardhat build && Hardhat deploy
Make sure to copy the deployed contract address for the next step.
-
🛠️ Configure the frontend:
Create a
.env.local
file in thefrontend
directory with the following content:NEXT_PUBLIC_CONTRACT_ADDRESS=YOUR_DEPLOYED_CONTRACT_ADDRESS NEXT_PUBLIC_RPC_URL=YOUR_RPC_URL
Replace
YOUR_DEPLOYED_CONTRACT_ADDRESS
with the contract address from the previous step, andYOUR_RPC_URL
with a valid RPC URL for the Polygon zkEVM network. -
🛠️ Run the frontend development server:
cd ../frontend && yarn dev
The application should now be accessible at http://localhost:3000.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to the project.
This project is licensed under the MIT License - see the LICENSE.md file for details.