Skip to content

saad0909/AutoChain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoChain ( Cars Marketplace DApp )

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.

Table of Contents

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

Installation and Setup

  1. Clone the repository:
    https://github.com/saad0909/AutoChain.git
  2. Install hardhat:
    npm install --save-dev hardhat
  3. Create a hardhat project:
    npx hardhat

Smart Contract

  1. Copy the auto.sol file to contract folder

  2. Compile the contract:

    npx hardhat compile
  3. Run Ganache blockcahin

  4. Check from Ganache app the port and address at which blockchain is running

  5. 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",
        },
        },

    image

  6. Replace the deploy.js file in scripts folder

  7. Deploy the contract to blockchain:

    npx hardhat run scripts/deploy.js --network localhost

Frontend

  1. Create a react app:
    npx create-react-app myapp
  2. add images folder and the App.js, index.js, logo.html, and css files in src folder
  3. Copy the address contract address returned on deploying the contract to contractAddress variable in header.js and credential.js files
  4. Start the react app:
    npm start
    image

Usage

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 image

For viewing different services like buying and renting click on their buttons image

For adding new service the purpose input field can have only 4 types of values("selling", "renting", "accessories", "modification", "selling")