This project is bootstraped with Create React App. It is unopinionated with only web3.js
as an added dependency, so nothing stands in your way.
-
Truffle - a JavaScript project build system that simplifies the development of smart contracts.
npm install -g truffle
-
Web3.js - a JavaScript library for interacting with Ethereum.
npm install -g web3
Follow the simple steps below to test this app.
-
Clone this repository to your local machine using the CLI command
git clone https://github.com/cheddarking/Ballot-App-Ganache-Blockchain.git
or download it from this link -
To use this app you need to run a local Ethereum blockchain on your machine. For this you can download and install the Ganache UI app to create one
-
Open the Ganache UI app and start a local blockchain.
-
Open the truffle folder (in your cloned repo) in your terminal and run
truffle migrate --reset
. This will deploy the Ballot smart contract to the Ganache blockchain. -
Install the Metamask Wallet extension to your browser to interact with the blockchain.
-
In Metamask, click on "Add a network" and add the local blockchain to your browser with the following details:
- Network Name: Ganache
- RPC URL: HTTP://127.0.0.1:7545
- Chain ID: 5777
- Currency Symbol: ETH
-
Open the root folder in your terminal and run
npm start
to start the dev server. This will launch the app in your browser at the address http://localhost:3000. -
In Metamask, select the Ganache network you configured in step 5. Click the “Connect Wallet” button in the web page to connect Metamask to the app. This will launch Metamask. Now click “Select All” in the Metamask wizard to allow the app to connect to all the imported Ganache blockchain accounts.
-
Get voting! :)
PS: If you want to play with the app without having to clone the repo, you can do so at https://ballot-app-ganache-blockchain.vercel.app/