Title: same-r-value-is-used-for-two-different-addresses Post by: abadon666999 on October 31, 2022, 09:54:26 AM hi all
i have 2 addresses that have same R value address 1 same R address 2 same R i know R i know S1 and S2 i know M signed message or Z M1 and M2 When a signing secret was used to sign two different messages, you can recover the signing secret with this calculation: k = (m1-m2)/(s1-s2) the problem is that i can recover only privatekey of 1 address i have need of recover privatekey address 2 what is correct formula for recover the privatekey of address 1 and address 2 that have same R used in 2 different address? thanks for your help Title: Re: same-r-value-is-used-for-two-different-addresses Post by: ecdsa123 on October 31, 2022, 10:34:53 AM simply you can't according algebra.
you have in math something like: r1,s1,z1 of addres1 and r1,s2,z2 of addres2 and you have equation: a*addres1 = b*addres2 so: addres1 = b*addres2/a addres2 = a*addres1/b addres1-addres2 = b*addres2/a - a*addres1/b after computional of this equation in this example you have b*s1/a=a*s2/b -> is the same - when you make perdorm calc -> you have zero. but there can be chance if and only if linear distance beetween addres 1 and adress 2 is less than 127 bit. Title: Re: same-r-value-is-used-for-two-different-addresses Post by: o_e_l_e_o on October 31, 2022, 10:38:25 AM i have 2 addresses that have same R value I assume by this you mean you have two transactions which are sending coins from two different addresses but use the same r value.The answer in that case is you cannot recover the private keys. To do this you need at least two transactions which are using the same private key and reuse the same r value. You cannot use two transactions with different private keys but the same r value. Title: Re: same-r-value-is-used-for-two-different-addresses Post by: abadon666999 on October 31, 2022, 10:42:51 AM i have 2 addresses that have same R value I assume by this you mean you have two transactions which are sending coins from two different addresses but use the same r value.The answer in that case is you cannot recover the private keys. To do this you need at least two transactions which are using the same private key and reuse the same r value. You cannot use two transactions with different private keys but the same r value. yes correct i have recovered privatekey address 1 but i can't recover privatekey address 2... m1 scalar:0x...................... m2 scalar:0x...................... r scalar:0x....................... s1 scalar:0x...................... s2 scalar:0x....................... k scalar:0x....................... x1 scalar:0x = to x2 x2 scalar:0x = to x1 i have checked this old post https://bitcoin.stackexchange.com/questions/37673/same-r-value-is-used-for-two-different-addresses-finding-z1-and-z2-value-and-pr and have recovered privatekey 1 and privatekey 2 Title: Re: same-r-value-is-used-for-two-different-addresses Post by: o_e_l_e_o on October 31, 2022, 10:49:51 AM yes correct If you have the private key for the first transaction, then you can calculate the k value as follows, where x is the private key:i have recovered privatekey address 1 but i can't recover privatekey address 2... k = (z1 + r1*x1)/s1 Once you know k, which you say is reused in the second transaction, then you can just rearrange the equation above to calculate the private key for the second transaction: x2 = (k*s2 - z2)/r2 Title: Re: same-r-value-is-used-for-two-different-addresses Post by: abadon666999 on October 31, 2022, 11:04:57 AM yes correct If you have the private key for the first transaction, then you can calculate the k value as follows, where x is the private key:i have recovered privatekey address 1 but i can't recover privatekey address 2... k = (z1 + r1*x1)/s1 Once you know k, which you say is reused in the second transaction, then you can just rearrange the equation above to calculate the private key for the second transaction: x2 = (k*s2 - z2)/r2 first of all..thanks for your help i have done equation i have k i have that x1 = x2 than i have only privatekey address 1 it's very strange Title: Re: same-r-value-is-used-for-two-different-addresses Post by: o_e_l_e_o on October 31, 2022, 11:28:10 AM -snip- Are you sure you are using the correct s and z in the second equation? You say you have k, and you should only have one r value if k is being reused, so it should simply be a case of taking s2 and z2 and using them to calculate the second private key.Title: Re: same-r-value-is-used-for-two-different-addresses Post by: abadon666999 on October 31, 2022, 02:23:50 PM -snip- Are you sure you are using the correct s and z in the second equation? You say you have k, and you should only have one r value if k is being reused, so it should simply be a case of taking s2 and z2 and using them to calculate the second private key.strange...no error Title: Re: same-r-value-is-used-for-two-different-addresses Post by: stanner.austin on November 09, 2022, 08:58:21 AM @abadon666999
Hello You can use second message sign/message for already discovered K to break X. x = (s*k-m)/r To recover second message private key use this one more user friendly. https://github.com/nlitsme/bitcoinexplainer Title: Re: same-r-value-is-used-for-two-different-addresses Post by: NotATether on November 10, 2022, 03:58:26 AM You can use second message sign/message for already discovered K to break X. x = (s*k-m)/r If you already have the nonce then you don't need the second transaction... assuming it was created with the same nonce then you can simply compute the signed transaction again with the private key. Title: Re: same-r-value-is-used-for-two-different-addresses Post by: stanner.austin on November 10, 2022, 12:33:57 PM @NotATether
Hello OP ask question how can he recover second address private key if he have same R of first one. If he have private key of first, it won't work on second because its not same as second public key. He already mention about 2 different address, so his question is 2 private key using same R= (K*G) How to discover private key of second one. My answer is correct & i already tested before posting. Title: Re: same-r-value-is-used-for-two-different-addresses Post by: NotATether on November 10, 2022, 06:28:24 PM @NotATether Hello OP ask question how can he recover second address private key if he have same R of first one. If he have private key of first, it won't work on second because its not same as second public key. He already mention about 2 different address, so his question is 2 private key using same R= (K*G) How to discover private key of second one. My answer is correct & i already tested before posting. Alright, just wanted to make sure that anyone coming in to ask about same K values also get accommodated here. Title: Re: same-r-value-is-used-for-two-different-addresses Post by: ecdsa123 on November 10, 2022, 09:59:09 PM @abadon666999 has asked about how to discover two privatekeys when we have two transactions with the same r but with differents pubkeys.
So he didn't inform that he know the first privatekey. So yours "calculation" above are wrong in this case. Of course according "modificate algebra as triangle" can be used for explore this topic. but still it is expensive as power which we need to solve with LLL reduction. Title: Re: same-r-value-is-used-for-two-different-addresses Post by: stanner.austin on November 11, 2022, 10:59:14 AM @ecdsa123
hello May be you did not read full message of him? Here he confirmed about privatekey for 1 address. the problem is that i can recover only privatekey of 1 address Here he ask help about privatekey for 2 address. i have need of recover privatekey address 2 what is correct formula for recover the privatekey of address 1 and address 2 that have same R used in 2 different address? thanks for your help Give me 2 pair of R,S,Z with both have same R let me show you second pair is recovered or not. I don't know what make you think my answer is wrong its not. Title: Re: same-r-value-is-used-for-two-different-addresses Post by: ecdsa123 on November 11, 2022, 11:56:42 AM Code: pubkey1_x = 99849857272418179203502331812772464642887864474228053990188623690904651999129 so what is privatekey1 and privatekey2 or nonce? my algo has tested it and after two weeks I found solutions. This is only prepared for testing purpose. no bitcoins on address:) Title: Re: same-r-value-is-used-for-two-different-addresses Post by: stanner.austin on November 11, 2022, 12:28:50 PM @ecdsa123
You did not understand question still please read again. If you want example from my testing here is it. Code: private Key 1000 for better understanding use this. https://github.com/nlitsme/bitcoinexplainer Title: Re: same-r-value-is-used-for-two-different-addresses Post by: o_e_l_e_o on November 12, 2022, 02:23:44 PM I already explained all this previously in this post: https://bitcointalk.org/index.php?topic=5418919.msg61215046#msg61215046
So he didn't inform that he know the first privatekey. He did:i have recovered privatekey address 1 so what is privatekey1 and privatekey2 or nonce? You are asking the wrong question. OP has said he already knows the private key from the first transaction, and has therefore managed to recover k. As pointed out, with this knowledge of k, s, and z for the second transaction, then the second transaction's private key can be calculated.Title: Re: same-r-value-is-used-for-two-different-addresses Post by: ecdsa123 on December 12, 2022, 04:41:51 PM I have prepared 4 transactions for 2 pubkeys with the same r1 and r2. it is according: ecdsa-revealing-the-private-key-from-four-signed-message-two-keys-and-shared-nonces- link here: https://billatnapier.medium.com/ecdsa-revealing-the-private-key-from-four-signed-message-two-keys-and-shared-nonces-secp256k1-5758f1258b1d (https://billatnapier.medium.com/ecdsa-revealing-the-private-key-from-four-signed-message-two-keys-and-shared-nonces-secp256k1-5758f1258b1d) it should work, but not work. I put transactions, nonces and privatekeys why I can't take value private1 and private2? it give me value 0: please help Code: privkey1= 74151126465914553719682701372546590912032713247110001383204298192577238294259 Title: Re: same-r-value-is-used-for-two-different-addresses Post by: stanner.austin on December 13, 2022, 10:55:15 AM @ecdsa123
Hello If you have 2 R(K*G) for 1 private key it's easy to crack K. Z should not be 0 or 1. if you found your known R in any public transaction you can crack his private key because you know value of R. Link you posted is already using private key 1 then same nonce(K) with 2 transaction which make it weak and easily to recover K. algo (k = (m1-m2)/(s1-s2) ) once you have K you can recover X(Private key it self) Title: Re: same-r-value-is-used-for-two-different-addresses Post by: pooya87 on December 13, 2022, 11:16:38 AM I have prepared 4 transactions for 2 pubkeys with the same r1 and r2. I don't think it is mathematically possible to solve this since you have 2 equations with 3 variables (k, d1, d2). Having two signatures for each key isn't giving us any edge either.Title: Re: same-r-value-is-used-for-two-different-addresses Post by: Minase on December 13, 2022, 01:32:00 PM interesting topic
i have tried the following formula k = (z1 + r1*x1)/s1 but something is quite wrong with my calculations everything is ok with (Z + R*X) but when i do the division with S the result is a very small number. should i do another operation? mod inv? thanks //edit nvm found my error ;D Title: Re: same-r-value-is-used-for-two-different-addresses Post by: whanau on February 15, 2023, 09:26:39 PM i have checked this old post https://bitcoin.stackexchange.com/questions/37673/same-r-value-is-used-for-two-different-addresses-finding-z1-and-z2-value-and-pr and have recovered privatekey 1 and privatekey 2 Please could you explain how you recovered these keys. Like the OP in the link above, I get the same wrong answer. I don't understand where all the extra inputs come from in the diagram (I am no mathematician!). I can see the first 3 items in the diagram relate to the public keys and R values in the OP but where do the rest come from? Thank you |