6

This question was inspired by this recent mempool phenomenon: some transactions were left out from blocks even when they had a competitive fee-rate simply because they had a positive sigop count and the max sigop count was reached before the block template was totally filled. Whatever empty space remained was filled using zero sigop txs.

It seems that miners have to solve a knapsack-like problem where they are constrained by two hard limits: one is the size of the block and the other is the maximum amount of sigops. The former is the one actually optimized for in the standard mining algorithm, and the latter is more-or-less considered due to the content of this PR, which penalizes the size of a transaction if it has a high sigop count.

I have two questions:

  1. Suppose the mempool contained no zero sigop transactions and that the selection algorithm constructed a block template consisting of high sigop count transactions only but lots of available space. Is it guaranteed by the choice of nBytesPerSigOp that this block template is more convenient for miners that one where the block is full and high sigop transactions are avoided?
    Judging by this answer it'd seem as if indeed the miner could earn slightly more if they did some clever work, but that it'd be hard for it to actually happen in practice.
  2. Why isn't the standard mempool-based fee estimation algorithm sigop-aware? In a context in which there are lots of high sigop transactions with competitive fee-rates, there are two different next block fees depending on whether the transaction one is about to craft has a positive sigop count or not.
2
  • 1
    The fee estimator uses virtual size, which is influenced by the number of sigops. Why do you say it's not sigop-aware? Jan 11 at 16:16
  • 1
    @AntoinePoinsot True, my question was poorly worded. What I meant to say is that in the case that sigops are a limiting factor, as mononaut explains in their answer, there are in fact two next block fee-rates: one for zero sigop txs and one for non-zero sigop txs. Jan 11 at 17:02

1 Answer 1

5

Q1: Suppose the mempool contained no zero sigop transactions and that the selection algorithm constructed a block template consisting of high sigop count transactions only but lots of available space. Is it guaranteed by the choice of nBytesPerSigOp that this block template is more convenient for miners that one where the block is full and high sigop transactions are avoided?

There are no guarantees that templates generated by Bitcoin Core will be optimal.

The adjusted vsize introduced by PR #8365 significantly underweights the contribution of high sigop transactions to the sigop limit, charging only 40% of the equivalent usage of the weight limit.

This means that in such extreme scenarios, the miner would likely lose out on fees compared to a weight-maximizing block.

However in practice it's very rare for sigops to be a limiting factor in template construction. Over the last 10,000 blocks (between heights 815316 and 825316), only 62 were constrained by the sigop limit, despite an abnormally large number of high sigop transactions during that period.

As long as sigops are not a limiting factor, it's more profitable to accept the additional fees incurred by the bytespersigop adjustment than to exclude them by raising the penalty further. So the current default of 20 weight units per sigop is likely to be more profitable than a "fair" cost of 50 WU/sigop most of the time.

Q2: Why isn't the standard mempool-based fee estimation algorithm sigop-aware? In a context in which there are lots of high sigop transactions with competitive fee-rates, there are two different next block fees depending on whether the transaction one is about to craft has a positive sigop count or not.

I suspect that nobody anticipated this scenario would actually occur, or thought it would be too rare to justify the additional effort and complexity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.