Skip to content

sbera13/supplyChain_blockchain

Repository files navigation

Supply-Chain-Dapp

Description

Managing a supply chain is challenging and requires extensive administrative infrastructure. Smart contracts on the blockchain have the potential to streamline supply chain management by minimizing administrative tasks and reducing paperwork. By implementing a supply chain dApp, which leverages blockchain technology, the process of transferring products from manufacturers to customers through online e-commerce platforms becomes more transparent, secure, and efficient. This not only reduces paperwork but also enhances transparency and establishes a reliable Root of Trust within the supply chain.

Architecture

The smart contract is being written with Solidity which is then compiled, migrated and deployed using Truffle.js on the local blockchain network created using Ganache-cli.The frontend uses Web3.js to communicate with the smart contract and local blockchain network and is written using React.js framework for better component and state lifecycle management.

Flow

Screenshots

Home Page


The admin adds accounts to their respective roles


Manufacturer adds different manufactured products' data in the blockchain


List of all the manufactured products


Third party(e.g. E-commerce websites) can view and buy the products from different manufacturers


After a third party buys a product, manufacturer ships the product to third party


Third party recieves the shipped product


Customers can view and buy products from different third parties


After a customer buys a product, third party ships the product to local delivery hub


Delivery hub receives the product from third party


Delivery hub ships the product to the customer who purchased it


Customer receives the product from delivery hub


Customer views all the purchased products till date

Working

The lifecycle of a product starts after it is manufactured and the product and manufacturer details are entered in the blockchain. The current product data is stored as product history with the current owner being the manufacturer.

Now this product shall be available to the Third Party for purchase. On being purchased by a Third Party seller, the owner is set to Third Party and the present data gets pushed to the blockchain. Simultaneously, the product is shipped by the manufacturer and is received by the Third Party and the details of the Third Party seller are entered. Each of these checkpoint's data is stored in product history with the state being updated at each step.

The online purchase of the product takes place from the Third Party. When the customer orders the product, it is shipped by the Third Party and received by the delivery hub. Here the customer address is stored, owner is set to Delivery Hub, details of the Delivery Hub are fed and the current data state gets pushed to the blockchain. Finally the product is shipped by the Delivery Hub and received by the customer and the current and final state gets pushed to the blockchain

All of these steps are carried out only after complete verification of product history while entering a checkpoint. (eg:- Customer accepts and confirms the product by clicking the receive button from his account only after it verifies the product).

Installation and Setup

Prerequisites : npm, git

Clone the repository

git clone https://github.com/bsandipan99/supplyChain_blockchain.git && cd supplyChain_blockchain

Install dependencies

npm i

Install ganache-cli

npm i -g ganache-cli

Configure ganache-cli for 10 accounts and extend gasLimit to 6721975000 and beyond, so as to have enough gas for migrating the smart contracts.

ganache-cli --accounts 10 --gasLimit 6721975000

Migrate the contracts

truffle migrate --network=develop --reset

Open a second terminal and enter the client folder

cd client

Install all packages in the package.json file

npm i

Setup an .env file using the nano .env command and enter the google maps api key and set the react rpc port to 8545 since the ganache-cli runs on the same port by default. The final .env file must look like this

REACT_APP_GOOGLE_MAP_API_KEY=*************************
REACT_APP_RPC=http://127.0.0.1:8545/

Run the app

npm start

The app gets hosted by default at port 3000.

License

This project uses an MIT license.

About

A supply chain management system using blockchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published