You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pyth Lazer is a permissioned service that provides ultra-low-latency market data to consumers.
6
4
It aggregates data from multiple publishers and distributes it to consumers through a multi-tier architecture.
7
5
8
6
## System Services
9
7
10
-
The architecture consists of five main services that work together to provide ultra-low-latency data to consumers.
8
+
The architecture consists of five main types of services that work together to provide ultra-low-latency data to consumers.
9
+
Each service has multiple instances running to ensure high availability and low latency.
11
10
12
11
### INSERT DIAGRAM HERE
13
12
@@ -23,33 +22,30 @@ The Relayer service is the ingestion layer that receives and validates all incom
23
22
**Key responsibilities:**
24
23
25
24
-**Authentication**: Validates publisher access tokens and optional Ed25519 signatures.
25
+
-**Validation**: Performs sanity checks on incoming updates by examining feed IDs, timestamps, and values to ensure data integrity and proper formatting.
26
26
-**Rate limiting**: Enforces configurable limits on publisher updates.
27
-
-**Message forwarding**: Publishes validated updates to an internal message queue (a NATS cluster).
27
+
-**Message forwarding**: Publishes validated updates to an internal message queue.
28
28
29
-
**Douro Labs** operates the relayer service for the Pyth Lazer network.
29
+
Douro Labs operates the relayer service for the Pyth Lazer network. It follows a strict, deterministic processing model:
30
30
31
-
<Callouttype="info">
32
-
The Douro Labs-operated relayer follows a strict, deterministic processing model:
33
-
-**No price dropping**: All validated updates are forwarded to the message queue without dropping any prices.
34
-
-**FCFS processing**: Updates are processed on a first-come-first-served basis without prioritization.
35
-
-**Deterministic operation**: The relayer operates according to its configured logic and does not deviate from it.
31
+
-**No price dropping outside of circuit breakers**: All validated updates are forwarded to the message queue without dropping any prices.
32
+
-**FCFS processing**: Updates are processed on a first-come-first-served basis without prioritization.
33
+
-**Deterministic operation**: The relayer operates according to its configured logic and does not deviate from it.
36
34
37
35
This ensures reliable, predictable data flow from publishers to consumers.
38
36
39
-
</Callout>
40
-
41
37
### Message Queue
42
38
43
-
The system uses NATS JetStream as the primary message queue for pub/sub messaging with stream persistence.
39
+
The system uses a distributed message queue for pub/sub messaging with stream persistence.
44
40
This allows the system to be deployed in a multi-datacenter environment and ensures reliable message delivery between services.
45
41
46
-
**Message ordering**: NATS JetStream guarantees message ordering within a single stream, ensuring that updates from publishers are processed in the order they were received by the Relayer.
42
+
**Message ordering**: The message queue guarantees message ordering within a single stream, ensuring that updates from publishers are processed in the order they were received by the Relayer.
47
43
This ordering guarantee is critical for maintaining consistent feed state across all aggregators.
48
44
49
45
### Routers
50
46
51
47
The Router is the real-time distribution layer that serves data to consumers.
52
-
It embeds aggregation logic to compute median prices, confidence intervals (using interquartile range), and best bid/ask prices from multiple publisher inputs.
48
+
It embeds aggregation logic to compute median prices, confidence intervals (using interquartile range), and best bid/ask prices, funding rates, and more from multiple publisher inputs.
53
49
54
50
**Key features:**
55
51
@@ -60,7 +56,7 @@ It embeds aggregation logic to compute median prices, confidence intervals (usin
60
56
61
57
#### Aggregation logic
62
58
63
-
Each Router embeds an aggregator component that consumes publisher updates from NATS and computes aggregated data feeds. The aggregator:
59
+
Each Router embeds an aggregator component that consumes publisher updates from the Message Queue and computes aggregated data feeds. The aggregator:
64
60
65
61
- Computes median values resistant to outlier data from individual publishers.
66
62
- Calculates confidence intervals using interquartile range to measure data spread.
@@ -73,5 +69,5 @@ The History Service provides persistence and historical data queries.
73
69
74
70
**Key responsibilities:**
75
71
76
-
- Data persistence: Stores all publisher updates, aggregated data, and transactions in ClickHouse.
72
+
- Data persistence: Stores all publisher updates, aggregated data, and transactions.
77
73
- Historical queries: Provides REST API for querying historical data.
0 commit comments