{"id":26730955,"url":"https://github.com/daedalus/bitcoin-recover-privkey","last_synced_at":"2025-03-27T23:34:22.807Z","repository":{"id":7227598,"uuid":"8535706","full_name":"daedalus/bitcoin-recover-privkey","owner":"daedalus","description":"Proof of concept of bitcoin private key recovery using weak ECDSA signatures","archived":false,"fork":false,"pushed_at":"2023-11-27T18:36:39.000Z","size":34,"stargazers_count":70,"open_issues_count":0,"forks_count":81,"subscribers_count":20,"default_branch":"master","last_synced_at":"2023-11-27T19:40:11.737Z","etag":null,"topics":["bitcoin","ecdsa","ecdsa-cryptography","key","poc","private","privkey","vulnerability"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daedalus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-03-03T12:03:15.000Z","updated_at":"2023-11-22T08:04:30.000Z","dependencies_parsed_at":"2023-11-27T19:52:28.986Z","dependency_job_id":null,"html_url":"https://github.com/daedalus/bitcoin-recover-privkey","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fbitcoin-recover-privkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fbitcoin-recover-privkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fbitcoin-recover-privkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2Fbitcoin-recover-privkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daedalus","download_url":"https://codeload.github.com/daedalus/bitcoin-recover-privkey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944020,"owners_count":20697945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","ecdsa","ecdsa-cryptography","key","poc","private","privkey","vulnerability"],"created_at":"2025-03-27T23:33:29.682Z","updated_at":"2025-03-27T23:34:22.785Z","avatar_url":"https://github.com/daedalus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![lint_python](https://github.com/daedalus/bitcoin-recover-privkey/workflows/lint_python/badge.svg)\n[![GitHub issues](https://img.shields.io/github/issues/daedalus/bitcoin-recover-privkey.svg)](https://github.com/daedalus/bitcoin-recover-privkey/issues)\n[![GitHub forks](https://img.shields.io/github/forks/daedalus/bitcoin-recover-privkey.svg)](https://github.com/daedalus/bitcoin-recover-privkey/network)\n[![GitHub stars](https://img.shields.io/github/stars/daedalus/bitcoin-recover-privkey.svg)](https://github.com/daedalus/bitcoin-recover-privkey/stargazers)\n\n# bitcoin-recover-privkey\nProof of concept of bitcoin private key recovery using weak ECDSA signatures\n\n```\nBased on http://www.nilsschneider.net/2013/01/28/recovering-bitcoin-private-keys.html\nRegarding Bitcoin Tx:\nhttps://blockchain.info/tx/9ec4bc49e828d924af1d1029cacf709431abbde46d59554b62bc270e3b29c4b1.\nAs it's said in the previous article you need to poke around into the OP_CHECKSIG \nfunction in order to get z1 and z2,\nIn other hand for every other parameters you should be able to get them from the Tx itself.\n```\n\n### ECDSA math recap: ###\n```\nQ=dP compute public key Q where d is a secret scalar and G the base point\n(x1,y1)=kP where k is random choosen an secret\nr= x1 mod n\ncompute k**-1 or inv(k)\ncompute z=hash(m)\ns= inv(k)(z + d) mod n\nsig=k(r,s) or (r,-s mod n)\nKey recovery\nd = (sk-z)/r where r is the same \n```\n\n### Try it: ###\n\n```\npython ProofOfConcept.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Fbitcoin-recover-privkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaedalus%2Fbitcoin-recover-privkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Fbitcoin-recover-privkey/lists"}