nym节点搭建教程

购买一台机子 最便宜的就可以 注意需要用Ubuntu 20.04 (LTS) x64

VPS Hardware Specs​

You will need to rent a VPS to run your mix node on. One key reason for this is that your node must be able to send TCP data using both IPv4 and IPv6 (as other nodes you talk to may use either protocol.

For the moment, we haven't put a great amount of effort into optimizing concurrency to increase throughput, so don't bother provisioning a beastly server with multiple cores. This will change when we get a chance to start doing performance optimizations in a more serious way. Sphinx packet decryption is CPU-bound, so once we optimise, more fast cores will be better.

For now, see the below rough specs:

  • Processors: 2 cores are fine. Get the fastest CPUs you can afford.

  • RAM: Memory requirements are very low - typically a mix node may use only a few hundred MB of RAM.

  • Disks: The mixnodes require no disk space beyond a few bytes for the configuration files.

sudo ufw allow ssh


sudo ufw enable

apt install mosh

sudo ufw allow 60000:61000/udp

https://nymtech.net/download/ 下载 Nym Mixnode 二进制文件

chmod 777 nym-mixnode 给权限

scp nym-mixnode root@xxx.xxx.xxx.xx:/root/ 上传到机子上

init 节点

./nym-mixnode init --id winston-smithnode --host $(curl ifconfig.me) --wallet-address <wallet-address>

run

./nym-mixnode run --id winston-smithnode

这样就跑起来了

处理一下防火墙

sudo apt install ufw -y

sudo ufw enable

sudo ufw status 

sudo ufw allow 1789,1790,8000,22,80,443/tcp,60000:61000/udp

sudo ufw status

但是还需要让它自动跑 通过创建一个systemd服务文件

[Unit]
Description=Nym Mixnode (1.0.0-rc.1)
StartLimitInterval=350
StartLimitBurst=10

[Service]
User=nym
LimitNOFILE=65536
ExecStart=/home/nym/nym-mixnode run --id mix0100
KillSignal=SIGINT
Restart=on-failure
RestartSec=30

[Install]
WantedBy=multi-user.target

将上述文件放到你的系统中,即/etc/systemd/system/nym-mixnode.service

ExecStart中的路径,使其指向你的混合节点的二进制文件(nym-mixnode),并修改User为你要运行的用户。我是root。

之后运行

systemctl enable nym-mixnode.service

启动你的节点

service nym-mixnode start

你也可以用service nym-mixnode stopservice nym-mixnode restart停止或者重启你的混合节点。 注意:如果你在启用systemd脚本后对其做了任何改动,你需要运行如下命令:

systemctl daemon-reload

可以通过 journalctl 查看

journalctl -u nym-mixnode.service -f

如果没有打印出内容,到sudo vi /etc/systemd/journald.conf

把#Storage=auto修改为 Storage=persistent

然后sudo systemctl restart systemd-journald

然后添加节点信息

./nym-mixnode describe --id xxx

查看信息

./nym-mixnode node-details --id xxx

然后在钱包里 bond mixnode 把信息填进去

Upgrade

在钱包里 bond处 Node Setting里面 把version修改成一致的 然后上链

pause your mix node process

replace the existing binary with the newest binary (which you can either compile yourself or grab from our releases page)

re-run init with the same values as you used initially. This will just update the config file, it will not overwrite existing keys.

restart your mix node process with the new binary.