Posts

Showing posts with the label Sign transaction with multiple inputs using bitcoinj/peercoinj libraries

Sign transaction with multiple inputs using bitcoinj/peercoinj libraries

Sign transaction with multiple inputs using bitcoinj/peercoinj libraries Good day for everyone! I have some troubles with adding signed Input to the transaction. Currently, I'm working with altCoin (fork peercoin) currency. I'm trying build the transaction in the following way: for (UTXO utxo : mUTXOs) { if (!done) { utxosValue += utxo.getValue().longValue(); 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); //here is adding outputs .... .... //serialization of the transaction and getting raw transaction byte[] bytesRawTransaction = transaction.peercoinSerialize(); String rawTransaction = HEX.encode(b...