Skip to main content

Running a Node

Hardware, kernel tuning, the seeds file, how a new node syncs, and a systemd service with signed auto-updates for amadeusd.

amadeusd is the Amadeus node. The same binary follows the chain, serves the optional HTTP API and, when you turn the solver on, computes MatMul solutions that earn a place in the validator set. This page gets a node running on mainnet. For every environment variable, see Node configuration. For how the validator set and rewards work, see Building your Score.

Requirements​

  • A stable internet connection of 1 Gbps or more, with working IPv4.
  • UDP port 36969 open to the internet. Peers always reach each other on this port.
  • An x86-64 CPU with AVX2. Release binaries are built for -march=haswell. For solving, a CPU with AVX-512 (AVX512F, AVX512BW and AVX512-VNNI) uses the fastest solver path; otherwise the solver falls back to AVX2. A Ryzen 9 7950X (Zen 4) is the best value.
  • Disk: a regular node keeps only the last 10 epochs of history (about 6 days), so a modest NVMe drive is enough. An archival node keeps everything and needs 2 TB or more: the default snapshot zip alone is about 890 GB, and it is extracted next to itself.
  • A synchronized clock. At startup the node runs timedatectl status and prints 🔴 🕒 time not synced OR systemd-ntp client not found; DYOR 🔴 unless it reports System clock synchronized: yes.
  • Tested on Ubuntu 24.04 with Linux kernel 6.8.

Tune the kernel​

Anything below these settings degrades performance. Append the UDP buffer settings to /etc/sysctl.conf and apply them:

cat <<EOT >> /etc/sysctl.conf
# buff up the UDP stack for 1gbps
net.core.wmem_max = 268435456
net.core.rmem_default = 212992
net.core.rmem_max = 268435456
net.core.netdev_max_backlog = 300000
net.core.optmem_max = 16777216
net.ipv4.udp_mem = 3060432 4080578 6120864

# for normal networks: block spoofed UDP packets
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.rp_filter=1
EOT
sysctl -p

Raise the process limits in /etc/security/limits.conf, /etc/systemd/system.conf and /etc/systemd/user.conf:

cat <<EOT > /etc/security/limits.conf
root hard nofile 1048576
root soft nofile 1048576
* hard nofile 1048576
* soft nofile 1048576
root hard nproc unlimited
root soft nproc unlimited
* hard nproc unlimited
* soft nproc unlimited
root hard memlock unlimited
root soft memlock unlimited
* hard memlock unlimited
* soft memlock unlimited
EOT

cat <<EOT > /etc/systemd/system.conf
[Manager]
DefaultTasksMax=infinity
DefaultLimitNOFILE=infinity
DefaultLimitNPROC=infinity
DefaultLimitMEMLOCK=infinity
DefaultLimitLOCKS=infinity
EOT

cat <<EOT > /etc/systemd/user.conf
[Manager]
DefaultTasksMax=infinity
DefaultLimitNOFILE=infinity
DefaultLimitNPROC=infinity
DefaultLimitMEMLOCK=infinity
DefaultLimitLOCKS=infinity
EOT

Download and start the node​

Download the latest release from github.com/amadeusprotocol/node/releases/latest and run it:

wget https://github.com/amadeusprotocol/node/releases/latest/download/amadeusd
chmod +x amadeusd
./amadeusd

At startup the node prints its config folder, its version and its public key (pk: ...), then opens an Elixir REPL in the same terminal. See Using the REPL for what you can run there.

Every release ships two assets: amadeusd and amadeusd.sig. The .sig file starts with a one-line manifest, <version> <sha256>, followed by an SSH signature over that line. To check a download by hand, compare the hash and verify the signature against the release key that the node pins in ex/lib/misc/autoupdate_release_verify.ex:

wget https://github.com/amadeusprotocol/node/releases/latest/download/amadeusd.sig
head -1 amadeusd.sig # <version> <sha256>
sha256sum amadeusd # must print the same sha256

# the release key pinned in node v1.6.5, in OpenSSH format
echo 'amadeus-release namespaces="amadeus-release" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOYLUP7IfP1ukQxHxzNh1odIZ9nYy8bE6jzLGCS4Hgrf' > allowed_signers
head -1 amadeusd.sig > manifest.txt
sed -n '/BEGIN SSH SIGNATURE/,$p' amadeusd.sig > manifest.txt.sig
ssh-keygen -Y verify -f allowed_signers -I amadeus-release -n amadeus-release -s manifest.txt.sig < manifest.txt

A valid release prints Good "amadeus-release" signature for amadeus-release with ED25519 key SHA256:jMW2foeWRlQJgzW9qkaFME9OBoj0hkMT+sWCLyJ7Lj8. With AUTOUPDATE=true the node runs the same checks itself (see Node configuration).

