This repository contains a Dapp as a demo concept on how you can automate and manage payments and the full life cycle of products, in a transparent way, on a Ehtereum blockchain, using smart contracts.
Using such system would give users visibility
, transparency
and confidence
at every step.
Supply chain workflow
(high level example):
- Seller (owner of smart contract) creates new product.
- New product is stored on blockchain with all necessary details and with uniqe address for payment (address of a new contract that has been created for handling the payment of that product).
- Seller informs the customer who wants to purchase the item with a price and address to make the payment.
- The sustomer is making a payment, transferring the funds to required address.
- Payment is automatically detected by listening to the events on a smart contract.
- Once the payment is completed and detected, now the seler can update the status of product, to notify the warehouse to ship the product to the customer.
Described Dapp is implemented with ReactJS, with Material-UI on top. For working with ethereum blockchain, Truffle was used with React Truffle Box boilerplate and MetaMask for interacting with Dapp. Ownable smart contract was used from OppenZeppelin.
Here is the aplication showing full life cycle of one product managed by smart contracts: from crating a new product, making and handling the payment and shipping the new product once the payment is completed.
You can view that by following the status and movement of a product from one table to another after each step:
In this repository you may find:
truffle-config.js
file - contains solidity compiler version and the port number for local development blockchain.contracts
directory - contains smart contracts for Dapp:ProductManager.sol
andProductPaymenthandler.sol
migrations
directory - contains migration files for smart contracts.client
directory - contains ReactJS app.
NodeJS version: v10.15.0
.
Solidity compiler version: v0.6.6
.
Truffle: v5.1.40
.
Setting up and running the application :
- Install truffle:
npm install truffle -g
- Install npd moduls:
cd client
&npm install
- Start truffle developmnet blockchain:
truffle development
- Compile and migrate smart contracts to the local blockchain (from truffle console):
migrate
- Start react app:
cd client
&npm start