1

In P2PKH the validation script is:

<sig> <pubKey> OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

If I always use exactly the same private key and always sign exactly the same message with it, is my <sig> unique among all my transactions?

Furthermore, if <sig> was always the same for all my transactions, would that mean that everyone who knows my <sig> can impersonate me?

2
  • Related: bitcoin.stackexchange.com/q/100253/5406
    – Murch
    Dec 1 '20 at 5:39
  • well, the message you're signing for each transaction changes, because the message includes the transaction data. all someone could do with your signature of an old transaction is attempt to replay that exact same transaction, which is only really an issue during a fork.
    – ieatpizza
    Dec 2 '20 at 16:47
2

Digital signatures really aren't much alike someone's John Hancock. Digital signatures cryptographically commit to exactly one message and resolve as invalid for any other messages. Unlike someone's three crosses they cannot be lifted from one document to another or easily imitated.

ECDSA's signature algorithm uses two inputs, the private key and the message that the signature commits to. In the case of Bitcoin, the "message" is the Bitcoin transaction you mean to commit to.

The signature is mathematically derived from the message, the private key, and a random component generated during the signing. While producing the signature requires knowledge of the private key, the signature can be validated by anyone who knows the message, the signature, and the corresponding public key. The signature will only ever fit that specific transaction. Any other transaction would require a signature to commit to a different "message", and such a signature could not be produced without knowledge of the private key.

As a transactions spends at least one unspent transaction output (UTXO), and each UTXO is unique¹, the premise of "signing the same message" is in conflict with "same for all my transactions". As each transaction must be unique, signatures do not transfer, even if the transaction spends inputs associated with the same private key. Therefore, yes, every signature is unique.

Furthermore, if <sig> was always the same for all my transactions, would that mean that everyone who knows my <sig> can impersonate me?

No, that's not how signatures work. If your signature was always the same for all transactions, they would not be useful. Such a "signature" would not prove that you committed to something specific and therefore could not be a means of authorizing a payment.


¹ A UTXO are uniquely identifiable by their outpoint which consists of the txid that created it and the output's position in that transaction's output list. txid are the SHA256D digest of the transaction data. This is defacto unique since BIP34 requires Coinbase transactions to include the block height, which therefore by induction means that no transaction can ever consist of the same data.

0

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.