Saturday, May 21, 2022
HomeBitcoinbitcoind - Mud threshold for Testnet

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 it is advisable know the input_weight to calculate an output’s mud threshold.

That is simple 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 not 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 lead to completely different enter weights.

Due to this fact, the Bitcoin Core code solely makes use of two completely different mud thresholds:
Screenshot of GetDustThreshold(…) by way of https://github.com/bitcoin/bitcoin/blob/grasp/src/coverage/coverage.cpp

For all native segwit outputs, it makes use of the burden of the particular output plus the burden of a P2WPKH enter. Word 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 really comes out as 67 vB.

This implies for P2WPKH, the place an output is 31 vB, the overall 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’ll be able to search for handle prefixes on this desk:
https://en.bitcoin.it/wiki/List_of_address_prefixes

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments