I am very new to bitcoinj library. I am using 0.14.7 version of bitcoinj and developing my own application in java. I have created a watch-only wallet by using the tPub of the Offline wallet. Upto Receiving payments on watch-only wallet, it is working fine. Now, i have to spend those coins. For that, I have created a transaction and found its transaction Hash.
To sign that transaction Hash with private key, I have followed How to sign raw transaction given a private key and SHA hash (in java) code. and now I am getting the signed hash. Please guide me that how can I use this signed hash to send and broadcast the transaction.?
Your help will be appreciable. Thanks in advance.
The sample code is given below:
// Through this way, I am finding the Transaction Hash. SendRequest request = SendRequest.to(Address.fromBase58(params,externalAddress), Coin.parseCoin(amount)); request.signInputs = false; request.tx.getInputs(); request.missingSigsMode = Wallet.MissingSigsMode.USE_DUMMY_SIG; String hash = request.tx.getHashAsString(); //now using createSignHash method, which is taking transaction hash and signing that with private key and returning the Signed Hex. System.out.println("Signed Hash : " + createSignHash(hash));