GithubHelp home page GithubHelp logo

chiemezie1 / blockchain-carride Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9.2 MB

This project is a smart contract for a car ride sharing service. The contract includes a mechanism to verify the identities of drivers and riders, a rating system to ensure high-quality drivers and riders are able to secure more rides, and additional safety checks to ensure that payments are only made and received once a ride is completed.

Home Page: https://blockchain-car-ride.vercel.app

Solidity 7.36% HTML 2.05% CSS 1.28% JavaScript 89.15% Nix 0.16%

blockchain-carride's Introduction

CarRide Contract

This is a smart contract for a car ride platform, using the Solidity programming language and built for the Goerli test network using Hardhat.

Deploy deployed on goerli contract address = 0x12175E6C31afc8A5648Aeee20563A7e9d6D29D46

Functions

registerRider The registerRider function allows a user to register as a rider by providing their name, contact, and email.

registerDriver
The registerDriver function allows a user to register as a driver by providing their name, contact, email, car     number and number of seats.

requestRide The requestRide function allows a registered rider to request a ride by providing the pickup and dropoff location, and the amount they are willing to pay.

acceptRide The acceptRide function allows a registered driver to accept a ride request.

confirmRide The confirmRide function allows a rider or a driver to confirm a ride.

getRideInfo The getRideInfo function allows a user to view the details of a specific ride.

Events

RiderRegister This event is emitted when a user successfully registers as a rider.

DriverRegister This event is emitted when a user successfully registers as a driver.

RequestDriverEvent This event is emitted when a rider requests a ride.

Requirements

Node.js v16 or higher
Hardhat v2.0 or higher
Goerli test network

Installation

Clone this repository to your local machine. Open a terminal and navigate to the project's root directory. Install the project's dependencies by running npm install.

Usage

Compile the contract by running npx hardhat compile. Deploy to the Goerli test network by running npx hardhat run scripts/deploy.js

Once the contract is deployed, you can interact with it using the following functions: registerRider(string memory _name, string memory _contact, string memory _email) : Registers a new rider with the provided name, contact, and email. registerDriver(string memory _name, string memory _contact, string memory _email, string memory _carNumber, uint _seats) : Registers a new driver with the provided name, contact, email, car number and number of seats requestRide(string memory _pickup, string memory _dropoff, uint _amount): Requests a new ride with the provided pickup and dropoff location and amount. Returns the ride ID. acceptRide(uint _rideId): Accepts a ride with the provided ride ID. confirmRide(uint _rideId) : Confirm a ride with the provided ride ID getRideInfo(uint _rideId) : Returns the information of a ride with the provided ride ID, including rider address, pickup and dropoff location, amount, and whether it is complete and confirmed by rider and driver Events RiderRegister(address indexed _riderAddr): Triggered when a new rider is registered. DriverRegister(address indexed _driverAddr): Triggered when a new driver is registered. RequestDriverEvent(address indexed _riderAddr,string pickup, string dropoff): Triggered when a new ride is requested.

Contact

If you have any questions or issues regarding this contract, please don't hesitate to contact me.

Disclaimer

This contract is for educational and demonstration purposes only. It has not been audited and should not be used in a production environment. Always thoroughly review and test any smart contract before deploying it.

blockchain-carride's People

Contributors

chiemezie1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.