Skip to main content
27 votes

Is there a difference between bytes and virtual bytes (vbytes)?

Yes, bytes and vbytes are referring to two different metrics: size and virtual size (vsize). The size in [bytes] of a transaction refers to the raw byte length of its serialized format. It is used to ...
Murch's user avatar
  • 76k
26 votes

How to calculate transaction size before sending (Legacy Non-Segwit - P2PKH/P2SH)

Here are some calculations based on the Protocol Documentation. A Bitcoin Transaction is composed of the following: Version (4 Bytes) TxIn Count (1 ~ 9B) For each TxIn: Outpoint (36B) Script Length ...
rny's user avatar
  • 2,428
22 votes
Accepted

How do virtual size, stripped size and raw size compare between legacy address formats and native segwit?

Segwit introduced a new limit for blocks, the blockweight limit, superseding the previous blocksize limit. Under the segwit rules, witness data is counted at a lower weighting than non-witness data ...
Murch's user avatar
  • 76k
19 votes
Accepted

How does SegWit reduce transaction size, when the signature is simply moved to another part of the transaction?

TL;DR: SegWit does not reduce the transaction size, if you're referring to the raw byte length of transactions. Instead it introduces block weight as a new metric that does not directly correspond to ...
Murch's user avatar
  • 76k
18 votes
Accepted

How is the size of a bitcoin transaction calculated

Since the activation of Segwit, transaction size is expressed in Weight Units (WU). Weight Units can be converted to a "virtual size" or virtual bytes (vB) by dividing by 4 and rounding up. The ...
Septem151's user avatar
  • 667
15 votes

What is the size of different Bitcoin transaction types?

There are a number of different address formats and other standard transaction types: Pay to Public Key (P2PK) outputs tie payments directly to the public key of the recipient instead of the derived ...
Murch's user avatar
  • 76k
11 votes
Accepted

How big is the input of a P2PKH transaction?

