This is a decenralized application for vehicle sharing using tokenization. So vehicle owners need to tokenize the vehicles and once vehicles are tokenized, they are listed and renters can rent them. So when a user rents a vehicle, the ownership of vehicle is transferred to renter from owner. When rental period is over, ownership is transferred back to owner from renter. Before renting a vehicle, renters will have to pay some deposit_money, this money will be serving as security money for vehicle and also if renters are using car beyond the time frame, some part of deposit_money will be deducted and transferred to owner's wallet.
In the digital era, traditional vehicle rental systems often face challenges related to transparency, trust, and intermediaries. However, with the emergence of blockchain technology, a new paradigm is reshaping the landscape of vehicle sharing. Blockchain-based tokenization is transforming the way vehicles are rented and shared, enabling a more effective and streamlined process for both owners and renters. By representing vehicles as digital assets on a secure and transparent blockchain network, tokenization empowers participants to engage in peer-to-peer transactions, bypassing intermediaries, and benefiting from enhanced trust and efficiency.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- HTML
- CSS
- Bootstrap
- NodeJs
- NPM
- Truffle
- Docker
- Ganche
- Sepolia TestNet
- Metamask wallet
- Visual Studio Code
Follow the below steps to install all the dependencies and run the project
-
Clone the project repository
git clone https://github.com/shrawank22/vehicle-sharing.git
-
Go to root directory of the project folder
cd vehicle-sharing
-
To insall all the dependencies which are there in package.json file, run the following command
npm install
-
Also you need to install truffle using command
npm install -g truffle@latest
-
For compiling and deploying smart contracts, sepolia testnet is used. So go to truffle-config.js file and find line
provider: () => new HDWalletProvider(MNEMONIC, `wss://eth-sepolia.g.alchemy.com/v2/${PROJECT_ID}`),
Here you need to add your own metamask
MNEMONIC
and also you need to replace thePROJECT_ID
with your own Alchemy project id. The best practice is that you should create a.env
file and add bothMNEMONIC
andPROJECT_ID
to that file only and this way you don't have to change truffle-config.js file. -
When you are done setting up truffle-config file, You have two choices to compile and deploy the smart contracts:
- Using Docker (For this, you need to install docker using command
sudo apt install docker.io
)- Docker container is already set up, you need to build the docker image by running command:
docker build -t truffle-docker .
- Run the docker container
docker run -it truffle-docker
- That's it, smart contracts are compiled and deployed.
- Docker container is already set up, you need to build the docker image by running command:
- Manually deploying contracts
- For compiling smart contracts, use command
truffle compile
- Then for deploying smart contacts on sepolia testnet, run command
truffle migrate --network sepolia
- For compiling smart contracts, use command
- Using Docker (For this, you need to install docker using command
-
For deploying on ganache (For this you need to open Ganache GUI), use command
truffle migrate --network development
- If you are using ganache CLI, make sure to update PORT in development to
8545
- If you are using ganache CLI, make sure to update PORT in development to
-
Once contract is deployed successfully, You will be getting something like this:
1_deploy_contracts.js ===================== Replacing 'VehicleSharing' -------------------------- > transaction hash: 0xe59324306fa78ce97bed9320a92bb7f4ca8abcc0e5271be69dcac5941a329a7e > Blocks: 0 Seconds: 8 > contract address: 0x33de9d83eB96778Ca66370e69a4A88C44D287597 > block number: 3517239 > block timestamp: 1684501656 > account: 0x14e833f0b66B9Fc76c87C4346cada5f214d4A83e > balance: 1.454903994834678383 > gas used: 3212103 (0x310347) > gas price: 2.500000009 gwei > value sent: 0 ETH > total cost: 0.008030257528908927 ETH Pausing for 2 confirmations...
Copy the contract address from here, and go to js file and replace the contract address with your address.
-
Now to run the project, use command
npm start
If everything works well then you will get
Server started at port 8080
in terminal after running command npm start. So you need to visithttp://localhost:8080/
to view the application. -
To run test files for smart contracts, use
truffle test
- Ganache - Ethereun Test Network
- Sepolia TestNet - Sepolia Test network
- Tuffle - Ethereum compiler and deployer
- Solidity - Blockchain smart contracts framework
- Metamask wallet - Metamask wallet
- Express - Server Framework
- NodeJs - Server Environment