Ethereum Dap for Tracking Items through Supply Chain. Part of the Udacity Blockchain Nanodegree.
Ethereum Dap for Tracking Items through Supply Chain. Part of the Udacity Blockchain Nanodegree.
This project uses: - ReactJS - Tailwind CSS - CSS - JS - NodeJS - EthersJS - Truffle
React-JS - Easy to set up single page application with multiple pages.
Tailwind CSS - Easier to style components as compared to SCSS and CSS. Also more predictable and makes a site more responsive.
Ethersjs - Had lots of trouble using web3js and @truffle/contracts as I was getting lots of errors when using create-react-app. Resorted to using Ethers-js.
- Truffle version
v4.1.14
- Solidity version
v0.4.24
- Create-react-app (client) node
v16
- Truffle node
v10
- Token Address
0xbced00aB0149c828B9abCa30E0BD3262C49De2bb
, to view on block explorer, see here
Ensure node is running on v16
. Do this, ensure you have node version manager installed. Once installed you can then run.
nvm install 16
nvm use 16
The npm packages need to be installed in the app directory by running
cd client
and then
yarn install
Once the installation process has been done, to run the frontend of the project, you can run.
yarn start
Ensure node is running on v10
. Do this, ensure you have node version manager installed. Once installed you can then run.
nvm install 10
nvm use 10
A .secret
file needs to be created at the root of the project with the private key of the account to deploy the contract. This has already been done.
Install hdwallet
by running
npm install @truffle/hdwallet-provider
To run the truffle development enviroment, run:
truffle develop
To compile the smart contract, within the truffle development environment, run:
compile
To migrate and create a fresh and clean smart contract session, within the truffle development environment, run:
migrate --refresh
To migrate and create a fresh and clean smart contract session, on the rinkeby testnet, run:
migrate --refresh --network rinkeby
To run the test cases within the truffle development environment, run:
test
An activity diagram shows busines and software processes as a progression of actions.
A class diagram describes the attributed and operations fo a class and also the constraints imposed on the system.
A sequence diagram is an interaction diagram that details how operations are carried out. They captrue the interaction between objects in the contrext of a collaboration.
A state diagram consists of states, transitions, events and activities. They represent the dynamic view of the system.
To test the full application (Local Node and UI):
- Run the Frontend and Backend as specified in the technology section.
- Ensure the smart contract is deployed to your local test node. In my case, I used Ganache which runs on port 7545
- Import your account to Metamask. To do this, ensure you have metamask installed. Import the seed phrase that is provided by the local node into Metamask and ensure the accounts show up in the wallet ui.
- Use the first account (normally marked as Account 1) to connect to the website. For some reason, it doesn't work with any other account, only the first account.
- Ensure your wallet is connected by clicking connect wallet to Account 1.
- Try going through the whole coffee export process by clicking the buttons (harvest, process, pack, sell) from the Farm Details page.
- Move to the next page and do the same (buy, ship, receive, purchase) from the Product Details page.
- Try to fetch items from the buffer from the Product Overview page.
- Try to fetch the transaction events from the Transactions History page.
Troubleshooting
- Remove data from localstorage. State data is stored there and see if the problem goes away.
I would/ We'd love to have your help in making supply-chain better. The project is still very incomplete, but if there's an issue you'd like to see addressed sooner rather than later, let me(/us) know.
Before you contribute though read the contributing guide here: Contributing.md
For any concerns, please open an issue, or just, fork the project and send a pull request.
- see LICENSE file
- Version 1.0 DATE 08/05/2022
If you have found any bugs, or have any feedback or questions and or want to post a feature request please use the Issuetracker to report them.