This project is a decentralized application (DApp) offering math quizzes powered by Ethereum smart contracts. It aims to enhance knowledge of DApp development.
- Math quizzes interacting with Ethereum smart contracts.
- Built using Solidity, Hardhat, and ethers.js.
- Frontend: TypeScript, React
- Backend: Solidity, Hardhat, ethers.js
- Blockchain: Ethereum (Polygon Amoy testnet)
-
Clone the repository:
git clone https://github.com/nabeo114/eth-math-quiz.git cd eth-math-quiz -
Install dependencies:
cd frontend npm install cd ../hardhat npm install
-
Configure environment variables:
In the
hardhatdirectory, create a.envfile:INFURA_API_KEY=your_infura_api_key_here ACCOUNT_PRIVATE_KEY=your_private_key_here
In the
frontenddirectory, create another.envfile:INFURA_API_KEY=your_infura_api_key_here
Note:
- The
ACCOUNT_PRIVATE_KEYis used for deploying contracts; ensure it holds MATIC tokens from the Polygon Faucet. - The
INFURA_API_KEYis required to connect to the Polygon Amoy testnet via Infura. Obtain it from Infura.
- The
-
Compile the smart contracts:
npm run compile
-
Deploy the contracts to the Polygon Amoy testnet:
npm run deploy
- Start the development server:
cd ../frontend npm start