krashfire (OP)
Member
Offline
Activity: 119
Merit: 11
Life aint interesting without any cuts and bruises
|
|
January 31, 2023, 05:44:57 AM |
|
Hi, i need help to check my code. import ecdsa
z = int(input("Enter value of z: ")) r = int(input("Enter value of r: ")) k = int(input("Enter value of k: ")) s = int(input("Enter value of s: "))
private_key = (z + (r * k)) / s
print("Private Key =", private_key)
and after giving my inputs, i got this output, Private Key = 2.378864885847563e+77I just wanna make sur. is my formula written correctly? and how do i actually read that answer? i tried googling but i cant get an answer on how do I read it as integer.
|
KRASH
|
|
|
|
witcher_sense
Legendary
Offline
Activity: 2394
Merit: 4372
🔐BitcoinMessage.Tools🔑
|
|
January 31, 2023, 06:31:23 AM |
|
I already have given you a link to a correct formula in your previous thread: What is the formula to calculate private keys if you already have all the R,S,Z(H) K Value? Where d= private_key.
d = (k * s - z) * r -1 mod n Source: https://learnmeabitcoin.com/technical/ecdsa (Why do you need to generate a random point each time? (Mathematical Explanation) Why not just use it instead of inventing your own? Also, your resulting private key shouldn't be a floating point number, which is why it is better to use floor division (//) instead of real division ( / ) that always gives you floats (even when you divide intehers without remainder)
|
|
|
|
krashfire (OP)
Member
Offline
Activity: 119
Merit: 11
Life aint interesting without any cuts and bruises
|
|
January 31, 2023, 06:51:38 AM |
|
thank you garlonicon. I got this answer from ChatGPT... Damn.
|
KRASH
|
|
|
krashfire (OP)
Member
Offline
Activity: 119
Merit: 11
Life aint interesting without any cuts and bruises
|
|
January 31, 2023, 06:52:21 AM |
|
I already have given you a link to a correct formula in your previous thread: What is the formula to calculate private keys if you already have all the R,S,Z(H) K Value? Where d= private_key.
d = (k * s - z) * r -1 mod n Source: https://learnmeabitcoin.com/technical/ecdsa (Why do you need to generate a random point each time? (Mathematical Explanation) Why not just use it instead of inventing your own? Also, your resulting private key shouldn't be a floating point number, which is why it is better to use floor division (//) instead of real division ( / ) that always gives you floats (even when you divide intehers without remainder) I already have given you a link to a correct formula in your previous thread: What is the formula to calculate private keys if you already have all the R,S,Z(H) K Value? Where d= private_key.
d = (k * s - z) * r -1 mod n Source: https://learnmeabitcoin.com/technical/ecdsa (Why do you need to generate a random point each time? (Mathematical Explanation) Why not just use it instead of inventing your own? Also, your resulting private key shouldn't be a floating point number, which is why it is better to use floor division (//) instead of real division ( / ) that always gives you floats (even when you divide intehers without remainder) yeah yeah...I forgot about that ..thanks for reminding.
|
KRASH
|
|
|
krashfire (OP)
Member
Offline
Activity: 119
Merit: 11
Life aint interesting without any cuts and bruises
|
|
January 31, 2023, 07:15:42 AM |
|
ChatGPT also gave me this formula to find K nonce Value
|
KRASH
|
|
|
garlonicon
|
|
January 31, 2023, 03:48:56 PM |
|
But there is no private key "d" here, so I am certain this formula is invalid. If it would be possible to calculate "k" from publicly known values r,s,z, then you could do that for every signature, and move any coins in this way. ChatGPT also gave me this formula ChatGPT is already banned in Stack Overflow, because of bad answers it gave for technical questions. Who knows, if there will be more such cases here, then maybe we will get "automatically generated post" as one of the reasons to report such posts. Because now, the quality of that bot is far from perfect, and even worse, typical answers seems to be correct, but are often misleading.
|
|
|
|
witcher_sense
Legendary
Offline
Activity: 2394
Merit: 4372
🔐BitcoinMessage.Tools🔑
|
|
January 31, 2023, 04:01:45 PM |
|
But there is no private key "d" here, so I am certain this formula is invalid. If it would be possible to calculate "k" from publicly known values r,s,z, then you could do that for every signature, and move any coins in this way. Just for reference, the correct formula is the following (we still need private key to obtain nonce value): k = (z + d * r) * s -1 mod n
|
|
|
|
krashfire (OP)
Member
Offline
Activity: 119
Merit: 11
Life aint interesting without any cuts and bruises
|
|
January 31, 2023, 07:31:58 PM |
|
But there is no private key "d" here, so I am certain this formula is invalid. If it would be possible to calculate "k" from publicly known values r,s,z, then you could do that for every signature, and move any coins in this way. Just for reference, the correct formula is the following (we still need private key to obtain nonce value): k = (z + d * r) * s -1 mod n Just to be sure, I again ask ChatGPT The mathematical formula to calculate k nonce from r,s,z signatures is:
k = (z + r*s) / s mod n
where n is the order of the elliptic curve.
Yeah This forum should ban CHATGPT as well.
|
KRASH
|
|
|
Critical_Thoughts
Newbie
Offline
Activity: 6
Merit: 7
|
|
February 01, 2023, 08:23:08 AM |
|
OP you need to understand chatGPT is not a computational operated model, it just generates answers based on a limited database, we don't know the source of it's outputs, they could be wrong in many cases. chatGPT is an experimental project, don't expect much from it.
|
|
|
|
NotATether
Legendary
Offline
Activity: 1652
Merit: 6962
In memory of o_e_l_e_o
|
|
February 02, 2023, 04:45:51 AM |
|
But there is no private key "d" here, so I am certain this formula is invalid. If it would be possible to calculate "k" from publicly known values r,s,z, then you could do that for every signature, and move any coins in this way. The divisor is also missing here, instead the s is being multiplied instead of divided. ChatGPT is already banned in Stack Overflow, because of bad answers it gave for technical questions. Who knows, if there will be more such cases here, then maybe we will get "automatically generated post" as one of the reasons to report such posts. Because now, the quality of that bot is far from perfect, and even worse, typical answers seems to be correct, but are often misleading.
Alternatively you can feed the input of a post into ChatGPT and prompt it to explain why it's a bad bitcointalk post, and you will get an automated report message out of it.
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
|