How one can signal a transaction utilizing BitcoinJ


Good day. You shoud have checklist of unspent outputs, for including them into inputs of your tx. Additionally you must generate non-public keys and use particular privKey for each enter you could have.

Attempt 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);

Supply hyperlink

Leave a reply