Thank you for using my Voting application.
This application consists of three parts: Smart contract, unit test and front-end.
- Run Hardhat Network: You can run a local Hardhat Network instance by running:
npx hardhat node
This will spin up a local Ethereum network. You will see output similar to:
Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
Accounts:
0x123... (1000 ETH)
0x456... (1000 ETH)
...
-
Keep the Local Node Running: Leave this terminal open with the node running. This network mimics a real Ethereum environment, but it’s only local, so transactions are fast and don't require real ETH.
-
Compile the smart contract
npx hardhat compile
- Deploy to the localtest net
npx hardhat run scripts/deploy.js --network localhost
- Run the test on the local testnet
npx hardhat test --network localhost
- Run the front-end
Leave this terminal open with the node running. Open other terminal.
npm start
MetaMask must be installed to ensure interaction between the frontend and voting contract deployed on the local testnet.
The process of a contract can be simulated through the front-end.