grin-wallet icon indicating copy to clipboard operation
grin-wallet copied to clipboard

Add ability to select outputs for send

Open jseibel-circle opened this issue 4 years ago • 2 comments

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.

jseibel-circle avatar Nov 05 '20 15:11 jseibel-circle

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.

antiochp avatar Nov 05 '20 15:11 antiochp

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.

antiochp avatar Nov 12 '20 19:11 antiochp