Im trying to get the estimation of how much the fees will be when a final
amount is decided on. I would say im getting familiar with bitcoinj but not
completely with java so im still learning how to code and exploring how to
get information.
this is my present code. I put everything inside a method.
public static String SendFund(String amount, String receiver){
String text;
Coin value = Coin.parseCoin(amount);
LegacyAddress to = LegacyAddress.fromBase58(MainPage.params,
receiver);
try {
System.out.println(gbal()+" - "+gaddress());
Wallet.SendResult result = kit.wallet().sendCoins(kit.peerGroup
(), to, value);
text = "<html>"+amount+" BTC sent to address <br/><br/>"+
receiver+".</html>";
System.out.println("Check transaction :
https://testnet.blockchain.info/tx/"+result.tx.getHashAsString());
}catch(InsufficientMoneyException e){
text = "Insufficient Funds.";
}
return text;
}
Currently it doesnt deal with fees. But when i view a transaction such as
this
==>
https://testnet.blockchain.info/tx/194b2a7505a537307abe9443b048bc7ddce6ca0d833d5758c3be3c03a9c7b838
Also when i purposely tried to send coins when i know the wallet doesnt
have enough it doesnt tell me that it failed
0.8625106 - n2uEm2QXqe2PCSsbHTdAJN9aDm2mDjz6iZ
May 02, 2018 5:08:58 PM org.bitcoinj.wallet.Wallet completeTx
INFO: Completing send tx with 1 outputs totalling 1.00 BTC and a fee of
0.001 BTC/kB
What am i doing wrong for failing to check? do i have to actually perform
an if statement just to check? If so how can i calculate reliably on what
the final amount would be?
--
You received this message because you are subscribed to the Google Groups
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.