Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: dkbit98 on February 06, 2021, 11:35:37 AM



Title: Bitcoin Transaction Size Calculators
Post by: dkbit98 on February 06, 2021, 11:35:37 AM
I was looking to collect all tools that can calculate Bitcoin Transaction Size and help myself and people to save fees when sending their coins.
It is important to know number of Inputs (number of addresses you are sending from) it is usually one, and number of Outputs (number of receiving addresses) usually two and we are counting change address here.

Pay attention on following Bitcoin address formats:
- P2PKH (Legacy, starting with 1)
- P2SH (starting with 3)
- P2WPKH and P2WSH (Native Segwit, starting with bc1q)
- P2TR (Taproot, starting with bc1p)

I found several websites for this purpose:

1. Jameson Lopp website (https://jlopp.github.io/bitcoin-transaction-size-calculator/) - Supporting all addresses and showing transaction size in raw bytes, virtual bytes and weight units

2. Bitcoin Ops (https://bitcoinops.org/en/tools/calc-size/) - Similar like previous website

3. ByBitcoinWorldwide (https://www.buybitcoinworldwide.com/fee-calculator/) - Showing USD value and not supporting all address formats

4. Coinb.in (https://coinb.in/#fees) - Not supporting all address formats

5. Bitcoindata.science (https://bitcoindata.science/plot-your-transaction-in-mempool.html) - made by our bitcointalk member Bitmover


Title: Re: Bitcoin Transaction Size Calculators
Post by: ranochigo on February 06, 2021, 11:44:12 AM
P2SH does not have to be Segwit, nested Segwit is just a subset of P2SH. It is just an address that has special unlocking scripts, multisig time lock addresses are examples of them. That's also why Jlopp has a parameter for the number of signatures.


Title: Re: Bitcoin Transaction Size Calculators
Post by: bitmover on February 07, 2021, 03:04:11 AM
I was looking to collect all tools that can calculate Bitcoin Transaction Size and help myself and people to save fees when sending their coins.
It is important to know number of Inputs (number of addresses you are sending from) it is usually one, and number of Outputs (number of receiving addresses) usually two and we are counting change address here.


Thanks for sharing!

It is very important to understand how transaction size is calculated.

Specially the total number of inputs and outputs, which are very important and often ignored by new comers.


For example, with 1 input and 2 outputs, and 16 sat/byte you can make a transaction with less than 1 usd:
https://i.imgur.com/IGipovv.png

But when you raise the number of inputs to 10, we get nearly 5 usd! This show us how important it is consolidate our inputs when fees are low!

https://i.imgur.com/BROP2OA.png
Source: https://bitcoindata.science/plot-your-transaction-in-mempool.html


It is also important to note that the segwit reduction grows exponentially when you increase input number. Note that you could sabe 51% when you have 10 inputs when using native segwit.


Title: Re: Bitcoin Transaction Size Calculators
Post by: dansus021 on February 07, 2021, 03:16:16 AM
oh its similar with gas fee on ethereum but its usually calculated by the wallet buy you can still reduce it right


Title: Re: Bitcoin Transaction Size Calculators
Post by: bitmover on February 07, 2021, 01:13:22 PM
oh its similar with gas fee on ethereum but its usually calculated by the wallet buy you can still reduce it right

This is how it works:

Blocks have a limit block size, in bytes (it is actually virtual bytes, but lets keep things simple).

And each transaction has a different size. The more inputs/outputs you have, the bigger the transaction size will be.

You can set how much fee per byte you are going to pay (the fee rate), which is measure in sat/byte (satoshi per byte). Miners will put the transaction with higher fee rate in the block first. When the block is full, transaction which paid higher fee rate will be confirmed and those who paid less will stay in the mempool.

So, how do you reduce total fees???

You can reduce transaction size by using segwit or reducing inputs and outputs

And you can reduce the fee rate, which will reduce the total fees as well, but it will make your transaction get confirmed later on...


Title: Re: Bitcoin Transaction Size Calculators
Post by: tranthidung on February 07, 2021, 03:08:09 PM
So, how do you reduce total fees???

You can reduce transaction size by using segwit or reducing inputs and outputs

And you can reduce the fee rate, which will reduce the total fees as well, but it will make your transaction get confirmed later on...
It is more realistic to make preparation with input reduction. Do it by consolidate a few inputs into one when transaction fee on the network is cheap. Perfectly, consolidations would be made when fee rate is from 1 to 2 satoshi/vbyte. There are chances to do so in weekends, especially Sundays around 1 to 5 AM UTC (see details (https://bitcointalk.org/index.php?topic=5314242.msg56259410#msg56259410)). You might have such chance almost one time every month, excludes very busy month of bitcoin network of course.

It is less realistic to reduce number of outputs.
  • Fees are low, use this opportunity to Consolidate your small inputs! (https://bitcointalk.org/index.php?topic=2848987.0)