Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bumi
Last active May 15, 2016 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bumi/6d58f86e2c88a89bc79107f6e741690a to your computer and use it in GitHub Desktop.
Save bumi/6d58f86e2c88a89bc79107f6e741690a to your computer and use it in GitHub Desktop.
Coin recipientAmount = (total wallet amount) - fees needed / this.recipients.length // if not dividable the rest should be ignored and go to the miners. I don't want change
// create a new transactions with the NetworkParameters
Transaction sendTx = new Transaction(params);
// add the outputs
for(String address : this.recipients){
sendTx.addOutput(recipientAmount, Address.fromBase58(params, address));
}
// create a SendRequest
SendRequest req = SendRequest.forTx(sendTx);
// let the wallet take care of completing and broadcasting the transaction
Wallet.SendResult result = wallet.sendCoins(req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment