Start your Nostr relay on Nym

Start your Nostr relay on Nym

Nostr (Notes and Other Stuff Transmitted by Relays) is a new, simple, open and censorship-resistant protocol. Discover how you can run a relay on Nym.


4 min read

To understand the will to have Nostr relays working on the mixnet, please read the article Nostr x Nym which details our motivations.

The fact of having a Nostr relay that works through the mixnet will allow to protect the users as for example that their ISP can know that they are using Nostr, how often and to which relay, or to have the risk to see you asking for all the IP addresses that contacted your server. The system proposed here is functional with all current relays, it is still in development phase, so bugs are not excluded.

Here is the final architecture summarized

Several components are necessary to install to achieve this:

  • A relay, a very complete list is available here. For this article, nostr-rs-relay will be used because it is very simple, uses SQLite and runs easily on Docker

  • nym-client, which will make the link between your relay and the mixnet

  • nostr-nym, to "translate" the requests received from the mixnet and send them to the relay


If you do not have Docker installed you can find the information here: Docker is not essential for a relay to work but it greatly simplifies the explanations.

Now we have to start the relay :

mkdir data
docker run -it -p 7000:8080 \
  --mount src=$(pwd)/data,target=/usr/src/app/db,type=bind \

If all goes well, here is the output that should appear. The relay is now started.


The nym-client is the component that will allow to communicate with the mixnet.

The download is on Github:, you have to search for a release called "Nym Binaries v1.1.x". In this example, the version Nym Binaries v1.1.14 is used.

# Download the nym-client and give exec permission
wget -O nym-client && chmod +x nym-client

# Init the nym-client
./nym-client init --id nostr-relay --latency-based-selection

# Start the nym-client
./nym-client run --id nostr-relay

If everything is correct the nym-client should now display its nym-client id. This is the element that will identify the relay and reach it in the mixnet.

The window must remain open.


It is this element that will make the link between the mixnet and the relay. It will establish a connection with the nym-client, listen to the messages sent by the clients, transmit the Nostr events and send back the answer or notify the clients.

For more flexibility, pipenv is used. To install pip is necessary: pip install pipenv

# clone the repo
git clone
cd nostr-nym

# start pipenv shell and install dependencies
pipenv shell
pipenv install

End result, the window must remain open.

The relay is now accessible via the mixnet, in this example it is at the address (=nym-client id)

5LhfbB9oGFEx4pTEUJ514LjCRuTr6zHq3kYmr45DeyAw.FfzyFK1GTAkRfpeKYMeQX3Ld1ascJUujXiHHozqunv6w@CfWcDJq8QBz6cVAPCYSaLbaJEhVTmHEmyYgQ6C5GdDW9 that it can be reached.

The following section explains how to test the relay, a simple nostr client has been developed.


Now that all the elements are in place, it is possible to test that creating notes and subscribing to new ones works.

In the previously cloned repository, there is a folder with a mixnet-compatible light Nostr client. Starting another nym-client is necessary.

# Init the nym-client
./nym-client init --id nostr-client --latency-based-selection --port 1978

# Start the nym-client
./nym-client run --id nostr-client

A public relay is available on the mixnet to easily test the operation :


# navigate to nostr client
cd nostr-nym/client

# start pipenv shell and install dependencies
pipenv shell
pipenv install

Publication of a new event.

python --cmd text-note --message "Hello world (from the Nym mixnet)" --relay <nym-client of relay started before> --nym-client ws://

Subscription to new events.

python --cmd subscribe --relay <nym-client id of relay started before> --nym-client ws://

Event filtering.

python --cmd filter --authors <npub to filter> --relay <nym-client id of relay started before> --nym-client ws://


The relay is now accessible via the mixnet. This is a first step towards more privacy and protection for relays.

A future article will present the benefits of setting up such an infrastructure for Nostr as well as the integration of the nym-client in an existing client such as,, damus on iOS or Amethyst on Android.