Supply Chain Tracking System

Supply Chain Tracking System

Overview

This tutorial outlines the process of creating a blockchain-based supply chain tracking system using Ignite CLI. The system enables businesses to transparently track products from production to delivery.

Key Components

  1. Product Registration: Recording unique product identifiers.
  2. Tracking Movements: Logging product movements or status changes.
  3. Verification and Audits: Facilitating product history verification and audits.
  4. Stakeholder Participation: Assigning roles and access levels to various stakeholders.

Steps for Development

Step 1: Initial Chain Setup

Initiate your blockchain project with Ignite CLI:

ignite scaffold chain supplychain && cd supplychain

Step 2: Module Development

Create modules for product management and audit:

ignite scaffold module product
ignite scaffold module audit

Step 3: Defining Data Structures

Define data structures for products and their movements.
We're scaffolding a list for the products and map the movements with their productID accordingly.

ignite scaffold list product name description origin --module product
ignite scaffold map movement productID location timestamp --module product

Step 4: Working with the Product

  1. Set Config to chain-id:

In order to not use the --chain-id flag on any command that uses the tx transaction generator, lets set the config for our chain-id.

supplychaind config set client chain-id supplychain
  1. Registering a Product

To register a product, you would use the create-product message you've defined in Step 4. Here's how you could present it:

supplychaind tx product create-product "Eco-friendly T-shirt" "100% organic cotton, size M" "Factory 1, Country ElSalvador" --from alice --chain-id supplychain

Show your product:

supplychaind query product show-product 0

First input is the name, second the description, and third origin correspond to the product's origin. --from specifies the blockchain address of the user performing the registration (likely a manufacturer alice in this context).

  1. Recording Product Movement

To log a product's movement, the recordMovement message comes into play:

supplychaind tx product create-movement "0" "0" "Distribution Center 678, City DEF" "23/12/2023 3:00" --from bob --chain-id supplychain
supplychaind tx product create-movement "1" "0" "Distribution Center 123, City XYZ" "23/12/2023 8:00" --from bob --chain-id supplychain

Show the movement:

supplychaind query product show-movement 0

supplychaind query product show-movement 1

Clarify that productID, first input, is the unique identifier of the product being moved, as well as ID. location as third parameter specifies the new location of the product, and a timestamp recorded when the product arrived. --from is the address, likely a transporter or distributor.

  1. Tracking Product Status

List all existing products with:

supplychaind query product list-product

For tracking the current status or location of a product, a user would query the system using the productID:

supplychaind query product show-product 0

This command retrieves details of the product, including its current status or location. It's a straightforward way for any stakeholder to check on a product.

Verifying Product Movement History

To verify a product's movement history, stakeholders can use the following command:

supplychaind query product show-movement 0

This command provides a history of all recorded movements for the specified product, offering transparency and traceability for audits or verification processes.

Conclusion

Congratulations! By following these steps, you'll create a robust supply chain tracking system, leveraging the power and versatility of Ignite CLI. This system will enhance transparency and efficiency in product tracking and verification.


The next steps include frontend development, testing, debugging, and deploying the network. Consider how the audit module could be integrated into this process.