Skip to main content

Decentralised Location Sharing

· 9 min read
xoron
positive-intentions

In a world where digital privacy is becoming increasingly critical, our decentralized peer-to-peer (P2P) chat app is designed to empower users with secure and private communication. Unlike traditional messaging apps, our solution is fully browser-based, written in JavaScript, and does not rely on any centralized servers for authentication or encryption. This app is part of an ongoing proof-of-concept project to explore the feasibility of creating a chat application that operates independently from centralized servers, offering users a secure, private, and truly decentralized messaging platform. Our app is still in the early stages of development, with some core functionalities already working but much more to come. As a demo, it is designed to showcase what is possible in a decentralized P2P architecture. The goal is not to replace mainstream chat apps immediately but to demonstrate potential alternatives that align with the growing demand for privacy, security, and decentralization in digital communication.

Why Introduce Location Sharing?

Our app leverages the geolocation capabilities built into modern web browsers to enable secure, peer-to-peer location sharing. Here's a breakdown of the process:

**Location sharing has become a staple feature in modern messaging apps. From coordinating meetups to sharing your current location in real-time, it adds a layer of convenience and connectivity to digital communication. However, mainstream apps often store and process location data on centralized servers, raising concerns about privacy, data security, and potential misuse.

In our decentralized chat app, we wanted to offer the same functionality level without compromising user privacy or deviating from our core philosophy of decentralization. By introducing a location-sharing feature, we aim to allow users to share their locations directly with their peers without intermediaries or centralized control. This feature aligns with our mission to offer an alternative to traditional apps that often sacrifice user control in favor of convenience.

How Location Sharing Works in a Decentralized Chat App

Implementing location sharing in a decentralized app presents unique challenges, but it is achievable with the right approach. Our app's location-sharing feature is built entirely in JavaScript and operates within the user's browser. Here's how it works:

  1. User Permission: When users want to share their location, they are prompted to grant their browser permission to access GPS data. This step ensures that users have full control over when and how their location data is accessed.
  2. Data Collection: Once permission is granted, the browser retrieves the GPS coordinates, which consist of latitude and longitude data.
  3. PeertoPeer Sharing: The GPS data is then encrypted and transmitted directly to the intended recipient(s) using a P2P connection without passing through any central server. This ensures that no third party, including us, can access the user's location data.
  4. Map Display: To make this data useful, the recipient's app uses OpenStreetMap and Leaflet.js to display the sender's location on a map. This dynamic and interactive visualization allows users to see the shared location.

This approach ensures that all location data remains under the users' control without the risk of interception, storage, or misuse by any third party.

Displaying GPS Data on a Map with OpenStreetMap and Leaflet.js

Location data alone is only very useful with a visual representation. To provide an intuitive and user-friendly experience, our app uses OpenStreetMap in combination with Leaflet.js. Here's why we chose these tools:

OpenStreetMap is an open-source, collaborative mapping project that provides a free and editable world map. Unlike proprietary mapping services, OpenStreetMap's data is freely available and can be customized to fit the needs of various applications. Although the data from OpenStreetMap.org is not inherently decentralized, it is a more open and accessible alternative than commercial options.

Leaflet.js is a lightweight, open-source JavaScript library for interactive maps. It is designed to work efficiently on both desktop and mobile devices, making it perfect for our browser-based app. Leaflet.js provides a straightforward way to display and interact with map data, which is essential for our location-sharing feature.

By combining OpenStreetMap with Leaflet.js, we provide users with a seamless experience. They can easily view shared locations directly within their chat interface. The integration is designed to be lightweight and fast, ensuring the app remains responsive even on low-resource devices.

Future Plans: SelfHosting Maps for Full Decentralization

While OpenStreetMap is a great open-source alternative, our app's current implementation still relies on fetching map tiles from OpenStreetMap's servers. While this approach is practical, it does not fully align with our goal of complete decentralization. Therefore, one of our future objectives is to introduce support for self-hosted maps.

Self-hosting maps involve downloading and serving the OpenStreetMap data locally or on a decentralized network. This approach would allow users or communities to maintain their map servers, eliminating reliance on any central service. It would provide several benefits:

