Supply Chain Tracking on Ethereum
This repository containts 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.
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 ganache-cli, Truffle and enabled MetaMask extension in your browser.
cd supply_chain
npm install
# Run tests
truffle develop
> test # in truffle console, exit to proceed (ctrl+c)
# Deploying DApp to the network
# Compile truffle contracts
truffle compile
# Option 1. Deploy DApp to the local ganache network
truffle migrate --network local
# Option 2. Deploy DApp to Sepolia testnet
touch .env # create .env file and put your sepolia private key under PRIVATE_KEY_SEPOLIA (see truffle-config for use case)
truffle migrate --network sepolia # truffle is flaky, so if encounter error just try deploying again
# Launch frontend
npm run dev # better use live server as it's more convenient and less flaky than npm
# Using frontend and metamask wallet assign Farmer and other roles to your other accounts and take role-specific actions from corresponding accounts
- Contract address on Sepolia testnet:
0x7fBD77efd292eEB2919A5bBB0f5E0106802cB227
(see package.json)
lite-server
for local frontend development in vscodetruffle/hdwallet-provider
for using private keysdotenv
for storing private keys
The DApp User Interface when running looks like...