How to sign a transaction using BitcoinJ

How to sign a transaction using BitcoinJ

Manage alerts

Loading saved threads...

Firass Obaid · External communityPost link
External question — Bitcoin Stack Exchange Author: Firass Obaid Original post: https://bitcoin.stackexchange.com/questions/37166 License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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 ?
Quote
Report
Timur Panzhiev · External communityPost link
External answer — Bitcoin Stack Exchange Author: Timur Panzhiev Original post: https://bitcoin.stackexchange.com/a/62680 License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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);
Quote
Report
Carlos Benini · External communityPost link
External answer — Bitcoin Stack Exchange Author: Carlos Benini Original post: https://bitcoin.stackexchange.com/a/119603 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Start by creating a Java project and adding the BitcoinJ library to your project's dependencies. You can download the BitcoinJ library from the official GitHub repository or use a build tool like Maven or Gradle to include it in your project
Quote
Report

Post Reply

Checking account access…