<p>Generally, your wallet software should ensure that you can create and recreate the same or different transactions safely.
However there is one issue that seems related and might have prompted your question.</p>
<p>When someone creates an ECDSA signature, the signature is composed of two integers, <code>r</code> and <code>s</code>. <code>r</code> only depends on a random nonce <code>k</code>, while <code>s</code> depends on the private key, <code>r</code>, and the message. If the same <code>k</code> is reused, it will cause a signature to have the same <code>r</code> value. Usually, your wallet will use a different <code>k</code> for every signature even for the same message, so your signature will be different every time. Some wallets use deterministic nonces, so they'd recreate the same signature for the same message. They will still create a different signature for different messages.</p>
<p>It is important that this <code>k</code> is always picked randomly (unless you're using deterministic nonces): if you sign two different messages (i.e. transactions) with the same private key and the same <code>k</code> value, the two signatures result in a set of equations that can be solved for the private key.</p>

CC BY-SA 4.0
2022-09-05T18:52:36.207Z
2022-09-05T22:35:19.203Z
2022-09-05T22:35:19.203Z
Murch
<p>No, regardless of whether the messages and signatures are the same, it is not possible to calculate the private key from the public information in the blockchain data.</p>
<p>In practise, I believe the signed data in a transaction includes the hash of the previous transaction for each input, these cannot be the same as in any prior confirmed transaction because that would constitute a forbidden double-spend.</p>
<p>I believe cryptographic weaknesses can be quite subtle but the situation you describe, multiple payments of the same amount to the same address, must be quite common. Consequently I'd be very surprised if it had not been anticipated and considered long ago.</p>

CC BY-SA 4.0
2022-09-03T15:53:27.350Z
2022-09-03T16:00:09.357Z
2022-09-03T16:00:09.357Z
RedGrittyBrick
<p>If I send the exact same amount to the same address in two separate transactions, can someone calculate my private key from the scriptSig? Will the signature (S) and the message (Z) be same?</p>

<transactions><private-key><signature>
Can someone calculate my private key if I send the same amount to one address?
jivesh aditya
# Can someone calculate my private key if I send the same amount to one address?

(Asked by: username_0 on 2022-09-03)

If I send the exact same amount to the same address in two separate transactions, can someone calculate my private key from the scriptSig? Will the signature (S) and the message (Z) be same?

**Tags:** transactions, private-key, signature


---

## 2 answers

### Answer by username_1 on 2022-09-05. Score: 3

Generally, your wallet software should ensure that you can create and recreate the same or different transactions safely.
However there is one issue that seems related and might have prompted your question.

When someone creates an ECDSA signature, the signature is composed of two integers, `r` and `s`. `r` only depends on a random nonce `k`, while `s` depends on the private key, `r`, and the message. If the same `k` is reused, it will cause a signature to have the same `r` value. Usually, your wallet will use a different `k` for every signature even for the same message, so your signature will be different every time. Some wallets use deterministic nonces, so they'd recreate the same signature for the same message. They will still create a different signature for different messages.

It is important that this `k` is always picked randomly (unless you're using deterministic nonces): if you sign two different messages (i.e. transactions) with the same private key and the same `k` value, the two signatures result in a set of equations that can be solved for the private key.


---

### Answer by username_2 on 2022-09-03. Score: 1

No, regardless of whether the messages and signatures are the same, it is not possible to calculate the private key from the public information in the blockchain data.

In practise, I believe the signed data in a transaction includes the hash of the previous transaction for each input, these cannot be the same as in any prior confirmed transaction because that would constitute a forbidden double-spend.

I believe cryptographic weaknesses can be quite subtle but the situation you describe, multiple payments of the same amount to the same address, must be quite common. Consequently I'd be very surprised if it had not been anticipated and considered long ago.


---

