This repository contains an Ethereum DApp that demonstrates a Supply Chain flow between a Seller and Buyer. The user story is similar to any commonly used supply chain process. A Seller can add items to the inventory system stored in the blockchain. A Buyer can purchase such items from the inventory system. Additionally a Seller can mark an item as Shipped, and similarly a Buyer can mark an item as Received.
Here is the UML document that provides details regarding the application design.
The DApp User Interface when running should look like...
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Please make sure you've already installed Node (v10), Truffle (v5) and enabled MetaMask extension in your browser.
- Node: 10.24.1
- Truffle: 5.0.2
- Solidity: 0.5.1
- Web3: 0.20.6
The starter code is written for Solidity v0.4.24. At the time of writing, the current Truffle v5 comes with Solidity v0.5 that requires function mutability and visibility to be specified (please refer to Solidity documentation for more details). To use this starter code, please run
npm i -g [email protected]
to install Truffle v4 with Solidity v0.4.24.
A step by step series of examples that tell you have to get a development environment running
Clone this repository:
git clone https://github.com/barbietunnie/DApp-Item-Tracker-Through-Supply-Chain
Change directory to project-6
folder and install all requisite npm packages (as listed in package.json
):
cd project-6
npm install
Create the secret files .secret
and .infura
in project-6
folder to hold your truffle mnemonic and infura api keys respectively.
Launch Truffle CLI:
truffle develop
Your terminal should look something like this:
In a separate terminal window, Compile smart contracts:
compile
Your terminal should look something like this:
This will create the smart contract artifacts in folder build\contracts
.
Migrate smart contracts to the locally running blockchain using truffle-cli:
migrate
Your terminal should look something like this:
Test smart contracts:
test
All 10 tests should pass.
In a separate terminal window, launch the DApp:
npm run dev
Based on the facilities currently provided by the web app, there is no way to create different roles at the moment, so the roles that were automatically created during deployment by the first account / deploy account should be used to perform the test, as a role has been created for each scenario you will encounter.
The contract is deployed on Ropsten Testnet network as against Rinkeby due to timeouts experienced while attempting to deploy on the Rinkeby Test network
- lite server: A lightwieght node server that serves the web app and automatically refreshes the page when file changes are detected, during development.
- truffle-hdwallet-provider: HD-wallet enabled web3 provider for developing smart contracts.
- web3.js: Ethereum Javascript API that allows you to interact with a local or remote ethereum node using HHTP, IPC or Websocket.
- jQuery: Easy to use Javascript library that makes working across multitude of browsers straightforward.
- ethjs-abi: Used for encoding and decoding from the
ethers-wallet
. - truffle-blockchain-utils: Utilities for identifying and managing blockchains
IPFS was not used in the project.
- Ethereum - Ethereum is a decentralized platform that runs smart contracts
- IPFS - IPFS is the Distributed Web | A peer-to-peer hypermedia protocol to make the web faster, safer, and more open.
- Truffle Framework - Truffle is the most popular development framework for Ethereum with a mission to make your life a whole lot easier.
See also the list of contributors who participated in this project.
- Solidity
- Truffle
- IPFS