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 ...
user avatar
  • 2,378
19 votes

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

Yes, they 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 measure the ...
user avatar
  • 62.3k
19 votes
Accepted

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

Let's compare a 2-input and 2-output transaction for single-sig output types. I'll refer to the byte length of the transaction as "raw size" , the transaction without its witness data as &...
user avatar
  • 62.3k
13 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 ...
user avatar
  • 62.3k
12 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 ...
user avatar
  • 552
9 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....
user avatar
  • 60.4k
9 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 ...
user avatar
8 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 ...
user avatar
  • 6,898
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 ...
user avatar
  • 62.3k
6 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 ...
user avatar
  • 62.3k
5 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....
user avatar
  • 62.3k
5 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 ...
user avatar
  • 17.2k
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 ...
user avatar
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 ...
user avatar
  • 6,898
4 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) ...
user avatar
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 ...
user avatar
3 votes
Accepted

Can larger transactions have a lesser fee per byte than smaller ones and still get equally treated?

No. There is no unit price discount for making larger transactions. Such transactions consume similar resources to multiple transactions which sum to the same size. They consume the same amount of ...
user avatar
  • 60.4k
3 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. ...
user avatar
  • 60.4k
2 votes
Accepted

What is the maximum size for SegWit transactions?

The standardness limit in all recent Bitcoin Core versions with SegWit support is 400000 weight.
user avatar
2 votes

What is the absolute smallest size of the data (bytes) that a blockchain transaction could possibly be?

Depends on the number of inputs, the types of scripts the inputs are redeeming, the number of outputs, and the type of scripts that the ouputs are paying to. The absolute minimum for a transaction ...
user avatar
  • 1,794
2 votes

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

I compared to the following 9 types of transaction's weight. And then I found that No9 (P2WPKH => P2WPKH) was the lightest. Transaction patterns // 1 transaction consists of 1 txin and 1 txout 1. (...
user avatar
  • 1,815
2 votes

regarding transaction size in a block

What about the second one ? That can be 61 bytes long ? Yes. Also, does each transaction carry a counter ? No. There is a global counter in the block that is right after the block header. That ...
user avatar
  • 60.4k
2 votes
Accepted

Understand how transaction size and fees calculation works in caravan

The fee rate is pulled here: export function fetchFeeEstimate(network, client) { if (client.type === BLOCK_EXPLORER) { return blockExplorerGetFeeEstimate(network); } return ...
user avatar
  • 36
2 votes

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 ...
user avatar
  • 60.4k
2 votes

UTXO Model and Trans Fee / Kb Clarification

Once this transaction is processed, 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 ...
user avatar
2 votes
Accepted

Most transactions in a block

Is this the highest number of transactions in a block until now? The highest number of transactions in a block is 12239 in block 00000000000000001080e6de32add416cd6cda29f35ec9bce694fea4b964c7be at ...
user avatar
  • 60.4k
2 votes
Accepted

What size does a transaction have?

The size of a transaction depends on the numbers of inputs and outputs it contains. Although many transactions might have one input and two outputs, some transactions can have hundreds of inputs and/...
user avatar
2 votes

What is the size and weight of a wrapped segwit single-sig input?

TL;DR: A P2SH-P2WPKH input should be conservatively estimated with 91.0 vbytes. Standard P2SH-P2WPKH inputs generally weigh 90.75 or 91.0 vbytes, depending on whether the r-value in the signature is ...
user avatar
  • 62.3k
1 vote

Coinbase transaction smaller than .001 btc? & Blockchain says my Bitcoincore wallet is invalid

Also, my blockchain wallet says that my bitcoincore wallet receiving qr code is an "Invalid Bitcoin address: " Why? It might be that your Blockchain.com wallet doesn't yet support the ...
user avatar
1 vote

Understand how transaction size and fees calculation works in caravan

Generally, the vsize and weight of transactions is determined by counting the byte length of the serialized transaction, and by weighting the different parts of the transactions according to the rules ...
user avatar
  • 62.3k

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