Automated transaction-size estimates

Automated transaction-size estimates

Hi all,

I’m currently working on a model to estimate the impact of segwit adoption on transaction throughput. As an intermediary step, I wrote a library to estimate the size of arbitrary transactions. I’m sure some of you might find it useful, so I decided to share it here: [https://github.com/hofm/libtxsize](https://github.com/hofm/libtxsize)

The library comes with a Python and a command-line interface. Playing around with it is as easy as specifying a number of inputs and outputs:

$ ./libtxsize-cli.py -i P2WPKH,P2SH-1-of-2-multisig -o P2PKH,P2TR
+————————-+————+————-+————-+
| Part/Metric | size [B] | weight [WU] | vsize [vB] |
+————————-+————+————-+————-+
| INPUTS | | | |
| 1. P2WPKH | 41 | 164 | 41 |
| 2. P2SH-1-of-2-multisig | 186 | 744 | 186 |
+————————-+————+————-+————-+
| WITNESSES | | | |
| 1. P2WPKH | 107 | 107 | 26.75 |
| 2. P2SH-1-of-2-multisig | N/A | N/A | N/A |
+————————-+————+————-+————-+
| OUTPUTS | | | |
| 1. P2PKH | 34 | 136 | 34 |
| 2. P2TR | 43 | 172 | 43 |
+————————-+————+————-+————-+
| INPUT DATA | 227 | 908 | 227 |
| WITNESS DATA | 108 | 108 | 27.0 |
| OUTPUT DATA | 77 | 308 | 19.25 |
| TRANSACTION OVERHEAD | 12 | 34 | 8.5 |
+————————-+————+————-+————-+
| TRANSACTION TOTAL | 424 | 1366 | 341.5 |
+————————-+————+————-+————-+

In case you’re interested, you can find some background here: [http://zen.science/science/on-bitcoin-transaction-sizes/](http://zen.science/science/on-bitcoin-transaction-sizes/)



View Reddit by the-catoView Source

Leave a Comment

Your email address will not be published. Required fields are marked *