Run an Antminer worker
Start an MDK worker for a Bitmain Antminer device.
Overview
This page details how to run the Bitmain Antminer worker. Select the development (mock) or real-device path.
Prerequisites
Review the common deployment prerequisites before you start.
Deployment-specific requirements:
- A Node.js service or script in your deployment that runs the MDK worker and registers devices
- A supported Antminer device reachable from the machine or container running the worker
- The miner API reachable over HTTP, typically port
80 - Digest-auth credentials for the miner. Antminer devices commonly default to username
rootand passwordroot, but use your site's configured credentials
Development
Run against a mock
To support development, each model ships a runnable example that starts an ORK, boots a mock device, and registers it. This guide uses the S21 example:
node backend/workers/miners/antminer/examples/run-s21.jsIt prints the ORK HRPC key and the registered device ID, then stays running until Ctrl+C. To run another model, use the matching example listed in USAGE.md.
Connect a miner
Pick your model
Use the Antminer worker's USAGE.md to choose the manager class and mock example for your model. This guide uses AM_S21 and run-s21.js as the example; replace them with the values for your miner.
Register your miner
Antminer devices use an HTTP API with digest authentication. Add this code to the Node.js service or script that runs the MDK worker in your deployment. The snippet shows the minimum registerThing call for one Antminer device; replace the example IP address and credentials with your miner's values:
const { getOrk, startWorker } = require('@tetherto/mdk')
const { AM_S21 } = require('@tetherto/miner-antminer')
const ork = await getOrk()
const { manager } = await startWorker(AM_S21, { ork })
await manager.registerThing({
info: { container: 'site-1', serialNum: 'AM-001' },
opts: { address: '192.168.1.20', port: 80, username: 'root', password: 'root' }
})Make sure each miner's IP is reachable from the machine or container running the worker before registering. Commands act on physical hardware — prioritize thermal safety.
Before running in a deployment, generate the worker config (common.json for worker identity, base.thing.json for device defaults and per-model alert thresholds):
cd backend/workers/miners/antminer
./setup-config.shFor the full registerThing option reference, the mock createServer options, and the per-model alert blocks, see the worker's USAGE.md and the shared install pattern.
Troubleshooting
The development example on this page uses run-s21.js. A working run prints ORK HRPC key: and Device:, then stays running until Ctrl+C.
If the example does not print both values, or if its mock port is already in use, follow miner troubleshooting.
Next steps
- Decide how to run the worker service — Deployment topologies
- Review telemetry units, command shapes, and error codes —
mdk-contract.json