Retrieve ECDSA signature R,S,Z values from blockchain rawtx or txid.
The script parse the data of rawtx to fetch all the inputs in the transaction and reconstructs the unsigned message for each of them to find the Z value. The result is given as R,S,Z,Pubkey for each of the inputs present in the rawtx data. [No Internet required]
If txid is given, instead of rawtx then blockchain API is used to fetch the details of rawtx and then R,S,Z calculation starts. [Internet required]
The required library (3 files) can be obtained from the location https://github.com/iceland2k14/secp256k1
python getz_input.py
usage: getz_input.py [-h] [-txid TXID] [-rawtx RAWTX]
This tool helps to get ECDSA Signature r,s,z values from Bitcoin rawtx or txid
optional arguments:
-h, --help show this help message and exit
-txid TXID txid of the transaction. Use Internet to fetch rawtx from
given txid
-rawtx RAWTX Raw Transaction on the blockchain. No internet required
Enjoy the program! :) Tips BTC: bc1q39meky2mn5qjq704zz0nnkl0v7kj4uz6r529at
(base) C:\anaconda3\RSZ>python getz_input.py -txid 82e5e1689ee396c8416b94c86aed9f4fe793a0fa2fa729df4a8312a287bc2d5e
Starting Program...
======================================================================
[Input Index #: 0]
R: 009bf436ce1f12979ff47b4671f16b06a71e74269005c19178384e9d267e50bbe9
S: 00c7eabd8cf796a78d8a7032f99105cdcb1ae75cd8b518ed4efe14247fb00c9622
Z: 9f4503ab6cae01b9fc124e40de9f3ec3cb7a794129aa3a5c2dfec3809f04c354
PubKey: 04e3896e6cabfa05a332368443877d826efc7ace23019bd5c2bc7497f3711f009e873b1fcc03222f118a6ff696efa9ec9bb3678447aae159491c75468dcc245a6c
======================================================================
[Input Index #: 1]
R: 0094b12a2dd0f59b3b4b84e6db0eb4ba4460696a4f3abf5cc6e241bbdb08163b45
S: 07eaf632f320b5d9d58f1e8d186ccebabea93bad4a6a282a3c472393fe756bfb
Z: 94bbf25ba5b93ba78ee017eff80c986ee4e87804bee5770fae5b486f05608d95
PubKey: 04e3896e6cabfa05a332368443877d826efc7ace23019bd5c2bc7497f3711f009e873b1fcc03222f118a6ff696efa9ec9bb3678447aae159491c75468dcc245a6c
(base) C:\anaconda3\RSZ>python getz_input.py -rawtx 01000000028370ef64eb83519fd14f9d74826059b4ce00eae33b5473629486076c5b3bf215000000008c4930460221009bf436ce1f12979ff47b4671f16b06a71e74269005c19178384e9d267e50bbe9022100c7eabd8cf796a78d8a7032f99105cdcb1ae75cd8b518ed4efe14247fb00c9622014104e3896e6cabfa05a332368443877d826efc7ace23019bd5c2bc7497f3711f009e873b1fcc03222f118a6ff696efa9ec9bb3678447aae159491c75468dcc245a6cffffffffb0385cd9a933545628469aa1b7c151b85cc4a087760a300e855af079eacd25c5000000008b48304502210094b12a2dd0f59b3b4b84e6db0eb4ba4460696a4f3abf5cc6e241bbdb08163b45022007eaf632f320b5d9d58f1e8d186ccebabea93bad4a6a282a3c472393fe756bfb014104e3896e6cabfa05a332368443877d826efc7ace23019bd5c2bc7497f3711f009e873b1fcc03222f118a6ff696efa9ec9bb3678447aae159491c75468dcc245a6cffffffff01404b4c00000000001976a91402d8103ac969fe0b92ba04ca8007e729684031b088ac00000000
Starting Program...
======================================================================
[Input Index #: 0]
R: 009bf436ce1f12979ff47b4671f16b06a71e74269005c19178384e9d267e50bbe9
S: 00c7eabd8cf796a78d8a7032f99105cdcb1ae75cd8b518ed4efe14247fb00c9622
Z: 9f4503ab6cae01b9fc124e40de9f3ec3cb7a794129aa3a5c2dfec3809f04c354
PubKey: 04e3896e6cabfa05a332368443877d826efc7ace23019bd5c2bc7497f3711f009e873b1fcc03222f118a6ff696efa9ec9bb3678447aae159491c75468dcc245a6c
======================================================================
[Input Index #: 1]
R: 0094b12a2dd0f59b3b4b84e6db0eb4ba4460696a4f3abf5cc6e241bbdb08163b45
S: 07eaf632f320b5d9d58f1e8d186ccebabea93bad4a6a282a3c472393fe756bfb
Z: 94bbf25ba5b93ba78ee017eff80c986ee4e87804bee5770fae5b486f05608d95
PubKey: 04e3896e6cabfa05a332368443877d826efc7ace23019bd5c2bc7497f3711f009e873b1fcc03222f118a6ff696efa9ec9bb3678447aae159491c75468dcc245a6c
(base) C:\anaconda3\RSZ>python rsz_solve.py
========================================================================
True Privatekey = 0x6a0d91cdd5cf761fe02de7b56bbe4ae1ed55b7a4faca12db65f02ee8e5b61602
========================================================================
k1: 0x3c977dbdb3deeefcffef9fda93cdfeacfb83a8a9a6439585bb37f052a16f314
r1: 0x2c0a015c8976d170edc918480ee981e75c513dfea11086ddc89baadfd9038a29
s1: 0xf06ac541347ff93f4269579d9ca71cf7ad32859b83596721798b370ec9100749
z1: 0x37c7de2760ab892174e6680d621e72eb60b4b7cde365164ee00fee7f3a3e83dd
Tx1 Correct: rsz Validated the Pubkey
========================================================================
k2: 0x85e0356d099499f90c926619fdde95b4f60c0a4644daf6f3b597d89dbb27f31c
r2: 0xc2e6e5acb70205a4f8a2639568e2bfd855111ecf334304193d70e967c1e3d7d8
s2: 0xfe7b7da891dfbb1d33a94b810d45caa7e8768b0e3b1bd750da76f08fcd00d814
z2: 0x2a3a32220a7376ce84cbbd96673a89d534f94b0d887fac8e532ec764aab9e86a
Tx2 Correct: rsz Validated the Pubkey
========================================================================
Starting to solve rsz using difference of k between 2 Tx
Extracted Privatekey = 0x6a0d91cdd5cf761fe02de7b56bbe4ae1ed55b7a4faca12db65f02ee8e5b61602
==== Nonce Found using 2 rsz diff = 0x3c977dbdb3deeefcffef9fda93cdfeacfb83a8a9a6439585bb37f052a16f314
(base) C:\anaconda3\RSZ>python LLL_nonce_leakage.py
Fixed Nonce bits = 56 Minimum Signature Required = 8
###############################################################################
secret: f13a1e3ceb21a8537c5b0c6a68ba01fc256edbd874c48275e0e43bb17b8df505
Pubkey: 043eb4b61f32e3365ebb679990f15c9049f2c452b3c72ec5c3e8e4359c2dccb886f8eaaa94d9e37140d9784020d0de9b4c8a4d7f16b8813703aff6f35c8be3c0f3
###############################################################################
Original Matrix
[[115792089237316195423570985008687907852837564279074904382605163141518161494337, 0, 0, 0, 0, 0, 0, 0, 0], [0, 115792089237316195423570985008687907852837564279074904382605163141518161494337, 0, 0, 0, 0, 0, 0, 0], [0, 0, 115792089237316195423570985008687907852837564279074904382605163141518161494337, 0, 0, 0, 0, 0, 0], [0, 0, 0, 115792089237316195423570985008687907852837564279074904382605163141518161494337, 0, 0, 0, 0, 0], [0, 0, 0, 0, 115792089237316195423570985008687907852837564279074904382605163141518161494337, 0, 0, 0, 0], [0, 0, 0, 0, 0, 115792089237316195423570985008687907852837564279074904382605163141518161494337, 0, 0, 0], [0, 0, 0, 0, 0, 0, 115792089237316195423570985008687907852837564279074904382605163141518161494337, 0, 0], [2988567097096369072114256704492752094134370478079672678724583563784523759380194381101303007421348038236013182197166091841310496678504274536669021895976687, -6738142932705740457105677849364580346544371553506799055378865962606747928093276755130757431460273806911522952651290394284163090327037989241628588755641563, -4609254798108186796170670673211114832918863612866138122054703317440751592943691412538893967917280774176482822495579075978206122967125902798957244551197095, -4241018251166027250833859007695934733691821946409054337471303047554210658455462398597308443919577256694427852291869818071497434990022568279646523419972974, -3786532040371568123260653635376072873735808584513069558430341354041374072323853425713333359031171721704455202520148845248110455200710766560032938878291436, -1455140373318134753656398793208140405472020050459686656109449769771489208866781231797782913592880545869819687376301918352653011562080323940635317208444392, -4531215516145026319614661110389205527691723869606480801406600020033638258342487080403483208628657933375998193530783342366298428990681271342765206141765890, 1.3877787807814457e-17, 0], [-3640897815219273726171209317919836168123870485952174405025247556887841773680519710925144846918890366983311099492360262678907710529974609367712450770232532, -2297328352498726261502892431990017228169119063790068441607856150715311591699626613603902401787786285587075499186045363199489859617591793008665855383016252, -954965833481163842583176851975881485172685582439393133772147837653200782253861390815646522387162631100976408183149777942842142453670313611884197350568958, -2673403826021012432158013606849776453129157388761886651386316233860577260189931431343792659010346167776362261841946472117774484438917640474689303485763098, -1657543466262215935719403308193088630371918573859132142053143226330371430854549309565433337909468889463607488811009398826177343366007786144219522532417902, 1998395227990224857517731021436691048749744756792397727553558892310572739051578625185843809195440634123692570493347436858750712895821615045659992558344464, 457104288102981440020849854044141614291770019109689785077187721851181461921741961531220677053564384775687984813817030125552994012190695367500652879856115, 0, 1606938044258990275541962092341162602522202993782792835301376]]
Reduced Matrix
[[0, 0, 0, 0, 0, 0, 0, 1606938044258990275541962092341162602516201955414261509405631, 0], [-1216674236050858179778423307933806313861976262663692177459505, -961319248046196147935690067612344523652647960777891808172466, -939218274296704509334085803490832671730917030741052720700551, -689284247273089543013034679061282951432484510730477009401773, -1205585714487743872094134206478015239912732375554422876465541, -47328867541166285983202769828718987202468065927547743537509, -1062793502486645769413900352391018429582619366049041166256918, -92731473947427358386673554123082880122698072324206367720926, 1606938044258990275541962092341162602522202993782792835301376], [162385477386577120585255320203282660417928558451013086108488700271, 471319780098501976580791250346316391728264102071722915803041227410, 79116519675663015769367710183256324988593944147332189368481288958, 35299313900563424380662359920585387924828091753334637323994934806, -583428424135750123518976374987219931024204299338021870479378212170, -94690281005192707011019467007883479911657131331357709896071718687, -112700003843235162243127006462484946241579596548267452063082094087, 372185213887535146763104417857097363561230093006104766055284, -48744858634552211018289878109076826384908505613407237866031939584], [-132090495765940200534085024838171940963660658562348911570236270674, -630062094395381731000823507925953007800358869425881083446608118454, -559431653287312227548995156211501110112540307077954782374448959444, -114304625542408124594436360781621674597425415567339300554488886742, -297940861450850569988993662783765629774736053559931735303395973801, -947453385076568932872887718512827637302565450547291320454129278226, 1056413216270422516954638537195377221151359614839995342750530760393, 425349534596469653362751627291677058510005755560068626461450, -405682757839491907992497123946172887144947801201422530821679480832], [895054617959122636610545407102258181850649371812861882522255521304, -1002999564847128944840093633727073043495959872755962870093581948051, -278499853321619591396629542636444347071098880668712796594547319229, -285056889792351116341942687126830545521318125051385712456110646047, -455235656858684910074639395834210351605651812213163297671935031920, 307587990339666351113300772576837082563594999421064029363579163220, 218756198082997390581373228316748487932783263966620120868947126179, -785645968693293670632397855667988005575208237027151461541317, -395191059348524960483483653445277436513080337855014676399996796928], [-15138371016527076872567737456079705395847955795648505541954699023, -20726432263824091815707478537841566736368587150955480575464165434, 302937865903103280067742477685024842349959810628602629781177723707, -119433777623252693511393180357394422243894419513207858524252073662, -220243912630677753943072966263165737006402230135140629740445017758, -72894702750048234292093672925558919787580283847264137260799153268, 884189896626441260554675516705983299723696552077322678919433785339, 254548013576963719500247497194241165334403475431278559094218, 519368803656682693016264316093033117785586096402573775540745928704], [294777126712621326481663572264989012863135890936915992147115832973, 334701172445166088659223279527364205253063069772786500599624311195, -19091407455208137809336263885113743664270239284603456409246607173, 455731751496798772118405945289788280982813291162921812112831168945, 66022461505811299812985707520634328062247019961084426674896512383, 165916609407200188690939691167424802407388440889063119318665804804, 32466975981875890740043057306155568234865579965334929213756560741, 203957754399204974922485137153029759391473028759365711610174, 683630010540836678982163681172146759015405686427050859165252583424], [-448105345735299341461643150205222650149000771111501809301682736046, 188108397562298607866512828174474651110135520785130869532491210507, 258972152915500529681651123075095418332249317480767795540149377353, 631804551545985644901565919265312086381943707930300914063014109343, -437996224302032991708140459125716041327609171136580597376043324616, 611576481046181845940103533309459182008915238274643462814639452220, -97356014331892221022009054023341237842903910215473644424955877552, 20014736944564812098428060308533522191505792033065345236390, -179350355119745904653238389126197158067503076136097508347986575360], [-160246247310128943280352001212317012809606322694202507252657234244, 378765160253169935862798686184204168944858577057694324242561136681, -668091669279796114986509047241136159813727883605651718025433840003, -238637465717041695445041357897145025665850471742616193121040902932, 186588358390772104778324952677196782114831025121284384248309627904, 238362938636193878008421082979585354343178378530103864645347370726, 302480189773002488526594621225999486891028983246560163851066458813, 83768962071937763115666777994778766401117983793017844552124, -40526977476211734749168283968844120835609959503202035306300702720]]
-------------------------------------------------------------------------------
Found private key = f13a1e3ceb21a8537c5b0c6a68ba01fc256edbd874c48275e0e43bb17b8df505
-------------------------------------------------------------------------------
time = 3.49 sec
(base) C:\anaconda3\RSZ>python rsz_rdiff_scan.py -a 1BFhrfTTZP3Nw4BNy4eX4KFLsn9ZeijcMm
Starting Program...
------------------------------------------------------------------------------------------------------------------------
Total: 50 Input/Output Transactions in the Address: 1BFhrfTTZP3Nw4BNy4eX4KFLsn9ZeijcMm
UnSupported Tx Input. Presence of Witness Data
Skipped the Tx [d52c7663adf9702529553e8eeb18f7f2bedad1e4ef23a7f9a187660d7dcb3522]........
UnSupported Tx Input. Presence of Witness Data
Skipped the Tx [d52c7663adf9702529553e8eeb18f7f2bedad1e4ef23a7f9a187660d7dcb3522]........
======================================================================
[Input Index #: 0] [txid: 3b7a0a5f4c55718f6374fd718d65e2b4a8fde8fd1158b4f9f659872899530939]
R: 384327a0bdd1aeb3c33c4a49d7ab617657e24e979085b672017f25f9761722fd
S: 6e2685a20bc95af56a8aa6035a7e29f1cedbb8cd56403011e9281687ed32ee58
Z: 938a0a4d20b7e40bbd587f752f85dd1ed7f84b790965ca0407b5367d33f17f6b
PubKey: 04dbd0c61532279cf72981c3584fc32216e0127699635c2789f549e0730c059b81ae133016a69c21e23f1859a95f06d52b7bf149a8f2fe4e8535c8a829b449c5ff
======================================================================
[Input Index #: 0] [txid: d3d0e560d414c86d88ea645a9dbee583d21a95ae2e57f10679b043ef33a0d23c]
R: 4e1e91433ad7b1f6e52466f4d233c94b7023937f6345ab1179a2b268a22d52cc
S: 270941b896645a8ecd98253dae59c580766ec10391d5742f830874dbabc4acbe
Z: 74419baf355e3e14c1e44b9bcd8e7a7a2cdd1488c72fbfd3ab30523a448dd70d
PubKey: 04dbd0c61532279cf72981c3584fc32216e0127699635c2789f549e0730c059b81ae133016a69c21e23f1859a95f06d52b7bf149a8f2fe4e8535c8a829b449c5ff
======================================================================
[Input Index #: 0] [txid: 3e9cd088d9f5462709b0e407c3e938518b348feaad879bc24fb88ff9b0ade941]
R: 755f50abc717f8a5c7bf41d4ae2f6c702afcb3dccf127ae02dbcf5c64c55f3ea
S: 45e92613115448bd6710c313ff2c6af2924dafee49d7a57915003ee218f5b73a
Z: ee540220c3570af1cf96f9d9660b3e1dc593cae60e68a284363badce26830d64
PubKey: 04dbd0c61532279cf72981c3584fc32216e0127699635c2789f549e0730c059b81ae133016a69c21e23f1859a95f06d52b7bf149a8f2fe4e8535c8a829b449c5ff
======================================================================
.....
.....
.....
.....
======== RSZ to PubKey Validation [SUCCESS] ========
======== RSZ to PubKey Validation [SUCCESS] ========
======== RSZ to PubKey Validation [SUCCESS] ========
======== RSZ to PubKey Validation [SUCCESS] ========
======== RSZ to PubKey Validation [SUCCESS] ========
======== RSZ to PubKey Validation [SUCCESS] ========
.....
.....
Duplicate R Found. Congrats!. (87, 95, '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')
.....
.....
======================================================================
------------------------------------------------------------------------------------------------------------------------
[i=103] [j=105] [R Diff = fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141]
Privatekey FOUND: 0xc477f9f65c22cce20657faa5b2d1d8122336f851a508a1ed04e479c34985bf96
======================================================================
------------------------------------------------------------------------------------------------------------------------
Program Finished ...