user2075: I am trying to extract the signatures from a transaction. What is the best way to do this given a com.google.bitcoin.core.Transaction object I just received from the network?

user2306: This works for P2PK, and P2PKH, but multisig will not work.
int index = (the index you want);
List<TransactionInput> inputs = Transaction.getInputs()
TransactionInput input = inputs.get(index);
Script scriptSig = input.getScriptSig();
List<ScriptChunk> signature_and_pubkey = scriptSig.getChunks();
ScriptChunk sig_chunk = signature_and_pubkey.get(0);
bytes[] sig_bytes = sig_chunk.data;

If you want a TransactionSignature object instead of raw bytes:
TransactionSignature ts = TransactionSignature.decodeFromBitcoin(sig_bytes, false)


2075: <p>I am trying to extract the signatures from a transaction. What is the best way to do this given a <code>com.google.bitcoin.core.Transaction</code> object I just received from the network?</p>
 2306: <p>This works for P2PK, and P2PKH, but multisig will not work.</p>

<pre><code>int index = (the index you want);
List&lt;TransactionInput&gt; inputs = Transaction.getInputs()
TransactionInput input = inputs.get(index);
Script scriptSig = input.getScriptSig();
List&lt;ScriptChunk&gt; signature_and_pubkey = scriptSig.getChunks();
ScriptChunk sig_chunk = signature_and_pubkey.get(0);
bytes[] sig_bytes = sig_chunk.data;
</code></pre>

<p>If you want a TransactionSignature object instead of raw bytes:</p>

<pre><code>TransactionSignature ts = TransactionSignature.decodeFromBitcoin(sig_bytes, false)
</code></pre>
