Node configuration
Every amadeusd environment variable with its default, plus snapshots and archival nodes, signed auto-updates, monitoring, replica clusters and building from source.
amadeusd reads its configuration from environment variables when it starts. This page covers node v1.6.5. The source of truth is ex/config/runtime.exs; check it when you upgrade. To set up a node first, see Running a Node.
How values are read
The node does not parse every variable the same way. Check the rule before you write a value:
| Rule | Variables | What turns it on |
|---|---|---|
| Presence | OFFLINE, TESTNET, COMPUTOR | Any value, including false, 0 or an empty string. Leave the variable unset to keep it off. |
| Yes-list | ARCHIVALNODE, AUTOUPDATE, AUTOSLASH, STATEPEERDOWNLOAD | Only true, y or yes. Anything else, or unset, is off. |
| No-list | CHECK_ROUTED_PEER | On by default. Only false, n or no turn it off. |
| Exact | RPC_EVENTS | On by default. Any value other than true turns it off. |
OFFLINE=false and COMPUTOR=false turn the feature onBecause of the presence rule, OFFLINE=false starts the node in offline mode (it never connects to peers), TESTNET=false switches it to testnet mode, and COMPUTOR=false starts the solver. Remove the variable instead.
Numeric variables must be integers, and the IP variables (UDP_IPV4, HTTP_IPV4) must be IPv4 addresses. An invalid value stops the node at boot.
Identity and storage
| Variable | Default | Description |
|---|---|---|
WORKFOLDER | ~/.cache/amadeusd/ | Holds the chain database (db/), the seeds file and other node state. |
ANR_NAME | unset | Optional validator name, published in the node's signed peer record (/api/peer/anr). |
ANR_DESC | unset | Optional description, published the same way. |
SEED64 | unset | A Base58 seed used only by the buildtx and build_and_broadcasttx command-line modes of amadeusd. The running node signs with the keys in $WORKFOLDER/seeds. |
The keys themselves live in $WORKFOLDER/seeds, one Base58 seed per line. See The seeds file.
Networking and HTTP API
| Variable | Default | Description |
|---|---|---|
UDP_IPV4 | 0.0.0.0 | Interface to bind for consensus traffic. Set a specific address if the machine has several. |
UDP_PORT | 36969 | Listen port for consensus traffic. The node always advertises 36969 to peers and sends to peers on its own UDP_PORT, so keep the default on mainnet. |
PUBLIC_UDP_IPV4 | unset | The public IPv4 to advertise. When unset, the node discovers it via STUN. Whatever you set is advertised verbatim, so only set a real IP address (useful behind complex NAT). |
CHECK_ROUTED_PEER | on | Accepts only peers whose IP is globally routed. Set to false only for private test networks. |
HTTP_IPV4 | 0.0.0.0 | Bind address of the HTTP API. The default 0.0.0.0 means the HTTP API is not started. Set a concrete address, for example 127.0.0.1, to enable it. |
HTTP_PORT | 80 | Port of the HTTP API. |
RPC_URL | https://mainnet-rpc.ama.one | Upstream RPC, without /api. The node downloads its bootstrap state bundle from here, forwards reads of pruned blocks to it, and the REPL's RPC.API.* helpers call it. |
RPC_EVENTS | true | Emits applied and rooted entry events to WebSocket subscribers of the HTTP API. |
Binding the HTTP API to a public interface exposes it to everyone. For a private RPC on a custom port use HTTP_IPV4=127.0.0.1 HTTP_PORT=8080.
Network modes
| Variable | Default | Description |
|---|---|---|
OFFLINE | unset | Presence rule. Runs the node without connecting to any peer. Useful for a local REPL that only talks to RPC_URL. |
TESTNET | unset | Presence rule. Runs a local testnet: on an empty WORKFOLDER the node creates its own testnet genesis, and it signs transactions with the testnet domain. See Local testnet. |
TESTNET_SLEEP | 350 with TESTNET, else 0 | Milliseconds the node waits before each slot tick. |
OFFLINE wins when both are set.
History, snapshots and archival nodes
| Variable | Default | Description |
|---|---|---|
ARCHIVALNODE | off | Yes-list. Keeps every block. On first start the node downloads the full-history snapshot instead of a state bundle, and pruning is disabled. Needed by exchanges, indexers and RPC providers. |
HISTORY_KEEP_EPOCHS | 10 | How many epochs of blocks and transactions a regular node keeps. 0 disables pruning, so the node keeps everything from the point where it bootstrapped. |
SNAPSHOT_HEIGHT | 88169793 | The height a new node bootstraps to. If the rooted chain is below it, an archival node downloads the snapshot again and a regular node exits (see below). |
STATEPEERDOWNLOAD | off | Yes-list. Builds a signed state bundle once per epoch (kept in /tmp/statepeerdownload_<height>.zstd, two most recent) and serves it at GET /api/sync/contractstate so other nodes can bootstrap from this one. Requires the HTTP API. Without it, that endpoint answers 503 with not_providing_contractstate_snapshot. |
How bootstrap works:
- Regular node. With no chain state, it downloads the bundle from
$RPC_URL/api/sync/contractstateand imports it. If chain state exists but is belowSNAPSHOT_HEIGHT, it refuses to import over it and exits; delete$WORKFOLDER/db/(never theseedsfile) and start again. - Archival node. It downloads
https://snapshots.amadeus.bot/<SNAPSHOT_HEIGHT padded to 12 digits>.zip(for the default,000088169793.zip), unzips it intoWORKFOLDERand checks that the genesis block is present. The node prints anaria2c -x 4 <url>command; you can run it yourself and unzip the archive intoWORKFOLDERbefore the first start.
At startup the node prints which mode it runs in, for example history: pruning enabled — keeping last 10 epochs.
Solving and slashing
| Variable | Default | Description |
|---|---|---|
COMPUTOR | unset | Presence rule. Starts the built-in MatMul solver. It submits solutions for every key in seeds that holds at least 0.01 AMA. See Building your Score. |
COMPUTOR_UPOW_THREADS | half the CPU schedulers minus 2, at least 1 | Solver threads. |
AUTOSLASH | off | Yes-list. Lets this node start removal motions on its own against a stalled or offline validator. See Risks of validating. |
MAX_PEERS and BUY_PEER_SOL are read by v1.6.5 but nothing uses them yet, so setting them has no effect.
Auto-update and signed releases
| Variable | Default | Description |
|---|---|---|
AUTOUPDATE | off | Yes-list. Keeps the node on the latest signed GitHub release. |
With AUTOUPDATE=true the node checks https://api.github.com/repos/amadeusprotocol/node/releases/latest at boot and then every 30 to 60 minutes. When the tag is newer than the running version:
- It downloads both release assets,
amadeusdandamadeusd.sig. A release withoutamadeusd.sigis never installed. - It checks that the manifest line in
amadeusd.sig(<version> <sha256>) is signed by an Ed25519 release key pinned inside the binary, under theamadeus-releasenamespace. - It checks that the binary's SHA-256 matches the signed manifest, and that the signed version is newer than both the running version and the highest version it ever accepted (stored in
$WORKFOLDER/release_min_version). This blocks rollbacks. - It writes the new
amadeusdinto its working directory and exits. A validator first finishes its block production slot. The node does not restart itself, so run it under systemd or another supervisor (see Running a Node).
Downloads are verified against the CA bundle compiled into the binary, not the host's certificate store. To check a release by hand, follow Download and start the node.
Auto-update is off by default. If your policy does not allow running code you have not reviewed, leave it off, follow the GitHub releases and build each version from source.
Monitoring
| Variable | Default | Description |
|---|---|---|
PROMETHEUS_TOKEN | unset | Bearer token for the metrics endpoints. It must be at least 16 characters; while it is unset or shorter, the endpoints answer 401. |
SSH_CONSOLE_PORT | unset | Starts an SSH console on 127.0.0.1:<port> for running REPL expressions on the live node. |
The metrics endpoints are served by the HTTP API, so HTTP_IPV4 must be set:
| Path | Content |
|---|---|
/health | amadeus_health (1 once the chain tip is above height 0) |
/metrics | All metrics below |
/metrics/stats | Block height, mempool size, TPS, network PFLOPS, supply, burned, epoch emission, difficulty bits |
/metrics/kpi | Total transactions, active wallets, peers, validators, fees paid, block time |
/metrics/validators | Solutions per validator in the current epoch (amadeus_validator_solutions) |
Every request needs the token in an Authorization header:
curl -H "Authorization: Bearer $PROMETHEUS_TOKEN" http://127.0.0.1:80/metrics/stats
Without a valid token the node answers 401 with {"error":"unauthorized"}.
The SSH console uses key authentication with the OS user's ~/.ssh/authorized_keys and only listens on localhost:
SSH_CONSOLE_PORT=2222 ./amadeusd
# from the same machine
ssh -p 2222 $USER@127.0.0.1 'API.Chain.stats().height'
If several nodes run on one machine, give each its own SSH_CONSOLE_PORT. If the console cannot start, the node logs it and keeps running.
Replica clusters
A replica cluster is a group of machines that carry the same seeds file, so a validator survives the loss of a machine. Only one member, the leader, may sign at a time. Leadership needs acknowledgements from a majority of the group (more than half), and every height is agreed inside the group before anything is signed, so two members never sign different blocks for the same height. If the group loses its majority, it stops signing.
| Variable | Description |
|---|---|
REPLICAS | The whole group as comma-separated id@ip:port entries, identical on every member. The port is a UDP port for replica traffic; use a dedicated one, not 36969. |
REPLICA_ID | This machine's id. It must appear in REPLICAS. Among the synced members that are online, the lowest id becomes leader. |
REPLICA_PSK | A shared secret of exactly 32 bytes in Base58, the same on every member. Replica messages are encrypted with AES-256-GCM under this key. |
REPLICAS=1@10.0.0.1:36970,2@10.0.0.2:36970,3@10.0.0.3:36970
REPLICA_ID=1
REPLICA_PSK=<32 random bytes in Base58>
The node refuses to start if REPLICAS is set without REPLICA_ID, if the id is not in the list, or if the PSK is not 32 bytes. To generate a PSK, run :crypto.strong_rand_bytes(32) |> Base58.encode() in the node's REPL. Use an odd group size: 3 members survive one failure, 5 survive two.
Building from source
The node repository builds a release binary inside a container. The build image is Ubuntu 24.04 with Erlang/OTP 29.0.6, Elixir 1.20.4, Rust 1.98.0, clang 19 and a static OpenSSL 3.6.4.
git clone https://github.com/amadeusprotocol/node.git
cd node/ex
podman build --tag erlang_builder -f build.Dockerfile
./build.sh
build.sh runs mix release in the container with MIX_ENV=prod and -march=haswell, copies the result to node/ex/amadeusd and prints its SHA-256. It then runs sign_release.sh, which only signs when the machine holds the pinned release key and otherwise skips. A self-built binary is unsigned. If you run it with AUTOUPDATE=true, the next signed release replaces it.
To test changes across several nodes, ex/localnet.sh starts a five-node network with ten validators on loopback addresses (it runs from the source tree with mix). For a single-node local testnet, see Local testnet.