What to pass in Transaction Input using Bitcoinj library

What to pass in Transaction Input using Bitcoinj library

URGENT - Need help with setting up Transaction Input and Output objects

Transaction rawTransaction = new Transaction(params);

txnAmount = Coin.valueOf(50000000);

rawTransaction.addOutput(txnAmount, toAddress);

txFee = Coin.valueOf(12800);

amountToReturn = balance.subtract(txnAmount);

amountToReturn = amountToReturn.subtract(txFee);

rawTransaction.addOutput(amountToReturn, fromAddress);

I am able to setup transaction outputs but not able to figure out how to set transaction inputs for fee

Currently with above code the signed transaction is having 0 fee

https://ift.tt/2RdQoBf

Comments

Popular posts from this blog

Need help to recover blpckchain.info wallet, my wife forgot her password and the brute force with btcrecover is not catching the password

When downloading the blockchain my application is become unusable, is there an issue with my code or am I using the BitcoinJ library incorrectly?

Mistakenly sent BTC from my personal wallet back to one of the exchange wallet addresses that I had received BTC from before - help recovering!