Author

Topic: Bitcoinj Anyone know how to do coin control? (Read 1480 times)

legendary
Activity: 1708
Merit: 1066
In your wallet you should have all the Transactions with your spendable outputs.
You can use a CoinSelector to examine any of these to see if their unspent outputs are 'good' for the Transaction you are building. (With good meaning your algorithm)

If you use all of them you'll be able to spend the whole balance, less the fee, but if you start filtering them obviously you'll have a lower total. For instance if you want to 'freeze' an address like in Electrum those outputs would be unavailable for you.

I don't think many people have written custom CoinSelectors yet so you might have some experimentation to get things working..
legendary
Activity: 1708
Merit: 1066
Hi Gweedo,

You can have a custom CoinSelector in the Wallet to only select the transaction outputs you want.
The default one selects unspent confirmed outputs and unspent pending outputs that come from you.

For change you specify a change address - I think from memory there is a getChangeAddress in Wallet (or maybe it is on the SendRequest).
legendary
Activity: 1498
Merit: 1000
It should be a viable input using transaction object. Is their anyway I can do this?
Jump to: