I am working with watching wallet and Offline wallet using bitcoinj, I created Watching Wallet using tpub key of Offline Wallet
I am receiving payment on watching wallet Fine, now I want to spend coins from watching wallet after Signing my transaction from offline wallet
But my wallet balance is 60.00123389 BTC , its not spendable balance as my watching wallet shows
Wallet containing 0.23389 BTC (spendable: 0.00 BTC)
This is not spendable because we cannot spend coins from watching wallet unless you sign it with the corresponding private key
Below is my code: As i am trying to sign transaction from my offline wallet, so i can spend coins from watching wallet
private void bla()
{
Coin coin = Coin.parseCoin("0.01");
Address address = Address.fromBase58(params, "n4oLPFUGvohSdDxvJS3amXvfE1GEdZBddd");
Transaction tx = new Transaction(params);
System.out.println("Raw TX: " + tx.toString());
byte[] bytes = Script.createInputScript("5ff01d61e67c706cb79653aa1e7ad2c7254b841167e0a34055504c35c7240469".getBytes()); // tx hash
TransactionInput input = newnull;
TransactionInput List<Transaction> list = kit.wallet(params,).getTransactionsByTime();
null, bytes for(Transaction t: list)
{
input = t.getInput(0);
}
//Creates a scriptPubKey that encodes payment to the given address.
Script scriptPubKey = ScriptBuilder.createOutputScript(address);
// Signature Script
Script scriptSig = input.getScriptSig();
// Adding output that involves Amount and Script
tx.addOutput(coin, scriptPubKey);
System.out.println("Script pub key: " + scriptPubKey);
//Adding input to the raw transaction
tx.addInput(Sha256Hash.wrap(tx.getHashAsString()), 0, scriptSiginput);
System.out.println("After adding inputs: " + tx.toString());
}