Satellite-Node Connections and Inter-Satellite Routing

Satellite-Node Connections and Inter-Satellite Routing

1. Establishing Satellite Connections

SolSatNet establishes satellite connections using WebSocket for real-time communication and REST APIs for data retrieval. Each satellite is identified by a unique ID that is either predefined or dynamically retrieved from the SolSatNet network.

Example WebSocket Connection:

Copy

javascriptCopier le codeimport WebSocket from 'ws';

// Connect to the WebSocket server for satellite communication
const socket = new WebSocket('wss://satellite.solsatnet.xyz');

socket.on('open', () => {
  console.log('Connected to the satellite WebSocket.');
});

socket.on('message', (data) => {
  console.log('Message received from satellite:', data);
});

2. Retrieving Active Satellites

The REST API provides details about active satellites, including their availability and load.

How it works:

  1. Query the /satellites endpoint to retrieve:

    • A list of active satellites.

    • Satellite-specific details such as their unique ID, status, geographical coverage, and current load.

  2. Use this list to determine which satellite to interact with.

Example API Call:

Copy

Response Example:

Copy


3. Relaying Data via Satellite

Once you have identified the satellite to use (e.g., sat-1), you can relay transactions or other blockchain data using its unique ID.

Steps:

  1. Check if the WebSocket connection is open.

  2. Format the data payload with the satellite ID and the actual data.

  3. Send the data to the satellite via WebSocket.

Example Code:

Copy


4. Inter-Satellite Routing

Inter-satellite routing ensures optimal data transmission by dynamically selecting the best path between satellites. This is particularly useful when direct routes to the target node are unavailable.

Steps:

  1. Identify the source and target satellites.

  2. Query the /route endpoint to calculate the optimal path.

  3. Use the returned route for data transmission.

Example Code:

Copy

Response Example:

Copy


How to Obtain Satellite Lists?

  1. Dynamic Retrieval via API:

    • Use the /satellites endpoint to fetch the current list of satellites available in the network.

    • Metadata includes information like geographic coverage, load, and status.

  2. Predefined List for Testing:

    • For development purposes, you can maintain a static list of satellite IDs.

    • Example:

      Copy

  3. Hybrid Approach:

    • Combine dynamic API calls with predefined lists to handle cases where new satellites are added or existing ones go offline.


Best Practices

  • Monitor Satellite Load: Always choose a satellite with low load to ensure faster processing.

  • Redundancy: Use inter-satellite routing as a fallback in case of network congestion.

  • Cache Satellite Data: Reduce API calls by caching the satellite list and refreshing periodically.

Last updated