Code Monkey home page Code Monkey logo

blockchaintraceablecoffee's Introduction

Traceability/Authenticity Coffee Supply Chain Demo.

Truffle Test Screenshot

A simple supply chain authenticity/traceability demo that records owenership and transactions of products on the ethereum blockchain using smart contracts. It is based on the coffee industry supply chain (direct-trade model).

The functionality is provided by two Smart Contracts:

  • CoffeeManagement - Register Coffee batches and keep their data on ethereum.
  • ChangeOwnership - Tracks ownership of the coffee in each stage.

We have a simple web interface to interact with the contracts that assume three roles: Farm, Local Team, and Client. Each has its own view (page) and we keep them separated to better demonstrate how different parties could use the contracts.

Setup and Running

The smart contracts and the tests Truffle and Ganache are used, so first install them: npm install -g ganache-cli truffle

Install Metamask extension to enable web3 interaction with browser.

Run ganache-cli and designate 3 accounts for our 3 roles, them add them to Metamask. Make sure Metamask is connected to 'localhost:8545'.

Deploy the contracts: In terminal: truffle migrate --reset.

After Tuffle is done compiling and deploying, Take note of the new ChangeOwnership and CoffeeManagement addresses and replace the values on "web/js/main.js" in the following parts:

[Line: 355] window.pm.options.address = "Your New Address Here"
...
[Line:499] window.co.options.address = "Your New Address Here"

In terminal run 'truffle test' to run the test file and check if the smart contracts are functional.

Run the app and explore the UI.

The Flow

@ The farm:

  • Pack coffee and add batch #, type, and weight.
  • Register the coffee to the owner.
  • Type the Local Team wallet address and click on "Change Ownership" to send it to them.

@ Local Team:

  • Assemble orders based on coffee batches recieved from farmers (with a minimum set to 6 batches).
  • Register order ownership to Local Team.
  • Add Client wallet addresss and transfer ownership of order (along with details of each indiviual coffee batch) to them.

Dealers:

  • Able to see orders owned and their history:
  • From which farm
  • Types of coffee batches
  • Weights of diffrent batches
  • Which team proccessed the order.
  • List of addresses that were the owners of the order (and it's batches).

Credits

blockchaintraceablecoffee's People

Contributors

hamadaljawder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.