The CarPooling smart contract facilitates the creation, booking, management, and cancellation of rides within a carpooling system. It is designed to run on the Ethereum blockchain and leverages Solidity for smart contract development. This project is divided into two parts: smart contract and frontend.
We are using Ethereum's Sepolia testnet for the smart contract. So the transactions will be based on Sepolia Ethers. Use these links to add Eth tokens to your wallet:
To get started with this project, you'll need to create accounts on Rapid API and obtain the following APIs:
Place Autocomplete: This API provides autocomplete functionality for place names, facilitating location-based searches or forms.
Driving Distance Calculator Between Two Points: This API calculates the driving distance and time between two locations, aiding in route planning and navigation.
Forward & Reverse Geocoding: This API offers both forward and reverse geocoding capabilities, translating between addresses or place names and geographic coordinates.
Daily Petrol, Diesel, LPG & CNG Fuel Prices in India: Retrieves daily fuel prices for petrol, diesel, LPG, and CNG in India, aiding in monitoring and analysis of fuel costs.
Install dependencies:
npm install
To configure environment variables for your project, follow these steps:
Create a .env
File:
Create a file named .env
in the root directory(frontend) of your project.
Define Environment Variables:
Inside the .env
file, define your environment variables in the following format:
NEXT_PUBLIC_RAPIDAPI_KEY1=your_rapidapi_key1
NEXT_PUBLIC_RAPIDAPI_KEY2=your_rapidapi_key2 #optional
NEXT_PUBLIC_RAPIDAPI_KEY3=your_rapidapi_key3 #optional
Users have the option to either act as a driver or a passenger. Depending on their role, they can fill in specific details as outlined below:
If you choose to be a driver, follow these steps:
Fill Details: Provide the necessary information such as the maximum number of passengers, ride fare, departure time, and trip details.
Confirm Ride Details: Once all details are filled, proceed to create a ride by submitting the form.
Create Ride: After clicking the button you'll be prompted to pay using metamask wallet. Wait 12-13 seconds for the confirmation.
If you choose to be a passenger, follow these steps:
Fill Details: Passengers need to provide information such as their destination, preferred departure time, and any special requests.
Book Ride: After filling in the details, passengers can search for available rides and book a suitable one.
By following these steps, users can seamlessly navigate between the roles of driver and passenger and contribute to the carpooling ecosystem efficiently.
Watch this to see how it works... https://github.com/StephCurry07/Ether-Wheels/assets/76783882/4c085542-ccf6-4469-94f7-91f815d922d3
Unit tests for the CarPooling smart contract can be found in the tests directory. Run the tests using a Solidity testing framework such as Truffle or Hardhat.
This project is licensed under the MIT License. See the LICENSE file for details.