bitcoinjs / coinselect

An unspent transaction output (UTXO) selection module for bitcoin.
MIT License
180 stars 101 forks source link

What is the best way to handle user selection of virtual bytes in coinselect? #56

Closed CodeForcer closed 4 years ago

CodeForcer commented 4 years ago

For users wallets I want to allow them to choose a desired satoshi/vB level, depending on how fast they wish to have their transactions confirmed.

However, I see that coinselect only uses feeRate in satoshi/byte, which is an independent metric.

What's the best practices for performing coin-selection with desired satoshi/vB? Should I just use an arbitrary feeRate (1 or 0 perhaps), and then make adjustments myself to the change address value afterwards?

Thanks

junderw commented 4 years ago

virtual bytes is a construct dealing with segwit.

as of current this library does not support segwit inputs. (Though it does support segwit outputs)

So from this library's perspective vBytes === bytes.

If you are not using segwit inputs at all, vBytes will always equal bytes.

Segwit support is definitely needed. But no one has gotten around to it.

Pull requests are welcome. (I think someone is working on a PR related to segwit right now)