# ECDSA: Revealing the private key, from four signed messages, two keys and shared nonces (SECP256k1)

It’s well known that the ECDSA signature (as used in Bitcoin) needs to be carefully created, or the private key can be discovered. The nightmare would thus be to sign a few messages and for Eve to then discover the private key from these. In this case, we will look at the case where Alice has two key pairs and signs four messages with these, and for Eve to discover where private keys.

Alice will have two key pairs [1], and with two private keys (*x_*1 and *x*_2). She will sign message 1 (*m*_1) with the first private key (*x*_1), sign message 2 (*m*_2) with a second private key (*x_*2), sign message 3 (*m_*3) with the first private key (*x*_1) and sign message 4 (*m*_4) with the second private key (*x*_2) The same nonce (*k*_1 is used for messages 1 and 2, and another nonce (*k*_2) is used to sign messages 3 and 4. Now let’s say we have four messages (*m*_1 .. *m)4*) and have hashes of:

The signatures for the messages will then be (*s*1,*r*1), (*s*2,*r*1), (*s*3,*r*2), and (*s*4,*r*2):