- This repository is made for learning the block chain technology and how to integrate it with the web application
- Solidity
- Express.js
- Web3.js
- Remix IDE
- Bootstrap 5.0.2
- Node.js
-
Create Account on Infura or Alchemy and get the API Key for Ethereum testnet (in this case I use Goerli from Infura and Sepolia from Alchemy)
-
Copy smart contract code from file Backend/TestProductRegistry.sol and paste it to Remix IDE
-
Compile the smart contract and deploy it to Ethereum testnet (adjust the network to Goerli or Sepolia, depends on your API Key)
-
Clone this repository
git clone https://github.com/ferdyhape/Blockchain-Create-Product.git
-
Open backend folder, copy paste .env.example file and rename as .env
-
Adjust the .env file
APP_PORT = 5000 INFURA_URL_API = "https://goerli.infura.io/v3/YOUR_INFURA_API_KEY" // You can get this from Infura ALCHEMY_URL_API = "https://eth-sepolia.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY" // You can get this from Alchemy CONTRACT_ADDRESS_GOERLI = "YOUR_CONTRACT_ADDRESS" // You can get this from Remix IDE CONTRACT_ADDRESS_SEPOLIA = "YOUR_CONTRACT_ADDRESS" // You can get this from Remix IDE MY_WALLET_PRIVATE_KEY = "YOUR_WALLET_PRIVATE_KEY" // You can get this from your wallet MY_WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" // You can get this from your wallet
-
Open your terminal and go to the backend folder
cd backend
-
Install all backend dependencies
npm install
-
Run the backend server
npm start
-
Open new terminal and go to the frontend folder
cd frontend
-
Install all frontend dependencies
npm install
-
Run the frontend server
npm start
-
Open your browser and go to
http://localhost:3000
-
You can create a new product by filling the form
-
You can see the list of products that have been created by clicking the
Read Contract
button -
Enjoy use!