* started on cosmos tutorial
* edited summary accordingly * edited links in other pages for new ts tutorial structure * removed ipfs coming soon page
This commit is contained in:
committed by
mfahampshire
parent
a50b4ad211
commit
2a7a681b7d
@@ -31,14 +31,17 @@
|
||||
|
||||
# Tutorials
|
||||
|
||||
- [Simple Service Provider](tutorials/simple-service-provider.md)
|
||||
- [(Rust SDK) Cosmos Blockchain Service](tutorials/cosmos-service/intro.md)
|
||||
- [Tutorial Overview](tutorials/cosmos-service/overview.md)
|
||||
- [Preparing Your Environment](tutorials/cosmos-service/preparing-env.md)
|
||||
- [(Typescript) Simple Service Provider](tutorials/simple-service-provider/simple-service-provider.md)
|
||||
- [Tutorial Overview](tutorials/simple-service-provider/overview.md)
|
||||
- [Preparing Your User Client Environment](tutorials/simple-service-provider/preparating-env.md)
|
||||
- [Building Your User Client](tutorials/simple-service-provider/user-client.md)
|
||||
- [Preparing Your Service Provider Environment](tutorials/simple-service-provider/preparating-env2.md)
|
||||
- [Building Your Service Provider](tutorials/simple-service-provider/service-provider.md)
|
||||
- [Sending a Message Through the Mixnet](tutorials/simple-service-provider/sending-message.md)
|
||||
- [IPFS Service Provider (coming soon)](tutorials/ipfs-service-provider.md)
|
||||
|
||||
|
||||
# Community Resources
|
||||
|
||||
|
||||
@@ -36,12 +36,11 @@ For example, a Service Provider could receive a request to check a mail server a
|
||||
|
||||
Maybe you would like to concentrate on building a application that uses the mixnet:
|
||||
|
||||
* Explore the Tutorials section of the Developer Portal. Our in-depth tutorial on [Building a Simple Service Provider](../tutorials/simple-service-provider.md) give a good understanding of building User Clients and Service Providers in TypeScript, and how to configure Nym Websocket Clients for seamless communication with the mixnet.
|
||||
* Explore the Tutorials section of the Developer Portal. Our in-depth tutorial on [Building a Simple Service Provider](../tutorials/simple-service-provider/simple-service-provider.md) give a good understanding of building User Clients and Service Providers in TypeScript, and how to configure Nym Websocket Clients for seamless communication with the mixnet.
|
||||
|
||||
* Get started with using the Nym Mixnet quickly and easily by exploring the [Quickstart](../quickstart/overview.md) options, such a NymConnect, proxying traffic through the Nym Socks5 client, or dive into integrating Nym into your existing application with the [Integrations](../integrations/integration-options.md) section.
|
||||
|
||||
Or perhaps you a developer that would like to run a infrastructure node such as a Gateway, Mix node or Network Requestor:
|
||||
* Check out the [Network Overview](https://nymtech.net/docs/architecture/network-overview.html) docs page.
|
||||
Or perhaps you a developer that would like to run a infrastructure node such as a Gateway, Mix node or Network Requestor:
|
||||
* Check out the [Network Overview](https://nymtech.net/docs/architecture/network-overview.html) docs page.
|
||||
|
||||
* Take a look at our [Node Setup Guide](https://nymtech.net/docs/nodes/setup-guides.html) with our Nym Docs, containing setup guides for setting up you own infrastructure node.
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
# Integrating with Nym for network privacy
|
||||
If you are wanting to integrate Nym by using the Mixnet as a transport layer for application traffic, you will have to run one of the three Nym clients in order to connect to the Mixnet.
|
||||
If you are wanting to integrate Nym by using the Mixnet as a transport layer for application traffic, you will have to run one of the three Nym clients in order to connect to the Mixnet.
|
||||
|
||||
## Connecting applications to the mixnet
|
||||
### SDK support
|
||||
### SDK support
|
||||
If your app is written in Typescript or Rust, then you can use the [Typescript](https://nymtech.net/docs/sdk/typescript.html) or [Rust](https://nymtech.net/docs/sdk/rust.html) SDKs. These SDKs abstract away much of the messaging logic from your app, and allow you to run a Nym client as part of your application process, instead of having to run them seperately.
|
||||
|
||||
### Choosing a client
|
||||
In order to connect your application to the mixnet, you need to select one of three clients to use. These clients do the majority of the heavy-lifting with regards to cryptographic operations and routing under the hood, and all do basically the same thing: create a connection to a gateway, encrypt and decrypt packets sent to and received from the mixnet, and send cover traffic to hide the flow of actual app traffic from observers.
|
||||
In order to connect your application to the mixnet, you need to select one of three clients to use. These clients do the majority of the heavy-lifting with regards to cryptographic operations and routing under the hood, and all do basically the same thing: create a connection to a gateway, encrypt and decrypt packets sent to and received from the mixnet, and send cover traffic to hide the flow of actual app traffic from observers.
|
||||
|
||||
As outlined in the [clients overview documentation](https://nymtech.net/docs/clients/overview.html) there are three clients availiable to developers to use when connecting applications to the mixnet:
|
||||
As outlined in the [clients overview documentation](https://nymtech.net/docs/clients/overview.html) there are three clients availiable to developers to use when connecting applications to the mixnet:
|
||||
|
||||
#### Websocket client
|
||||
Your first option is the native websocket client. This is a compiled program that can run on Linux, Mac OS X, and Windows machines. It runs as a persistent process on a desktop or server machine. You can connect to it with any language that supports websockets.
|
||||
Your first option is the native websocket client. This is a compiled program that can run on Linux, Mac OS X, and Windows machines. It runs as a persistent process on a desktop or server machine. You can connect to it with any language that supports websockets.
|
||||
|
||||
You can see an example of how to connect to and manage interactions with this client in the [Simple Service Provider tutorial](../tutorials/simple-service-provider.md).
|
||||
You can see an example of how to connect to and manage interactions with this client in the [Simple Service Provider tutorial](../tutorials/simple-service-provider/simple-service-provider.md).
|
||||
|
||||
#### Webassembly client
|
||||
If you’re working in JavaScript or Typescript in the browser, or building an edge computing app, you’ll likely want to choose the webassembly client.
|
||||
@@ -27,16 +27,16 @@ You can find example code in the [examples section](https://github.com/nymtech/n
|
||||
#### SOCKS client
|
||||
This client is useful for allowing existing applications to use the Nym mixnet without any code changes. All that’s necessary is that they can use one of the SOCKS5, SOCKS4a, or SOCKS4 proxy protocols (which many applications can - crypto wallets, browsers, chat applications etc).
|
||||
|
||||
It’s less flexible as a way of writing custom applications than the other clients, but able to be used to proxy application traffic through the mixnet without having to make any code changes.
|
||||
It’s less flexible as a way of writing custom applications than the other clients, but able to be used to proxy application traffic through the mixnet without having to make any code changes.
|
||||
|
||||
You can find examples of how to utilise this client in the [Quickstart](../quickstart/socks-proxy.md) section, and the [SOCKS5 documentation](https://nymtech.net/docs/clients/socks5-client.html).
|
||||
You can find examples of how to utilise this client in the [Quickstart](../quickstart/socks-proxy.md) section, and the [SOCKS5 documentation](https://nymtech.net/docs/clients/socks5-client.html).
|
||||
|
||||
## Recommended infrastructure setup
|
||||
In order to ensure uptime and reliability, it is recommended that you run some pieces of mixnet infrastructure. What infrastructure is necessary to run depends on the architecture of your application, and the endpoints that it needs to hit!
|
||||
## Recommended infrastructure setup
|
||||
In order to ensure uptime and reliability, it is recommended that you run some pieces of mixnet infrastructure. What infrastructure is necessary to run depends on the architecture of your application, and the endpoints that it needs to hit!
|
||||
|
||||
* If you're running a purely P2P application, then just integrating clients and having some method of sharing addresses should be enough to route your traffic through the mixnet.
|
||||
* If you're wanting to place the mixnet between your users' application instances and a server-based backend, you can use the [network requester](https://nymtech.net/docs/nodes/network-requester-setup.html) service provider binary to proxy these requests to your application backend, with the mixnet 'between' the user and your service, in order to prevent metadata leakage being broadcast to the internet.
|
||||
* If you're wanting to route RPC requests through the mixnet to a blockchain, you will need to look into setting up some sort of service that does the transaction broadcasting for you. You can find examples of such projects on the [community applications](../community-resources/community-applications-and-guides.md) page.
|
||||
* If you're running a purely P2P application, then just integrating clients and having some method of sharing addresses should be enough to route your traffic through the mixnet.
|
||||
* If you're wanting to place the mixnet between your users' application instances and a server-based backend, you can use the [network requester](https://nymtech.net/docs/nodes/network-requester-setup.html) service provider binary to proxy these requests to your application backend, with the mixnet 'between' the user and your service, in order to prevent metadata leakage being broadcast to the internet.
|
||||
* If you're wanting to route RPC requests through the mixnet to a blockchain, you will need to look into setting up some sort of service that does the transaction broadcasting for you. You can find examples of such projects on the [community applications](../community-resources/community-applications-and-guides.md) page.
|
||||
|
||||
## Example application traffic flow
|
||||
### Initialization
|
||||
@@ -44,36 +44,36 @@ First, we need to initalise an app and connect it to Nym.
|
||||
|
||||
|
||||
```
|
||||
+-----------+
|
||||
| Gateway |
|
||||
+-----------+
|
||||
^
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
+-------------------+
|
||||
| +---------------+ |
|
||||
| | Nym client | |
|
||||
| +---------------+ |
|
||||
| ^ |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| v |
|
||||
| +---------------+ |
|
||||
| | Your app code | |
|
||||
| +---------------+ |
|
||||
+-------------------+
|
||||
Your Local Machine
|
||||
| Gateway |
|
||||
+-----------+
|
||||
^
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
+-------------------+
|
||||
| +---------------+ |
|
||||
| | Nym client | |
|
||||
| +---------------+ |
|
||||
| ^ |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| v |
|
||||
| +---------------+ |
|
||||
| | Your app code | |
|
||||
| +---------------+ |
|
||||
+-------------------+
|
||||
Your Local Machine
|
||||
```
|
||||
|
||||
At the bottom we have an app. It consists of two parts:
|
||||
|
||||
* your application specific logic
|
||||
* your Nym client - either running as a standalone process, or as part of the process of your app code if you're using an SDK
|
||||
* your application specific logic
|
||||
* your Nym client - either running as a standalone process, or as part of the process of your app code if you're using an SDK
|
||||
|
||||
Nym apps have a stable, potentially long-lasting relation to a gateway node. A client will register itself with a gateway, and get back an authentication token that it can then use to retrieve messages from the gateway later on.
|
||||
|
||||
@@ -89,40 +89,40 @@ The Nym client part of the app accepts messages from your code and automatically
|
||||
The app has now connected to the Gateway, but we haven't sent a message to ourselves yet. Let's do that now.
|
||||
|
||||
```
|
||||
|
||||
+----------+ +----------+ +----------+
|
||||
| Mix Node |<-----------> | Mix Node |<----------->| Mix Node |
|
||||
| Layer 1 | | Layer 2 | | Layer 3 |
|
||||
+----------+ +----------+ +----------+
|
||||
^ ^
|
||||
| |
|
||||
|
||||
+----------+ +----------+ +----------+
|
||||
| Mix Node |<-----------> | Mix Node |<----------->| Mix Node |
|
||||
| Layer 1 | | Layer 2 | | Layer 3 |
|
||||
+----------+ +----------+ +----------+
|
||||
^ ^
|
||||
| |
|
||||
|<--------------------------------------------------+
|
||||
|
|
||||
v
|
||||
+--------------+
|
||||
| Your gateway |
|
||||
+--------------+
|
||||
^
|
||||
|
|
||||
|
|
||||
v
|
||||
+-------------------+
|
||||
| +---------------+ |
|
||||
| | Nym client | |
|
||||
| +---------------+ |
|
||||
| ^ |
|
||||
| | |
|
||||
| | |
|
||||
| v |
|
||||
| +---------------+ |
|
||||
| | Your app code | |
|
||||
| +---------------+ |
|
||||
+-------------------+
|
||||
Your Local Machine**
|
||||
|
|
||||
v
|
||||
+--------------+
|
||||
| Your gateway |
|
||||
+--------------+
|
||||
^
|
||||
|
|
||||
|
|
||||
v
|
||||
+-------------------+
|
||||
| +---------------+ |
|
||||
| | Nym client | |
|
||||
| +---------------+ |
|
||||
| ^ |
|
||||
| | |
|
||||
| | |
|
||||
| v |
|
||||
| +---------------+ |
|
||||
| | Your app code | |
|
||||
| +---------------+ |
|
||||
+-------------------+
|
||||
Your Local Machine**
|
||||
|
||||
|
||||
** note that depending on the technical setup, the Nym client running on this machine may
|
||||
be either a seperate process or embedded in the same process as the app code via one of our SDKs.
|
||||
be either a seperate process or embedded in the same process as the app code via one of our SDKs.
|
||||
```
|
||||
|
||||
Let's say your code code pokes a message `hello world` into the Nym client. The Nym client automatically wraps that message up into a layer encrypted Sphinx packet, adds some routing information and encryption, and sends it to its own gateway. The gateway strips the first layer of encryption, ending up with the address of the first mixnode it should forward to, and a Sphinx packet.
|
||||
@@ -139,38 +139,37 @@ Messages are end-to-end encrypted. Although the gateway knows our app's IP when
|
||||
The process for sending messages to other apps is exactly the same, you simply specify a different recipient address. Address discovery happens outside the Nym system: in the case of a Service Provider app, the service provider has presumably advertised its own address. If you're sending to a friend of yours, you'll need to get a hold of their address out of band, maybe through a private messaging app such as Signal.
|
||||
|
||||
```
|
||||
|
||||
+----------+ +----------+ +----------+
|
||||
| Mix Node |<-----------> | Mix Node |<----------->| Mix Node |
|
||||
| Layer 1 | | Layer 2 | | Layer 3 |
|
||||
+----------+ +----------+ +----------+
|
||||
^ ^
|
||||
| |
|
||||
| |
|
||||
v v
|
||||
+--------------+ +-----------------+
|
||||
| Your gateway | | Service gateway |
|
||||
+--------------+ +-----------------+
|
||||
^ ^
|
||||
| |
|
||||
| |
|
||||
v v
|
||||
+-------------------+ +-------------------+
|
||||
| +---------------+ | | +---------------+ |
|
||||
| | Nym client | | | | Nym Client | |
|
||||
| +---------------+ | | +---------------+ |
|
||||
| ^ | | ^ |
|
||||
| | | | | |
|
||||
| | | | | |
|
||||
| v | | v |
|
||||
| +---------------+ | | +---------------+ |
|
||||
| | Your app code | | | | Service Code | |
|
||||
| +---------------+ | | +---------------+ |
|
||||
+-------------------+ +-------------------+
|
||||
Your Local Machine** Service Provider Machine**
|
||||
|
||||
+----------+ +----------+ +----------+
|
||||
| Mix Node |<-----------> | Mix Node |<----------->| Mix Node |
|
||||
| Layer 1 | | Layer 2 | | Layer 3 |
|
||||
+----------+ +----------+ +----------+
|
||||
^ ^
|
||||
| |
|
||||
| |
|
||||
v v
|
||||
+--------------+ +-----------------+
|
||||
| Your gateway | | Service gateway |
|
||||
+--------------+ +-----------------+
|
||||
^ ^
|
||||
| |
|
||||
| |
|
||||
v v
|
||||
+-------------------+ +-------------------+
|
||||
| +---------------+ | | +---------------+ |
|
||||
| | Nym client | | | | Nym Client | |
|
||||
| +---------------+ | | +---------------+ |
|
||||
| ^ | | ^ |
|
||||
| | | | | |
|
||||
| | | | | |
|
||||
| v | | v |
|
||||
| +---------------+ | | +---------------+ |
|
||||
| | Your app code | | | | Service Code | |
|
||||
| +---------------+ | | +---------------+ |
|
||||
+-------------------+ +-------------------+
|
||||
Your Local Machine** Service Provider Machine**
|
||||
|
||||
|
||||
** note that depending on the technical setup, the Nym client running on these machines may
|
||||
be either a seperate process or embedded in the same process as the app code via one of our SDKs.
|
||||
be either a seperate process or embedded in the same process as the app code via one of our SDKs.
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Building a Cosmos Blockchain Service with the Rust SDK
|
||||
|
||||
This tutorial is for Rust developers wanting to interact with the Rust SDK and take a first step at building a service with which to interact with a blockchain.
|
||||
The key here is to think of the service as a proxy: it interacts with the blockchain _on the client's behalf_, shielding it from the Validator it interacts with, whilst also being shielded from the client by the mixnet!
|
||||
@@ -0,0 +1,57 @@
|
||||
# Tutorial Overview
|
||||
|
||||
This tutorial involves writing two pieces of code in Rust:
|
||||
|
||||
- A client side binary used to construct a blockchain query and send this query to a service, which will interact with a Cosmos SDK blockchain on our behalf.
|
||||
- A service which will listen out for requests from the mixnet, act on those requests, and anonymously reply to the client sending the requests.
|
||||
|
||||
You will learn how to do the following with the Rust SDK:
|
||||
- Create clients with manual storage settings.
|
||||
- Parse incoming traffic from the mixnet and reply anonymously using [SURBs]().
|
||||
|
||||
> Services usually run on remote servers to assure reliable uptime and to unlink sender and receiver metadata. For demonstration purposes however, you will run both components on your local machine, looping messages through the mixnet to yourself.
|
||||
|
||||
|
||||
```
|
||||
+----------+ +----------+ +----------+
|
||||
| Mix Node |<-----------> | Mix Node |<----------->| Mix Node |
|
||||
| Layer 1 | | Layer 2 | | Layer 3 |
|
||||
+----------+ +----------+ +----------+
|
||||
^ ^
|
||||
| |
|
||||
|<--------------------------------------------------+
|
||||
|
|
||||
v
|
||||
+--------------+
|
||||
| Your gateway |
|
||||
+--------------+
|
||||
^
|
||||
|
|
||||
|
|
||||
v
|
||||
+-------------------------------------------+
|
||||
| |
|
||||
| +-------------+ +--------------+ |
|
||||
| | Client code | | Service code | |
|
||||
| +-------------+ +--------------+ |
|
||||
| |
|
||||
+-------------------------------------------+
|
||||
Your Local Machine
|
||||
```
|
||||
|
||||
You can find the code for these components [here](). You can use it as a reference while building or simply download it and follow along as you progress through the tutorial.
|
||||
|
||||
Notice that this tutorial attempts to use very few external libraries. This tutorial is not showing you how to build production-grade code, but **to understand how to connect and send messages to, as well as recieve messages from, the mixnet.**
|
||||
|
||||
```admonish note title="Sidenote: What is a Service / Service Provider?"
|
||||
'Service' or 'Service Provider' are catchall names used to refer to any type of app that can communicate with the mixnet via a Nym client - in this case, one embedded in your app process via the Rust SDK.
|
||||
|
||||
The first SP to have been released is the [Network Requester](https://nymtech.net/docs/nodes/network-requester-setup.html) - a binary that receives a network request from the mixnet, performs that request (e.g. authenticating with a message server and receiving new messages for a user) and then passes the response back to the user who requested it anonymously, shielding their metadata from the message server.
|
||||
|
||||
The SP you will build in this tutorial is far more simple than this, showing you how to approach building something that can:
|
||||
* connect to the mixnet,
|
||||
* listen for messages, and
|
||||
* perform some action with them - in this case, query a Cosmos SDK blockchain.
|
||||
|
||||
However, once you see how easy it is to integrate with the mixnet for traffic transport, you will be able to build apps with real-world uses easily.
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
# Preparing Your Environment
|
||||
|
||||
## Prerequisites
|
||||
* `Rust` & `cargo`
|
||||
|
||||
## Creating your Project Structure
|
||||
|
||||
* Make a new cargo project:
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
* Create the following directory structure and files:
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
* Finally add the following dependencies - you can just copy and paste this into your `Cargo.toml` file:
|
||||
```
|
||||
TODO pull validator client code etc from the monorepo instead of workspace loading
|
||||
```
|
||||
@@ -1 +0,0 @@
|
||||
# Building a Image Upload Service Provider with IPFS (coming soon)
|
||||
Reference in New Issue
Block a user