msigner is an open source Bitcoin Ordinals Partially Signed Bitcoin Transactions (PSBT) signer library. It supports atomic swap of the inscription and provides a simple and secure way to structure Bitcoin transactions for marketplaces.
Apache License 2.0
229
stars
76
forks
source link
Enhancement proposal for tx size / network fee estimation #10
Hey @nothing0012 , this is tech partner of Ordyssey.com,
The 2-dummy algorithm proposed by msigner library effectively protects the interests of sellers, buyers and platforms. This has laid a good foundation for the industry's tx security.
But there is an issue for msigner's implementation in the fee estimation part, at present, msigner library uses a method similar to the following to estimate the tx size:
This method makes a rough estimate of the tx size. We hope to propose a more accurate estimation method that traverses the input and output of PSBT, and estimate the tx size according to the input and output types.
We wrote the following TxSizeCalculator class in Ordyssey signer code base (which also based on 2-dummy algorithm). We hope that the TxSizeCalculator can be trans-compiled and moved to msigner library (may do that with a new pull request) to make a more accurate estimate for tx size and network/miner fee paid by buyer.
We compared them. In a typical inscription transaction, the estimated value by msigner will be more than 400vB larger than the actual value. If calculated by 20sat/vB, the user's gas fee will be more spend 8000 sats. This is an example:
Hey @nothing0012 , this is tech partner of Ordyssey.com,
The 2-dummy algorithm proposed by msigner library effectively protects the interests of sellers, buyers and platforms. This has laid a good foundation for the industry's tx security.
But there is an issue for msigner's implementation in the fee estimation part, at present, msigner library uses a method similar to the following to estimate the tx size:
This method makes a rough estimate of the tx size. We hope to propose a more accurate estimation method that traverses the input and output of PSBT, and estimate the tx size according to the input and output types.
We wrote the following
TxSizeCalculator
class in Ordyssey signer code base (which also based on 2-dummy algorithm). We hope that theTxSizeCalculator
can be trans-compiled and moved to msigner library (may do that with a new pull request) to make a more accurate estimate for tx size and network/miner fee paid by buyer.We compared them. In a typical inscription transaction, the estimated value by msigner will be more than 400vB larger than the actual value. If calculated by 20sat/vB, the user's gas fee will be more spend 8000 sats. This is an example:
Welcome any discussion on this topic. Thanks again to @nothing0012 for creation of two-dummy algorithm. Learnt a lot!