3

I am creating a wallet app using the bitcoinj library. I have a use-case where I need to send bitcoins to multiple recipients in one transaction. Currently, I am creating multiple send requests for each address but only first send request is successful and rest of the requests failed and give me following error:

Exception in thread "AWT-EventQueue-0" org.bitcoinj.core.Wallet$DustySendRequested
   at org.bitcoinj.core.Wallet.completeTx(Wallet.java:3646)
   at org.bitcoinj.core.Wallet.sendCoinsOffline(Wallet.java:3471)
   at org.bitcoinj.core.Wallet.sendCoins(Wallet.java:3536)
   at org.bitcoinj.core.Wallet.sendCoins(Wallet.java:3506)....

Please help me to sort this out. I would be very thankful.

1

Try this. You can add several outputs to a transaction

 SendRequest req;
 Transaction transaction = null;

transaction = new Transaction(this.activity.getNetWorkParameters());
        transaction.addOutput(coin1,address1);
        transaction.addOutput(coin2,address2);
        req = SendRequest.forTx(transaction);

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.