Add Extension 0x0003: Coinbase Output Weights#195
Open
warioishere wants to merge 2 commits into
Open
Conversation
added 2 commits
May 10, 2026 12:32
Generalises Section 6.4.3 single-output payout rule via a TLV on AllocateMiningJobToken.Success carrying a SEQ0_64K[U32] weight vector. Opt-in; when not negotiated, implicit weights [1, 0, ..., 0] preserve existing behaviour. Continues sv2-spec discussion stratum-mining#192 / sv2-apps #388.
Clarify that the extension does not impose a wire-format cap on output count. coinbase_output_max_additional_size from §6.4.3 already governs space commitment; per-block output limits, dust thresholds and pending ledgers are pool-side accounting and out of scope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a draft extension
0x0003 — Coinbase Output Weightsthat allows a Job Declaration Server (JDS) to specify how the Job Declaration Client (JDC) should distribute coinbase template revenue across multiple pool-defined coinbase outputs. The mechanism is a TLV appended toAllocateMiningJobToken.Successcarrying a per-output weight vector (SEQ0_64K[U32]).This continues the conversation from:
Why an extension (not a breaking spec change)
Per @Fi3's guidance in #192 ("I'm leaning to use an extension here"), this is structured as a TLV extension. When the extension is not negotiated, nothing changes — the implicit weight vector is
[1, 0, …, 0]and the existing single-output payout rule of §6.4.3 applies exactly as before.Design choices made in this draft
A few decisions had to be made to write the doc. None of them are load-bearing — happy to flip any of them based on review.
AllocateMiningJobToken.Success, mirroring the pattern of extension 0x0002 and §3.4.3.SEQ0_64K[U32](explicit U16 count prefix), matching how every other array is encoded in §3.1. An alternative would be implying the count from the outer TLVLength / 4. I went with the canonical type-system encoding for consistency, but it is two bytes more on the wire.amount[i] = floor(T * weights[i] / S), whereTistemplate_revenueminus any non-zero outputs the JDC added itself, andSis the sum of weights. Uses 128-bit arithmetic to avoid overflow.0 ≤ residual < S) goes to the highest-weight output, tie-broken by lowest index. This was chosen because it does not assume any particular output is the pool's own — fee-less pools and pools without an output for themselves are first-class deployments. The proportionally-largest output absorbs the dust, so the bias is smallest as a percentage of that output's amount. Alternatives considered: residual tooutput[0](assumes pool fee output exists), residual to last output (arbitrary).[1, 0, …, 0]as the implicit weight vector that produces the existing behavior. I think this reads more cleanly than "this extension overrides §6.4.3" — but I am not married to the framing if the maintainers prefer to phrase it as a supersession instead.Explicitly out of scope
Per the conversation in #192, the following are intentionally not part of this extension and are deferred to follow-up extensions, so this proposal stays narrow enough to actually land:
template_revenue. The conclusion is that this is operator policy, not protocol semantics: the existingcoinbase_output_max_additional_sizefield in §6.4.3 already lets the JDS commit a space envelope that the JDC reserves on the Template Provider side, and pool-side machinery (dust thresholds, pending balance ledgers, per-block output caps, payout consolidation) sits naturally behind the weights this extension delivers. Section 4.5 of the new doc spells this out so reviewers and implementers see we considered the trade-off rather than overlooked it.Section 4.4 of the extension doc lists the scope split, so future extensions can layer on top without conflict.
Open to feedback
This is a draft. Areas where I would value maintainer guidance:
0x0003is a placeholder; happy to use whatever number the registry should allocate.SEQ0_64K[U32], I will swap it.I'd rather iterate on this PR until the shape is right than assume it's right and merge.
Files changed
extensions/0x0003-coinbase-output-weights.md— new extension doc (mirrors structure of0x0002-worker-specific-hashrate-tracking.md).09-Extensions.md— registry row added.