Skip to content

Rig identity from the stick: random rig id plus token, hardware as hints, clone detection #4014

Open

Description

@pithead-developer

What's the problem

A rig is matched by worker name (xmrig_client.py:285-301) with the stick's access_token as credential. rig_id exists nowhere in pithead today. Per-rig history is keyed by worker name (storage_schema.py:256). Nothing handles a cloned stick (same name, token and machine-id), and hardware is not used anywhere.

What it impacts

Renaming a rig loses history; a cloned stick is indistinguishable and served twice; a stick moved to another machine is not recognised as the same rig.

How I found it

Owner decisions of 2026-11-10 (item 8). Reading lib/pithead/14-local-miner.sh:283-300 (token minted on the stick), dashboard/mining_dashboard/client/xmrig_client.py:285-301, service/workers/worker_adopt.py:7-50, os/overlay/pithead-machine-id.

How important is it

Medium for 2.1.0; it must land before Update all, Remove rig and log storage rely on it.

It is blocked by p2pool-starter-stack/rigforge#680. Rig data analytics (#4006) builds on it.

Acceptance criteria

  • A random rig id is minted once on the stick in the pithead rig setup code, written to rig.json beside the token and passed into the RigForge config (RigForge only passes it through). Rigs without an id mint one at the updater or on first boot of the new image.
  • Adoption records the id; match order is rig id, then name, then IP. A name match with a different rig id never silently takes over an existing record (see the replace-stick issue).
  • The id is a lookup hint only: a wrong id never authenticates and never reveals which ids exist.
  • MAC, board UUID and CPU model are optional display hints; their absence is not an error and they authenticate nothing.
  • Same id from different hints is shown as 'moved hardware' (info event).
  • Clone detection rule: the same rig id answered by two distinct sources (two IPs with differing live state or an id seen from two IPs within a defined window) raises a duplicate-identity fault that blocks control and update for that record until the operator re-keys one copy. A test uses two simulated sources.
  • Old rig.json files without an id keep working.
  • Docs state what a clone, a moved stick and a dead stick look like and what to do; a clone shares the token, so Remove rig rotation affects only the copy that answers.

Possible solutions

  • Extend worker_adopt with an optional rig_id and add a history column keyed by it, migrating gradually.
  • Escrow of rig.json for Restore rig is out of scope; the coordinator already holds the token.

Activity

  1. added this to the v2.1.0 milestone on Nov 10, 2026
  2. added
    enhancement
    appliance
    on Nov 10, 2026
  3. pithead-developer commented on Nov 13, 2026

    @pithead-developer
    ContributorAuthor

    Grouped with #4013, but PR #4103 does not close it: the feed-side surfacing of the status file needs the open rigforge#680 feed broadcast merged before adoption and clone detection can be proven end to end. Released for its own pick.

  4. pithead-developer commented on Nov 17, 2026

    @pithead-developer
    ContributorAuthor

    Left out of PR #4189 (the grouped pick for #4065). Nothing here was implemented for this issue, and that PR carries no closing keyword for it. Why: #4065's contract work (paired/TLS/fingerprint from submit through rig.json into the miner config) is complete on its own head, and this issue is more than one objective — rig id minting plus the rig.json/config pass-through, adoption with rig-id-first match order, clone detection with two simulated sources, and the docs for clone/moved/dead sticks — across well over five source files, which the slow-local-session limit excludes for a group of three. It is ready to pick: the rig-side feed fields this issue was blocked behind (rigforge#680) have landed upstream, so the coordinator can now read the echoed rig id and the display hints. The rigkeep leg that seeds a rig id for its criterion still waits on this issue landing; when it does, drop the leg's seeding and rerun that battery phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    applianceenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions