I am having problem signing the transaction using BitcoinJ library without the Wallet instance, I only have the Transaction class instance and the ECKey in order to sign the transaction.
Is there a way to implement it ?
Good day. You shoud have list of unspent outputs, for adding them into inputs of your tx. Also you should generate private keys and use special privKey for every input you have.
Try it out:
TransactionOutPoint outPoint = new TransactionOutPoint(params, utxo.getIndex(), utxo.getHash()); byte privKeyBytes = HEX.decode(privKeyAsHex); ECKey ecKey = ECKey.fromPrivate(privKeyBytes); transaction.addSignedInput(outPoint, utxo.getScript(), ecKey, Transaction.SigHash.ALL, true);