Open ShookLyngs opened 1 month ago
If an address holds normal BTC UTXOs, RGBPP UTXOs and dust UTXOs, we should only transfer the normal BTC UTXOs and exclude the others. In this case, the sendBtc
API is not suitable and we might wanna implement a new API for it.
Ideally, we can fetch the Utxo[]
list of the address, and then add all BTC UTXOs to the transaction inputs, while doing this, we should also calculate the total value of the inputs. And then, we can generate an output in the transaction that it contains all the value of the transaction inputs.
The current logic supports:
By setting the output with fixed: false
and protected: true
should prevent a redundant change output.
In the current implementation of the btc lib, all imbalanced transactions without non-fixed outputs, should generate a change output. This means that if there are satoshi left in the inputs, they should be returned as a change output. This can be inappropriate in some scenarios, for example, when a user wants to transfer the entire balance to another address, a change output is redundant.
Overall, the feature has two key points to be resolved:
Related Issues