bitcore-lib icon indicating copy to clipboard operation
bitcore-lib copied to clipboard

Transaction fee estimate uses 1KB as smallest tx size

Open Gustav-Simonsson opened this issue 8 years ago • 2 comments

https://github.com/bitpay/bitcore-lib/blob/master/lib/transaction/transaction.js#L917

Math.ceil(size / 1000) returns 1 for transactions with size < 1KB. This will estimate a unnecessary high fee for small txs - average tx size is around 530 bytes these days

Gustav-Simonsson avatar Sep 16 '16 04:09 Gustav-Simonsson

Could use some clarification here regarding how miners calculate the fees, but there may be an 1kb increment.

braydonf avatar Sep 22 '16 14:09 braydonf

Would https://github.com/bitcoin/bitcoin/issues/7633 help in making that decision? Rounding is gone for some time, it seems likely that miners are not considering rounded fees as well. Maybe initially this should be a new parameter, e.g. tx.feePerKb(amount, true) (true being use exact rate, false / undefined being the default as don't use exact rate and round it instead)?

gpip avatar Nov 22 '16 16:11 gpip