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:
Query the
/satellitesendpoint to retrieve:A list of active satellites.
Satellite-specific details such as their unique ID, status, geographical coverage, and current load.
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:
Check if the WebSocket connection is open.
Format the data payload with the satellite ID and the actual data.
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:
Identify the source and target satellites.
Query the
/routeendpoint to calculate the optimal path.Use the returned route for data transmission.
Example Code:
Copy
Response Example:
Copy
How to Obtain Satellite Lists?
Dynamic Retrieval via API:
Use the
/satellitesendpoint to fetch the current list of satellites available in the network.Metadata includes information like geographic coverage, load, and status.
Predefined List for Testing:
For development purposes, you can maintain a static list of satellite IDs.
Example:
Copy
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