0

this is the initialization of wallet and block and PeerGroup :

    Wallet wallet = new Wallet(params, KeyChainGroup.createBasic(params));
    BlockChain chain = new BlockChain(params, wallet, new MemoryBlockStore(params));
    PeerGroup peerGroup = new PeerGroup(params, chain);
    peerGroup.addWallet(wallet);
    peerGroup.start();

and this is the transaction code :

    Address targetAddress = Address.fromString(params,"mxRLrEdaPKyts9CvaVhphTLqZe3xpdNJjM");
    Wallet.SendResult result = wallet.sendCoins(peerGroup, targetAddress, 
    Coin.valueOf(100000));
    peerGroup.broadcastTransaction(result.tx);

but when I run the program I've got this error :

Exception in thread "main" org.bitcoinj.core.InsufficientMoneyException: Insufficient money, missing 0.001 BTC
 at org.bitcoinj.wallet.Wallet.calculateFee(Wallet.java:5070)
 at org.bitcoinj.wallet.Wallet.completeTx(Wallet.java:4165)
 at org.bitcoinj.wallet.Wallet.sendCoinsOffline(Wallet.java:3962)
 at org.bitcoinj.wallet.Wallet.sendCoins(Wallet.java:4029)
 at org.bitcoinj.wallet.Wallet.sendCoins(Wallet.java:3998)
 at com.example.blockchainwallet.BitcoinUtils.main(BitcoinUtils.java:30)

Your Answer

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

Browse other questions tagged or ask your own question.