Simple implementation of blockchain based online market place for cars buying, renting, accessories, modification, and inspection services.
Project was made for practicing the basics of solidity and using it to create a dapp.
Welcome to the Cars Marketplace DApp! This decentralized application (DApp) allows users to engage in various activities related to cars, including renting, selling, modification, inspection, and accessories. The project uses Solidity for smart contract development, Hardhat for deployment, and React for the frontend, with integration with the Metamask wallet through Web3.js.
Before you begin, ensure you have the following installed:
- Node.js
- npm (Node Package Manager)
- Ganache (for local blockchain development)
- Metamask browser extension
- Clone the repository:
https://github.com/saad0909/AutoChain.git
- Install hardhat:
npm install --save-dev hardhat
- Create a hardhat project:
npx hardhat
-
Copy the auto.sol file to contract folder
-
Compile the contract:
npx hardhat compile
-
Run Ganache blockcahin
-
Check from Ganache app the port and address at which blockchain is running
-
goto hardhat.config.js file and check if networks configuration for localhost are mentioned if not then add configurations which you got in previous step from Ganache. It wil be most probably this:
networks: { localhost: { url: "HTTP://127.0.0.1:7545", }, },
-
Replace the deploy.js file in scripts folder
-
Deploy the contract to blockchain:
npx hardhat run scripts/deploy.js --network localhost
- Create a react app:
npx create-react-app myapp
- add images folder and the App.js, index.js, logo.html, and css files in src folder
- Copy the address contract address returned on deploying the contract to contractAddress variable in header.js and credential.js files
- Start the react app:
npm start
For new wallets interacting with the dapp need to register with unique username of atleast 4 characters and password of atleast 8 characters first to interact with the website
For viewing transactions history click on List Events button
For viewing different services like buying and renting click on their buttons
For adding new service the purpose input field can have only 4 types of values("selling", "renting", "accessories", "modification", "selling")