In the past, Smart Contracts have been integrated with electric vehicles via the use of specialized hardware that plugs directly into the vehicle to obtain real-time data. Not only were these examples restricted to just accessing data, but they also didn't scale well, as each vehicle requires special hardware installed. Tesla electric vehicles have a proper feature rich API that can be leveraged to obtain vehicle data & change the state of the vehicle, which then gives us the ability to create a custom external adapter to connect Smart Contracts to the vehicle via a Chainlink Oracle, giving the Smart Contract full access to the given vehicles data & ability to change its state.
What it does
This submission demonstrates the design pattern described above, applying it to the use case of the peer to peer sharing economy. In traditional vehicle rental platforms, the vehicle renter relies on the 'brand power' of the company renting the vehicles, and trusts that the bond they submit will be returned if they adhered to the conditions. And as a vehicle owner/provider, going through a trusted centralized platform usually requires sacrificing approximately 30% of revenue earned. But in a peer to peer scenario, both renter and owner are strangers, there is no 'brand power', and there's no guarantee any bond paid will be returned fairly if agreement conditions are met. This is where a Smart contract connected to external data and events can be leveraged to facilitate a digital agreement between a Vehicle Owner & Vehicle Renter in a trust minimized & secure way.
How I built it
React front end + Solidity Smart Contracts Chainlink node + custom Tesla External Adapter deployed to Google Cloud Lambda function deployed to AWS Google Cloud Firestore NoSQL DB for authentication token storage Was developed against the Tesla Mock Server, then tested against an actual tesla in the late stages of development See github architecture diagram for more info
Challenges I ran into
The sheer scope of the submission & the many moving parts, integrations and complexities made time the biggest limiting factor.
Accomplishments that I'm proud of
We believe this is the first ever public integration of an electric vehicle to a Smart Contract that doesn't require specialized hardware connected to the vehicle.
Also we believe this is the first Chainlink external adapter that makes use of Googles NoSQL Firestore Serverless Database technology, which now opens up a conversation that can be had on how it can be leveraged in hybrid blockchain/cloud applications
What I learned
Harry: Learned a lot about Google serverless functions and NoSQL serverless database technologies.
Matt: Learned a lot about web3js and using Chainlink price feeds.
What's next for Link My Ride
- Ensure financial incentive for both vehicle owner and renter are sufficient to promote good behaviour
- Add features to facilitate vehicle fleet management including reporting and analytics
- Complete the external adapter to make use of all possible API endpoints
- Expand to other API-enabled vehicles
- Cover all essential insurance
- Improve Security, & add multiple Chainlink Nodes for better decentralization
- Improve UI/UX (Form validation, responding to events emitted from smart contract, use user's timezone [currently all times in the web app are in UTC] and more)