This app can be hosted locally using Node.js, Truffle and Ganache. The installation steps are as follows:
- Download and install Node.js https://nodejs.org/en/
- Install Truffle using npm (Node.js' built-in package manager)
npm install -g truffle
- Download and install Ganache https://www.trufflesuite.com/ganache
- Add Metamask extension to your browser of choice (Chrome, Brave, Edge, Firefox)
- To host a local blockchain, Run Ganache -> Create a new workspace -> Server -> change port to 8545 -> Save workspace.
- Navigate to project folder in console and deploy the smart contracts with the commands:
truffle migrate --reset
- To host the web app locally, navigate to [project folder]/client/, and run the following commands:
npm run start
- The web app should now be available at http://localhost:8080/ on your browser.
To connect your simulated wallet on Ganache with the webapp, first run Ganache with the configured settings, then do the following:
- On Ganache, click on the key icon at the right end of the first address, and copy the private key.
- On Metamask, click on the colored circle at the top right corner -> Import Account -> Paste the private key
- With the new wallet added, change the network to Localhost 8545 (next to the colored circle).
- Host the web app locally (step 3 in the previous section) and navigate to the server on browser.
- Metamask will now prompt you to give access to the webapp, accept and your account will now be connected with the app.