Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add max coinbase out sigops to CoinbaseOutputDataSize in TP protocol #86

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Fi3
Copy link
Contributor

@Fi3 Fi3 commented Jun 16, 2024

The template provide need a way to know how many sigops the pool want to include in the coinbase outupts, otherwise is not able to create a template that if mined will result in a valid block.

The template provide need a way to know how many sigops the pool want to
include in the coinbase outupts, otherwise is not able to create a
template that if mined will result in a valid block.
@Sjors
Copy link
Contributor

Sjors commented Jun 17, 2024

I can implement this on the template provider side.

Let's recommend 400 as the default, as that's what Bitcoin Core has been using for ages (nBlockSigOpsCost = 400; in src/node/miner.cpp). It can be 0 only if all coinbase payout addresses are taproot.

This will need some coordination in deployment, especially if we don't change the protocol version number (see #82).

@Fi3
Copy link
Contributor Author

Fi3 commented Jun 18, 2024

@Sjors I addressed your comments. When we have consensus on this I can implement it in SRI and you can add it to TP. I think the most contentious point here is how to handle versioning

@Sjors
Copy link
Contributor

Sjors commented Jun 18, 2024

I'll let you know here once I have a branch with this change in it for the Template Provider. If you can open a pull request on the SRI repo with the same change, we can test if they're compatible.

@Sjors
Copy link
Contributor

Sjors commented Jun 18, 2024

Let's recommend 400 as the default

This is still missing. Perhaps worded as:

Use 400 for optimal backwards compatibility with v1. Note that taproot outputs consume 0 sigops.

@Fi3
Copy link
Contributor Author

Fi3 commented Jun 18, 2024

Let's recommend 400 as the default

This is still missing. Perhaps worded as:

Use 400 for optimal backwards compatibility with v1. Note that taproot outputs consume 0 sigops.

not sure if we should recommend a default at all. If so I would go with 0.

@Sjors
Copy link
Contributor

Sjors commented Jun 18, 2024

0 will create an invalid block if you your coinbase output is non-taproot. And you won't find out until someone starts spamming the mempool with bare multisig: https://bitcoinexplainedpodcast.com/@nado/episodes/bitcoin-explained-76-stamps-and-the-invalid-block-caused-by-it

The reason I suggest 400 is because that's what getblocktemplate does, so every stratum v1 miner does it by default - unless they patched Bitcoin Core. This has never been configurable before.


| Field Name | Data Type | Description |
| ----------------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
| coinbase_output_max_additional_size | U32 | The maximum additional serialized bytes which the pool will add in coinbase transaction outputs |
| coinbase_output_max_sigops | U16 | The maximum additional sigops which the pool will add in coinbase transaction outputs |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add _additional for consistency?

@Fi3
Copy link
Contributor Author

Fi3 commented Jun 18, 2024

0 will create an invalid block if you your coinbase output is non-taproot. And you won't find out until someone starts spamming the mempool with bare multisig: https://bitcoinexplainedpodcast.com/@nado/episodes/bitcoin-explained-76-stamps-and-the-invalid-block-caused-by-it

The reason I suggest 400 is because that's what getblocktemplate does, so every stratum v1 miner does it by default - unless they patched Bitcoin Core. This has never been configurable before.

what about: legacy pools should use 400, new pools should use 0 ?

@Sjors
Copy link
Contributor

Sjors commented Jun 18, 2024

new pools should use 0

That assumes new pools want to use Taproot, that seems too DEMANDing :-)

@Sjors
Copy link
Contributor

Sjors commented Jun 18, 2024

Here you go, completely untested: Sjors/bitcoin#45 (branch sjors/sv2-sigops)

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.

None yet

2 participants