Skip to content

emartinezs/SupplyChain

Repository files navigation

Sugar Supply Chain

An Ethereum Dapp for tracking the authenticity of sugar


Running the Tests

To run the test first start a local node

truffle develop

Then in another terminal run the tests

truffle test     

Running the Application

To deploy the smart contracts run

truffle develop
truffle(develop)> migrate

To start the frontend server run

npm run dev

Using the Application

  1. Input the UPC and press the fetch data button to get the product information.

product

  1. Input the farm name, farm information, longitude, latitude and product notes, then press the Harvest button to change the product state to harvested.
  2. Press the Send to Mill button to change the product state to sent to mill.

farmer

  1. Press the Receive from Farm to change the product tate to received by mill.
  2. Press the Mill button to change the product state to milled.
  3. Press the Send to Refinery button to change the product state to send to refinery.

mill

  1. Press the Receive from Mill button to change the product state to received by refinery.
  2. Press the Refine button to change the product state to refined.
  3. Press the Pack button to change the product state to packed.
  4. Input the price to distributor and press the Sell to Distributor button to change the product state to for sale to distributor.

refinery

  1. Press the Buy button to change the product state to bought by distributor.
  2. Press the Send to Retailer button to change the product state to sent to retailer.

distributor

  1. Press the Receive from Distributor button to change the product state to received by retailer.
  2. Input the price to consumer and press the Sell to Consumer button to change the product state to for sale to consumer.

retailer

  1. Press the Buy button to change the product state to bought by consumer.

consumer

  1. Input an address and press one of the buttons to add a role to the address.

roles


Testnet

  • Contract address on Goerli Testnet: 0xb25C0E0300084E7Ac34786B9316ce6d37cdD26EF
  • Transaction ID: 0x2144eefb009cca0fb19dbd23e23b49166d6b3eb87aaa01e64636d73cac05e8da

Libraries


IPFS

IPFS is not used in this project


Versions

  • Node 16.13.2
  • Truffle 5.6.9
  • Web3 1.8.1