3

If all transactions in a block were spending one p2tr output using the key-path spend and sending to a p2tr output, how many of these transactions could we fit in a single block?

1 Answer 1

4

For a transaction spending a single p2tr output via the key-path and creating a single p2tr output, we would construct a transaction with the following fields:

version (4 bytes)
witness marker (1 byte)
witness flag (1 byte)
input count (1 byte)
  inputs (41 bytes)
output count (1 byte)
  outputs (43 bytes)
witness stacks (as many as input count)
  witness item count (1 byte)
  witness items (65 bytes)
locktime (4 bytes)

For more details and to understand how the numbers above were chosen, make sure to read What is the weight of a P2TR input?.

This gives us a raw byte size of: (4 + 1 + 1 + 1 + 41 + 1 + 43 + 1 + 65 + 4) = 162 bytes. However, post-segwit, block limits are no longer measured in bytes but in weight units.

To calculate the weight units for our transaction, recall that each non-witness byte is counted as 4 weight units and each witness byte is counted as one weight unit: (94) x 4 WU + (68) x 1 WU = 444 WU.

With a blockweight limit of 4M WU, we could fit 9,009 of our simple transactions in a single block (4M WUs / 444 WUs per tx = 9,009 txs).

Furthermore, each additional p2tr input adds 230 WU and each additional p2tr output adds 172 WU to the transaction. A more realistic transaction would be a 2-input, 2-output transaction with a total weight of 846 WU (444 + 230 + 172), of which we could fit 4,728 in a single block.

3
  • 1
    Nit: the necessity of having a coinbase transaction with a witness commitment shaves one or two off of your estimate. :)
    – Murch
    Jan 30 at 17:54
  • @Murch good point! IIRC, the block header also counts towards the block weight limit?
    – josie
    Jan 30 at 17:59
  • Oh, yes that too.
    – Murch
    Jan 30 at 18:06

Your Answer

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

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