f648349e82
* Diatixisify! * First pass at Typedoc generation for TS SDK * Remove overview pages * Fix typos and remove codebase references from docs Fix typos across network and developer docs: Quorum, available, cryptosystem, transaction, proportional, Standalone. Remove TODO placeholder from dVPN protocol page. Strip GitHub source links from network docs to decouple documentation from repo structure. * Expand thin landing pages across network and developer docs - Add intro content to network overview, infrastructure, and reference landing pages - Expand developer index with "where to start" guide - Add usage instructions and explanations to all five TS playground pages - Expand WebSocket client page with setup and message format examples * Restructure Rust SDK developer docs - Delete redundant mixnet example, message-helpers, and message-types subpages - Delete client-pool architecture and example subpages (content folded into landing) - Delete tcpproxy troubleshooting (folded into landing page) - Add deprecation notices to TcpProxy pages, pointing to Stream module - Add stream module docs: landing page, architecture, tutorial, and 4 example pages - Add mixnet and client-pool tutorials - Add SDK tour page - Update navigation and landing pages with docs.rs links * Restructure TS SDK developer docs - Merge overview, installation, and getting started into TS SDK landing page - Fold FAQ content into bundling/troubleshooting section - Delete redundant overview, installation, start, and FAQ pages - Update internal links in browsers.mdx and native.mdx - Update navigation and example page imports * Flatten and expand APIs section - Collapse nested API subpages into single pages with inline Redoc embeds - Rewrite introduction as landing page with decision table - Add endpoint categories, quick curl examples to each API page - Mark Explorer API as deprecated - Move NS API deployment guide to operators/performance-and-testing - Fix dangling /apis/nym-api/mainnet link in network-components - Remove sandbox endpoints from all API pages * Add redirects for moved and deleted pages - Add 25 redirects covering TS SDK, Rust SDK, APIs, and network sections - Fix dangling /developers/typescript/start link in operators changelog * Replace individual example doc pages with GitHub-linked tables, expand tutorials - replace individual example doc pages with GitHub-linked tables - expand mixnet tutorial with persistent identity and split_sender sections - add tcpproxy tutorial - rename "API Reference" to "TypeDoc Reference" in TS SDK sidebar - rename "Misc" to "Extras" in developer sidebar, move VPN CLI up - remove echo server from tools - update message-queue callout to reference actual modules - fix mixnet/examples redirect collision * Add SEO frontmatter, validate encryption standards, clean up URLs - add title/description/schemaType/section/lastUpdated frontmatter to 48 pages across developers, network, and APIs sections - remove network/.archive/ directory (compare against develop instead) - update nymtech.net → nym.com for website/blog links (keep infra URLs) - add native proxy "in progress" callout for Rust/C/Go * API-scraper update (#6598) * read nodes and locations * update python-prebuild.sh * Address PR #6494 review feedback - Use "mode" consistently instead of "role" on nym-nodes page - Replace "staking" with "bonding" for NYM token collateral - Wire up auto-scraped node counts via TimeNow + nodes-count.json - Fix broken licensing images: download CC icons locally, replace inline HTML - Fix 9 stale redirects pointing through deleted /network/architecture path * Fix linkcheck errors - Fix stale cross-links: /network/concepts/ → /network/mixnet-mode/ - Replace README.md references with globals.md in TypeDoc output - Add entryFileName: globals to typedoc.json configs to prevent recurrence * Fix remaining stale /network/architecture links - zk-nym-overview: architecture/nyx#nym-api → /network/infrastructure/nyx#nym-api - setup: network/architecture → /network/overview * Remove accidentally re-included architecture.md file from rebase * Standardize tutorials, document examples, add llms.txt, apply tone fixes - Expand Rust SDK tutorials with step-by-step structure; document all SDK examples across mixnet, client-pool, and tcpproxy pages - Add llms.txt generation script, wire into build and CI workflows - Apply tone/style fixes: deduplicate callouts, vary sentence structure, standardize voice consistency across changed pages * Consolidate redundant network overview docs * Trim dev docs: git-first imports, stream notice, collapse TcpProxy * Update tutorial * Refresh auto-generated API and command outputs * Update network section docs * Update developer and API docs: reusable components, stream protocol, conventions, tutorial fixes * Fix Rust SDK tutorial bugs: setup_env, port conflicts, logging, open_stream race condition * Update stream.mdx * Remove docs.rs link from Stream overview for the moment * add llms.txt and llms-full.txt note to readme --------- Co-authored-by: import this <97586125+serinko@users.noreply.github.com>
134 lines
4.5 KiB
Plaintext
134 lines
4.5 KiB
Plaintext
import { Callout } from 'nextra/components'
|
|
|
|
# Traffic Flow
|
|
|
|
This page walks through how packets travel through the mixnet, from sending client to destination.
|
|
|
|
<Callout type="info">
|
|
This describes the 5-hop mixnet flow. For the 2-hop dVPN mode, see [dVPN Protocol](/network/dvpn-mode/protocol).
|
|
</Callout>
|
|
|
|
## Overview
|
|
|
|
The Nym mixnet uses source routing: the sender chooses the complete route before sending. This means the sender constructs a Sphinx packet with layered encryption, where each layer contains routing information for one hop.
|
|
|
|
## Client to Entry Gateway
|
|
|
|
On connection, the Nym client registers with a particular Entry Gateway. This Gateway becomes part of the client's Nym address and is where incoming messages are delivered.
|
|
|
|
The client continuously sends packets to the Entry Gateway over a WebSocket connection. This stream includes both real messages and cover traffic at a constant rate. When the application has data to send, the client encrypts it as Sphinx packets and slots them into the stream. When there is no data, cover packets flow instead.
|
|
|
|
```mermaid
|
|
---
|
|
config:
|
|
theme: neo-dark
|
|
---
|
|
sequenceDiagram
|
|
box Local Machine
|
|
participant App as Application
|
|
participant Client as Nym Client
|
|
end
|
|
participant Gateway as Entry Gateway
|
|
|
|
Gateway->>Client: Key Exchange
|
|
|
|
loop Continuous Traffic
|
|
Client->>Gateway: Cover packet
|
|
Client->>Gateway: Cover packet
|
|
App-->>Client: Data to send
|
|
Client->>Client: Encrypt as Sphinx
|
|
Client->>Gateway: Real packet
|
|
Client->>Gateway: Cover packet
|
|
end
|
|
```
|
|
|
|
## Through the Mix Nodes
|
|
|
|
The Entry Gateway forwards packets into the three Mix Node layers. At each hop, the node decrypts its layer of the Sphinx packet to learn the next destination, verifies the HMAC to ensure integrity, applies a random delay, and forwards to the next hop.
|
|
|
|
The delay is critical. Without it, timing would correlate inputs to outputs. With exponential random delays, packets are reordered and the timing relationship is destroyed.
|
|
|
|
```mermaid
|
|
---
|
|
config:
|
|
theme: neo-dark
|
|
---
|
|
sequenceDiagram
|
|
participant Entry as Entry Gateway
|
|
participant M1 as Mix Layer 1
|
|
participant M2 as Mix Layer 2
|
|
participant M3 as Mix Layer 3
|
|
participant Exit as Exit Gateway
|
|
|
|
Entry->>M1: Sphinx Packet
|
|
M1->>M1: Decrypt layer
|
|
M1->>M1: Verify HMAC
|
|
M1->>M1: Random delay
|
|
M1->>M2: Sphinx Packet
|
|
M2->>M2: Decrypt layer
|
|
M2->>M2: Verify HMAC
|
|
M2->>M2: Random delay
|
|
M2->>M3: Sphinx Packet
|
|
M3->>M3: Decrypt layer
|
|
M3->>M3: Verify HMAC
|
|
M3->>M3: Random delay
|
|
M3->>Exit: Sphinx Packet
|
|
```
|
|
|
|
## Exit Gateway to Destination
|
|
|
|
The Exit Gateway handles the final hop. For traffic destined for external services, it decrypts the packet and forwards to the destination, then packages responses back into Sphinx packets for the return journey.
|
|
|
|
For traffic destined for another Nym client, the Exit Gateway delivers to that client's registered Gateway, which holds the message until the recipient comes online.
|
|
|
|
## The complete picture
|
|
|
|
Putting it together, a packet travels through five hops with encryption removed and delays applied at each Mix Node layer:
|
|
|
|
```mermaid
|
|
---
|
|
config:
|
|
theme: neo-dark
|
|
---
|
|
sequenceDiagram
|
|
box Sender
|
|
participant App1 as Application
|
|
participant C1 as Nym Client
|
|
end
|
|
|
|
box Mixnet
|
|
participant Entry as Entry GW
|
|
participant M1 as Mix L1
|
|
participant M2 as Mix L2
|
|
participant M3 as Mix L3
|
|
participant Exit as Exit GW
|
|
end
|
|
|
|
box Receiver
|
|
participant C2 as Nym Client
|
|
participant App2 as Application
|
|
end
|
|
|
|
App1->>C1: Send data
|
|
C1->>C1: Create Sphinx packet
|
|
C1->>Entry: Encrypted packet
|
|
Entry->>M1: Forward
|
|
M1->>M1: Decrypt, delay
|
|
M1->>M2: Forward
|
|
M2->>M2: Decrypt, delay
|
|
M2->>M3: Forward
|
|
M3->>M3: Decrypt, delay
|
|
M3->>Exit: Forward
|
|
Exit->>C2: Deliver
|
|
C2->>C2: Decrypt final layer
|
|
C2->>App2: Received data
|
|
```
|
|
|
|
## External services
|
|
|
|
When sending to an external service rather than another Nym client, the Exit Gateway acts as a proxy. It extracts the destination from the decrypted packet, makes the request on your behalf, and routes responses back through the network. The destination service sees the Exit Gateway's IP, not yours.
|
|
|
|
## Peer-to-peer
|
|
|
|
For applications where all parties run Nym clients, traffic stays entirely within the mixnet. Both sides enjoy full privacy protection, and [SURBs](/network/mixnet-mode/anonymous-replies) enable anonymous bidirectional communication without either party learning the other's address.
|