Increased Privacy: No external server would be involved in fetching or serving map data, reducing the exposure of user activities.

Better Control: Users could customize their map data and create unique layers or styles.

Offline Availability: Self-hosted maps could be made available offline, enhancing accessibility in regions with limited internet connectivity.

We are actively exploring how to implement self-hosting capabilities in a user-friendly way that does not require extensive technical knowledge. Our goal is to make decentralization accessible to a broad audience.

Overcoming Challenges in a Decentralized P2P Architecture

Developing a decentralized P2P chat app with advanced features like location sharing comes with a unique set of challenges:

Data Transmission: In a P2P environment, data must be transmitted directly between peers. This requires efficient handling of data packets, encryption, and error correction to ensure that the information reaches its intended recipient accurately and securely.

Security: With centralized servers, ensuring the security and integrity of communications is simple. Our app uses end-to-end encryption to secure all messages and location data, but this needs to be balanced with performance and usability.

Scalability: Maintaining a decentralized architecture becomes more challenging as the number of users grows. P2P networks can face latency, bandwidth, and reliability issues, especially in environments with limited connectivity.

User Experience: Mainstream chat apps offer a highly polished user experience that users have come to expect. Creating a comparable experience in a decentralized app, where resources and data are distributed, is complex. We are continuously working on optimizing the app to ensure a smooth and responsive user experience.

These challenges are part of exploring what is possible with a decentralized approach. Every improvement we make is a step toward demonstrating that decentralized apps can provide functionality on par with their centralized counterparts.

Benefits of Decentralized P2P Location Sharing

Decentralized location sharing offers several advantages over traditional methods:

Enhanced Privacy: We eliminate the risk of unauthorized data access or breaches by removing the need for a central server. Users maintain full control over who sees their location.

Greater Transparency: Users know exactly how their data is used and shared, with no hidden intermediaries or third-party services.

Flexibility and Freedom: The decentralized model aligns with the philosophy of free and open-source software, allowing users to customize, modify, or host the service as they see fit.

In an era where data privacy is a significant concern, these benefits are more important than ever. By offering decentralized location sharing, we aim to provide a safer, more transparent alternative to mainstream options.

How to Use the Location-Sharing Feature

Getting started with location sharing in our app is simple:

  1. Open the App: Navigate to our app in your browser.
  2. Grant Location Permission: Grant the browser permission to access your device's location data when prompted.
  3. Start a Chat: Open a chat with a peer.
  4. Share Your Location: Click on the location-sharing icon and your current GPS coordinates will be encrypted and sent directly to the recipient.
  5. View on Map: The recipient can view the shared location on a dynamic map powered by OpenStreetMap and Leaflet.js.

This process is straightforward and designed to be user-friendly, ensuring that anyone can easily use the feature.

Getting Involved and Providing Feedback

We believe in building this app collaboratively with our community. We invite you to explore the app, test its features, and provide feedback. Your input is invaluable in shaping the app's future development. You can share your thoughts, report issues, or request new features directly through our feedback channels.

Check out the app and let us know your thoughts! We're excited to hear from you and to continue building a decentralized communication tool that meets your needs.

Conclusion

Our new location-sharing feature is a significant step toward creating a decentralized, privacy-focused alternative to mainstream chat apps. While there are still challenges to overcome, we are committed to developing an app that aligns with user privacy, control, and decentralization principles. We hope you'll join us on this journey by trying out the app, sharing your feedback, and helping us create a tool that serves the needs of its users first and foremost.

FAQs

  1. What makes this location-sharing feature different from others?

Our decentralized feature means no central servers store or process your location data. Everything is shared directly between users, ensuring maximum privacy and control.

  1. Is my location data secure and private in this app?

Yes, all location data is encrypted and transmitted directly between peers. No central servers are involved, reducing the risk of data breaches or unauthorized access.

  1. How does the app ensure decentralization while using OpenStreetMap?

Although OpenStreetMap data is not inherently decentralized, it is an open-source and flexible solution. To align more closely with our decentralization philosophy, we plan to support self-hosted maps.

  1. Can I use self-hosted maps with the app?

Still, we are actively working on supporting self-hosted maps in future updates.

  1. How can I contribute to the app's development or suggest new features?