SHARENOTEProof of energy
Specs/Infrastructure
SNP-08draftneeds 01needs 02

Ask

An owner tells its own mining rig what to mine, for how long, and reads back status and hashrate.

Summary

An ask is an owner telling its own mining rig what to mine: notes bound to what, how much, and until when. The rig queues it, mines it, reports its state, and returns to its usual work when it ends.

An owner can also request a report of the rig's hashrate and current work. Everything travels gift-wrapped. The notes are ordinary SNP-01 notes, which the owner checks without trusting the rig.

rig ownersminersapp builders

Kinds and tags

KindNameHow
1728Askrumor from owner to rig, NIP-59 gift-wrapped
1729Statusrumor from rig to owner, gift-wrapped
1730Reportrequest and answer rumors, gift-wrapped both ways
TagMeaning
dask id, 64 random hex; required
expirationwhen the ask ends; required
bbinding hex, empty for unbound; required
wanttotal work wanted; default: mine until expiration
zZ-bit of each note; default: the rig's share size
galgorithm; default: the rig's
identitykey the notes credit; default: the owner
priorityorder among this owner's asks; default 0
relaywhere notes go; default: the rig's note relays

Owners and rigs

  • Owner: a key allowed to command a rig, configured by the rig's operator with a rank.
  • Rig: software driving mining hardware, such as a stratum server, under its own key. It needs no owner's key: notes need no signature.
  • Usual work: what the rig mines with no ask running, templates from its own node or an NSP, or nothing (standby).

All messages are NIP-59 gift wraps to the recipient's kind:10050 inbox relays. A rig drops, without answering, any message not from one of its owners, and any ask without a valid d or expiration. Relays see neither who commands which rig nor what is asked.

The ask and its versions

An ask is (owner, d). b, g and identity are fixed for the life of an ask; a version changing them is refused with immutable. A rig that mines several algorithms refuses an ask without g.

To update, the owner sends a new rumor with the same d. The rig applies the latest created_at, ties to the larger rumor id, and ignores older ones. To cancel, the owner sends a version whose expiration has passed.

Numbers are decimals without sign or leading zeros, at most 2^53 - 1. A bad number makes the ask refused with invalid-tag.

Lifecycle

StateMeaning
queuedvalid, waiting for hashrate
runningbeing mined
donewant reached, or expiration reached with no want
expiredexpiration reached before want, or cancelled
failedunavailable or stopped by the operator
refusedunsupported-algorithm, ambiguous-algorithm, immutable, invalid-tag, queue-full, over-limit

A version whose want is at or below the progress made ends the ask done at once. Final states stay final. A rig never starts or resumes an expired ask, and drops an ask received already expired.

Status and queue

A kind:1729 status names the ask (d), the version applied (e) and the state. While queued or running it gives the resolved g and z. It adds queue (position, running ask = 1), progress (notes and summed Z-bit), rate and reason as they apply.

The rig keeps one queue, ordered by owner rank, then priority, then arrival. priority orders only that owner's asks, so no owner can jump ahead of a higher-ranked one. An arrival ahead of the head preempts it back to queued, progress kept. A rig may bound the queue (queue-full) and how far ahead an expiration may lie (over-limit).

Reports and checking

An owner sends a kind:1730 request with expiration and optional every (at least 60 seconds). The rig answers once, or at that interval until expiration, with rate per algorithm, workers, one worker tag per miner (name, algorithm, rate, last share), mining (ask, usual or standby), queue, and d only when the running ask is the requester's.

A status is a claim. The owner counts the notes itself with {"kinds":[1723], "authors":[<identity>], "#b":[<b>]}, in g, at least z, each proof once. A rig can only misreport progress and rate, and the rate can be estimated from shares (SNP-02).

For an -aux algorithm on real work, only the z-chain header changes, so the same hashing still mines blocks.

Worked example

Alice's rig mines scrypt-aux on its usual work.

AskRig
A: b = an offer binding, want 20z00, 1 dayqueued 1, g scrypt-aux, z 12z00, then running
(mining)A running, progress 7 14z80
B: b = a service epoch, priority 5, 1 hourB running; A queued 2
(1 hour)B done; A running
A, newer: want 21z00A running
(mining)A running, progress 300 20z22
A, newer: want 20z00, below progressA done; usual work
A, older version replayedignored
C, received already expireddropped
from a key not an ownerdropped

Seven 12z00 notes are 7 · 2^12 = 28,672, which reads back as 14z80.

Try it

Rendered from soprinter/snps/SNP-08.md. The full text has every rule; this page condenses it.