This repository contains the needed code (Solidity smart contracts, and other assets) to run a pet shop example dApp running on a Ethereum Virtual Machine (EVM) compatible blockchain running in local, using Ganache, and other tools from the Truffle Suite.
This codebase is the result of following the full tutorial available at https://trufflesuite.com/tutorial/. I highly encourage you to follow the full tutorial to fully understand what is happening behind the scenes.
You will need to install the following software to run this code:
After installing the needed software, execute the following commands to have the full example running:
$ npm install
Simply execute the Ganache executable file you've previously downloaded & installed
Go to Contracts tab and link the truffle-config.js
file you'll find in your local project. This will help Ganache to add some interesting data to your transactions when we interact with the smart contracts.
$ truffle compile && truffle migrate
$ npm run dev
You should add an additional network using your Ganache RPC server, and should also add an additional wallet. You can use the private key from the first available virtual wallet. (More information, screenshots and instructions on the tutorial page.)
When you go to http://localhost:3000/
you will find your Pet Shop. If you followed the previous steps, Metamask should ask you for permission to connect to your local wallet, and you should be able to adopt dogs. Every time you adopt a dog, Metamask will ask for permission for the transaction, and gas will be deducted from your virtual wallet.
Enjoy!
Full credits to Truffle Suite and its tutorial guide at https://trufflesuite.com/tutorial/