Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Stratum Proxy Configuration

The stratum proxy is an aggregating mining proxy. It accepts Stratum V1 and/or Stratum V2 miners downstream, opens a single Stratum V2 extended channel to an upstream pool, turns the pool’s jobs into jobs for its own miners, and forwards qualifying shares upstream.

This page lists the settings an operator may need to change, with their defaults. Any setting not listed here should be left at its default.

Loading configuration

Pass the path to a TOML file with -c / --config:

stratum-proxy -c /path/to/stratum-proxy.toml

The container image runs ./stratum-proxy -c /config/stratum-proxy.toml, so mount your config file at /config/stratum-proxy.toml.

Required sections

The file must contain the [network] and [difficulty] section headers, even if [difficulty] is left empty, and at least one [[upstream.endpoints]] entry. The remaining sections are optional.

Generating the proxy’s authority keypair

Serving Stratum V2 miners (listen_port_sv2) requires a Noise authority keypair for the proxy. It is not needed to connect to the pool, so a proxy that serves only Stratum V1 miners does not need one. Generate it with key-utils-bin from the Stratum V2 reference implementation’s key-utils crate:

cargo install key-utils
key-utils-bin

It prints a Secret Key and a Public Key. Use them as authority_secret_key and authority_public_key in [network], and configure your SV2 miners with the public key.

Minimal example

[logger]
log_level = "INFO"

[network]
listen_address = "0.0.0.0"
listen_port_sv1 = 3333          # Stratum V1 miners
listen_port_sv2 = 3336          # Stratum V2 miners
# The proxy's own Noise identity, presented to downstream SV2 miners.
authority_public_key = "<PROXY_AUTHORITY_PUBLIC_KEY>"
authority_secret_key = "<PROXY_AUTHORITY_SECRET_KEY>"

[difficulty]
submit_interval_secs = 25.0
initial_hashrate_ths = 45.036       # starting difficulty 2^18

# Optional liveness endpoint; see [health] below.
# [health]
# port = 8080

[upstream]
user_identity = "<your-pool-account>"

[[upstream.endpoints]]
address = "<pool-host>:<pool-sv2-port>"
authority_pubkey = "<POOL_AUTHORITY_PUBLIC_KEY>"
max_job_delay_secs = 60

[logger]

KeyTypeDefaultDescription
log_level"DEBUG" | "INFO" | "WARN" | "ERROR""INFO"Minimum level to log. Values are case-sensitive. Logs are JSON lines: info and below go to stdout, warnings and errors go to stderr.

[network]

Settings for the downstream listeners that miners connect to. Set at least one of the two listen ports, and do not set them to the same value.

KeyTypeDefaultDescription
listen_addressstring"0.0.0.0"Address both miner listeners bind to.
listen_port_sv1integerunset (disabled)Port for Stratum V1 miners. Leave it unset to disable SV1. At least one (sv1 or sv2) port must be set
listen_port_sv2integerunset (disabled)Port for Stratum V2 miners. Leave it unset to disable SV2. Setting it makes the authority keypair required. At least one (sv1 or sv2) port must be set
authority_public_keybase58 stringunsetPublic half of the proxy’s Noise authority keypair. Downstream SV2 miners use it to authenticate the proxy. Required when listen_port_sv2 is set. This keypair should be generated by you as it facilitates encryption between your miners and your proxy. See Generating the proxy’s authority keypair.
authority_secret_keybase58 stringunsetSecret half of the same keypair. Required when listen_port_sv2 is set, and it must be the secret half generated with authority_public_key, otherwise startup fails. Keep this file out of version control. This keypair should be generated by you as it facilitates encryption between your miners and your proxy
tcp_read_timeout_secsinteger600Seconds without an inbound message before a downstream miner is disconnected. If vardiff has just lowered the miner’s difficulty, the deadline is extended a limited number of times.

[difficulty]

Variable difficulty (vardiff) for downstream miners. The upstream channel’s difficulty is set by the pool, within the floor set by [upstream] min_difficulty.

Hashrates are in TH/s. Every key is optional. A value outside the range in the Valid range column stops the proxy at startup.

KeyTypeDefaultValid rangeDescription
initial_hashrate_thsfloat150.0≥ 0.005Hashrate assumed for a new miner until vardiff has measured it, unless the miner reports its own. It sets the miner’s starting difficulty. If you want to override the default, you should set this to the hashrate of your lowest hashing miner. Lower is better because vardiff will quickly adjust difficulty to maintain share rates according to submit_interval_secs for each individual miner
submit_interval_secsfloat15.01 – 48Target time between shares from each miner. Vardiff adjusts difficulty to approach this interval.

[health]

Optional. Without this section, the proxy runs no health endpoint.

KeyTypeDefaultDescription
portinteger80Port for a liveness endpoint on 0.0.0.0. Every connection receives HTTP/1.1 200 OK. This shows only that the process is running, not that it is connected upstream. This endpoint can be polled by a custom monitoring service to quickly trigger alerts during downtime

[upstream]

The proxy’s connection to the pool.

While the proxy is not connected upstream, it accepts no new miners. When the upstream connection drops, the proxy also disconnects all of its current miners and clears its job cache, so that no miner works on stale jobs. Miners reconnect once the upstream channel is open again.

KeyTypeDefaultDescription
user_identitystring""Pool account the proxy authorizes as. It is used for any endpoint that does not set its own user_identity. The proxy opens its channel as <user_identity>.foundryproxy.
min_difficultyfloat8388608 (2^23)Lowest difficulty the pool may assign the proxy’s upstream channel. It is sent to the pool when the channel opens and with every hashrate update. The proxy caps each miner’s difficulty at half the upstream difficulty, so set this to at least double the normal operating difficulty of the highest-hashing miners in your fleet. A small proxy stays at this floor, so it sends fewer, harder shares upstream.
failover_thresholdinteger3Number of consecutive failures on the active endpoint before the proxy moves to the next one. A failure is a connection that ends before any new work arrives. Each job or new block from the pool resets the count, so a connection that worked for a long time before dropping does not count toward failover.
max_job_delay_secsintegerunset (watchdog off)Default stale-work watchdog for every endpoint that does not set its own. See max_job_delay_secs below.

[[upstream.endpoints]]

One entry per pool endpoint, with at least one entry required. The proxy starts with the first entry. After failover_threshold consecutive failures it moves to the next entry, and after the last entry it wraps around to the first. There is no priority: once the proxy has moved past an endpoint, it only returns to it when the rotation comes back around. Between attempts it waits with exponential backoff.

KeyTypeDefaultDescription
addresshost:port stringrequiredThe pool’s Stratum V2 address.
authority_pubkeybase58 stringrequiredThe pool’s Noise authority public key, used to authenticate the pool during the handshake. This will be given to you by the pool operators
user_identitystring[upstream] user_identityPool account to use for this endpoint only.
max_job_delay_secsinteger[upstream] max_job_delay_secsIf the pool sends no new work for this many seconds, the proxy treats the connection as stale and reconnects, which disconnects all miners. The watchdog is checked every 60 seconds, so values below 60 do not trigger any sooner. Set this to a few times the pool’s job refresh interval (for example, 60 for a pool that refreshes every 15 seconds). Leave it unset for a pool that sends new work only when a block is found. For such a pool, gaps of several minutes are normal, and the watchdog would keep reconnecting.