Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: bikerleszno on February 08, 2017, 12:32:52 PM



Title: How to calculate size of transaction?
Post by: bikerleszno on February 08, 2017, 12:32:52 PM
Hello,

I know it is very important how big is transaction. I mean size of it. Generally if it comes from 1 to 2 inputs it is about 370 bytes.
Can you tell me is there any way to calculate how big will be transaction ?
We know more inputs, bigger size but we need to know how big fee we need to put.

Is there any way to calculate it ?
What is the maximum inputs transaction you ever saw ?


Title: Re: How to calculate size of transaction?
Post by: mocacinno on February 08, 2017, 12:36:29 PM
Hello,

I know it is very important how big is transaction. I mean size of it. Generally if it comes from 1 to 2 inputs it is about 370 bytes.
Can you tell me is there any way to calculate how big will be transaction ?
We know more inputs, bigger size but we need to know how big fee we need to put.

Is there any way to calculate it ?
What is the maximum inputs transaction you ever saw ?

EDIT: Please read DannyHamilton's post (right beneith this one). Seems like my info is a bit on the old side (you learn something new every day ;) )


You can't really calculate it, but you can make an estimation this way:

in*180 + out*34 + 10 plus or minus 'in'*

* source: http://bitcoin.stackexchange.com/questions/1195/how-to-calculate-transaction-size-before-sending

This is valid for "standard" P2PKH transactions. Offcourse, it's still an estimation.

For example, a transaction with one input and two outputs (one output to the receiver, one output to your change address):

1*180+2*34+10 +/-1 = estimated size between 257 and 259 bytes.
https://bitcoinfees.21.co/ tells us that at time of writing 140 satoshi's per byte will give you a 90% chance of getting into one of the next 3 blocks.
Personally, i don't mind waiting 3 hours, so i'd go for a 61-80 satoshi/byte fee... 259 * 61 =~ a 0.00016 BTC fee would probably be enough if you don't mind waiting for a couple of hours.


Title: Re: How to calculate size of transaction?
Post by: DannyHamilton on February 08, 2017, 12:40:26 PM
you can make an estimation this way:

in*180 + out*34 + 10 plus or minus 'in'*

* source: http://bitcoin.stackexchange.com/questions/1195/how-to-calculate-transaction-size-before-sending

That information is old and no longer accurate.

Most modern wallets and services use compressed key addresses.  If you received the bitcoins at a compressed key address (which you probably did), then each input is between 147 and 149 bytes (not 180).

Outputs are still typically 34 bytes each (there may be a variation of a few bytes if you are not sending to a P2PKH address), and there is still 10 bytes of overhead per transactions.


Title: Re: How to calculate size of transaction?
Post by: bikerleszno on February 08, 2017, 12:48:23 PM
Thank you for info.