<p>ECDSA signatures are not deterministic unless you are using a deterministic signature scheme. Meaning that signing the same data with the same key produce different (valid) signatures. </p>

<p>I don't know if Bitcoinj uses such a scheme so If only the signature bytes in the transaction are different it is probably  fine.</p>

CC BY-SA 4.0
2018-10-24T13:20:40.857Z
2018-10-24T13:20:40.857Z
Mike D
<p>I don't know if there is an error in the <code>scriptsig</code> generation method of input in P2PSH.</p>

<p>My address is a single signing address with one Private key，
I created a transaction that will generate hex string via Bitcoinj.</p>

<pre><code>script = ScriptBuilder.createOutputScript(key.getAddress(params));
Sha256Hash hashForSign = transaction.hashForSignature(i, script, SigHash.ALL, false);
ECDSASignature signature = eckey.sign(hashForSign);
TransactionSignature tranSign = new TransactionSignature(signature, SigHash.ALL, false);
scriptSig = ScriptBuilder.createInputScript(tranSign, eckey);
</code></pre>

<p>But it is not the same as the hex string generated by the client RPC, but I don't know where it is wrong.</p>

<p>I will be very grateful if you can help me.</p>

<input-script>
i don't know if there is an error in the scriptsig generation method of input in p2psh
guorui an
# i don't know if there is an error in the scriptsig generation method of input in p2psh

(Asked by: username_0 on 2018-10-24)

I don't know if there is an error in the scriptsig generation method of input in P2PSH.
My address is a single signing address with one Private key，
I created a transaction that will generate hex string via Bitcoinj.
script = ScriptBuilder.createOutputScript(key.getAddress(params));
Sha256Hash hashForSign = transaction.hashForSignature(i, script, SigHash.ALL, false);
ECDSASignature signature = eckey.sign(hashForSign);
TransactionSignature tranSign = new TransactionSignature(signature, SigHash.ALL, false);
scriptSig = ScriptBuilder.createInputScript(tranSign, eckey);

But it is not the same as the hex string generated by the client RPC, but I don't know where it is wrong.
I will be very grateful if you can help me.

**Tags:** input-script


---

## 1 answers

### Answer by username_1 on 2018-10-24. Score: 1

ECDSA signatures are not deterministic unless you are using a deterministic signature scheme. Meaning that signing the same data with the same key produce different (valid) signatures.

I don't know if Bitcoinj uses such a scheme so If only the signature bytes in the transaction are different it is probably fine.


---

