grin-wallet
grin-wallet copied to clipboard
Add ability to select outputs for send
Is your feature request related to a problem? Please describe. When the amount of unspent outputs (UTXOs) in the wallet gets large, the wallet starts to time out and run slowly. If we had the ability to explicitly select outputs, we could keep the total number of UTXOs more strategic and have better logic on how to fund sends to reduce fees.
Describe the solution you'd like
I would like a new flag for the send
command that allowed a list of output commitments. Commitment hash is long but it allows you to be super explicit. It can either be a single flag where you pass string comma-separated or pass the same flag numerous times. Should gracefully handle this even if very high number of selections (over 100). Also update the API.
Describe alternatives you've considered
We are trying to get the existing smallest
selection strategy to work but it is cumbersome. We could also craft our own transaction manually but there is no easy way to sign a raw tx with the private key, we would have to reverse engineer the wallet code.
Totally agree. This effectively exposes the ability to use "custom" selection strategies with external logic.
Ideally this explicit output selection strategy would also bypass the "refresh all outputs" logic and only refresh the relevant subset of outputs.
There is some interesting interaction with "late locking" (see #530) here that I don't think we have considered.
Given how we are thinking about "late locking" we would not actually be selecting the specific outputs during initial transaction creation. We would specify the tx fee which in turn would implicitly constrain the max number of outputs spent by the transaction. And then during finalize we would choose the specific outputs to spend, given the constraints.
i.e. Define a large enough fee on the initial transaction and we can choose 500 outputs to spend during finalize
, assuming they cover the amount being sent. We then create the necessary change output to balance the transaction.
Need to think about this a bit more.