Examples
Runnable examples in sdk/rust/nym-sdk/examples/ (opens in a new tab). Each file is self-contained with step-by-step comments.
cargo run --example <NAME>| Example | Source | What it demonstrates |
|---|---|---|
| Simple | simple.rs (opens in a new tab) | Send a message to yourself and print it |
| SURB Reply | surb_reply.rs (opens in a new tab) | Anonymous replies using AnonymousSenderTag and send_reply() |
| Builder | builder.rs (opens in a new tab) | Using MixnetClientBuilder with ephemeral keys |
| Builder with Storage | builder_with_storage.rs (opens in a new tab) | Persisting keys to disk with StoragePaths |
| Parallel Send/Receive | parallel_sending_and_receiving.rs (opens in a new tab) | Using split_sender() for concurrent tasks |
| Sandbox Testnet | sandbox.rs (opens in a new tab) | Connecting to the Sandbox testnet instead of mainnet |
| Bandwidth Credential | bandwidth.rs (opens in a new tab) | Acquiring a bandwidth credential for paid mixnet access |
| Custom Topology | custom_topology_provider.rs (opens in a new tab) | Implementing the TopologyProvider trait to filter or customize node selection |
| Overwrite Topology | manually_overwrite_topology.rs (opens in a new tab) | Manually constructing a topology with hardcoded nodes |
| Control Requests | control_requests.rs (opens in a new tab) | Sending service provider control requests (health, version, binary info) |
| Custom Storage | manually_handle_storage.rs (opens in a new tab) | Implementing custom storage backends for keys, gateways, and credentials |