1

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?

2 Answers 2

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.