Skip to content

Origin Chain is a blockchain-based supply chain management system designed for any type of product. It ensures transparency, security, and efficiency by leveraging smart contracts on the blockchain. Origin Chain reduces administrative overhead and enhances trust among all supply chain participants.

License

Notifications You must be signed in to change notification settings

Mohit6304/OriginChain

Repository files navigation

Origin Chain


Origin Chain

   

A Supply Chain Management System with Solidity.

Description

Origin Chain is a blockchain-based supply chain management system designed specifically for agricultural products, though it is adaptable to other types of supply chains. This system leverages smart contracts to ensure a transparent and secure transfer of products from the raw material supplier to the end customer. The use of blockchain technology reduces administrative overhead, increases transparency, and builds an efficient root of trust among all parties involved.

Demo

Origin.Chain.Demo.mp4

Architecture

The smart contract is written in Solidity and is compiled, migrated, and deployed using Truffle.js on the Gode Testnet blockchain network. The frontend uses Web3.js to interact with the smart contract and the Gode Testnet blockchain network. MetaMask Wallet is used to perform transactions between each component in the supply chain.

Supply Chain Flow

Supply Chain Flow

Smart Contract Working Flow

Smart Contract Working Flow

This smart contract models various roles and stages involved in the supply chain of agricultural products:

  • Raw Material Supplier: Provides the raw materials required for production.
  • Manufacturer: Converts raw materials into finished products.
  • Distributor: Distributes the products to retailers.
  • Retailer: Sells the final products to customers.
  • Customer: The end consumer of the products.

The contract owner deploys the contract and is responsible for authorizing various roles like retailer, manufacturer, etc. It stores information about the products, such as name, description, and current stage in the supply chain. Functions like addRMS(), addManufacturer(), addDistributor(), and addRetailer() are used by the contract owner to add new players to the supply chain, ensuring transparency and accountability.

Registration Process to Add in Blockchain

Registration Process

  1. Registration: The raw material supplier, manufacturer, distributor, and retailer register on the blockchain.
  2. Owner Verification: The owner checks the addresses.
    • Valid Address: Verified and registered.
    • Invalid Address: Not registered.
  3. Ledger: Every transaction is recorded in the ledger, and any node can view the transaction.

Setting up Local Development

Step 1: Installation and Setup

  1. VSCode: Download from here.
  2. Node.js: Download the latest version from here and check the version using terminal: node -v.
  3. Git: Download the latest version from here and check the version using terminal: git --version.
  4. Ganache: Download the latest version from here.
  5. MetaMask: Install as a browser extension from the Chrome Web Store or Firefox Add-ons store.

Step 2: Create, Compile & Deploy Smart Contract

  1. Open VSCode and open the terminal by pressing Ctrl + '.

  2. Clone the project:

    git clone https://github.com/Mohit6304/OriginChain.git
  3. Install Truffle globally:

    npm install -g truffle
  4. Install dependencies:

    npm install
  5. Compile the smart contract:

    truffle compile
  6. Deploy the smart contract:

    • Open Ganache and create a new Workspace. Copy the RPC Server Address.
    • Add the RPC address in truffle-config.js and replace the host address and port address with your Ganache RPC.
    • Open terminal and run:
      truffle migrate

Step 3: Run DAPP

  1. Open a second terminal and enter the client folder:

    cd client
  2. Install all packages in the package.json file:

    npm install
  3. Install Web3:

    npm install --save web3
  4. Run the app:

    npm start

    The app gets hosted by default at port 3000.

Step 4: Connect MetaMask with Ganache

  1. Start Ganache: Start the Ganache application and note the RPC server URL and port number.

  2. Connect MetaMask:

    • Open MetaMask in your browser and click on the network dropdown in the top-right corner.
    • Select "Custom RPC" and enter the RPC server URL and port number for your Ganache instance. Click "Save".
  3. Import an account:

    • In Ganache, click on the "Accounts" tab and select the first account listed. Click on the "Copy" button next to the "Private Key" field to copy the private key.
    • In MetaMask, click on the three dots in the top-right corner, select "Import Account", and paste the private key into the private key field. Click "Import".

License

This project uses an MIT license.

Documentation

About

Origin Chain is a blockchain-based supply chain management system designed for any type of product. It ensures transparency, security, and efficiency by leveraging smart contracts on the blockchain. Origin Chain reduces administrative overhead and enhances trust among all supply chain participants.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published