What is the formula for calculating the private key? I want the equation in detail to try to solve it on cocalc

I want an equation to extract the private key from two different addresses I have tried K ((z1 * s2 - z2 * s1) / (r * (s1-s2))) And it didn't work

These are the data for the transactions

tx/ 952730ab31f6e9949343bc186484f95168fa6842489e89b5b48500c54818c683


"sigR": "6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b", "sigS": "7b4bde105608e96da63b54288a5dae961fc074008f4fc9c79d4e486fb9d4bc0b", "sigZ": "c49cc0d0ef2a72386e63d28a319e58dc0258dacedf9f7858619a615bb20cd8f6", "pubKey": "02a0d204d69210b21d79c60b506b27259c314f0c64ea24d419696722ea285db1f1",

tx/ cf7a5114e0036d98c531538885b4c906a47d74a615721d620b3c53d4f7c43856


"sigR": "6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b", "sigS": "78f05c60ebd2befb89a62e438c17ace056d6a450de5c6b1a3eff8fb5080928c5", "sigZ": "3d9f9cf2b32fac5966773e0f1697f1601218c72c1a908cf11278b30da2b6a0ed", "pubKey": "0482ba73f4c09accb62b982ab2b29848a292e3380e062c03c03a5880a918f937ea28f2b7da09deb91c2358414ffd31f8daacc60a5e2f9cafb8b9d212f8a888c7e8", "N": 0 }

1 Answer 1


If the same private key is used to sign different data with the same R (or equivalently k), the private key can be extracted. Since the transactions you linked have inputs from different addresses, there's no one private key that you can extract.

However, if you know the k value that caused this R value, which you would if you're the creator of at least one of these transactions, you should be able to extract the private key of the other by using the same method but skipping the derivation of k steps.

  • I don't understand yet, can you write the equation to include it in the cocalc.com program
    – hisham yem
    Mar 2, 2021 at 14:37
  • 2
    @hishamyem: Reusing the same "r" value is only unsafe if you reuse the same private key. For different private keys, you cannot learn anything unless you knew "r" in the first place.
    – Murch
    Mar 2, 2021 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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