krashfire (OP)
Jr. Member
Offline
Activity: 96
Merit: 6
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
|
|
|
|
|
|
|
In order to achieve higher forum ranks, you need both activity points and merit points.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
garlonicon
|
It is invalid, because: 1. You have to calculate it modulo "n". 2. The correct formula is "s=(z+rd)/k", so your private key "d" is "(sk-z)/r". Also, if 256-bit numbers are too big for you to start with, then compute everything on smaller numbers first: https://www.coindesk.com/markets/2014/10/19/the-math-behind-the-bitcoin-protocol/
|
Hold your horses before deploying blockchain-related things. You don't want to deploy SHA-1 collision without deploying hardened SHA-1. Once you reveal some code, and make it Open Source, there is no "undo" button. Once you share some idea, there is no way to erase it from reader's memory.
|
|
|
witcher_sense
Legendary
Offline
Activity: 2310
Merit: 4313
🔐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)
Jr. Member
Offline
Activity: 96
Merit: 6
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)
Jr. Member
Offline
Activity: 96
Merit: 6
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)
Jr. Member
Offline
Activity: 96
Merit: 6
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.
|
Hold your horses before deploying blockchain-related things. You don't want to deploy SHA-1 collision without deploying hardened SHA-1. Once you reveal some code, and make it Open Source, there is no "undo" button. Once you share some idea, there is no way to erase it from reader's memory.
|
|
|
witcher_sense
Legendary
Offline
Activity: 2310
Merit: 4313
🔐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)
Jr. Member
Offline
Activity: 96
Merit: 6
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: 1582
Merit: 6679
bitcoincleanup.com / bitmixlist.org
|
|
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 | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
|