Git Product home page Git Product logo

supply-chain-solution-project-architect's Introduction

Architect a Blockchain Supply Chain Solution - Part B

FAIR TRADE COCONUTS

Supplychain Blockchain Dapp for Udacity Nanodegree program

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Environment

This program requires node.js and npm program environment

Prerequisites

Please make sure you've already installed Tools and used the versions listed

  • node (v8.12.0)
  • npm (6.4.1)
  • Ganache CLI v6.4.3 (ganache-core: 2.5.5)
  • Truffle v4.1.15 (core: 4.1.15)
  • Solidity - ^0.4.24 (solc-js)
  • MetaMask version extension for browser (6.4.1)
  • web3 (1.0.0-beta.54)

Installing

A step by step series of examples that tell you have to get a development env running

Create a local working directory and then clone github repository:

mkdir workspace
cd workspace
git clone https://github.com/osamabari/Supply-Chain-Solution-Project-Architect.git

Install required node packages

Change to folder Supply-Chain-Solution-Project-Architect and install all requisite npm packages (as listed in package.json):

cd Architect-a-Blockchain-Supply-Chain-Solution
npm install

Open a terminal window and Launch Ganache-CLI:

ganache-cli -m "volume sense walk more oak rocket success treat rug boat pool soup"

Your terminal should look similar below:

truffle test

Open a separate terminal window and compile smart contracts:

truffle compile

Your terminal should look similar below:

truffle test

This will create the smart contract artifacts in folder build\contracts.

Test smart contracts:

truffle test

All 11 tests should pass.

truffle test

Migrate smart contracts to the locally running blockchain, ganache-cli:

truffle migrate

Your terminal should look similar below:

truffle test

In a separate terminal window, launch the DApp:

npm run dev

Your terminal should look similar below:

truffle test

Testing DApp with User Interface.

Now test the DApp with UI: Open http://localhost:3000 to use DApp User Interface.

Import Accounts into MetaMask:

the folowing ganache-cli accounts should be imported into MetaMask:

ganache-cli accounts used here...
Contract Owner: accounts[0]  0xfcf83e33d565a45411c7824d65084b435d5341b8
Farmer: accounts[1]  0xdc94ac22ec9eeddcf0fa46c0a2459b175864189c
Distributor: accounts[2]  0xbc0a52baff25eebc2c2a3d6ccb05db5e41f7da6e
Retailer: accounts[3]  0x59f48202795499a875c4d8eec510538d5365f1ce
Consumer: accounts[4]  0x335ca1a755db8bb13ddd6a6bb285eb91b3ec7b63

Select Contract Owner Account in MetaMask:

truffle test

Add Farmer :

Add all actors into Contract:

  • Add Farmer
  • Add Distributor
  • Add Retailer
  • Add Consumer

truffle test

Select Farmer Account on MetaMask:

truffle test

Activate Farmer Actions in following order:

  • Harvest
  • Process
  • Pack
  • For Sale

Select Distributor Account on MetaMask:

Activate Distributor Actions in following order:

  • Buy

Select Farmer Account on MetaMask:

Activate Farmer Actions in following order:

  • Ship

Select Retailer Account on MetaMask:

Activate Retailer Actions in following order:

  • Receive

Select Consumer Account on MetaMask:

Activate Consumer Actions in following order:

  • Purchase

Built With

  • Ethereum - Ethereum is a decentralized platform that runs smart contracts to make the web faster, safer, and more open.
  • Truffle Framework - Truffle is the most popular development framework for Ethereum with a mission to make your life a whole lot easier.

Acknowledgments

  • Solidity
  • Ganache-cli
  • Truffle
  • IPFS
  • HTML
  • JavaScript
  • Node

supply-chain-solution-project-architect's People

Contributors

osamabari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

afikri 1984victor

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.