---
title: Shortest Path Routing
sidebar_position: 5
---


# Shortest Path Routing

## Empowering Connectivity with an End-to-End Encrypted Overlay Network

### The Concept of End-to-End Encryption

End-to-end encryption (E2EE) ensures that data is encrypted on the sender's device and only decrypted on the recipient's device. This means that no intermediaries, including service providers, can access or alter the data while it is in transit. 

### Shortest Path Routing in Overlay Networks

An overlay network is a virtual network built on top of an existing physical network. 

Each enduser mycelium agent will execute custom routing logic and protocols to improve connectivity. 

- In the context of a Mycelium peer-to-peer (P2P) overlay network, nodes (participants) can dynamically discover and connect to each other, forming a mesh-like structure.
- Shortest Path Routing: The network can use algorithms to find the shortest or most efficient path between nodes. This ensures that data packets travel the minimum distance required to reach their destination, reducing latency and improving performance.

### Multi-Hop Communication

In a P2P overlay network, data can hop through multiple nodes to reach its destination. This means that if a direct connection is not available, the data can be relayed through intermediary nodes. For example:

1. **Node A** wants to send data to **Node D**.
2. There is no direct connection, but **Node A** can reach **Node B**, which can reach **Node C**, which finally reaches **Node D**.
3. The data is encrypted end-to-end, so it remains secure throughout its journey.

Network usage tracking and billing can be used to make sure all participants are rewarded.

### Leveraging Existing Networks

This overlay network operates on top of existing internet infrastructure. 

This leads to:

1. **Cost Efficiency**: By leveraging existing infrastructure, there is no need for extensive new investments in physical hardware.
2. **Flexibility**: The network can dynamically adapt to changing conditions, such as network congestion or outages.

### Improving Connectivity for Underserved Populations

Currently, around 4 billion people lack decent internet access. 

Mycelium can significantly improve their connectivity:

1. **Decentralized Access**: People in remote or underserved areas can connect to the network through nearby nodes, which may belong to friends, community members, or even commercial providers offering bandwidth.
2. **Community-Driven Networks**: Local communities can set up nodes that connect to the broader overlay network, creating a resilient and scalable web of connectivity.
3. **Increased Bandwidth**: By aggregating available bandwidth from multiple sources, the overlay network can provide higher data rates and more reliable connections.

### Example Scenario

Imagine a remote village with limited internet access. The villagers set up several nodes that connect to each other and to nearby towns with better connectivity, also some of the nodes can be connected to Internet over satelite, mobile 4g or other mechanisms.

Here’s how it works:

1. **Local Node Setup**: Villagers install nodes on their devices, which form a local mesh network.
2. **Connecting to Broader Network**: Some nodes have access to satellite internet or long-range Wi-Fi that connects to nearby towns.
3. **Dynamic Routing**: When a villager wants to access online resources, their data is encrypted end-to-end and routed through the shortest path available, which may include local nodes, satellite links, and commercial internet providers.
4. **Enhanced Access**: This setup leverages all available bandwidth sources, providing more reliable and faster internet access to the village.