You can also build the binary yourself; see Building from source.

Configure it with environment variables​

The node reads its whole configuration from environment variables. These are the ones most operators touch:

WORKFOLDER=~/.cache/amadeusd/ # chain data and the seeds file (this is the default)

UDP_IPV4=0.0.0.0 # interface to listen on for consensus traffic (default: all)
PUBLIC_UDP_IPV4=5.6.7.8 # optional; leave unset to discover your public IP via STUN

HTTP_IPV4=127.0.0.1 # HTTP API bind address; the default 0.0.0.0 means the API is off
HTTP_PORT=80 # HTTP API port (default 80)

ANR_NAME=my-validator # optional name, published in /api/peer/anr
ANR_DESC="ops contact: you@example.com"

AUTOUPDATE=true # install new signed releases automatically (off by default)
COMPUTOR=true # run the built-in solver (off unless set)
Do not write =false

OFFLINE, TESTNET and COMPUTOR switch on whenever the variable is set, whatever its value. OFFLINE=false puts the node in offline mode, TESTNET=false switches the node to testnet mode, and COMPUTOR=false turns the solver on. To keep one of them off, leave it unset (or remove the Environment= line from your service file).

HTTP_IPV4 and UDP_IPV4 must be IPv4 addresses. A value such as off stops the node at boot.

Node configuration lists every variable with its default.

The seeds file​

Your validator keys live in $WORKFOLDER/seeds (by default ~/.cache/amadeusd/seeds):

  • Each line is one 64-byte seed in Base58.
  • If the file is missing on first start, the node generates a new key and writes it there.
  • The first line is the node's main key: the pk it prints at startup and the identity it announces to peers. Every key in the file is tracked as a potential validator, and the built-in solver uses all of them.
  • Older installs kept a single seed in $WORKFOLDER/sk. If seeds does not exist yet, the node copies sk into it on start.

Whoever holds a seed controls that validator and its rewards. Back the file up and never share it.

One key, one node

Do not load the same seeds on two independent nodes. Both would sign blocks for the same slots. For redundancy, use a replica cluster, which lets only one member sign at a time.

How a new node syncs​

A new node does not replay the chain from genesis.

  • Regular node (default). On an empty datadir the node downloads one signed state bundle from $RPC_URL/api/sync/contractstate (by default https://mainnet-rpc.ama.one), imports it and continues from there. It then keeps the last HISTORY_KEEP_EPOCHS epochs (default 10) and prunes older blocks. Reads of pruned blocks are forwarded to RPC_URL.
  • Archival node (ARCHIVALNODE=true). The node downloads the full-history snapshot for SNAPSHOT_HEIGHT from https://snapshots.amadeus.bot/<height padded to 12 digits>.zip and keeps every block. The node prints an aria2c command for the same file. To fetch it faster yourself, run that command (for the default height, aria2c -x 4 https://snapshots.amadeus.bot/000088169793.zip) and unzip the archive into $WORKFOLDER before you start the node; it contains the db/ folder. Exchanges and indexers need this mode.

If the datadir already holds chain state below SNAPSHOT_HEIGHT, a regular node refuses to import a bundle over it and exits with FATAL: chain state exists ... but is below snapshot height. Stop the node and delete the chain database in $WORKFOLDER/db/ (keep the seeds file), then start again.

Run it as a systemd service​

This unit restarts the node whenever it exits and runs it inside screen, so you can attach to its REPL. Auto-update depends on that restart: after installing a new release, the node exits and systemd starts the new binary.

cat <<EOT > /etc/systemd/system/amadeusd.service
[Unit]
Description=AmadeusD
After=network-online.target

[Service]
Type=forking
LimitNOFILE=1048576
KillMode=control-group
Restart=always
RestartSec=3
User=root
WorkingDirectory=/root/
Environment="AUTOUPDATE=true"
ExecStart=/usr/bin/screen -UdmS amadeusd bash -c './amadeusd'

[Install]
WantedBy=default.target
EOT

systemctl daemon-reload
systemctl enable amadeusd
systemctl start amadeusd

# attach to the running node (detach with Ctrl+A, then D)
screen -rd amadeusd
  • Keep amadeusd in WorkingDirectory. Auto-update writes the new binary into the node's working directory, and ExecStart runs ./amadeusd from there.
  • To run as a regular user, change User=youruser and WorkingDirectory=/home/youruser.
  • To solve with this node, add Environment="COMPUTOR=true". Never add COMPUTOR=false: it also turns the solver on.
  • Optional: run the node under jemalloc so memory is returned to the system promptly. Install it with apt install libjemalloc2 and add Environment="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" and Environment="MALLOC_CONF=background_thread:true,narenas:4,dirty_decay_ms:0,muzzy_decay_ms:0".

Next steps​