Vehicle Record and Service Maintenance on Blockchain using Ethereum, Solidity & Truffle..(Part 1)

Pritam Dewan
Coinmonks
3 min readJan 25, 2018

--

I moved to Dubai in 2015 from Bangalore after selling my car. Incidentally I started getting “Thank You” emails from the service center for every time the new owner visits them.

The problem lies that the CRM records were not updated and they are unaware of the new owner and the vehicle registration records are with government and Road Transport Authority(RTA) . Also the service requests are on pen & paper and does not update their CRM records. In the above there are few entities that work in isolation for the same vehicle.

1)Does Blockchain apply to my scenario ?

Blockchain appeals to the scenario , it adds efficiency , transparency and transformation. In above scenario multiple parties are involved and hold their version of “system of record” for the same asset, their business processes does not converge or share information.

2)What technology I can use for the scenario ?

There are multiple blockchain platforms available , I am using Ethereum on Test/Dev node.

3)How do I translate existing process into smart contracts ?

A smart contract essentially represents a “state” stored on blockchain with the rules of asset transfer.

In the following smart contract stored and executed on Ethereum blockchain will register a new vehicle with its owner and also record any transfer of the vehicle to new owner. The vehicle service history can be retrieved which will explore in Part 2.The contract is implemented using Solidity.Solidity is a contract-oriented, high-level language for implementing smart contracts.

a.The Vehicle object is created with the vehicle information and maintains a state.

b.Registering the Vehicle using the VehicleManager contract takes the VIN as key identifier along with YMM and the owner of the vehicle.

c.Transferring the vehicle to the new owner uses the VIN as identifier and registers the vehicle under the new owner. The vehicle status represents different states the vehicle has been .

We will use the Remix online Solidity editor to compile and test the contract. The advantage of using Remix editor is that you can quickly deploy the contract on Javascript VM and it will create a simple Test GUI to run the functions. It also includes a debugger.

As you can see the contract has been compiled and deployed (hit the create button) on Javascript VM. One can test the functions of the contract ,clicking greyed buttons one returns the getters which does not need to spend “Gas” and peach buttons are setters that are executed for consensus on each node in the network and thus you need to spend Gas for execution on the blockchain.

The full contract code can be found at github .

Get Best Software Deals Directly In Your Inbox

--

--