A example of a decentralized app that utilizes a smart contract to transfer funds (link to slides with instructions/solutions).
Make sure you have Node, the Metamask extension, and Git installed.
- Clone the repo
$ git clone https://github.com/jp3hou/dapp-demo
$ cd dapp-demo
- Install dependencies using npm
$ npm install
- Compile the smart contracts with truffle
$ npm run compile
- Run a local blockchain server using ganache
$ npm run blockchain
- Deploy smart contracts onto your blockchain server
$ npm run migrate
- Start your frontend server
$ npm run start
Open your browser to http://localhost:3000 to see your local environment! The constructor in the KatCoin.sol contract auto-mints 30 KatCoins and displays them in the frontend React app.
Find the address of your wallet in Metamask:
(Click the address to copy it to your clipboard)
Set the default web3 address to your wallet address
$ web3.eth.defaultAccount = "[Your address]"
Click on one of the cats to see the success message! You've successfully purchased one of the KatCoins!