> For the complete documentation index, see [llms.txt](https://support.marscat.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.marscat.io/core-network/self-service/technical-architecture.md).

# Technical Architecture

## System Components

Self Service consists of the following core components, forming a complete decentralized service ecosystem:

#### MarsApp Frontend

* Role: User interaction interface and request initiator
* Core Capabilities:
  * Protocol conversion from HTTP requests to P2P messages
  * Response result reception and display
  * Local caching and offline processing

#### RelayX Node

* Role: Efficient routing and forwarding dedicated to Self Service messages
* Core Capabilities:
  * Intelligent routing algorithms optimizing transmission paths
  * Load balancing avoiding single-node overload
  * Message encryption and forwarding
  * Network topology maintenance and optimization

#### Regular Node

* Role: General P2P network node
* Core Capabilities:
  * Participate in message forwarding, increasing network complexity
  * Provide random routing paths
  * Enhance network anonymity and censorship resistance

#### Self Service Node

* Role: Bridge between P2P network and traditional application services
* Core Capabilities:
  * Protocol conversion from P2P messages to HTTP requests
  * Application service access and management
  * Request verification and permission control
  * Response data encapsulation and return

#### Application Service

* Role: Actual business logic processing unit
* Core Capabilities:
  * Maintain existing business logic unchanged
  * Communicate only with Self Service nodes, completely hiding public network addresses
  * Standard HTTP API interfaces

## Network Topology

<figure><img src="https://content.gitbook.com/content/Og6PR7NBhQvS02SSHEf6/blobs/bZ18evJGeGJeiU1lrpMD/framework%201.png" alt=""><figcaption></figcaption></figure>

## Request Processing Flow

### Complete Call Chain

<figure><img src="https://content.gitbook.com/content/Og6PR7NBhQvS02SSHEf6/blobs/k5lgMCBEE4MKYDDBr8ks/self%20service%20flow.png" alt=""><figcaption></figcaption></figure>

### Key Processing Steps

{% stepper %}
{% step %}

### Request Initiation Stage

* User initiates API call through MarsApp frontend
* Frontend performs identity verification and request format validation
* Generate unique request ID for response matching
  {% endstep %}

{% step %}

### Protocol Conversion Stage (Request)

* MarsApp encapsulates HTTP request and sends to RelayX Client
* RelayX Client converts request to P2P network message format
* Encrypt request content and add routing information
  {% endstep %}

{% step %}

### Network Transmission Stage

* RelayX Client sends P2P message to network
* Message forwarded through multiple random nodes
* Nodes select forwarding paths based on network topology and routing algorithms
  {% endstep %}

{% step %}

### Service Invocation Stage

* Self Service Node receives P2P message
* Convert to standard HTTP request format
* Call corresponding application service endpoint
  {% endstep %}

{% step %}

### Response Return Stage

* Application service returns processing results
* Self Service Node encapsulates as P2P message
* Return to RelayX Client through random network paths
  {% endstep %}

{% step %}

### Protocol Conversion Stage (Response)

* RelayX Client receives P2P response message
* Convert to standard HTTP response format
* Return to MarsApp frontend for user display
  {% endstep %}
  {% endstepper %}

## Technical Features and Limitations

### Core Features

* Latency: Average 1-3 seconds response time, affected by local network
* Message Size: Maximum 10 MiB per message, exceeding messages are directly discarded
* Consistency: Eventual consistency model, suitable for distributed scenarios
* Concurrency: Single node supports medium-low concurrency, overall network can scale horizontally

### Application Scenario Analysis

#### Unsuitable Scenarios

* High real-time requirements: Game operations, high-frequency trading, instant messaging
* Strong consistency requirements: Bank transfers, inventory deduction, order payments
* High concurrency intensive: Flash sales, hotspot data access, high-traffic APIs
* Ultra-large data transmission: Video streaming, large file downloads, real-time synchronization

#### Suitable Scenarios

* Asynchronous processing: Message notifications, email sending, background task scheduling
* Content management: Article publishing, comment systems, user profile updates
* Data synchronization: Configuration updates, state synchronization, log collection
* Lightweight interaction: Form submission, data queries, simple CRUD operations
* Privacy protection: Anonymous voting, privacy social, sensitive data processing
