NYM: A Guide to Setting Up Mix Nodes and Gateways

Beyond
6 min readOct 4, 2024

--

What is NYM?

NYM builds a mixnet — a routing protocol that creates a private connection that is hard to trace. This is achieved by using a chain of proxy servers, known as “mixes.” These mixes accept messages from multiple senders, shuffle them, and send them back in random order to the next destination (either another mix node or the final recipient).

Why is this better than VPN or TOR?

1. NYM Protects Network Traffic During Transmission

The mixnet encrypts packets on multiple levels and transmits them through a multi-layered network. At each level, your internet traffic is mixed with traffic from other users, securing both the content and metadata (IP address, with whom you’re communicating, when, where, and from which device, etc.).

2. NYM is Incentivized and Decentralized

Users pay fees in NYM tokens to send their data through the mixnet. Anyone can run a mix node by staking an initial deposit in NYM. Node operators are rewarded based on reputation, service quality, uptime, and the number of lost packets. This makes the mixnet economically sustainable and decentralized.

3. NYM Can Work with Any Blockchain or Application

From Bitcoin to ZCash, no current Level-1 blockchain provides Level-0 privacy for peer-to-peer broadcasts used in cryptocurrency transactions. NYM provides network-level privacy for any blockchain and application, offering metadata protection.

Additional Resources

Website

Documentation

Whitepaper

Telegram

X (Twitter)

Discord

GitHub

Mixnet Explorer

DYOR Before Interacting with Any Project

To follow best practices in researching any project, see:

1. DYOR Guide

2. DYOR Practice

Server Recommendations

Minimum requirements:

  • 4 CPU
  • 4 GB RAM
  • 40 GB SSD
  • IPv6 + IPv4
  • 1Gb/s port speed

Guide

  1. Update the package database of your local storage and upgrade installed packages:
sudo apt-get update && sudo apt-get upgrade -y

2. Install Required Packages

sudo apt install pkg-config build-essential libssl-dev curl jq git

3. Install Rust:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh

4. Configure Your Shell to Use the Rust Environment

source $HOME/.cargo/env

5. Check Rust Version

rustc --version

Install NYM

1. Clone the repository:

git clone https://github.com/nymtech/nym.git

2. Navigate to the nym directory:

cd nym

3. Check the master branch:

git checkout master

4. Build the binaries:

cargo build --release

5.Run the command to install nano (depending on your distribution)

apt update && apt install nano

6. Create service files.

When launching the nym-node, you can use various flags:

— id <YOUR_ID>: Local identifier of your node.

— config-file <PATH>: Used by the migrate command to specify the location of an existing node configuration file. Default path: ~/.nym/nym-nodes/default-nym-node/config/config.toml.

— deny-init: Use this flag to prevent the initialization of a new node. It’s recommended to use this after the first launch to avoid accidentally running a second node.

— init-only: Use this flag if you want to set up the node without running it.

— mode: Specifies the operating mode of the node, which is always required. It can be one of the following:

• exit-gateway

• entry-gateway

• mixnode

— write-changes: Used to change values in the config.toml file after the node is running.

— mnemonic: Used when gateways have coconut-credentials-enforced. This mnemonic prevents double-spending. The account needs credit to function.

— expose-system-info <true/false>: Specifies the visibility of system information in the network.

— expose-system-hardware <true/false>: Specifies the visibility of system hardware information in the network.

— expose-crypto-hardware <true/false>: Displays information about your cryptographic hardware in the network.

— http-bind-address: Address and port for the HTTP interface (default: 0.0.0.0:8080). You can change the port if needed.

— mixnet-bind-address: Address and port for the Mixnet (default: 0.0.0.0:1789). You can change the port if needed.

— location <FULL_COUNTRY_NAME>: Specifies the location of your node.

— public-ips: Automatically detects your public IP address:

"$(curl -4 https://ifconfig.me)"

Example of a Completed ExecStart Command (You will need to provide your ID and IP of your server):

ExecStart=/root/nym/target/release/nym-node run --id BeyondZcash --mode mixnode --public-ips 95.164.69.112 --mixnet-bind-address 0.0.0.0:1789 --http-bind-address 0.0.0.0:8080 --accept-operator-terms-and-conditions

Create the nym-node.service file:

tee /etc/systemd/system/nym-node.service > /dev/null <<EOF 
[Unit]
Description=NYM Node
StartLimitInterval=350
StartLimitBurst=10

[Service]
User=root
ExecStart=/root/nym/target/release/nym-node run --id BeyondZcash --mode mixnode --public-ips 95.164.69.112 --mixnet-bind-address 0.0.0.0:1789 --http-bind-address 0.0.0.0:8080 --accept-operator-terms-and-conditions
Restart=on-failure
RestartSec=30
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOF

7. Restart Daemon, Enable the Service, and Start It

systemctl daemon-reload && \
systemctl enable nym-node && \
systemctl start nym-node && \
systemctl status nym-node

If everything is set up correctly, you will see a successful status.

Binding a NYM node

1. Navigate to the nym/target/release folder and check your nym node information:
Change <ID> to the node ID from the service file.

cd && \
cd nym/target/release && \
./nym-node bonding-information --id <ID>

Example:

2. Open NYM desktop wallet.

3. Go to the tab: ‘Bond’.

4. Click: “Bond”.

5. Fill in the required information from the first step and click ‘Next’.
The host is your IP address. To get the correct host address, run:

echo "$(curl -4 https://ifconfig.me)"

6. Add a minimum of 100 NYM.

7. Now you need to enter the ‘Sign’ command.

7.1 Copy: <payload-generated-by-the-wallet>.:

7.2 Run the command provided by the wallet in the nym/target/release folder, but change <payload-generated-by-the-wallet> to the one you copied in the previous step:

./nym-node sign --id <ID> --contract-msg <payload-generated-by-the-wallet>

7.3 Copy the withdrawal to your wallet:

8. Check if everything is correct:

If all goes well, you will see this:

9. Go to Bond and check the status.
10. Check the logs:

journalctl -u nym-node -f -o cat

Wait until your node starts receiving packets.

Useful commands

Check logs:

journalctl -u nym-node -f -o cat
  • Check node status:
systemctl status nym-node
  • View all available commands:
./nym-node -help
  • List all available flags for each command:
./nym-node <КОМАНДА> -help

Upgrade

  1. Go to the nym folder:
cd nym

2. Pull updates from the repository:

git pull

3. Rebuild the binaries:

cargo build --release

4. Restart the service:

systemctl daemon-reload && \
systemctl restart nym-node

Removing the NYM Node

systemctl stop nym-node && \
systemctl disable nym-node && \
rm /etc/systemd/system/nym-node.service && \
systemctl daemon-reload && \
cd && \
rm -rf nym .nym

Thank you for the provided material, crptcpchk. You can always reach out to us:

Discord

X (Twitter)

Telegram

--

--