Skip to content

add coinbase_witness field to NewTemplate - #198

Open
plebhash wants to merge 1 commit into
stratum-mining:mainfrom
plebhash:2026-06-09-new-template-coinbase-witness
Open

plebhash wants to merge 1 commit into
stratum-mining:mainfrom
plebhash:2026-06-09-new-template-coinbase-witness

Conversation

@plebhash

@plebhash plebhash commented Jun 9, 2026 •

Copy link
Copy Markdown
Member

close #166

as discussed in #156 (TLDR: future-proofing Sv2 TDP wrt future/potential BIP141-related consensus changes)


note: this PR is similar to #15, which was opened in 2022 and closed in 2023 with pending review comments and no merging

so I'm trying to preemptively address some confusion points that were left as pending review comments on #15

@plebhash
plebhash force-pushed the 2026-06-09-new-template-coinbase-witness branch from 5faa219 to 1bd0189 Compare June 9, 2026 15:20
@coleFD

coleFD commented Jun 12, 2026

Copy link
Copy Markdown

ack

@Sjors

Sjors commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

ACK 1bd0189

I updated stratum-mining/sv2-tp#108 to match.

How do you want to go about deploying this? It's probably safest if you first update SRI to optionally handle this extra field. I could then release a new sv2-tp version that sets the field, and note in its release notes the minimum expected SRI release.

Or we could do something more graceful like bumping a protocol number?

Comment thread 07-Template-Distribution-Protocol.md Resolved
@average-gary

Copy link
Copy Markdown

Ack

@plebhash
plebhash marked this pull request as ready for review July 30, 2026 15:26
@plebhash
plebhash force-pushed the 2026-06-09-new-template-coinbase-witness branch 2 times, most recently from 7a54b79 to dc6c26d Compare July 30, 2026 18:28
@Fi3

Fi3 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

ack

@Sjors

Sjors commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@plebhash do you have a branch that implements this spec change? Then I can test stratum-mining/sv2-tp#108 CI against that. I'll update it to use OPTION[U256].

Comment thread 03-Protocol-Overview.md Resolved
Comment thread 07-Template-Distribution-Protocol.md Resolved
Comment thread 07-Template-Distribution-Protocol.md Resolved
Comment thread 07-Template-Distribution-Protocol.md Resolved
@plebhash
plebhash force-pushed the 2026-06-09-new-template-coinbase-witness branch from dc6c26d to d9b06ac Compare September 23, 2026 20:06
@Sjors

This comment was marked as outdated.

@plebhash

This comment was marked as outdated.

- add `NewTemplate.coinbase_witness` to TDP as `OPTION[U256]`
- define conditional encoding:
  - empty when witness commitment output is omitted
  - exactly 32 bytes when witness commitment output is present
- codify BIP141 empty-block behavior (witness commitment optional)
- require clients to preserve TP-provided output ordering as
  `<client-added-outputs> || <NewTemplate.coinbase_tx_outputs>`
- clarify field purpose: serialize coinbase witness coherently with TP
  commitment output; no witness-commitment recomputation required
- update Protocol Overview BIP141 text to match the new rules
@plebhash
plebhash force-pushed the 2026-06-09-new-template-coinbase-witness branch from d9b06ac to 0c274cf Compare November 7, 2026 23:17
@plebhash

plebhash commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

@Sjors your review comments above should be addressed, except

@plebhash do you have a branch that implements this spec change?

@Sjors

Sjors commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Thanks, it would be good to test sv2-tp against a proposed SRI change, and figure out the right deployment sequence.

I suspect we'll need a protocol version bump for this. If so, we should also settle on #216.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add coinbase_witness to NewTemplate

5 participants