RustMinerSystem

文档

仪表盘、版本与系统配置 API

RustMinerSystem 币种、系统资源、版本、掉线记录保留、RMS、通知、快捷矿池和 KENC 配置接口。

仪表盘、版本与系统配置 API

本章覆盖后台仪表盘、程序版本和常用系统配置。每次 API 请求直接携带 X-ACCESS-TOKEN: <Access Token>

币种和系统信息

方法 路径 用途/主要参数
GET /api/currency/config 获取币种、算法、图标和公开状态配置。
GET /api/sys/base/info 获取操作系统、CPU、内存、磁盘等基础信息。
GET /api/sys/stat 获取 CPU、内存和网络流量历史。
GET /api/device/stats 获取全部设备数量历史。
GET /api/currency/online/stat/{coin} 获取指定币种在线设备历史。
GET /api/stat/currency/{currency} 获取指定币种算力历史。
POST /api/config/refresh 请求更新算法引擎。不要高频调用。

路径中的 {coin}{currency} 使用后端币种代码,例如 BTCKAS 或节点币种代码。

版本和运行状态

方法 路径 用途
GET /api/local/version 获取当前运行版本。
GET /api/version 获取远程版本、更新和 APP 中心配置。
GET /api/releases 获取版本更新日志。
GET /api/sys/starttime 获取程序启动时间戳。
GET /api/mb/port 获取移动端访问端口和状态。
GET /api/u/i 获取当前实例 UUID。
POST /api/failed/reset 重置程序崩溃/启动失败标记。

版本响应在不同后端版本中可能是字符串或包含 version 的对象,调用端应同时兼容。

掉线推送设置

GET /api/warning/setting
POST /api/warning/setting

新版前端使用的配置字段包括:

{
  "is_off": 0,
  "wr": 0,
  "key": "<Server酱 Key>",
  "smtp_email": "[email protected]",
  "smtp_secret": "<SMTP 密码或授权码>",
  "smtp_endpoint": "smtp.example.com",
  "smtp_port": 465,
  "smtp_use_tls": 1
}

后端版本还可能返回算力下降阈值等字段。保存时建议先读取现有对象,只修改需要的字段,避免覆盖新增配置。

掉线矿机记录保留时长

当前时长从 GET /api/sys/base/info 响应的 group_expire_secs 字段读取,单位为秒。修改接口:

POST /api/group/offline/secs
Content-Type: application/json
{
  "secs": 3600
}

secs 为必填整数,最小有效值为 600;更小的值会按 600 秒保存。服务端成功时返回 HTTP 200 和文本 Ok;保存后可重新请求 /api/sys/base/info 确认规范化后的值。该设置只控制离线矿机记录的保留时长,不会断开在线矿机。

RMS 客户端配置

GET /api/rms/config
POST /api/rms/config

保存请求示例:

{
  "ports": {},
  "code": "",
  "mode": 0,
  "title": "RMS",
  "pool_mode": 0,
  "notice": "",
  "info": "",
  "peers": {},
  "host": "miner.example.com",
  "protocol": 1
}

首次获取返回未注册状态时,新版前端会用 mode: 0pool_mode: 0 和默认标题自动注册。保存时前端还会自动写入当前页面的 host,并以 protocol=1 表示 HTTPS、0 表示 HTTP。portspeers 均为以端口为键的对象,内部字段应以当前后台读取到的结构为准。

快捷矿池和钱包配置

方法 路径 用途
GET /api/local/pool/endpoint 获取快捷矿池、钱包和自定义配置。
POST /api/local/pool/endpoint 保存完整快捷配置对象。
GET /api/pool/info/{id} 获取预置矿池列表;新版前端使用 id=1

POST /api/local/pool/endpoint 会提交完整配置对象。自动化修改前应先 GET、合并目标字段,再 POST,避免删除用户已有的 customPoolcustomWallet

KENC 密钥

方法 路径 用途
GET /api/kc/key 获取 KENC 自定义密钥。
POST /api/kc/key 保存 KENC 自定义密钥。
POST /api/kc/reset 恢复默认 KENC 密钥。

保存请求:

{
  "k": "<自定义密钥>"
}

修改密钥可能影响已有客户端连接,操作前应确认客户端和服务端配置一致。

币种配置响应

GET /api/currency/config 返回以币种代码为键的对象,不是数组:

{
  "BTC": {
    "id": 1,
    "name": "BTC",
    "version": "1.0.0",
    "category": "sha256",
    "rr": 0,
    "rl": 0,
    "rj": 0,
    "pow": 0,
    "is_pub": 1,
    "created_at": "...",
    "updated_at": "..."
  }
}
字段 类型 说明
对象键 string 前端可选择的币种标识;端口请求的 currency 使用此值或条目 name
id number 币种记录 ID。
name string 币种代码。
version string 当前币种引擎版本。
category string 算法类别;创建端口时原样写入 category
rr / rl / rj number 算法兼容元数据;当前前端仅透传或保留,不应自行改写。
pow number 算法工作量相关标志。
is_pub number 1 为公开展示;非公开项默认不在前端币种列表显示。
created_at / updated_at string 配置记录时间。

端口的 currencycategory 必须来自同一条币种记录,详见端口完整字段。统计接口的 {coin} / {currency} 使用 name

图表响应

