This README file directs you how to install this project and the various dependencies on your local system and run this project locally. Before proceeding to clone, amke sure you have node@16.14.0 and greater installed in your local system.
Clone this repository in your local system by running the following command in your preferable terminal.
git clone https://github.com/CaptianJack0001/MozoHack.git After cloning the repository, move into the directory by the following command
cd MozoHack Install the various dependencies required for the project to work by running
npm install Install truffle and ganache-cli
truffle
v5.2.4
ganache-cliv6.12.2
npm install -g truffle
npm install -g ganache-cliInstall metamask browser extension Download and install metamask from here. Before proceeding further, it is advisable to split 3 terminals to avoid confusion. Run local Ethereum blockchain on first terminal
ganache-cli> Note: Do not close `ganache-cli` (the blockchain network needs to be running all the time)
Configure metamask on the browser with following details
New RPC URL: http://localhost:8545
Chain ID: 1337
Import accounts using private keys from ganache-cli to the metamask extension on the browser
Deploy smart contract to the (local) blockchain
# on the Election-blockchain-class directory
truffle migrateNote: Use
truffle migrate --resetfor re-deployments
-
Launch the development server (fronted)
npm run dev
Note: If you face text visibility errors on client side, try changing your browser to dark mode.
Repeat all the above steps similarily as done before
ganache-cli-
Now copy one of the private keys given by ganache-cli to .secrets file present in root folder
-
Now we need to create a new network i.e. Mumbai faucet
-
Next, click on Networks and then Add Network:
-
Here, we will add the following configurations for the Mumbai test network as listed here: Network Name: Mumbai TestNet New RPC URL: https://rpc-mumbai.maticvigil.com Chain ID: 80001 Currency Symbol: Matic
-
Save this, then you should be able to switch to and use the new network!
Finally, you will need some testnet Matic tokens in order to interact with the applications. To get these, you can visit the Matic Faucet, inputting the address of the wallets that you would like to request the tokens.
-
Now we have some test Matic in our accounts (typically 0.5 Matic)
-
Run this command in root of the project directory:
$ truffle compile
$ truffle migrate --reset --network maticContract will be deployed on Matic's Mumbai Testnet
- finally run
$ npm run dev