Coffee Supply Chain Dapp
This is a Supply Chain Managment blockchain Dapp using Ethereum.
This project was built using the following framework versions:
IPFS was not used in this project.
The Supply Chain Contract Address on Rinkeby Network is: 0xB4a0131Bd169BAf980E39EcdaB9B77C23E1D2a5E and can be viewed on the Rinkeby Etherscan website here
The Supply Chain Contract Transaction Hash on Rinkeby Network is: 0x2898bb06f4cdec1218d3d2e2f802213f52d669469bef05c5a69b9163534ff34f and can be viewed on the Rinkeby Etherscan website here
NOTE: The Regulator role has not been included in the final solution and that some method names used in the diagrams may be slightly different in the code.
In order to run the application locally you will need to do the following:
touch .secret
npm install
ganache-cli -m "spirit supply whale amount human item harsh scare congress discover talent hamster"
npm run dev
In order to test the client side application, its necessary to import the different actor roles into your MetaMask and to ensure that each actor role is added to the deployed contract.
Keep the first account (index 0) as the contract owner and make account 1 - 4 as the actors as follows:
Use the private keys for each of these accounts to add to MetaMask. Optionally rename the accounts to help with testing as shown below:
In your local truffle console
terminal window run the following code to associate each actor account to the deployed supply chain contract:
originFarmerID = accounts[1]
distributorID = accounts[2]
retailerID = accounts[3]
consumerID = accounts[4]
let supplyChain = await SupplyChain.deployed()
await supplyChain.addFarmer(originFarmerID)
await supplyChain.addDistributor(distributorID)
await supplyChain.addRetailer(retailerID)
await supplyChain.addConsumer(consumerID)
Now open the app and in MetaMask select the Farmer account. Now interact with the app, performing the transactions that a Farmer is allowed to perform. Notice that if you try to perform a transaction that a Farmer cannot process there is a transaction error and the approriate message is shown in the log. In oder to process the entire flow of the supply chain you will need to switch wallet addresses to the different actor wallets that were imported in Step 1 above to complete the end to end journey through the entire supply chain.
Note that the transaction history contains the events logged for adding the actors to the contract as well as any transactions you have just performed as shown below:
If you experience with bugs or need further improvement, please create a new issue under Issues.
Pull requests are very welcome. Before submitting a pull request, please make sure that your changes are well tested. Pull requests without tests will not be accepted.
You will need to launch ganache as follows:
ganache-cli -m "spirit supply whale amount human item harsh scare congress discover talent hamster"
You can then run tests as follows:
truffle test
This CoffeeChain Ethereum Dapp application was developed as part of the Blockchain Nanodegree with Udacity and Darren Jensen.
This CoffeeChain Ethereum Dapp application is released under AGPL
This application is part of a project assignment and is most definitely not suitable for Production use! :)