First, we need to clone the repository and change the working directory. Then, we must set up environment variables for the project. Make sure to add .env
to .gitignore
.
git clone https://github.com/ayush-that/HackOn-Blocks-2024.git
cd HackOn-Blocks-2024
Use the node version manager (nvm) and set up the project to use Node v16 for seamless installation. Now install the dependencies.
nvm install 16
nvm use 16
npm i
In the .env
, add the following environment variables. Get the PRIVATE_KEY
from your MetaMask account. For Polygon zkEVM (ETH):
PRIVATE_KEY="METAMASK_PRIVATE_KEY"
NEXT_PUBLIC_CONTRACT_ADDRESS="CONTRACT_ADDRESS"
URL=https://rpc.cardona.zkevm-rpc.com
NEXT_PUBLIC_RPC_URL=https://rpc.cardona.zkevm-rpc.com
To get the value of NEXT_PUBLIC_CONTRACT_ADDRESS
, In the root directory of the project run the following commands. This will compile and deploy the smart contract.
npx hardhat compile
npx hardhat run scripts/deploy.js --network polygonZkEvmTestnet
Now, run npm run dev
or yarn dev
to start the live deployment server. You can use Vercel to deploy it too. See the Live site here.