# What is the formula for calculating the private key? resued R value

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

01000000013cc593a1e73b9c7b5aa30e2ae1ae5ab31301b7a789ce43575c9f859513f85a800100000068453042021e6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b02207b4bde105608e96da63b54288a5dae961fc074008f4fc9c79d4e486fb9d4bc0b012102a0d204d69210b21d79c60b506b27259c314f0c64ea24d419696722ea285db1f1ffffffff0103621700000000001976a91428dc4730af1538b45ee1f0e3df7a9c9f31b000a388ac00000000

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

tx/ cf7a5114e0036d98c531538885b4c906a47d74a615721d620b3c53d4f7c43856

0100000001ed11d775420022c79e7d17ae587242dcc3a1a679f64b27451712b990bdc84a720400000088453042021e6fcf15e8d272d1a995af6fcc9d6c0c2f4c0b6b0525142e8af866dd8dad4b022078f05c60ebd2befb89a62e438c17ace056d6a450de5c6b1a3eff8fb5080928c501410482ba73f4c09accb62b982ab2b29848a292e3380e062c03c03a5880a918f937ea28f2b7da09deb91c2358414ffd31f8daacc60a5e2f9cafb8b9d212f8a888c7e8ffffffff0129060000000000001976a91428dc4730af1538b45ee1f0e3df7a9c9f31b000a388ac00000000

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

## 1 Answer

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 Mar 2, 2021 at 14:37
• @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