接口 响应字段
/api/stat/currency/{currency} ChartPoint[]
/api/sys/stat SystemPoint[]
/api/device/stats DevicePoint[]
/api/currency/online/stat/{coin} CoinDevicePoint[]

ChartPoint 同时用于币种、端口和矿工算力图表:

字段 类型 说明
s string 采样时间。
s_h number/null 有效算力。
p_h number/null 抽水算力。
f_h number/null 失败算力。
s_s number/null 总份额数。
p_s number/null 抽水份额数。
f_s number/null 失败份额数。
d_l number/null 延迟,单位毫秒。

SystemPointidcpumemrecvtransrktimecpu/mem 是百分比统计,recv/trans 是接收和发送字节数,rk 为兼容保留值。

DevicePointidonlineofflinetimeCoinDevicePointidonlineofflinecrrktimecrrk 是币种统计兼容字段,可能为 null

图表采样可能包含 null,调用方应保留时间点并把缺失数值按空值处理,而不是删除整条记录。

系统信息响应

GET /api/sys/base/info 返回当前资源快照:

字段 类型 说明
os_version string 操作系统版本。
load_avg string[] 1、5、15 分钟负载。
total_mem / used_mem number 总内存和已用内存,单位由当前运行版本统一返回。
total_space / available_space / used_space number 磁盘总量、可用量和已用量。
cpu_usage number 当前 CPU 使用率。
cpu_nums number CPU 逻辑核心数。
api_failed_flag number 程序失败标志,1 表示后台提示需要处理。
group_expire_secs number 掉线矿机记录保留时长,单位秒;设置页面通常换算为分钟展示。
rp number 运行实例兼容元数据;未使用时不要修改。
exp number 当前配置中的有效期数值。
t number 运行实例兼容时间/状态值。

版本与运行状态响应

接口 成功响应
/api/local/version { "version": "x.y.z+build" }
/api/version 远程配置对象,至少含 version,还可能含各客户端版本、APP_INFOPAY
/api/releases GitHub Release 风格数组;前端使用 tag_namenamebodyhtml_urlpublished_atprerelease 等字段。
/api/sys/starttime number,Unix 秒或毫秒时间戳;调用方按数值位数兼容。
/api/mb/port { "port": number, "status": number }
/api/u/i string,实例 UUID。
/api/failed/reset HTTP 200 表示失败标志已清除;该接口会修改状态。
/api/config/refresh HTTP 200 表示刷新请求已接受;之后重新读取币种配置和版本。

/api/version 的已确认顶层字段包括 versionPoolNodeAndroidVersionPoolNodeIosVersionRustMinerSystemIOSVersionRustMinerSystemAndroidVersionRustMinerSystemCliVersionRMSAPP_INFOPAYAPP_INFO 包含:

  • dialog.titledialog.description:按 zh/en/ru/jp 分语言。
  • overview.eyebrow/title/description/counterLabel:按语言分组。
  • apps[]key、多语言 name/title/tagline/description/statusicontonefeatures[]actions[]previewplatforms[]
  • actions[]key、多语言 labelurlicontargetrel
  • platforms[]key、多语言 label/status/description/stateLabeliconactions[]

这些远程展示字段允许增加新键,客户端应宽松解析。

配置接口返回值

掉线推送

GET /api/warning/setting 返回:

字段 类型 说明
is_off number 总开关标志。
wr number 推送规则/模式标志。
key string Server 酱等推送密钥,展示和日志中应脱敏。
smtp_email string 发件邮箱。
smtp_secret string SMTP 密码或授权码,必须脱敏。
smtp_endpoint string SMTP 主机。
smtp_port number SMTP 端口。
smtp_use_tls number 1 使用 TLS,0 不使用。

POST 保存完整对象,HTTP 200 表示成功;随后 GET 确认服务端规范化值。

RMS 配置

GET /api/rms/config 的已确认字段:

字段 类型 说明
url / url2 string 主、备用 RMS 地址。
code string RMS 配对/访问代码,按敏感值处理。
mode number RMS 工作模式。
ports object 以监听端口字符串为键、端口状态/映射值为值。
peers object 以 peer ID 为键的上游配置。
title / notice / info string 客户端标题、公告和说明。
pool_mode number 矿池模式标志。

peers.* 包含 coinrkclcsupstream_peers[];每个上游项包含 urlportcodeprotocol。保存时前端还会加入当前页面的 hostprotocol。自动化编辑必须先 GET 并深合并 portspeers,不能用空对象覆盖。

快捷矿池与钱包

GET /api/local/pool/endpoint 返回:

{
  "customPool": [
    { "address": "...", "coin": "BTC", "deal": "TCP", "name": "Pool A" }
  ],
  "customWallet": [
    { "address": "...", "name": "Wallet A" }
  ]
}

customPool[].coin 应关联币种配置deal 是前端展示的连接协议文本。POST 保存完整对象,成功后重新 GET。

GET /api/pool/info/{id} 返回预置矿池数组,每项包含 idcategory_idbrandcontenturlprotocolcreated_at。使用预置项时,把 url 作为矿池地址,并按 protocol 选择连接方式。

KENC

GET /api/kc/key 直接返回字符串密钥;POST /api/kc/key 和 POST /api/kc/reset 成功时返回成功标量或 HTTP 200。密钥响应不得写入日志。