Transaction type:
Number of inputs:
Number of outputs:


Legend: data field sizes

All sizes in parenthesis in the overhead, input, and output sections are vbytes. Sizes in the common elements section are bytes.

Overhead

  • nVersion (4) The transaction version number

  • Input count (compactSize) The number of inputs included in the transaction. 1 byte for up to 252 inputs

  • Output count (compactSize) The number of outputs included in the transaction. 1 byte for up to 252 outputs

  • nLockTime (4) The earliest epoch time or block height when the transaction may be included in a block

  • Only in transactions spending one or more segwit UTXOs:

    • Segwit marker & segwit flag (0.5) A byte sequence used to clearly differentiate segwit transactions from legacy transactions

Input

  • Outpoint (36) The txid and vout index number of the output (UTXO) being spent

  • scriptSig length (compactSize) The length of the scriptSig field. 1 vbyte for a scriptSig up to 252 vbytes. Maximum of 3 vbytes for a maximum-length scriptSig (10,000 vbytes).

  • scriptSig (varies) The source of witness data for legacy UTXOs. This data is used to prove that the transaction is authorized by someone controlling the appropriate private keys. For the templates used by this calculator, the scriptSigs sizes are:

    • P2PKH (107) OP_PUSH72 <ecdsa_signature> OP_PUSH33 <public_key>

    • P2SH 2-of-3 (254) OP_0 OP_PUSH72 <ecdsa_signature> OP_PUSH72 <ecdsa_signature> OP_PUSHDATA1 105 <OP_2 OP_PUSH33 <pubkey> OP_PUSH33 <pubkey> OP_PUSH33 <pubkey> OP_3 OP_CHECKMULTISIG>

  • nSequence (4) The sequence number for the input. Used by BIP68 and BIP125, with other values having no defined meaning

  • Witness item count (compactSize/4) The number of witness elements. This field is included for each input if the transaction contains at least one segwit input. 0.25 vbytes for up to 252 elements

  • Witness items (varies) The source of witness data in segwit transactions. This data is used to prove that the transaction is authorized by someone controlling the appropriate private keys. Each item is prefixed by a compactsize size() identifier. For the templates used by this calculator, the witness data sizes are:

    • P2WPKH (27)
      • (73) size(72) signature
      • (34) size(33) public_key
    • P2WSH 2-of-3 (63.5)
      • (1) size(0) (empty)
      • (73) size(72) ecdsa_signature
      • (73) size(72) ecdsa_signature
      • (106) size(105) OP_2 OP_PUSH33 <pubkey> OP_PUSH33 <pubkey> OP_PUSH33 <pubkey> OP_3 OP_CHECKMULTISIG
    • P2TR (16.5)
      • (65) size(64) schnorr_signature

Output

  • nValue (8) The amount of bitcoin value being paid

  • scriptPubKey length (compactSize) The length of the scriptPubKey field. 1 vbyte for a script up to 252 vbytes. Maximum of 3 vbytes for a maximum-length script (10,000 vbytes).

  • scriptPubKey (varies) The specification of what conditions need to be fulfilled in order for this output to be spent. For the templates used by this calculator, the scriptPubKeys are:

    • P2PKH (25) OP_DUP OP_HASH160 OP_PUSH20 <public_key_hash> OP_EQUALVERIFY OP_CHECKSIG

    • P2WPKH (22) OP_0 OP_PUSH20 <public_key_hash>

    • P2SH 2-of-3 (23) OP_HASH160 OP_PUSH20 <script_hash> OP_EQUAL

    • P2WSH 2-of-3 (34) OP_0 OP_PUSH32 <script_hash>

    • P2TR (34) OP_1 OP_PUSH32 <schnorr_public_key>

Common elements

The list below indicates the size in bytes of common elements used in the scripts above. When used in a scriptPubKey or a scriptSig, the size in vbytes is the same as the size in bytes. When used as witness data in a segwit input, the size in vbytes is the size in bytes divided by four.

  • OP_* (1)—all current opcodes in Bitcoin are a single byte

  • ecdsa_public_key (33)—old wallets may use 65-byte public keys

  • ecdsa_signature (72) (about half of all signatures generated with a random nonce are this size, about half are one byte smaller, and a small percentage are smaller than that)

  • schnorr_public_key (32)

  • schnorr_signature (64)—may also be one-byte longer for a non-default signature hash (sighash)

  • public_key_hash (20)

  • script_hash (20)—P2SH only

  • script_hash (32)—P2WSH only