I tweaked the gen_data.py script found at this GitHub repo: https://github.com/bitlogik/lattice-attack.
Now, whenever you generate sets of R,S,Z(HASH) Signatures, you can see the K_Nonce value used. Just a heads up, it doesn't show up in the json file like the other data; you'll see it directly in the Terminal. The full modified code is below.
Make sure to enter your own public keys' XY coordinates in gen_data.py.
I also updated ecdsa_lib.py to include a print function for the K_Nonce.
With R,S,Z(HASH) and now K nonce out in the open, you can head over here and plug in your data: https://rawcdn.githack.com/nlitsme/bitcoinexplainer/aa50e86e8c72c04a7986f5f7c43bc2f98df94107/ecdsacrack.html to find the Private key.
With this info, you’re pretty close to getting the private key. Best of luck!
Modified Lattice Attack Script
6 replies 351 views
Hi there,
This is interesting, but is not quite working for me. After I generate the json file, once I run the lattice.py I get this error:
Loading data from file data7.json
Public key data invalid, not on the given SECP256K1 curve.
I think it has to do with the format that the xY coordinates I am putting in is not correct. My question it, where and how you get this XY ( or RS) coordinates from, so that they are in the right format to go in gendata.py?
Thanks for your input
omega_bearFull Member
Posts: 116 · Reputation: 780
#3Sep 14, 2017, 07:46 PM
KRASH
Can you add calculation of privkey to scrypt?
pvk = (inv(r) * ( (k*s)-z ) ) % N
I have added those definitions but I get an error. Is that the right part of the code on the lattice_attack.py for them to go in? THANKS.
mahuro@machine1:~/lattice-attack$ python3 lattice_attack.py -f data7.json
File "/home/mahuro/lattice-attack/lattice_attack.py", line 41
r * pvk = ( (k*s)-z ) % N
^^^^^^^
SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
Not sure where in the code should it go the definitions you mentioned.
I get another error, but I think I am closer now. I think I simply need to change of private_value to integer, But I am not sure how.
There is a comment in the lattice_attack.py that says how to convert between integer and hex, but it doesnt say where those given equations should go:
# To convert to integer :
# if got bytes use : int.from_bytes(bytesvar, bytesorder="big")
# if got hex use : int(hexintvar, 16)
#
Has anyone got this to actually work? just curious...
omega_bearFull Member
Posts: 116 · Reputation: 780
#6Sep 17, 2017, 08:53 AM
krossfire know kode, he can do it
theres no point running this. as the rsz created will not point to the correct private key or public key. ran it a long time ago.
Related topics
- Twist Attack, Sub-Group Attack and Pollard-Rho Implementation Issues 4
- Could Innopolis Tech launch a 51% attack on the testnet? 19
- Potential attack strategy for btc puzzle pool: ttd's pool. 4
- Bitcoin Core displaying coins (UTXOs) in a new tab 13
- Are you in favor of BIP-110? Let's get a Bitcoin poll going. 0
- Erlay seems to have some issues here’s a better proposal for a bitcoin protocol without invites 3