0

I have a list of unspent outputs. Let's say: 0.4 BTC, 0.6 BTC and 1.0 BTC. Now I want to create a new transaction for a 0.5 BTC. How I understand it, it would be best to take the 0.6 BTC output as input, and add 0.1 output as change. The simpler way would be to just start at the beginning and add up inputs until I reached the desired amount. But that seems stupid...

How is this being done by the usual bitcoin clients? What's the best way of finding the most optimal unspent outputs?

1

Every client has different selection criteria based on fees, age of the outputs, and other factors that impact the ultimate fee and priority. Normally older outputs are preferred as they incur less fees. You would probably want the 0.6 BTC output as you'd need 0.0001 BTC for the fee, sending 0.9999 to a new change address.

There's ultimately no "proper" method as this is wallet functionality and not core protocol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.