blockchain – What’s the dimension of various Bitcoin transaction sorts?

0
65


There are a variety of various deal with codecs and different customary transaction sorts:

  • Pay to Public Key (P2PK) outputs tie funds on to the general public key of the recipient as an alternative of the derived deal with. These have been nearly fully changed by P2PKH, though typically mining rewards are nonetheless paid out to P2PK.
    Input¹: 114 B
    Output: 44 B (compressed), 76 B (uncompressed)

  • Multisig transactions had been doable through the use of the corresponding op-code instantly within the output script even earlier than P2SH was launched. Most multisig transactions at this time are achieved with P2SH transactions at this time, although.
    Enter: variable (relies on m-of-n)
    Output: variable (should embrace all pubkeys)

  • Pay to Public Key Hash (P2PKH) is at this time probably the most generally used deal with format. A P2PKH output indicators over funds on to an deal with derived from a single recipient key.
    Input¹: 148 B (compressed), 180 B (uncompressed)
    Output: 34 B

  • Pay to Script Hash (P2SH) was previously foremost used for multisignature transactions, however any legitimate redeemscript is allowed. Inventive use of P2SH allowed the introduction of backwards-compatible segwit addresses: “Nested Pay to Witness Public Key Hash” (P2SH-PWPKH or NP2WPKH) and “Nested Pay to Script Hash” (P2SH-P2WSH or NP2WSH) might be despatched to by any shopper that may ship to P2SH.
    Input¹: variable (2-of-3: 297 B, NP2WPKH: 91 vBytes, NP2WSH 2-of-3: 139 vBytes)
    Output: 32 B

  • Pay to Witness Public Key Hash (P2WPKH) is the corresponding native segwit format to P2PKH, making use of a witness program moderately than a signature script. P2WPKH addresses are encoded with bech32 as an alternative of base58 that means that solely purchasers that perceive the native segwit format can ship to them.
    Input¹: 68 vBytes
    Output: 31 B

  • Pay to Witness Script Hash (P2WSH) is the corresponding native segwit format to P2SH, making use of a witness program moderately than a redeemscript. P2WSH addresses are encoded with bech32 moderately than base58, solely up to date purchasers can ship to them.
    Input¹: variable (2-of-3: 105 vBytes)
    Output: 43 B

  • Pay to Taproot (P2TR) is a local segwit format that mixes traits of P2PK with P2WSH capabilities. It’s also the primary output sort to utilize Schnorr signatures. The outputs include a model 1 witness program, and addresses are encoded with bech32m which differs from bech32 within the checksum solely. Outputs might be spent both through the keypath, which is akin to P2PK in that solely a signature is required, or through the script path the place a department of the taptree is revealed and the leaf script is glad in an identical manners as with P2WSH.
    Enter: variable (keypath: 57.5 vB, scriptpath 2-of-3²: 82.75 vB–115.5 vB)
    Output: 43 B

  • Null Information (OP_RETURN) transactions are allowed to have a single output that writes as much as 83 bytes of knowledge to the blockchain.
    Enter: N/A
    Output: x ≤ 83 + 11(?) bytes

  • Non-standard transactions embody some other transactions that do not match one of many above template. Non-standard transactions is not going to be relayed by most nodes within the community.

Moreover, transaction overhead provides 10 bytes for non-segwit transactions and 10.5 vbytes for segwit transactons (for numInputs, numOutputs < 256).

  overhead = model + numInputs + numOutputs + nLocktime = 4 + 1 + 1 + 4 = 10 bytes 
  segwit overhead = model + numInputs + numOutputs + nLocktime + marker + flag = 16 + 4 + 4 + 16 + 1 + 1 [weight units] = 42 weight items = 10.5 vbytes

If non-segwit and segwit inputs are blended, the load of non-segwit inputs is elevated by 1 WU for the empty witness stack that’s added.


¹Note that because of the formatting chosen to symbolize ECDSA signatures in Bitcoin, they’ve variable dimension as much as 72 bytes with most being 71 bytes or 72 bytes. The given figures above symbolize the utmost dimension of the enter scripts.

²2-of-3 scriptpath spends have variable enter weights relying on whether or not a MuSig development is used, there’s a single leaf with a 2-of-3 development, or three 2-of-2 leafs at totally different depths within the tree. See e.g. https://bitcoin.stackexchange.com/a/96018/5406.


Lots of the above codecs could produce variable enter and output sizes.
Typically, the typical transaction dimension has been 514 bytes previously week. I think that this quantity could also be absolute transaction information dimension and never digital dimension, sadly blockchain information suppliers are nonetheless lagging behind on correctly assessing segwit transactions.

p2sh.data collects numerous statistics on varied transaction codecs, however so far as I can inform sadly not the variety of transactions utilizing the respective codecs in every block.

transactionfee.data has numerous statistics concerning transactions together with use of output sorts and transaction dimension.


All dimension information is supplied on a best-effort foundation, corrections welcome. Figures with “(?)”, I’ve been unable to corroborate. H/T to Pieter Wuille, Alex Bosworth, Raghav Sood, Sergi Delgado for corrections.

LEAVE A REPLY

Please enter your comment!
Please enter your name here