This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
cd pharma-app npm install npm start (react app will run on localhost://3000)
cd pharmaSC-contract
truffle migrate --reset
paste the smart contract address from the delpoyed contract to the constants file in the src folder inside the pharma-app
Open a Ganache node Copy & paste private key of first address on the node to import an account on metamask Also, copy the address and paste it in the address of the firebase admin account
Bingo! you are live on our website (launch it on localhost://3000)
-
=> npm install -g truffle
-
Open project directory of smart contract in terminal with truffle project created => npm install @truffle/hdwallet-provider
-
create the .env file => npm install dotenv
-
.env file should contain the following: INFURA_API_KEY = "https://sepolia.infura.io/v3/" MNEMONIC = ""
-
Add the following to truffle-config.js: => require('dotenv').config(); => const HDWalletProvider = require('@truffle/hdwallet-provider'); => const { INFURA_API_KEY, MNEMONIC } = process.env; => module.exports = { networks: { development: { host: "127.0.0.1", port: 8545, network_id: "*" }, sepolia: { provider: () => new HDWalletProvider(MNEMONIC, INFURA_API_KEY), network_id: '11155111', gas: 4465030 } } };
-
Compile the smart contract => truffle compile
-
Deploy the smart contract => truffle migrate --network sepolia
- Use web3,
- copy abi file into abi folder under src directory
- Declare web3 to access wallet inside our dapp => const web3 = new Web3(Web3.givenProvider);
- Change contract address from constants file
- Run the frontend => npm start
- Create a project in firebase console online => npm install -g firebase-tools
- Login to firebase in your terminal => firebase login
- => npm run build
- => firebase init
- Select option hosting: configure and deploy Firebase hosting using GitHub
- Answer build to deploy assets
- Single page application? Yes
- Overwrite existing index.html? No
- You'll see two new files .firebaserc, firebase.json
- Deploy react app => firebase deploy Once it is deployed, firebase will give you a unique hosting URL where the deployed app is located
email - admin@gmail.com password = 123456