Companies like DoorDash, Uber Eats, and Amazon Flex have solved the last-mile delivery problem using a centralized, server-based architecture. A central server, owned by the company, is the trusted intermediary that holds all the data: customer orders, restaurant/merchant locations, driver locations, driver reputations, and payment information. It acts as the “brain,” dispatching orders to drivers based on a proprietary algorithm.
From first principles, design a system that accomplishes the same goal—efficiently matching customers who want items delivered with a fleet of independent drivers—but without a central server or trusted intermediary.
Your proposed system must solve the following core problems from the ground up:
- Discovery: How does a customer’s order request get broadcast to nearby, available drivers without a central server to see everyone’s location? How does a driver “see” available orders?
- Selection & Bidding: How is a driver selected for an order? Does the customer choose? Is there a bidding system? How do you prevent a single malicious actor from accepting all orders and never completing them (a Sybil attack)?
- Reputation & Trust: Without a central database of star ratings, how is driver reputation established and verified in a decentralized manner? How can a customer trust a driver they’ve never met? How can a driver trust that the customer will pay? Reputation must be resistant to manipulation.
- Payment: How are payments processed trustlessly? The customer needs to be sure they won’t be charged until the item is delivered, and the driver needs to be sure they will be paid upon successful delivery. Design a payment-in-escrow mechanism that doesn’t rely on a central company holding the funds. Consider using smart contracts or a similar cryptographic method.
- Efficiency & Scalability: Centralized dispatch algorithms are highly optimized. How can a decentralized, peer-to-peer network achieve comparable route and batching efficiency without a god’s-eye view of the entire system? How does your system scale from a single neighborhood to a whole city?
Your answer should focus on the fundamental architecture, protocols, and incentive structures, not just the user interface of an app.