Just a little dApp where digital goods might be exchanged via the Ethereum blockchain. Fetches active account from current web3 provider, and allows to create products of any non-zero price with any name, and purchasing of those products from any other account as many times as wanted. This is ideal for digital goods, for example.
Originated from the Truffle “Pet Shop” Tutorial (forked starter kit from an article about that tutorial at dappuniversity.com).
Dependencies:
- Node.js (npm)
With a working directory of the root of this repository, run the following commands.
This will install all of the required dependencies not listed above.
npm install
This will compile the smart contracts.
npx truffle compile
This will migrate the smart contracts, so that they are ready to be deployed to a blockchain.
npx truffle migrate
NOTE: Further migrations should probably be done with --reset
flag.
Dependencies:
- Ganache (or some other local blockchain)
- Ethereum-enabled browser (MetaMask extension, for example)
Follow the steps to setup a default Ganache workspace (press the quickstart button when you launch the application). After that, add it as a custom network to MetaMask using the RPC URL from Ganache. Don’t forget to import at least two accounts from Ganache (by copying private key) into MetaMask; there needs to be at least one seller and one buyer.
With the imported MetaMask accounts connected to the custom local blockchain hosted within Ganache, all that’s left is to start the website so we can actually interact with it.
npm run start
That should open up your browser to your locally hosted version of the dApp!
npx truffle test