jlopp / bitcoin-transaction-size-calculator

A simple web tool for calculating the weight and size of a bitcoin transaction with specific properties
https://jlopp.github.io/bitcoin-transaction-size-calculator/
MIT License
41 stars 8 forks source link

Consider transactions with inputs of different address types #10

Open kyranjamie opened 6 months ago

kyranjamie commented 6 months ago

The implementation here assumes that all the inputs are of the same type, however transactions might be spending inputs from different address types, impacting the size of the tx.

Would be great if this calculator allowed you to specify how many inputs of each payment type, the same way it does for outputs.

tadeubas commented 5 months ago

I know this is possible, but can you elaborate on what real-world scenarios someone would need or want to sign a transaction with inputs of different types?

kyranjamie commented 5 months ago

Sure. Ordinal inscriptions, for example, are by convention on Taproot addresses. Perhaps I want to send an inscription, funding the transaction from some UTXOs lying around on Native Segwit addresses.

Via Leather, apps like MagicEden use PSBTs to construct transactions needed for marketplace functionality. To calculate an accurate fee, we need to consider the input types.