I tweaked my code a bit and I'm looking for some feedback on whether my approach is more efficient or legit.
I got pretty lucky before since I was told that six weeks was quite fast, but I wanna speed things up even more.
So here's my question:
Can you guys check out my code in SageMath and point out anything I might've missed or ways to make it better?
Also, I heard that the u1 value gives some kind of "hint" about the k nonce. I get that it's basically just the mod n of the k nonce, not the k nonce itself.
Please have a look and let me know where I can improve. Thanks a bunch!
Looking for K nonce optimization
19 replies 179 views
matrix_nodeFull Member
Posts: 85 · Reputation: 519
#2Nov 29, 2017, 03:37 PM
Hi
This is my version if you have private key or may need to bf.
But you can always do R == K * G to find out if you really found valid K or not.
Regards,
omega_bearFull Member
Posts: 116 · Reputation: 780
#3Nov 29, 2017, 09:21 PM
great , I will try
omega_bearFull Member
Posts: 116 · Reputation: 780
#4Nov 30, 2017, 02:45 AM
I take error:
line 12
SyntaxError: Non-ASCII character '\xc2' in file nonce9.sage.py on line 12, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
omega_bearFull Member
Posts: 116 · Reputation: 780
#5Nov 30, 2017, 06:19 AM
Krashfire,
u1 = (modinv(s, n) * z) % n
u2 = (modinv(s, n) * r) % n
if K == (u1 * G + u2 * R):
u1, u2 are known. What a problem find u1*G +u2*R ?
u2 * R is a number? How you add number to point u1*G ?
br
i just updated the code in sagemath.
omega_bearFull Member
Posts: 116 · Reputation: 780
#7Dec 1, 2017, 05:00 AM
bro, test your code at this test data, I try you scrypt from your orevious topic not found k !
this test data from ecdsa123:
r= 115780575977492633039504758427830329241728645270042306223540962614150928364886
s= 115784413730767153834193500621449522112098284939719838943229029456606672741370
z= 2
k = 6
omega_bearFull Member
Posts: 116 · Reputation: 780
#8Dec 1, 2017, 08:27 PM
error again, I try remove error, same error:
k = ((r * i%n + z%n)%n * modinv(s, n) % n)%n
File "sage/structure/element.pyx", line 1921, in sage.structure.element.Element.__mod__ (build/cythonized/sage/structure/element.c:13675)
File "sage/structure/coerce.pyx", line 1167, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:9612)
File "sage/structure/element.pyx", line 1919, in sage.structure.element.Element.__mod__ (build/cythonized/sage/structure/element.c:13640)
File "sage/structure/element.pyx", line 1954, in sage.structure.element.Element._mod_ (build/cythonized/sage/structure/element.c:13933)
TypeError: unsupported operand parent(s) for %: 'Symbolic Ring' and 'Symbolic Ring'
that's impossible. Have you insert your rsz? I did with 3 different sets of rsz. The signature verified. And the code works.
omega_bearFull Member
Posts: 116 · Reputation: 780
#10Dec 2, 2017, 07:03 AM
im use this rsz bro:
r= 115780575977492633039504758427830329241728645270042306223540962614150928364886
s= 115784413730767153834193500621449522112098284939719838943229029456606672741370
z= 2
?
omega_bearFull Member
Posts: 116 · Reputation: 780
#11Dec 2, 2017, 08:37 AM
I put this part:
k = (r * i + z) * modinv(s, n) % n
R = E.lift_x(Integer(r))
P = k * G
print("K:", hex(P.xy()[0])) # Print the x-coordinate of K in hexadecimal
if hex(P.xy()[0]) == hex(r):
print("Found real k:", hex(P.xy()[0])) # Print the real k in hexadecimal
break
and put to your code of your presious thread, working.
('Found real k:', 87069027473077907962879272067307854440257155754636880132689937952837782290998, 6)
('Match found for u1 at i =', 0)
('!!!', 6, 4)
but ecdsa123 tell what nonce is 6, not 87069027473077907962879272067307854440257155754636880132689937952837782290998
omega_bearFull Member
Posts: 116 · Reputation: 780
#12Dec 2, 2017, 01:49 PM
little example how to add your code to bsgs or kangaroo software:
r= 1157805759774926330395047584278303292417$
s= 1157844137307671538341935006214495221120$
z= 2
i = 0
while True:
k = (z + i )%n # * modinv(s, n) % n #start range
print("k",k)
R = E.lift_x(Integer(r))
K = k * ( modinv(s, n) * G) #( modinv(s, n) * G) - base point
u1 = (modinv(s, n) * z) % n
u2 = (modinv(s, n) * r) % n
#if k <=2**100:print("$$$",k,i)
if K == (u1 * G + u2 * R): # in () is a pubkey
print("&",k)
print("yes!!!")
print("Found real k:", k,i)
break
i = i + r
('Found real k:', 115723009678374821119173625523542436186184050224879315428219959977314762717633, 69468345586495579823702855056698197545037187162025383734124577568490557018931
enjoy ))
lol. of course that wont work. its not real rsz
omega_bearFull Member
Posts: 116 · Reputation: 780
#14Dec 2, 2017, 11:39 PM
why this not work ?
replace base pooint and "i" in cangaroo and you take "i" were finder k,after put "i" to your formula....
this is work, jast enother way of using cangaroo and bsgs search
try with your real 6 weeks search rsz, and tall what time was need to find k with cuda bsgs or cuda kangaroo ?
thx
ps this is work, bro
omega_bearFull Member
Posts: 116 · Reputation: 780
#15Dec 3, 2017, 05:42 AM
@Krashfire, do you have any new findings ?
Hi sir I want to try your code with these rsz
1:
r = 0x57a463b8ac30f2ed36767d5ccabf04fbe29c94b054b4309996f086556428c748
s = 0x5a4c7e96159688e8cd2525a3230ec5184597d6cfbaf037ca5815fa01097f67cc
z = 0xa37f38a2db651ba57f68ef4d0ac297e732d0eb3954bb85ac069569f9b372daa0
2:
r = 0x4f7f2657387cf1fef8152e2bbd39f153ee235e1f46294fded0d42dacbbe7ea
s = 0x430773be7ebda7fba5ed2f829e9b47a7f92d526905c250780f044ed860de0786
z = 0x76757e4b29801bbb747a125c0bb6752feeeabd84c58fe3dd71e94eed3839dfaa
Can you help me with script to find private keys from these rsz.
These 2 sets of r,s,z use different public keys...the private keys must also be different..
1:
0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e
2:
0x000000000000000000000000000000000000000000000001a838b13505b26867
omega_bearFull Member
Posts: 116 · Reputation: 780
#18Dec 3, 2017, 10:09 AM
oh f-k, you really find privkeys?
you use kangaroo multy gpu from GL or keyhunt ?
use Google .......so I find 2 private key from his 2 rsz
1:
D:\python\bitcoin_rsz>python getz_input.py -txid a37f2f87bd371d621178605a79062010298c31fc884ed966a2041684eb8198f1
Starting Program...
======================================================================
[Input Index #: 0]
R: 57a463b8ac30f2ed36767d5ccabf04fbe29c94b054b4309996f086556428c748
S: 5a4c7e96159688e8cd2525a3230ec5184597d6cfbaf037ca5815fa01097f67cc
Z: a37f38a2db651ba57f68ef4d0ac297e732d0eb3954bb85ac069569f9b372daa0
PubKey: 02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
2: puzzle #65
D:\python\bitcoin_rsz>python getz_input.py -txid 65c7e5cbff719ff7fd32645b777cb20b69db513f1cd6a064dfcc95b69ad77acc
Starting Program...
======================================================================
[Input Index #: 0]
R: 4f7f2657387cf1fef8152e2bbd39f153ee235e1f46294fded0d42dacbbe7ea
S: 430773be7ebda7fba5ed2f829e9b47a7f92d526905c250780f044ed860de0786
Z: 76757e4b29801bbb747a125c0bb6752feeeabd84c58fe3dd71e94eed3839dfaa
PubKey: 0230210c23b1a047bc9bdbb13448e67deddc108946de6de639bcc75d47c0216b1b
Ok but how can I find these rsz with this script very fast?
Related topics
- Looking for 3 examples of r, s, z and nonce data 19
- 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
- New Optional Hourglass Implementation is Live 3
- Ways to earn some sats by contributing to bitcoin core development 5