Getting Started
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 takes you from nothing to miners hashing through the proxy. Each step links to the full reference when you need more detail.
Before you start
You need:
- An x86-64 Linux host with Docker, reachable by your miners.
- From the pool operator:
- the proxy image name,
- the pool’s Stratum V2 address (
host:port), - the pool’s authority public key,
- your pool account name.
- Accurate clocks. Run NTP on the proxy host and on your miners. Stratum V2 encryption rejects certificates from a peer whose clock is more than 10 seconds off. See How the proxy’s encryption works.
- Network access: outbound from the proxy host to the pool address, and inbound from your
miners to the proxy’s miner ports (
3333for Stratum V1 and3336for Stratum V2 in the examples below). Do not expose the miner ports to the internet.
1. Generate the proxy’s authority keypair
Skip this step if you will only connect Stratum V1 miners.
Stratum V2 miners authenticate the proxy with a keypair that you generate:
cargo install key-utils
key-utils-bin
It prints a Secret Key and a Public Key. You need both in the next step, and you configure your
Stratum V2 miners with the public key in step 5. Keep the secret key private. See
Generating the proxy’s authority keypair.
2. Write the config file
Save this as stratum-proxy.toml and replace each <...> value:
[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
authority_public_keyandauthority_secret_keyare the keypair from step 1. For a Stratum V1 only proxy, remove them andlisten_port_sv2.user_identityis your pool account.addressandauthority_pubkeyare the pool’s address and key.- Set
initial_hashrate_thsto the hashrate of your smallest miner. Vardiff adjusts each miner from there.
Every other setting can stay at its default. See Configuration for all of them.
3. Start the proxy
From the directory that holds stratum-proxy.toml:
docker run -d --name stratum-proxy --restart unless-stopped \
--ulimit nofile=65535:65535 \
--log-driver json-file --log-opt max-size=20m --log-opt max-file=1250 \
-p 3333:3333 -p 3336:3336 \
-v $(pwd)/stratum-proxy.toml:/config/stratum-proxy.toml:ro \
<image>
Replace <image> with the image name the pool operator gave you.
--ulimit nofilelets the proxy hold many miner connections open at once.- The
--log-optsettings cap how much log history Docker keeps. - The
-pports must matchlisten_port_sv1andlisten_port_sv2in your config. - The config file is mounted read-only at
/config/stratum-proxy.toml, where the image expects it.
4. Check that it connected to the pool
docker logs -f stratum-proxy
Within a few seconds you should see these events, in this order:
Listening on TCP: once for each miner port.Connecting to upstream poolUpstream SetupConnection successUpstream channel opened
Until the pool channel is open, the proxy turns miners away. If you see Upstream connection ended
instead, its error field says why. See
Reading the error on Upstream connection ended.
5. Point your miners at the proxy
| Miner protocol | Pool URL | Also configure |
|---|---|---|
| Stratum V1 | stratum+tcp://<proxy-host>:3333 | — |
| Stratum V2 | <proxy-host>:3336 | The proxy’s authority public key from step 1. |
For the worker name, use <name>.<worker>, for example site1.rack4-s19. The proxy uses it to
identify each miner in its logs. Every share reaches the pool through the proxy’s own channel, under
the user_identity account in your config.
When a miner connects, the proxy logs Incoming connection, then subscribe success, then
authorize success. If a miner does not get that far, see
Miner connections.
Next steps
- Configuration: every setting, including failover to backup pool endpoints and the optional health endpoint.
- Troubleshooting and Logs: what every log line means, and how to recognise tampering and interception.
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]
| Key | Type | Default | Description |
|---|---|---|---|
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.
| Key | Type | Default | Description |
|---|---|---|---|
listen_address | string | "0.0.0.0" | Address both miner listeners bind to. |
listen_port_sv1 | integer | unset (disabled) | Port for Stratum V1 miners. Leave it unset to disable SV1. At least one (sv1 or sv2) port must be set |
listen_port_sv2 | integer | unset (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_key | base58 string | unset | Public 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_key | base58 string | unset | Secret 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_secs | integer | 600 | Seconds 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.
| Key | Type | Default | Valid range | Description |
|---|---|---|---|---|
initial_hashrate_ths | float | 150.0 | ≥ 0.005 | Hashrate 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_secs | float | 15.0 | 1 – 48 | Target time between shares from each miner. Vardiff adjusts difficulty to approach this interval. |
[health]
Optional. Without this section, the proxy runs no health endpoint.
| Key | Type | Default | Description |
|---|---|---|---|
port | integer | 80 | Port 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.
| Key | Type | Default | Description |
|---|---|---|---|
user_identity | string | "" | 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_difficulty | float | 8388608 (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_threshold | integer | 3 | Number 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_secs | integer | unset (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.
| Key | Type | Default | Description |
|---|---|---|---|
address | host:port string | required | The pool’s Stratum V2 address. |
authority_pubkey | base58 string | required | The 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_identity | string | [upstream] user_identity | Pool account to use for this endpoint only. |
max_job_delay_secs | integer | [upstream] max_job_delay_secs | If 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. |
Stratum Proxy Logs
This page explains the log lines the stratum proxy writes and what to do about them. Most of it covers connections and encryption. Those lines show whether miners and the pool can reach the proxy, and they are where tampering or interception shows up.
Many of the same lines are also written when the network is unreliable, so this page gives the ordinary causes and the suspicious causes for each one, and tells you how to tell them apart.
- Log format
- How the proxy’s encryption works
- Pool connection (upstream)
- Miner connections (downstream)
- Recognising tampering and interception
- Miner sessions, jobs and shares
- Startup, shutdown and configuration
Log format
Each log line is one JSON object:
{"timestamp":"2026-12-01T14:03:22.418Z","level":"INFO","event":"Incoming connection","fields":{"ip":"10.0.4.17","port":51544},"target":"[SV2/svr_core/src/core/session_management.rs:77]"}
| Field | Meaning |
|---|---|
timestamp | UTC time of the event. |
level | DEBUG, INFO, WARN or ERROR. DEBUG and INFO lines go to stdout. WARN and ERROR lines go to stderr. Lines below [logger] log_level are not written. |
event | What happened. Search and alert on this field. The event names on this page are exact. |
fields | Details. Field names vary by event. |
target | The source location that wrote the line. Include it when you report a problem to us. |
Common fields
| Field | Meaning |
|---|---|
identity | The miner connection the line is about: connection_id, protocol (Sv1 or Sv2), and, once known, ip, channel_id, subaccount, worker_name and user_agent (firmware). |
connection_id | A number the proxy assigns to each miner connection. Use it to follow one connection through the log. |
reason | Why a connection or request ended. On socket closed this is the name of the error that closed it. |
error | The underlying error text. |
The (Critical) and (Non-Critical) prefixes
Many error values begin with (Critical) or (Non-Critical). Pool connection errors can carry
both, for example (Non-Critical) (Critical) Aead Error. These prefixes show how the proxy
handled the error internally. They are not a severity rating for you. Use the level field and
the guidance on this page instead.
How the proxy’s encryption works
Knowing what the encryption protects makes the encryption log lines much easier to read.
Stratum V2 connections are encrypted and authenticated with the Noise protocol. Every connection begins with a handshake. In the handshake, the server proves who it is by presenting a certificate signed with its authority key. The client checks that certificate against the authority public key it was configured with. After the handshake, every message is encrypted and carries an authentication tag. If anything changes, adds, removes or reorders bytes in transit, the receiver cannot decrypt the message and the connection is closed.
There are two encrypted links, and on each one only one side is the server:
| Link | Server (presents the certificate) | Client (checks the certificate) | Who detects an impostor |
|---|---|---|---|
| Proxy → pool | The pool | The proxy, using authority_pubkey in [[upstream.endpoints]] | The proxy, which logs it. |
| Miner → proxy | The proxy, using authority_public_key / authority_secret_key in [network] | The miner, using the proxy public key you configured on it | The miner, which logs it in its own logs. The proxy only sees the connection close. |
Four consequences follow from this:
- Only servers are authenticated. The handshake proves the pool’s identity to the proxy and the proxy’s identity to miners. It does not prove a miner’s identity to the proxy. The proxy identifies miners by the user name they authorize with, not cryptographically.
- Configure every SV2 miner with the proxy’s authority public key. Some firmware can connect without one. That connection is still encrypted, but the miner cannot tell the real proxy from an impostor, so an interceptor goes undetected.
- Clocks matter. The server signs a fresh certificate for every handshake, valid from that
moment (
valid_from) untilnot_valid_after. For the proxy’s own certificate that is one hour later (cert_validity_secs). The client allows 10 seconds of clock difference at each end. As a result, a client whose clock is more than 10 seconds behind the server rejects a genuine certificate, because it appears not yet valid. A client whose clock is ahead is accepted until it is more than the validity period (plus 10 seconds) ahead. Run NTP on the proxy host and on your miners. - Stratum V1 has no encryption and no authentication. Nothing on the SV1 port
(
listen_port_sv1) can detect tampering or interception, so no log line will report it. Use SV2, or keep SV1 miners on a network you trust.
Ordinary network faults such as packet loss, a dropped Wi-Fi link or a rebooted switch do not cause decryption failures. TCP retransmits lost data and discards corrupted packets before the proxy sees them. Network faults show up as timeouts, resets and closed connections. A decryption or certificate failure has a short list of causes: misconfiguration, a wrong clock, a device that is not speaking SV2, or someone altering the traffic.
Pool connection (upstream)
Normal sequence
When the proxy starts, and after every reconnect, it logs:
Connecting to upstream pool(address,endpoint_index)Upstream SetupConnection successUpstream channel opened(channel_id,extranonce_size,proxy_difficulty)
From then on it logs Dispatching upstream job downstream for every job the pool sends.
When the pool connection ends
Every time the pool connection ends, the proxy logs these lines:
| Event | Level | Meaning |
|---|---|---|
Upstream connection ended | ERROR | The connection to the pool failed or was lost. error gives the reason. See the table below. consecutive_failures counts failures since the pool last sent work. |
upstream disconnected: dropped all downstream connections and cleared job cache | WARN | Without a pool connection the proxy cannot give miners valid work, so it disconnects all of them. connections_dropped is how many. Miners reconnect once the pool channel is open again. |
Failing over to next upstream endpoint | WARN | failover_threshold consecutive failures were reached, so the proxy is moving to the next [[upstream.endpoints]] entry (next_index, endpoint). |
Rejecting new connection: no upstream connection | INFO | A miner tried to connect while the pool connection was down and was turned away (ip, port). You will see many of these during a pool outage. That is expected. |
The proxy retries with exponential backoff, waiting between 0.5 and 30 seconds between attempts.
Reading the error on Upstream connection ended
Look for the text in the first column inside error.
Before encryption: TCP connection
error contains | Meaning | Ordinary causes | Suspicious causes / action |
|---|---|---|---|
Connection refused | Nothing is listening at address. | Pool endpoint down or restarting, or a wrong port. | Check address. |
failed to lookup address information | DNS could not resolve the pool host name. | DNS outage, or a typo in address. | If the name resolves to an unexpected IP when it does work, investigate DNS. |
Connection timed out, No route to host, Network is unreachable | The proxy cannot reach the pool. | Internet outage, routing problem, or an egress firewall. | — |
During the encryption handshake
error contains | Meaning | Ordinary causes | Suspicious causes / action |
|---|---|---|---|
Failed to read upstream handshake reply: Timed out after 10s | The pool accepted the TCP connection but did not answer the handshake within 10 seconds. | Wrong port (for example the pool’s SV1 port, which waits silently for a text line). Heavy packet loss. An overloaded pool. | Firewalls that inspect traffic sometimes stall or drop mining traffic. If this happens only from one network, test from another. |
Failed to read upstream handshake reply: Connection reset by peer / Connection closed during the handshake | The pool side closed the connection during the handshake. | Pool restart, a load balancer draining, wrong port, or a firewall that resets mining traffic. | — |
Initiator step_2 failed: Invalid Certificate: SignatureNoiseMessage { version: …, valid_from: …, not_valid_after: …, signature: … } | The pool’s certificate was rejected. Either it was not signed by the key in authority_pubkey, or it is outside its validity window. | A wrong or outdated authority_pubkey, or an address that points at a different server. Clock error on the proxy host. | Someone presenting their own certificate in place of the pool’s (interception). See Diagnosing Invalid Certificate. The proxy does not connect, so no work or shares go through the impostor. |
Initiator step_2 failed: Noise SV2 Error: Aead(Error) | The pool’s handshake reply could not be decrypted. | The endpoint is not an SV2 pool. | Handshake bytes altered in transit. Investigate if address is definitely the pool’s SV2 port. |
Invalid handshake reply size | The reply was not a valid SV2 handshake message. | The endpoint is not an SV2 pool. | Same as above. |
Diagnosing Invalid Certificate from the pool
valid_from and not_valid_after are Unix timestamps in seconds. Convert them, for example with
date -u -d @1796135745, and compare them with the line’s timestamp:
timestampis more than 10 seconds beforevalid_from: the proxy’s clock is behind the pool’s.timestampis more than 10 seconds afternot_valid_after: the proxy’s clock is ahead. Either way it is a clock problem, not an attack. Fix NTP on the proxy host.timestampfalls inside the window: the certificate’s signature does not match the key you configured.- If you recently changed
authority_pubkeyoraddress, it is almost certainly a configuration mistake. Re-copy the key the pool gave you, and check that the address is that pool’s SV2 endpoint. - If nothing changed, and an endpoint that used to work suddenly fails this way, treat it as
possible interception. Check what IP the pool host name resolves to, check for transparent
proxies or new network equipment on the path, and contact the pool operator. Do not work around
it by changing
authority_pubkeyto make the error go away.
- If you recently changed
After the connection is set up
error contains | Meaning | Ordinary causes | Suspicious causes / action |
|---|---|---|---|
(Critical) secure stream closed by peer | The pool closed the connection. | Pool restart or deployment, or a load balancer timeout. | — |
(Critical) Connection reset by peer, Connection timed out, Broken pipe | The connection broke at the network level. | Network interruption, NAT or firewall state expiry, or pool restart. | — |
(Critical) Aead Error: `Error` | A message from the pool failed decryption. The bytes were not produced by the pool with this connection’s keys. | Very unlikely from ordinary network problems (see above). Possibly a faulty middlebox. | Traffic injected or altered between the proxy and the pool. A single occurrence is worth noting. Repeated occurrences need investigating: look at the network path between the proxy and the pool. The connection is dropped, so no altered message is acted on. |
timed out waiting for setup connection success / timed out waiting for channel open success, or deadline has elapsed | The pool did not answer the setup or channel-open request within 30 seconds. | Pool overloaded or unhealthy. | — |
… since last job, limit … | The stale-work watchdog fired: no new work arrived within max_job_delay_secs. | Pool stalled. If the pool sends work only on new blocks, max_job_delay_secs is set too low for it (see the configuration reference). | — |
An error code from the pool, for example unknown-user | The pool refused the connection setup or the channel open. | A wrong user_identity, or account not enabled for proxy use. | Contact the pool. |
granted N != requested 8 | The pool offered a different extranonce size than the proxy requires. | Pool not compatible with this proxy. | Contact the pool. |
Other pool messages
| Event | Level | Meaning |
|---|---|---|
Upstream SetTarget | INFO | The pool changed the proxy’s channel difficulty (proxy_difficulty). |
Upstream rotated extranonce prefix | INFO | The pool assigned a new extranonce prefix. Normal. |
Upstream rejected share | WARN | The pool rejected a share the proxy forwarded. error is the pool’s reason code, such as a stale share. An occasional rejection around block changes is normal. A steady stream is not normal and should be reported to the pool. |
Ignoring unexpected upstream mining message | WARN | The pool sent a message the proxy does not use. Harmless. Report it if frequent. |
Active NewExtendedMiningJob before any SetNewPrevHash; ignoring job | WARN | The pool sent a job before the block it builds on. That job is skipped. Harmless unless frequent. |
failed to build upstream message, dropping it | ERROR | One share or update could not be encoded and was dropped. The connection stays up. Report it to us. |
Upstream outbound channel closed; stopping connection manager | INFO | Part of shutdown. |
Miner connections (downstream)
Normal sequence
For a connection on the SV2 port:
Incoming connection(ip,port)- The encryption handshake. It is not logged when it succeeds.
subscribe success. The miner’sSetupConnectionwas accepted.authorize success. The miner opened a mining channel (identitynow includessubaccountandworker_name).
For a connection on the SV1 port there is no handshake. subscribe success follows
mining.subscribe, and authorize success follows mining.authorize.
Every miner connection that gets past the handshake ends with exactly one socket closed line
(INFO). Its reason says why, and its identity says which miner it was. A connection that fails
during the handshake ends with Failed to initialize client session instead.
Matching lines for one connection.
Incoming connectionhas theipbut noconnection_id.Failed to initialize client sessionhas theconnection_idbut noip. Match them by time.socket closedincludes both.
Failed to initialize client session (WARN): handshake failures
The connection was closed before the encryption handshake finished. Look for the text in the first
column inside error.
error contains | Meaning | Ordinary causes | Suspicious causes / action |
|---|---|---|---|
Failed to read first handshake message: Connection closed during the handshake | Something opened a TCP connection and closed it without starting a handshake. | Load balancer or uptime-monitor health checks (often at a fixed interval from the same IP). Miners giving up on a slow connection. | Port scanning. Many of these from IPs that are not yours means the port is reachable from places it should not be. Restrict it with a firewall. |
Failed to read first handshake message: Timed out after 10s | Something connected and then sent too little to start a handshake within 10 seconds. | A badly congested link. A non-SV2 client on the SV2 port that sent a short message. | Scanners, or clients deliberately holding connections open. Restrict the port if the IPs are not yours. |
Failed to read first handshake message: Connection reset by peer | The client reset the connection before the handshake. | Miner reboot, network interruption. | — |
Failed to write second handshake message to stream | The client disappeared during the handshake. | Network interruption, miner reboot. | — |
socket closed (INFO): why a miner connection ended
Read reason first, then error.
Encryption-related reasons (SV2 only)
reason | Meaning | Ordinary causes | Suspicious causes / action |
|---|---|---|---|
secure stream closed by peer | The miner closed the connection. | Miner reboot, pool switch, or firmware reconnect. | If it comes immediately after the handshake (no subscribe success between Incoming connection and socket closed), the miner probably rejected the proxy’s certificate. Check the miner’s own logs. Ordinary causes: the miner is configured with the wrong proxy public key, or the miner’s clock is more than 10 seconds behind the proxy’s. If neither applies, something between that miner and the proxy may be intercepting the connection. See Recognising tampering and interception. |
failed to decode encrypted frame (error contains Aead Error) | A message from the miner failed decryption. It was not produced with this connection’s keys. | A device that is not speaking SV2 encryption on the SV2 port (for example an SV1 miner pointed at the SV2 port, or an SV2 client with encryption disabled). Faulty firmware. Packet loss does not cause this. | Traffic injected or altered between that miner and the proxy. If it is always the same ip, check that device’s configuration first. If it suddenly affects many miners at once, especially after a network change, inspect the network path. The connection is dropped, so no altered message is acted on. |
secure stream read after a failed decode | Follows a decode failure on the same connection. | — | Treat it like failed to decode encrypted frame. |
failed to buffer secure stream bytes | Internal buffering error on an encrypted connection. | — | Report it to us with the full line. |
Network and timeout reasons
reason | Meaning | Ordinary causes | Action |
|---|---|---|---|
error while reading secure stream buffer (SV2) / failed to read plaintext TCP buffer (SV1) | The connection broke at the network level. error gives the OS reason: Connection reset by peer, Connection timed out, No route to host… | Network interruption, a miner power-cycle, NAT or firewall state expiry. | Only investigate if it is frequent for many miners at once. |
Sv1 connection closed by peer (EOF) | An SV1 miner closed the connection. | Miner reboot or reconnect. | — |
client timeout | The miner sent nothing for tcp_read_timeout_secs. | Miner hung, powered off without closing, or its network path is gone. | — |
unauthorized timeout | The miner connected but did not authorize within 30 seconds. | A miner on the wrong port (for example SV1 firmware on the SV2 port). A miner stuck mid-setup. | Check the miner’s pool URL and port. Many from unknown IPs means scanning. |
graceful shutdown | The proxy closed the connection on purpose, for example during shutdown. | — | — |
Protocol reasons
These mean the client completed the encryption handshake, so it had valid keys, but then broke the protocol. They point to a misbehaving or incompatible client, not to tampering in transit.
reason / event | Meaning | Action |
|---|---|---|
Sv2 message before SetupConnection (also logged as Sv2 message before SetupConnection, closing connection, with msg_type) | The client skipped the required first message. | Check the firmware’s SV2 support. |
Sv2 SetupConnection with unknown protocol, closing connection | The client asked for a protocol the proxy does not serve. | Point it at a mining endpoint. |
Failed to parse Sv1 JSON message | An SV1 line was not valid JSON. error quotes the start of it. If that looks like binary data, an SV2 miner is connected to the SV1 port. | Fix the miner’s port. |
plaintext message too large | An SV1 line exceeded 16 KiB without a newline. | Wrong client, or abuse. |
client error | Another error. See error. | Report it to us if frequent. |
Connections the proxy drops
| Event | Level | Meaning |
|---|---|---|
dropping Sv2 connection: write failed / dropping Sv1 connection: write failed | WARN / INFO | Sending to the miner failed. The connection was already broken. |
dropping Sv2 connection: write did not complete (backpressure) / dropping Sv1 connection: write did not complete (backpressure) | WARN / INFO | The miner was not reading fast enough to keep up with new jobs, so the proxy disconnected it rather than send it stale work. Usually a slow or congested link to that miner. |
TCP write buffer full, dropping connection... | WARN | Same as backpressure. |
dropping failed Sv2 writers due to failed job dispatch / dropping failed Sv1 writers due to failed job dispatch | ERROR | Summary after a job broadcast: count connections could not be sent the job and were dropped. A few are normal. A large count means a network problem on the miner side. |
Encryption state corrupted, dropping writer | ERROR | An internal encryption error on the sending side for one connection. This should not happen. Report it to us with the full line. |
Recognising tampering and interception
Use the patterns below. Any one line on its own has ordinary explanations. Patterns are what matter.
| What you see | Most likely | Investigate as a security issue when… |
|---|---|---|
Upstream connection ended with Invalid Certificate | Wrong authority_pubkey, or clock skew on the proxy host | The certificate’s validity window covers the log time, the configuration has not changed, and the same endpoint worked before. |
Upstream connection ended with (Critical) Aead Error | Interference on the proxy–pool path | Always worth noting. It is not caused by ordinary packet loss. |
socket closed with failed to decode encrypted frame from one miner IP | That device is misconfigured or not speaking SV2 | Many miners are affected at the same time, or a device that worked before starts doing it. |
socket closed, reason secure stream closed by peer, immediately after connecting, with no subscribe success | The miner rejected the proxy’s certificate (wrong key on the miner, or the miner’s clock) | The miner’s logs show a certificate error and its key and clock are correct. Something on the path may be impersonating the proxy. |
Many Failed to initialize client session lines from IPs that are not yours | Port scanning | The proxy’s ports are reachable from the internet and should not be. |
Timeouts, resets and closed by peer that clear up on their own | Network instability | They come with certificate or decryption errors. |
If you suspect interception:
- Do not “fix” it by changing the configured authority keys until you know why the certificate stopped matching.
- Keep the full log lines, including
timestamp,ipanderror. - Check DNS resolution of the pool address, and any proxies, VPNs or new network equipment on the path.
- Contact the pool operator with the lines.
The proxy always disconnects when a certificate or decryption check fails. Unverified traffic never reaches the pool or your miners.
Miner sessions, jobs and shares
Session setup
| Event | Level | Meaning |
|---|---|---|
subscribe success | INFO | SV2: SetupConnection accepted (version, flags). SV1: mining.subscribe accepted. |
authorize success | INFO | The miner opened a mining channel. identity has its subaccount, worker_name and user_agent. |
authorize failure | WARN | Authorization was refused. reason gives the cause (see below). name (and on SV1, password) is what the miner sent, with unusual characters removed. |
Subscribed connection still unauthorized after a vardiff check interval | WARN | The miner subscribed but has not authorized yet. If it does not, it ends with unauthorized timeout. |
Standard jobs requested, but only extended jobs are supported | WARN | The SV2 miner asked for standard jobs. The proxy serves only extended channels. Firmware incompatibility. |
Work selection requested, but not supported | WARN | The SV2 miner asked to choose its own transactions. Not supported. |
Received OpenStandardMiningChannel message, but standard channels are not supported yet | WARN | Same incompatibility as above. |
group channels unsupported, Unimplemented function, Received SetCustomMiningJob message, but custom jobs are not supported yet, Received SubmitSharesStandard message, but standard shares are not supported yet | WARN | The miner used an SV2 feature the proxy does not support. |
failed to parse Sv1 message | WARN | An SV1 request had an unknown method or bad parameters. The connection stays open. |
Failed to handle message: … | WARN | An SV1 request could not be processed. error and message give details. |
authorize failure reasons:
reason | Meaning |
|---|---|
not-subscribed | SV1 mining.authorize was sent before mining.subscribe. |
empty-user-name | The user name was empty after unusual characters were removed. |
invalid-min-extranonce-size | SV2: the miner requires more extranonce space than the proxy offers. |
max-target-out-of-range | SV2: the miner will not accept a difficulty as high as the proxy’s minimum. |
Difficulty, jobs and shares
| Event | Level | Meaning |
|---|---|---|
vardiff difficulty change | INFO | A miner’s difficulty changed (old_difficulty, new_difficulty). Normal. |
new job arrived, dispatched job, Dispatching upstream job downstream | INFO | Work flowing from the pool to miners. Normal, once per job. |
unclean job changes prevhash; dispatching as clean to Sv2 | INFO | A job built on a new block was sent to SV2 miners as a clean job. Normal. |
no buffered job to dispatch | INFO | A dispatch tick found no new work. Normal. |
high diff share | INFO | A miner found a share well above its difficulty. |
block found | INFO | A share met the network target (height, block_hash). |
share.ntime == 0, overriding to job.ntime | WARN | A miner submitted a share without a timestamp. The job’s timestamp was used. A firmware quirk. |
invalid-channel-id | ERROR | A miner sent a request for a channel it does not have. Firmware bug or desynchronised miner. |
dropping difficulty update for a channel the write loop never added | WARN | Internal timing during connection teardown. Harmless if occasional. |
DEBUG-level lines (invalid shares, difficulty computation, per-message tracing) are written only
with log_level = "DEBUG". Use that level for troubleshooting, not in normal operation.
Startup, shutdown and configuration
| Event | Level | Meaning |
|---|---|---|
Listening on TCP | INFO | A miner listener is up (address). One per enabled port. |
starting health check listener | INFO | The [health] endpoint is starting. |
failed to bind health check listener / health check accept failed | ERROR | The health port could not be opened (usually already in use), or a health-check connection failed. Mining is not affected. |
Sv1 server task ended / Sv2 server task ended | ERROR | A miner listener stopped. Usually the port is already in use or cannot be bound. The proxy shuts down. |
task exited, shutting down... | ERROR | A core task stopped (task, and panicked if it crashed). The proxy shuts down. Report a crash to us. |
Critical error detected, shutting down server / Critical shutdown signal received, shutting down... | ERROR / INFO | An unrecoverable internal error. Report it to us with the lines before it. |
Critical error in CoreWriteLoop, Write loop terminated | WARN | The component that sends to miners stopped. Report it to us with the lines before it. |
Received SIGTERM, shutting down... / Received SIGINT, shutting down... | INFO | Normal stop requested by you or your orchestrator. |
Server has stopped | INFO | Shutdown finished. |
task did not stop after abort / client sessions did not stop | ERROR | Shutdown did not finish cleanly. The process still exits. |
Failed to parse <VARIABLE>, using None, Failed to parse environment variable…, Unknown environment variable | ERROR | A configuration override from the environment was ignored. Check the variable’s value. |
Skipping upstream endpoint … | ERROR | An upstream endpoint given through the environment was invalid and skipped. |
Embedding the proxy as a library
These lines appear only when the proxy runs inside another program that receives its events. The standalone binary never writes them.
| Event | Level | Meaning |
|---|---|---|
proxy event sink is full, dropping events until it drains | WARN | The embedding program is not reading events fast enough. Events are dropped until it catches up. |
proxy event sink has room again | INFO | Events are being delivered again. |