Run truffle version
command:
Package | Version |
---|---|
Truffle | v5.1.58 (core: 5.1.58) |
Solidity | 0.6.12 (solc-js) |
Node | v14.15.1 |
Web3.js | v1.2.9 |
As configured in truffle-config.js the smart contracts was compiled successfully using:
- solc: 0.6.12
Install a clean version of nodejs. I´m using the nvm (Node Version Manager) tool to allow install and switch between versions. Currently the version 14 of node.js works:
nvm install 14.15.1
nvm use 14.15.1
install truffle, openzelepin, webpack and dependences:
cd DrugChain\
npm i -g truffle
npm i --save openzeppelin-solidity
npm i --save truffle-hdwallet-provider
npm i --save-dev eth-gas-reporter
npm i truffle-assertions
npm i -g webpack
npm i -g webpack-dev-server webpack-cli webpack-dev-middleware webpack-hot-middleware copy-webpack-plugin
For starting the development console, run:
truffle develop
For compiling the contract, inside the development console, run:
compile
For migrating the contract to the locally running Ethereum network, inside the development console, run:
migrate --reset
For running unit tests the contract, inside the development console, run:
test
npm install -g ganache-cli
create a file called ./secret.txt with your mnemonics of your wallet, like:
skin impose this task range body amused apple spin jazz inhale bench
edit line 24 of ./truffle-config.js and replace with your Infura Key:
24: const infuraKey = "c216..."; // INFURA - PROJECT ID
First send some funds to your account. Use Ganache to get the addess of the first account from your secrets.txt mnemonic. Go to https://faucet.rinkeby.io/ and send a tweet as instructions. Copy-paste your tweet url and have fun!
Then, execute the command:
truffle migrate --network rinkeby --reset
.\DrugChainDAPP> truffle migrate --network rinkeby --reset
Compiling your contracts...
===========================
> Compiling .\contracts\access\Roles.sol
> Compiling .\contracts\access\roles\ConsumerRole.sol
> Compiling .\contracts\access\roles\DistributorRole.sol
> Compiling .\contracts\access\roles\FarmerRole.sol
> Compiling .\contracts\access\roles\InspectorRole.sol
> Compiling .\contracts\access\roles\ProducerRole.sol
> Compiling .\contracts\core\Ownable.sol
> Artifacts written to .\DrugChainDAPP\build\contracts
> Compiled successfully using:
- solc: 0.6.12+commit.27d51765.Emscripten.clang
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0xd26ceda3eb7e7fe27734f2395497bd3a3a4daf14151e8df444119628412613b9
> Blocks: 2 Seconds: 17
> contract address: 0x16F1eb70865083bc9EBbf2165dF564A7612Ea95b
.
.
.
.
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.004620735 ETH
2_deploy_contracts.js
=====================
Deploying 'SupplyChain'
-----------------------
> transaction hash: 0x575c4e7023d2a4536337556d5e9cd07c9c46af8b0efbab3821026305a42c3764
> Blocks: 1 Seconds: 9
> contract address: 0x4975415603247b763a9a315e23923fe29f4bd220
> block number: 8254426
.
.
.
.
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.078643236 ETH
Summary
=======
> Total deployments: 2
> Final cost: 0.083263971 ETH
contract address: 0x4975415603247b763A9a315E23923fE29f4BD220
https://rinkeby.etherscan.io/address/0x4975415603247b763A9a315E23923fE29f4BD220
deployment transaction hash: https://rinkeby.etherscan.io/tx/0x575c4e7023d2a4536337556d5e9cd07c9c46af8b0efbab3821026305a42c3764
For running the Front End of the DAPP, open another terminal window and go inside the project directory, and run:
> npm install
> npm run start
Hosted website through github pages: https://ck-lim.github.io/brillinsupplychain/
Following there is a online version of Enterprise SupplyChain Fronted deployed in GitHub pages: https://kirinshibori.github.io/DrugChainUI/.