Inspiration
We constantly hear stories about how delivery drivers aren't adequately reimbursed for amounts expended in making deliveries, such as the costs of wear and tear on their vehicles, gas, tires, car maintenance, insurance, and the like, making their hourly earnings fall below the legal minimum wage. The main reason for this is that most intermediary companies that hire these delivery persons take away a major portion of the income from deliveries. But what if there was a way to completely remove intermediaries from the picture? This question inspired the creation of this project.
What it does
It helps create a direct link between customers and delivery men. Through a system of checks and balances, it creates a trustless environment. A customer simply creates a request, by giving details of the pickup destination, delivery destination and the item to be picked up. The customer also puts in the amount of money he/she is willing to pay anyone who chooses to make that delivery. This request gets stored onto the blockchain, which emits a request event. This event is caught by the application and displayed in the form of UI to all delivery persons. If the reward seems tempting enough to a certain delivery person, he/she can accept the delivery. Once the delivery is made, he/she can "proclaim" to have done so, upon which the smart contract will wait for a confirmation from the original customer before transferring the reward money to the delivery person's wallet. Thus an entire delivery is carried out, without any need for a centralized authority. It all happens in a decentralized and autonomous manner.
How we built it
The first step of the project was writing the smart contract, which is always the most interesting part. It was originally designed to go with Ethereum, but it was soon decided to migrate it over to the polygon sidechain, due to it's fast, cheap and scalable nature. Next, the front end was made, and contract methods were successfully called from client side. To make the project even more scalable, it was decided to integrate it's current structure with MongoDB to create complex filters off-chain, hence saving on gas, while retaining the trust and authenticity associated with blockchain.
Challenges we ran into
When the app was just a smart contract and a front end, we realized that as the traffic on the app would grow, the amount of calculations required to be performed would increase, and so would the gas fees per transaction. In short, the application would not be scalable. That is when we decided to
- Switch to Polygon.
- Incorporate a traditional database for faster computation. Another challenge was to retain the trust and authenticity associated with blockchain even though we were using a traditional database. Therefore we designed the system in a way that the only changes that can ever happen to the data inside the database, would be through events emitted by the smart contract, and from nowhere else. The database would only be used to GET, and never to POST from the client side. Thus we managed to ensure the integrity of all data inside the system.
Accomplishments that we're proud of
We're proud of the four-way system of Client, Contract, Listener and Server, which combines in the fast and scalable nature of web2 with the trust, authenticity and integrity associated with web3 and blockchain. We are proud to have started exploration towards solving one of the world's problems through blockchain and decentralization.
What we learned
We learnt a lot of things. We learnt about blockchain and how to use it to solve problems. We learnt how to code web3 websites, and about the essence of decentralization. We explored a way to combine web2 and web3 to create the perfect blend of speed, security, scalability and decentralization.
What's next for Decentralized Deliveries
The next step would be to integrate IoT into the current web-based system. The plan is to add a verification step when an order is picked up by the delivery person, such that the customer can be sure of the authenticity of the item he/she receives. This is one of the main use-cases of blockchain in logistics, and we plan on implementing the same into last-mile logistics too.
Built With
- express.js
- mongodb
- node.js
- polygon
- react.js
- solidity
Log in or sign up for Devpost to join the conversation.