In this sample project, we will create a decentralized database matching drivers and passengers based on their matching zip codes in their metro area.
MVP: Showcase publishing and subscribing within the terminal by creating the json files for the passengers and drivers.
- Create a json file for each driver and each passenger
- Matching the driver and passengers with the IPFS pubsub method via curl commands in the terminal to showcase peer to peer to matching
How to Use:
These json files require less code than a traditional python file with a centralized database. Every passenger would have their own JSON (JSON formmated payloads) file, so if this app had 20M passengers there would be 20M JSON files. So here you can see another perspective of having a decentralized database because you would need 20M individual JSON files rather than having 20M rows in a single database.
-
Create a Topic as a JSON file
-
Create a Passenger File
-
Create a Driver File
-
Publish passenger file to passenger topic
-
Publish driver file to driver topic
-
Subscribe to passenger topic to get location
At this point I've created JSON files for Passengers and Drivers.
How to Use:
-
Install the IPFS https://docs.ipfs.io/install/command-line/#official-distributions Once IPFS is installed you can call the daemon from the Command Line.
-
To store Drivers and Passengers, each profile would be json files in IPFS. - List of Drivers with zip codes as a file - List of Passengers with zip codes as a file Every file would be published with a curl command to the local host 127001. Each driver/passenger would publish their own request, and pull each other's profiles. Each file would be their own driver/passenger profile.
-
Start the daemon - Installing the IPFS is like building the post-office. Publishing a JSON file would be putting a letter in the mail.
How to Use:
-
Create a topic
-
sub to the topic
ipfs pubsub passengers
-
publish to a topic
ipfs pubsub pub passengers passengers/passenger1.json
-
Publish to a Driver Topic
-
sub to the topic
ipfs pubsub drivers
-
publish to a topic
ipfs pubsub pub drivers drivers/driver1.json
Official distributions https://docs.ipfs.io/install/command-line/#official-distributions ipfs pubsub https://docs.ipfs.io/reference/cli/#ipfs-pubsub ipfs pubsub Is https://docs.ipfs.io/reference/cli/#ipfs-pubsub-ls