The first number does not include the prevout, sequence number, or the length byte for the scriptSig. It also uses 65 bytes for the public key (which is correct if it is uncompressed, but compressed ...
Pieter Wuille's user avatar
11 votes
Accepted

Is there an economic incentive to switch from P2WPKH to P2TR?

Facts A P2WPKH input weighs 68 vB (assuming the worst-case with a high-r signature, -0.25 vB with a low-r signature) and a P2WPKH output weighs 31 vB for a total of 99 vB. A P2TR input weighs 57.5 vB ...
Murch's user avatar
  • 76k
10 votes

Is there a difference between bytes and virtual bytes (vbytes)?

For non-segwit transactions, vbytes = bytes. With the implementation of SegWit, we now see the weight of the block/transactions rather than seeing the absolute size on the wire. While calculating the ...
Ugam Kamat's user avatar
  • 7,417
10 votes
Accepted

What are the minimum sizes for transactions and blocks in Bitcoin?

There is no minimum size restraint on blocks and transactions. However, due to the nature of blocks and transactions, there is a practical minimum. The smallest transaction I can think of is 61 bytes....
Ava Chow's user avatar
  • 70.9k
8 votes
Accepted

What is signature grinding?

The serialization format used for ECDSA signatures requires 33 bytes to encode an r-value that falls into the higher half of the range, but only 32 bytes to encode one falling into the lower half of ...
Murch's user avatar
  • 76k
8 votes
Accepted

When is OP_RETURN cheaper than OP_FALSE OP_IF?

TL;DR: OP_RETURN is cheaper for data smaller than 143 bytes. The overhead of an OP_RETURN output is at least 11 bytes: amount (8 bytes) compact size of script (at least 1 byte) script: OP_RETURN ...
Vojtěch Strnad's user avatar
7 votes
Accepted

Why does BIP141 define both virtual transaction size and weight?

The transaction limit under segwit is derived solely from the transaction weight and the block weight limit of 4,000,000 weight units. Virtual transaction size was not used for the limit calculation ...
Murch's user avatar
  • 76k
7 votes

What is the maximum number of inputs/outputs a transaction can have?

These numbers are slightly different today after the segwit and taproot softforks got activated. A standard transaction is limited to 400 000 weight units (WU). The smallest standard (single-sig ...
Murch's user avatar
  • 76k
7 votes
Accepted

What are the sizes of single-sig and 2-of-3 multisig taproot inputs?

Taproot generally has two ways of spending. The default way is to spend the output using the key path: pay-to-taproot then behaves like a p2pk output except that it is using a schnorr signature and ...
Murch's user avatar
  • 76k
6 votes
Accepted

What happens if "transaction size" is larger than "maximum block size"?

what happens if size of a transaction is larger than maximum block size? Then the transaction can never be included in a block. There is no mechanism for dividing it up into multiple blocks, or ...
chytrik's user avatar
  • 18.3k
6 votes
Accepted

What is the size and weight of a P2WPKH input?

TL;DR: A P2WPKH input should be conservatively estimated with 68.0 vbytes. Standard P2WPKH inputs generally weigh 67.75 or 68.0 vbytes, depending on whether the r-value in the signature is low or high....
Murch's user avatar
  • 76k
6 votes
Accepted

How much blockspace would it take to spend the complete UTXO set?

TL;DR: Spending the whole UTXO set would take the blockspace of about 11 500 blocks. What follows is some very rough napkin math that is almost certainly off by a few percent points. I've roughly ...
Murch's user avatar
  • 76k
6 votes
Accepted

What is the maximum size transaction that will be relayed by bitcoin nodes using the default configuration?

Bitcoin Core's standardness rules limit transactions to 100000 vbytes (or 400000 WU). Larger transactions are not relayed or added to mempools. Since they are consensus-valid, they are obviously ...
Pieter Wuille's user avatar
5 votes
Accepted

Benefits of Bech32 addresses?

Native P2WPKH Unspent outputs save 23 bytes as their ScriptSigs are empty instead of 0x0014{20-byte-key-hash}. 2) Yes, there's already a checksum of the same length. The newer checksum algorithm is ...
MCCCS's user avatar
  • 10.2k
5 votes

How does SegWit reduce transaction size, when the signature is simply moved to another part of the transaction?

segwit IS a block size limit increase. No magic. The segwit mechanism enforces a limit on a weighted data size calculated by counting the non-sig part of a transaction as base data (weight=4) and to ...
harrym's user avatar
  • 190
5 votes

What happens if "transaction size" is larger than "maximum block size"?

Nick Odell answers the original question: The maximum transaction size is the size of the block. Source. and Transactions larger than 100 kilobytes (including witness at a 75% discount rate) ...
Rene Pickhardt's user avatar
5 votes
Accepted

Is it possible for the `size` and `vsize` to be the same for a valid segwit (bech32) transaction?

With segwit outputs, yes. Segwit outputs do not have a witness that could get discounted. With segwit inputs, in theory possibly, but in practice no. Every standard segwit input today has a non-empty ...
Pieter Wuille's user avatar
5 votes
Accepted

How to accurately calculate the vsize of a transaction?

It is not possible to calculate the size, weight, or vsize, purely from the JSON decoding of the transaction as the JSON decoding does not output the hex values of various counters, as well as the ...
Ava Chow's user avatar
  • 70.9k
5 votes
Accepted

What's cheaper, musig or multisig?

I assume that you are asking about MuSig being used to aggregate the participants' public keys and an input that spends directly using the aggregate pubkey in a keypath spend. In that case, the on-...
Murch's user avatar
  • 76k
5 votes
Accepted

What is considered witness data in SegWit?

This is defined in BIP141, section "Block size": Blocks are currently limited to 1,000,000 bytes (1MB) total size. We change this restriction as follows: Block weight is defined as Base ...
Vojtěch Strnad's user avatar
4 votes
Accepted

On chain cost of Segwit version 1 versus version 0

In general, Segwit v1 is cheaper than segwit v0 to spend but slightly more expensive to create. Segwit v1 output scripts as defined by the proposed taproot BIP will always be 35 bytes in length. ...
Ava Chow's user avatar
  • 70.9k
4 votes
Accepted

How to calculate the size of multisig transaction?

Let's re-write and calculate from scratch as the calculations that you have posted might not be self-explanatory in itself and some of them are not entirely accurate. From the question, I presume you ...
Ugam Kamat's user avatar
  • 7,417
4 votes
Accepted

UTXO Model and Trans Fee / Kb Clarification

does my wallet remember that these 2 btc came from separate UTXO's? Or does it "get melted" as someone alluded to in my first link. More precisely, if I send these 2 btc to Gerald, will it ...
Pieter Wuille's user avatar
4 votes
Accepted

What is the maximum number of taproot transactions that can be mined in a single block?

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)...
josie's user avatar
  • 681

Only top scored, non community-wiki answers of a minimum length are eligible