CypherCab: A Blockchain enabled Transportation Application

— Ridesharing is a transportation strategy that allows drivers to share their trips with other people which results in less travel expenses. It also minimizes traﬃc congestions and carbon emissions. Currently, most of the existing ride-sharing services rely on a central third party, like Uber, Ola, Didi which charges high service fees. In this paper, we are using blockchain technology to build a smart ride-sharing platform - CypherCab. All the services from registering as a driver, to using this platform for ridesharing will be written directly to the blockchain distributed ledger. Utilizing the decentralized nature of blockchain, the data stored in the blocks will be stored in a distributed ledger, hence removing the dependency on a central third-party server. Moreover, blockchain enables us to remove intermediaries and allows direct transactions between the driver and passengers. In this paper, we have implemented a prototype using smart contracts in the Ethereum network and Ganache test network.


I. INTRODUCTION
In 2008, Satoshi Nakamoto published a Bitcoin white paper, and later in the year 2009, Bitcoin was initially released.Bitcoin was the very first successful Blockchain application.Bitcoin was originally created with the idea of eliminating the double-spending problem by using a peer-to-peer network.Blockchain is a time-series data block that is interconnected with other blocks to form a chain structure embedded with cryptography and distributed ledgers.This chain is decentralized by peers, using a peer-to-peer network, without the dependency of any central authority.Each transaction is organized in blocks that are created and added to the blockchain ledger.These blocks are verified by the members of the peer-to-peer network.These peers are called miners.The initial block in the chain is called the Genesis block or Block 0. Each block has its own hash value which is generated by some cryptographic hash functions and every other block contains hash of the previous block in the chain.Altering the data stored in the blocks even slightly can change hash of the blocks which results in an incorrect chain or requires changing the hash values in all the following blocks.
A blockchain is tamper-proof because the changes of past blocks are practically impossible.To achieve this immutability, blockchain uses different consensus mechanisms.A consensus mechanism is a fault-tolerant technique in which a majority of network peers reach a common agreement on the value of a piece of data or a proposed transaction.
There are three types of blockchain-Private, Consortium blockchain, and Public.
1. Private Blockchain -It is a permissioned blockchain in a closed network in which only a central organization has the authority to write transactions.But, the read operations are allowed to be done by everyone or a restricted subset of the population.
2. Consortium Blockchain -It is a partly private blockchain and is managed by a group of organizations in which a pre-selected set of nodes handle the consensus process.
3. Public Blockchain -It is a permission less blockchain that is publicly available and everyone can perform read and write operations on the blockchain.They aim to replace centralized trust with the use of crypto-economics which is the combination of monetary incentives and cryptographic verifications.
The Ethereum Blockchain -It is a type of consortium blockchain that enables us to develop and deploy our own decentralized applications.It also offers Turing-complete programming that allows anyone to develop smart contracts and decentralized applications.
Smart Contracts-These are simply programs that run on an Ethereum Blockchain, that automatically controls the transfer of digital assets when certain predetermined conditions are met.They act as an immutable agreement used to receive or execute transactions.

II. LITERATURE REVIEW
Blockchain technology enables secure transactions without relying on any central authority.Since 2009, starting with Bitcoin, there has been an increasing number of blockchain technology-based solutions.The very first applications were electronic cash systems with distributed global ledger having all of the transactions.Transactions are secured here using cryptographic hashes and are signed and verified using asymmetric key pairs.Here, the transaction history is securely and efficiently stored using blocks in such a way that any attempt to edit or change a past transaction requires recalculation of all subsequent blocks of transactions.In the blockchain, once data is recorded, it is there forever even if there is a mistake.Applications that implement the blockchain as a data layer work around the fact that the actual blockchain data that cannot be changed by making later blocks and transactions act as updates or modifications to the earlier blocks and transactions.This software abstraction allows for modifications to working data, while providing a full history of changes.For some organizations, these are desirable features.For others, these may be deal-breakers preventing the adoption of blockchain technology.
This paper illustrates a new model for ridesharing services by using blockchain.Ridesharing has a wide scope because it helps us to deal with poor traffic conditions and high travel expenses.It is very beneficial in places with poor public transportation infrastructure and high fuel costs.
Existing ride-sharing services rely on central third parties.They are subject to a single point of failure and privacy disclosure concerns by internal as well as external attackers.They are also vulnerable to Distributed denial of service (DDoS) and Sybil attacks commenced by malicious users and external attackers.On top of everything, we have to pay high service fees to ride-sharing service providers.
The use of Blockchain technology makes ride-sharing a distributed service that ensures the security, confidentiality, and privacy of users.It enables us to share rides without relying on any third party.It allows direct transactions between the rider and driver.It will attract more people to adopt ride-sharing services which are favourable financially as well as environmentally.It can protect the information of ride sharers from data pirates.In this work, we aim to automate the ride-sharing service by using blockchain and smart contracts to avail the merits of decentralized collaborations.

III. METHODOLOGY
Decentralized Apps (DApps) is a concept of deploying apps on the blockchain.Unlike normal apps where data is stored on a centralized unit (i.e.sever).In DApps the data is distributed over the network.The data is encrypted and transactions between users remain anonymous.This helps in maintaining the privacy of the user.
We're proposing the idea of implementing a DApp which can help a user to book a cab.This will also help the driver to control the price they want to charge for a ride, rather than an intermediate company deciding the price of a ride.
To implement this idea, we're using the following technologies-

Ionic React
Ionic is a framework that lets you build a hybrid cross-platform web app/mobile app.It provides some premade UI components that let us build app faster.Ionic can be used with the 3 most popular technologies (i.e.React, Angular & Vue).For this project, we're using the React variant.

Capacitor
Capacitor is a tool that works with ionic to convert the web code to the native device code.This lets us write one code that can be deployed on different platforms (web, android, and iOS).This helps in maintaining the code in the longer run.

web3.js
Blockchain works on a different network and we need a different protocol to communicate with it.Web3js is a library that lets the frontend code connect with blockchain.In normal apps, this work is done via APIs.So, in the case of blockchain, we can consider them as an API.

Mapbox
As we're creating a cab sharing app, we need map services through which users can select their pick up and destination location.We're using Mapbox to show users their location.

Solidity
Solidity is a programming language that is used to write smart contracts.These smart contracts are then deployed on the Ethereum blockchain.We will use these smart contracts to store the information of the user.In the case of the driver, it will store its traveling location and the price he/she is willing to take as well as for the rider, it will store his/her current location and the destination location.

Ganache
Every transaction on the blockchain needs some real Ethereum tokens which makes it impossible for the developer to build and test applications on the real blockchain.So, we use a tool called Ganache that works as a local blockchain and we can test and develop our app on it without spending any real money.It provides free 10 external Ethereum accounts with addresses, each consisting of 100 fake ethers.

IV. CONCLUSION
Blockchain is a technology that guarantees the integrity, non-repudiation, and security of transactional data through a digitally signed transaction chain.In this paper, we illustrated a practical demonstration of blockchain technology in the domains that are beyond finance and cryptocurrencies.We proposed a working DApp namedCypherCab using blockchain technology.CypherCab demonstrates how decentralization and distribution can be used in ride-sharing.The system is decentralized, hence does not require any company or organization to manage it.All the interactions between drivers and passengers are done based on the consensus algorithm in the blockchain including the ride requests, matching the driver with a request, and the payment system.This blockchain-based architecture also prevents malicious attacks and improves security by eliminating the dependency of a central authority.This platform allows the user to behave as a rider or passenger without any switching in the account.This makes the platform more user-friendly.