Passer au contenu

Référence de l’API des mineurs (port 4028)

Réponse rapide

Presque tous les mineurs ASIC exposent une API de gestion locale sur le port TCP 4028 — le « socket API » de cgminer/BMMiner/BOSminer. Vous envoyez un objet JSON d'une ligne comme {"command":"summary"} et recevez du JSON ; c'est ainsi que les outils de parc, pyasic et les tableaux de bord de surveillance lisent vos mineurs et (lorsque c'est permis) changent de pool, activent des cartes et règlent le tuning. Mais la MÊME commande se comporte différemment selon le firmware : l'Antminer d'origine est largement en lecture seule sur 4028 (les écritures passent par son CGI HTTP), BraiinsOS garde 4028 en lecture seule et déplace le contrôle vers gRPC, et la famille LuxOS implémente lecture+contrôle complets sur 4028 derrière un jeton de session. Cette référence est cette matrice — 50 commandes (25 de classe contrôle), chacune mappée sur Stock, la famille BraiinsOS, la famille LuxOS et DCENT_OS, avec les paramètres et une description d'une ligne, chaque ligne citée.

Comment la lire : la colonne « Accès » indique ce que la commande FAIT (lecture vs contrôle) ; les quatre colonnes de firmware indiquent COMMENT chaque famille l'expose — Read / Control sur le socket 4028, gRPC (la capacité vit sur le port gRPC 50051 de BraiinsOS, pas 4028), HTTP CGI (le firmware d'origine fait l'écriture via /cgi-bin), ou — (pas sur ce socket). Les commandes de contrôle de la famille LuxOS prennent un jeton de session comme premier paramètre (logon pour en obtenir un). Les colonnes DCENT_OS sont des CIBLES bêta (bêta publique en ligne depuis juillet 2026) visant une détection compatible cgminer pour que les outils existants fonctionnent tels quels — construites sur les épaules de cgminer, BOSminer et LuxOS, sans prétendre les surpasser. CSV/JSON gratuits sous CC BY 4.0.

Télécharger le CSV Télécharger le JSON API REST →

CommandeAccèsStock AntminerBraiinsOS-familyLuxOS-familyDCENT_OS
version
Returns miner/API version (CGMiner version, API version string e.g. '3.7', Miner type, compile time). Primary tool-fingerprint call. Identity
lectureReadReadReadBeta
summary
Top-level mining summary: Elapsed, GHS 5s / GHS av (or MHS av/5s), Accepted, Rejected, Hardware Errors, Utility, Found Blocks, Best Share, Device Hardware%/Rejected%. Status
lectureReadReadReadBeta
stats
Detailed per-board statistics: per-chain chip counts (chain_acn*), per-chain hashrate (chain_rate*), chip status maps (chain_acs*), temps (temp*, temp2_*), fan RPM (fan1-4), total_rateideal, uptime. Status
lectureReadReadReadBeta
pools
Lists configured pools with per-pool metrics: URL, Status (Alive/Dead), Priority, Quota, Accepted/Rejected, User, Stratum Active, Last Share Time/Difficulty, Pool Rejected%/Stale%. Pools
lectureReadReadReadBeta
devs
Per-device (hashboard/ASC) report: status, temperature, hashrate, accepted/rejected, hardware errors per board. Devices
lectureReadReadReadBeta
devdetails
Static hardware details per board: Model, Chips, Cores, Frequency, Voltage, Profile, Serial. Used for model identification. Devices
lectureReadReadReadBeta
config
Basic configuration info: ASC count, pool count, active strategy, log interval, device code, OS. Config
lectureReadReadReadBeta
edevs (none (legacy '[old]' arg accepted))
Same as devs but excludes blacklisted/zombie devices. Cleaner board list for monitoring. Devices
lectureReadReadReadBeta
estats (none (legacy '[old]' arg accepted))
Same as stats but excludes zombie devices. Variety of model-specific miner stats. Status
lectureReadReadReadBeta
coin
Current coin/algorithm info (hash method, current block diff, network diff). Placeholder/compatibility on many ASIC builds. Status
lectureReadReadReadBeta
lcd
Compact one-shot general summary (originally for LCD displays). Compatibility placeholder on most ASIC firmware. Status
lectureReadReadTBD
check (command_name)
Reports whether a given command exists and the caller's access level for it. Used for capability discovery. Meta
lectureReadReadReadBeta
asc (board_id (n))
Detailed report for a single ASC (hashboard) by index. Devices
lectureReadReadReadBeta
asccount
Returns the quantity of ASC devices (hashboards) detected. Devices
lectureReadReadReadBeta
notify
Returns the device notification/error history (last share, temps, comms errors per device). Status
lectureReadReadReadBeta
privileged
Reports whether the calling connection has privileged (write) access under the api-allow policy. Meta
lectureReadReadReadBeta
pga (n)
Legacy: data for FPGA device n. Placeholder/empty on ASIC-only miners. Devices
lectureReadReadTBD
debug (setting)
Get/set the daemon debug verbosity flags (e.g. quiet, verbose, debug, rpc). Meta
lectureReadReadTBD
lockstats
Writes internal lock statistics to the log (build-dependent debug aid). Meta
lectureReadTBD
switchpool (n (pool index))
Switch the active pool to index n (raise to top priority). Pools
contrôleHTTP CGIgRPCControlTBD
enablepool (n)
Enable (activate) pool n. Pools
contrôleHTTP CGIgRPCControlTBD
disablepool (n)
Disable (deactivate) pool n. Pools
contrôleHTTP CGIgRPCControlTBD
addpool (url,user,password)
Add a new pool (to the first group). On LuxOS the leading session_id is required. Pools
contrôleHTTP CGIgRPCControlTBD
removepool (n)
Remove pool n. Pools
contrôleHTTP CGIgRPCControlTBD
poolpriority (n,n,n,... (priority order))
Set the priority order of all pools. Pools
contrôleHTTP CGIgRPCControlTBD
poolquota (n,q (pool,quota))
Set the load-balancing quota for pool n. Pools
contrôleHTTP CGIgRPCControlTBD
save ([file])
Persist the current configuration to disk (optionally to a named file). Config
contrôleHTTP CGIgRPCControlTBD
restart
Restart the mining daemon (cgminer/bmminer/bosminer/luxminer) without rebooting the device. System
contrôleHTTP CGIgRPCControlTBD
quit
Terminate the mining daemon process. System
contrôleHTTP CGIgRPCControlTBD
ascenable (n)
Enable hashboard (ASC) n. Devices
contrôleHTTP CGIgRPCControlTBD
ascdisable (n)
Disable hashboard (ASC) n. Devices
contrôleHTTP CGIgRPCControlTBD
ascset (n,opt[,val] (vendor-specific opcodes))
Set a vendor-specific ASC option. On Avalon/Canaan this carries the model-specific ascset opcodes (e.g. frequency, voltage, LED). Parameters are not portable across vendors. Devices
contrôleHTTP CGIgRPCControlTBD
pgaenable (n)
Legacy: enable FPGA device n (placeholder on ASIC miners). Devices
contrôleHTTP CGITBD
pgadisable (n)
Legacy: disable FPGA device n (placeholder on ASIC miners). Devices
contrôleHTTP CGITBD
pgaidentify (n)
Legacy: blink the identify LED on FPGA device n. Devices
contrôleHTTP CGITBD
setconfig (name,value)
Set a global cgminer config value (e.g. queue, scantime, expiry). Config
contrôleHTTP CGIgRPCControlTBD
zero (which,summary (true/false))
Zero the named statistics counters; optional summary printout. Stats
contrôleHTTP CGIgRPCControlTBD
hotplug (n (seconds))
Set the hotplug device-scan interval (0 disables). System
contrôleHTTP CGIControlTBD
failover-only (true|false)
Restrict work to the primary pool unless it is dead (failover-only mode). Pools
contrôleHTTP CGIgRPCControlTBD
logon
Open a control session; returns SessionID. Single-session mutex: fails if a session already exists. SessionID is the FIRST parameter of every mutating command. (LuxOS-family model; BraiinsOS uses gRPC bearer token instead.) Session
contrôlegRPCControlTBD
logoff (session_id)
Close the active control session. Session
contrôlegRPCControlTBD
session
Report whether a control session is currently active. Session
lectureReadTBD
kill
Force-terminate any active session (recover a stuck mutex). Session
contrôleControlTBD
fans
Fan statistics: per-fan RPM, speed %, target %. Cooling
lectureReadReadReadBeta
temps
Per-chain board and chip temperatures. Cooling
lectureReadReadReadBeta
tempctrl
Temperature-control thresholds (target / hot / dangerous). Cooling
lectureReadTBD
power
Get power consumption in watts (measured or estimated). Power
lecturegRPCReadBeta
profiles
List available tuning profiles (frequency/voltage operating points). Note: profile values are runtime operating points, not factory presets. Tuning
lecturegRPCReadBeta
profileset (session_id,profile_name[,frequency_step,voltage_step,update_atm])
Set the active tuning profile for the miner/board. (BraiinsOS equivalent is a gRPC tuner call; stock has no socket equivalent.) Tuning
contrôlegRPCControlTBD
curtail (session_id,sleep|wakeup[,voltage_step,frequency_step,mode])
Demand-response sleep/wake control (curtailment). LuxOS exposes sleep/wakeup; an operator can pause hashing for grid events. (BraiinsOS pause/resume is gRPC.) Power
contrôlegRPCControlTBD

Légende : Read lecture seule sur 4028 · Control écriture/contrôle sur 4028 · gRPC / HTTP CGI contrôle via une surface différente (gRPC 50051 de BraiinsOS / /cgi-bin d'origine) · Beta‡ cible bêta DCENT_OS · — / TBD pas sur ce socket. Les commandes de contrôle de la famille LuxOS nécessitent un jeton de session (logon).

Source : la Mining Bible de D-Central (PYASIC_COMPATIBILITY, rétro-ingénierie BraiinsOS et LuxOS) — citations par commande dans le CSV/JSON. Voir aussi la matrice des fonctionnalités de firmware, le protocole de pool Stratum V2 (distinct de ce socket local), et le flasheur web.

Transports, ports et authentification, firmware par firmware

La matrice ci-dessus indique ce que fait chaque commande. Ce tableau indique comment l'atteindre. Les cellules marquées Unknown le restent : le fournisseur ne publie pas l'information et nous ne la devinons pas.

FirmwareTransportPortAuthentificationÉcritureSpécification lisible par machine
cgminer / bmminer (stock Antminer)raw TCP, plain text or JSON4028none; IP allow-listread-only by default; --api-allow with a W: prefix grants privileged commandsGPL source drop bitmaintech/bmminer-mix (S9/C5-era only)
Braiins OS+gRPC50051token via AuthenticationService.Login, Authorization header, 3600 s inactivity expiry; server reflection onyes16 .proto files, braiins/bos-plus-api under proto/bos/v1/
Braiins OS+ (REST, since 25.07)HTTP/REST80POST /api/v1/auth/loginyesOpenAPI v1.7.0, live at GET /api/v1/docs/openapi.json
Braiins OS+ (legacy socket)raw TCP, CGMiner-compatible4028nonepartial — Braiins states switchpool/enablepool/disablepool/addpool/removepool are not fully implemented and reset after restart
LuxOSraw TCP4028session (logon → SessionID → logoff)yes, session required; the session expires after one minute
LuxOS (HTTP)HTTP8080sessionyes, same session model
AxeOS / ESP-Miner (Bitaxe)HTTP/REST + WebSocket (/api/ws, /api/ws/live)80none at allyesOpenAPI 3.1.0, main/http_server/openapi.yaml
MicroBT Whatsminerraw TCP, 4-byte length-prefixed JSON, max 10 clients4433 — not 4028 (API v3.0.0; older v2.0.5 revisions on mirrors say 4028)per-device salt → tokenget.* enabled by default; set.* disabled by default
VNishHTTP; the documentation is served by the miner itself at http://<miner_IP>/docs/UnknownUnknownUnknownnone published off-device
Hiveon ASICnot documentedUnknown — the common assumption that it serves 4028 is not vendor-confirmedUnknownUnknownnone published
Awesome Miner (the platform, not its firmware)HTTP17790optional API key, per-user scopingyesOpenAPI 3.0.2, awesomeminer.com/assets/apidoc.yaml
DCENT_OS (ours, GPL-3.0)CGMiner-compatible TCP · REST · WebSocket4028 · 80 · /ws (same port as HTTP)13 cgminer-compatible commands in source: summary, stats, pools, devs, version, coin, config, switchpool, enablepool, disablepool, addpool, restart, quitGPL-3.0 source

Exemples à copier-coller

Toutes les adresses sont dans la plage de documentation RFC 5737 (192.0.2.0/24) : remplacez-les par l'IP de votre mineur.

# cgminer / bmminer / LuxOS — raw TCP, plain text or JSON, port 4028
echo '{"command":"summary"}' | nc 192.0.2.10 4028

# Braiins OS+ legacy CGMiner-compatible socket (still served; Braiins says it will be deprecated)
echo '{"command":"pools"}' | nc 192.0.2.10 4028

# LuxOS HTTP API — port 8080
curl -X POST -d '{"command":"version"}' -H 'Content-Type: application/json' http://192.0.2.10:8080/api

# AxeOS — plain HTTP on port 80, no authentication
curl http://192.0.2.10/api/system/info

# Braiins OS+ REST (since 25.07) — log in, then read the live OpenAPI document
curl -X POST http://192.0.2.10/api/v1/auth/login -d '{"username":"root","password":"..."}'
curl http://192.0.2.10/api/v1/docs/openapi.json

# MicroBT Whatsminer — 4433, NOT 4028, on API v3.0.0
nc 192.0.2.10 4433

Lecture ou contrôle : l'API est désactivée, locale et en lecture seule tant que vous n'y touchez pas

The canonical document for the 4028 socket is cgminer's own API-README, and it is worth reading before you open anything up. Verbatim: “By default, you cannot access any privileged command that affects the miner — you will receive an access denied status message.” The two flags that govern it are --api-listen, documented as “Enable API, default: disabled”, and --api-network, whose default is “only 127.0.0.1”. That is three separate answers in one place: the API is off, it is local-only, and it is read-only until an operator deliberately changes all three. Credit: Con Kolivas and the cgminer contributors, whose API-README is still the reference document the whole category is built on.

Ce que le firmware Antminer d'origine implémente réellement

Bitmain's own GPL source drop bitmaintech/bmminer-mix carries an api.c whose cmds[] table has an explicit iswritemode flag, so the split is not inferred — it is read off the table.

  • Write-mode: switchpool addpool poolpriority poolquota enablepool disablepool removepool save quit privileged restart failover-only debug setconfig zero hotplug ascenable ascdisable ascidentify ascset lockstats
  • Read-only: version config devs edevs pools summary noncenum pgacount notify devdetails stats estats check coin usbstats asccount lcd
  • That is upstream cgminer's set plus a Bitmain-specific noncenum.
  • Braiins-only additions on its legacy 4028 socket: fans tempctrl temps tunerstatus pause resume

The caveat that matters. bmminer-mix is the S9/C5-era drop. No S19 or S21 bmminer source drop is available to read, so the current stock command set is Unknown and the list above should be treated as the S9-generation answer, not a present-day one.