Ride-sharing is a service that enables drivers to share their trips with other riders, contributing to appealing benefits of shared travel cost and improved access to transportation. However, the majority of existing ride-sharing services rely on a central third party, which make them subject to a single point of failure and privacy disclosure concerns by both internal and external attackers. Moreover, they are vulnerable to distributed denial of service (DDoS) and Sybil attacks due to malicious users involvement. Besides, high service fees should be paid to the ride-sharing service provider. In this paper, we propose a decentralized ride-sharing service based on public Blockchain, named B-Ride. B-Ride enables drivers to propose ride-sharing services without relying on a trusted third party. Both riders and drivers can find rides match while preserving their trip data, including pick-up/drop-off location, departure/arrival date and travel price. However, under the anonymity of the public blockchain, a malicious user may submit multiple ride requests or offers, while not committing to any of them, in order to discover better offer or to make the system unreliable. B-Ride solves this problem by introducing a time-locked deposit protocol for a ride-sharing by leveraging smart contract and zero-knowledge set membership proof. In a nutshell, both a driver and a rider have to show their good willing and commitment by sending a deposit to the blockchain. Later, a driver has to prove to the blockchain on the agreed departure time that he has arrived at the pick-up location. To preserve rider/driver privacy by hiding the exact pick-up location, the proof is performed using zero-knowledge set membership proof. Moreover, to ensure fair service payment, a pay-as-you-derive methodology is introduced based on the elasped distance of the driver and rider. In addition, we introduce a reputation-based trust model to rate drivers based on their past trips without involving any third-parties to allow riders to select them based on their history on the system. Finally, we implement our protocol and deploy it in a test net of Ethereum. The experiment results show the applicability of our protocol atop the existing real-world blockchain.