bitcoind – Mud threshold for Testnet

The mud threshold is outlined as (output_weight+input_weight)×discard_feerate. The discard_feerate is outlined as 3 s/vB. It follows that you should know the input_weight to calculate an output’s mud threshold.

That is straightforward within the case of P2PKH outputs, as a result of the enter has a hard and fast weight. It’s nevertheless is not possible within the case of P2SH, P2WSH, and P2TR outputs, since you can’t inform from the handle what situation script the recipient encoded of their handle to spend the output later. It may very well be a legacy multisig, wrapped segwit, or some customized development. In case of P2TR it may very well be spend per the keypath or the scriptpath which might end in completely different enter weights.

Due to this fact, the Bitcoin Core code solely makes use of two completely different mud thresholds:
through https://github.com/bitcoin/bitcoin/blob/master/src/policy/policy.cpp

For all native segwit outputs, it makes use of the burden of the particular output plus the burden of a P2WPKH enter. Observe that though

nSize += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);

ought to consider to 67.75 vB, since nSize is a size_t, it truly comes out as 67 vB.

This implies for P2WPKH, the place an output is 31 vB, the whole comes out to 31 vB + 67 vB = 98 vB. This implies for P2WPKH mud threshold is 294 satoshis. For P2WSH and P2TR, the place outputs are 43 vB, the mud threshold comes out to 330 satoshis.

P2PKH outputs are 34 vB, inputs are 148 vB. 34 vB + 148 vB = 182 vB, i.e. their mud threshold is 546 satoshis. Since P2SH outputs are solely 32 vB for wrapped segwit and all different P2SH outputs, their mud threshold comes out to 540 satoshi.

You possibly can search for handle prefixes on this desk:

  • m… is a testnet P2PKH handle
  • 2… is a testtnet P2SH handle

Leave a Reply

Your email address will not be published.

Back to top button