Transaction size & weight calculation tooling

Transaction size & weight calculation tooling
From: Jameson Lopp @ 2020-05-27 18:52 UTC ( / )
  To: Bitcoin Dev



Hi all,

Anyone who has built a Bitcoin wallet / service has to deal with a variety
of challenges when it comes to transaction construction. One of these
challenges is around determining an appropriate fee; aside from block space
market volatility and the inherent problems of forecasting the future, you
need to know how much block space for which your transaction needs to "bid."

Every time I've run into the problem of calculating the size of a
transaction with specific attributes I've ended up having to sift through
answers scatter across stack overflow posts, so I finally got around to
building a user friendly tool at
https://jlopp.github.io/bitcoin-transaction-size-calculator/

As I was looking for more data on constants to use in the calculation I was
informed that the folks at Bitcoin Optech have also been working on a
calculator: https://bitcoinops.org/en/tools/calc-size

It seems clear that this is a common problem for which we could use better
tooling. I'm also about 99% certain that there's at least 1 or 2 bugs in my
current calculator code.

Please bookmark and share these tools; if you're capable and so inclined,
code reviews would be greatly appreciated!

- Jameson