This project demonstrates a decentralized application (dApp) for supply chain management built on the Ethereum blockchain. It enables the creation, management, transfer ownership, and tracking of products in a transparent and secure manner, using blockchain technology to ensure data integrity.
- Create Product: Add new products with a unique ID and assign an owner.
- Update Product State: Change the state of products (e.g., Created, In Transit, Delivered).
- View Product Details: Retrieve detailed information about a product, including its current state and owner.
- Transfer Ownership: Ownership of a product can be transferred to another user by entering the product ID and the new owner's Ethereum address.
- Frontend Interaction: Simple web interface for interacting with the blockchain.
Ensure the following tools and accounts are set up:
- Node.js: Install Node.js and npm for package management.
- MetaMask: Install and configure MetaMask to connect to the blockchain. It will be used for all transactions and interactions with the smart contract on the testnet.
- Truffle Suite: Install Truffle globally for Ethereum smart contract development.
- Infura Account: Set up a project on Infura to connect with the Sepolia testnet.
- Sepolia Test ETH: Obtain test Ether from a Sepolia faucet for deploying and interacting with the smart contract.
- Install Node.js and Truffle.
- Install MetaMask and add the Sepolia testnet configuration.
- Create an Infura Project and copy the project ID for blockchain connectivity.
- Create a new project directory and initialize a Truffle project.
- Install the necessary dependencies, including the HDWalletProvider for connecting to the blockchain.
-
Create a
.env
file and add your MetaMask seed phrase and Infura project ID:MNEMONIC=your_metamask_private_key INFURA_PROJECT_ID=your_infura_project_id
-
Update the Truffle configuration file (
truffle-config.js
) to include the Sepolia testnet settings.
- Create a smart contract to manage the supply chain workflow.
- Compile the contract using Truffle.
- Add a migration script to deploy the contract on the Sepolia testnet.
- Connect to the Sepolia testnet using Infura and deploy the contract using Truffle.
- Verify the deployment and note the contract address for frontend integration.
- Create a simple frontend using HTML, CSS, and JavaScript.
- Integrate Web3.js to connect the frontend with the Ethereum blockchain.
- Add functionality to:
- Create a product.
- Update product states.
- View product details.
- Transfer ownership of products.
- Serve the frontend using a lightweight HTTP server such as lite-server.
- Open the application in a browser and connect it to MetaMask.
- Interact with the deployed smart contract via the frontend using MetaMask for transaction confirmation.
- Test the contract functionality locally using Ganache.
- Verify interactions on the Sepolia testnet using a blockchain explorer like Etherscan for Sepolia.
- Deploy the frontend on a hosting platform like Vercel, Netlify, or GitHub Pages.
- Share the deployed application URL for easy access.
This project provides hands-on experience with blockchain development, including smart contract creation, Ethereum dApp integration, and interaction with the Sepolia testnet. It highlights the practical use of blockchain technology for enhancing supply chain transparency and efficiency.