{"id":19345201,"url":"https://github.com/qwerty-w/btc-lib","last_synced_at":"2026-01-24T23:31:18.987Z","repository":{"id":57416505,"uuid":"398315340","full_name":"qwerty-w/btc-lib","owner":"qwerty-w","description":"Simple Bitcoin Library","archived":false,"fork":false,"pushed_at":"2025-04-19T14:24:08.000Z","size":312,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-04T05:41:26.468Z","etag":null,"topics":["bitcoin","btc","lib","library","python","simple"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qwerty-w.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-20T15:09:00.000Z","updated_at":"2025-08-27T12:28:22.000Z","dependencies_parsed_at":"2023-12-31T13:21:44.386Z","dependency_job_id":"08941f01-2be0-48c5-af86-3a96d587a87a","html_url":"https://github.com/qwerty-w/btc-lib","commit_stats":{"total_commits":128,"total_committers":1,"mean_commits":128.0,"dds":0.0,"last_synced_commit":"4741156e133c9a648821eb1368e5cd92e739938d"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/qwerty-w/btc-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwerty-w%2Fbtc-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwerty-w%2Fbtc-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwerty-w%2Fbtc-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwerty-w%2Fbtc-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qwerty-w","download_url":"https://codeload.github.com/qwerty-w/btc-lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qwerty-w%2Fbtc-lib/sbom","scorecard":{"id":756514,"data":{"date":"2025-08-11","repo":{"name":"github.com/qwerty-w/btc-lib","commit":"efe14e52554ab40aa14d3bbb1eb6f464fc30ab53"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-wj6h-64fc-37mp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T21:49:28.323Z","repository_id":57416505,"created_at":"2025-08-22T21:49:28.324Z","updated_at":"2025-08-22T21:49:28.324Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28738997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T22:12:27.248Z","status":"ssl_error","status_checked_at":"2026-01-24T22:12:10.529Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","btc","lib","library","python","simple"],"created_at":"2024-11-10T04:05:20.890Z","updated_at":"2026-01-24T23:31:18.932Z","avatar_url":"https://github.com/qwerty-w.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"btc-lib: Simple Bitcoin Library.\n=======================\n\nThis library is a simple python cold wallet management library for the Bitcoin network. It allows you to generate private/public keys, get Bitcoin addresses from them, create transactions, deserialize already created ones, sign them, sign messages, create multi-signatures and multi-addresses using Bitcoin Script. But its most important difference from most similar libraries is support for Segwit (bech32 encoding) addresses and transactions with them. You can get address using PublicKey.get_address, or create it from your own hash.\n\n**Examples:**\n\n``` python\n\n\u003e\u003e\u003e from btclib import address, Input, Output, Transaction, Service, AddressType, NetworkType\n\u003e\u003e\u003e\n\u003e\u003e\u003e wif = 'cMtnJjkY8hBrNdNN1kPBCMuTM5h4rxes9nrfRfktTn8tW6HW2pC2'\n\u003e\u003e\u003e pv = address.PrivateKey.from_wif(wif)\n\u003e\u003e\u003e pb = pv.public\n\u003e\u003e\u003e pb.compressed, pb.network\n(True, \u003cNetworkType.TEST: 'testnet'\u003e)\n\u003e\u003e\u003e\n\u003e\u003e\u003e pb = pb.change_network()  # create new instance with toggled network\n\u003e\u003e\u003e pb.get_address(AddressType.P2PKH).string\n'12Nj1W9U7xvzbRFsMErK8hsm7pYGZv9jsT'\n\u003e\u003e\u003e\n\u003e\u003e\u003e pb.get_address(AddressType.P2SH_P2WPKH).string\n'39YgiFhV8U5rWiUQLh5sDeGJvaft81k1sV'\n\u003e\u003e\u003e\n\u003e\u003e\u003e pb.get_address(AddressType.P2WPKH).string\n'bc1qpuf7m9ysjtnxhpfvx80v6lptsk33lm2x3t9s5w'\n\u003e\u003e\u003e\n\u003e\u003e\u003e pb.get_address(AddressType.P2WSH).string\n'bc1qxmh2drh6xsqyr5m4c8f72fwmqskmgk0rdqtggn6leswzf6m4kxvqhehfwy'\n\u003e\u003e\u003e\n\u003e\u003e\u003e\n\u003e\u003e\u003e pb.network = NetworkType.TEST  # change network in same instance\n\u003e\u003e\u003e addr = pb.get_address(AddressType.P2WSH)\n\u003e\u003e\u003e addr.string\n'tb1qxmh2drh6xsqyr5m4c8f72fwmqskmgk0rdqtggn6leswzf6m4kxvqq3px5t'\n\u003e\u003e\u003e\n\u003e\u003e\u003e # To see address info:\n\u003e\u003e\u003e s = Service(NetworkType.TEST)\n\u003e\u003e\u003e ainf = s.get_address(addr)  # request to one of the blockchain APIs\n\u003e\u003e\u003e ainf\nAddressInfo(received=100000, sent=0, tx_count=1, address=P2WSH.from_string('tb1qxmh2drh6xsqyr5m4c8f72fwmqskmgk0rdqtggn6leswzf6m4kxvqq3px5t'))\n\u003e\u003e\u003e ainf.balance\n100000\n\u003e\u003e\u003e\n\u003e\u003e\u003e # Get unspent outputs (UTXO):\n\u003e\u003e\u003e utxo = s.get_unspent(addr)\n\u003e\u003e\u003e utxo\n[Unspent(748131e63a0c27a407316cdafb7cad20ec0994c856862d63e50e706073bc7f00, 0, 100000, block=2103815, address=P2WSH('tb1qxmh2drh6xsqyr5m4c8f72fwmqskmgk0rdqtggn6leswzf6m4kxvqq3px5t'))]\n\u003e\u003e\u003e\n\u003e\u003e\u003e # Convert unspents to inputs\n\u003e\u003e\u003e # Input also contains a private key to be able to sign yourself in a transaction\n\u003e\u003e\u003e ins = [Input.from_unspent(u, pv, addr) for u in utxo]\n\u003e\u003e\u003e ous = [Output.from_address(address.from_string('tb1q7n075vj7tz4jm28zky7dzknuxujzl5vt6pxkz4'), 90000)]\n\u003e\u003e\u003e\n\u003e\u003e\u003e tx = Transaction(ins, ous)\n\u003e\u003e\u003e tx.default_sign()  # will be used: inp.default_sign() for inp in tx.inputs\n\u003e\u003e\u003e\n\u003e\u003e\u003e # Notice: inp.default_sign (tx) will try to sign itself in the tx transaction (set the desired inp.script / inp.witness value),\n\u003e\u003e\u003e # if inp.address was obtained using PublicKey.get_address, it will succeed, but if the address hash was generated by your custom script,\n\u003e\u003e\u003e # and the address object itself was obtained using address.\u003cP2PKH/P2SH/P2WPKH/P2WSH\u003e.from_hash, maybe the signature algorithm will differ\n\u003e\u003e\u003e # from the algorithm in inp.default_sign, for this use inp.custom_sign(script=Script(...), witness=Script(...)).\n\u003e\u003e\u003e # To summarize: if the address was obtained with PublicKey.get_address(), Input.default_sign will be able to sign it otherwise, use\n\u003e\u003e\u003e # inp.custom_sign with custom scripts.\n\u003e\u003e\u003e\n\u003e\u003e\u003e tx.serialize().hex()\n'02000000000101007fbc7360700ee5632d8656c89409ec20ad7cfbda6c3107a4270c3ae63181740000000000ffffffff01905f010000000000160014f4dfea325e58ab2da8e2b13cd...'\n\u003e\u003e\u003e tx.id.hex()\n'fff79b6d9f6a4068d5b8298c522177e9783af70d61653d628314e155a1e0e94e'\n\u003e\u003e\u003e b = s.push(tx)\n\u003e\u003e\u003e type(b)\n\u003cclass 'btclib.transaction.BroadcastedTransaction'\u003e\n\u003e\u003e\u003e b.get_confirmations(s.head())\n0\n\u003e\u003e\u003e\n\u003e\u003e\u003e # After a while\n\u003e\u003e\u003e b = s.get_transaction(tx.id.hex())\n\u003e\u003e\u003e b\n{'inputs': [{'txid': '748131e63a0c27a407316cdafb7cad20ec0994c856862d63e50e706073bc7f00', 'vout': 0, 'amount': 100000, 'script': '', 'witness': '473044022072909d3facf0377c1eee3b0000798ca0e76146777a026fd39cbe9307c3d73bb2022007d468e6f9985854d223a5f7742c6f312a48b4cdf9b64a46a6abb75939baf1830125512102e7b47c65a13f84fc934367d3d5be65015f62a56ab103d49df6aa25dacf540c0351ae', 'sequence': 4294967295}], 'outputs': [{'pkscript': '0014f4dfea325e58ab2da8e2b13cd15a7c37242fd18b', 'amount': 90000}], 'version': 2, 'locktime': 0}\n\u003e\u003e\u003e b.block\n2103822\n\u003e\u003e\u003e b.get_confirmations(s.head())\n718449\n```\n\nThis transaction - https://live.blockcypher.com/btc-testnet/tx/fff79b6d9f6a4068d5b8298c522177e9783af70d61653d628314e155a1e0e94e/.\n\nInstallation\n------------\n\nbtc-lib is distributed on `PyPI` and is available on Windows/Linux/macOS\nand Windows and supports Python 3.12+.\n\n```bash\n$ python3 -m pip install btc-lib\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqwerty-w%2Fbtc-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqwerty-w%2Fbtc-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqwerty-w%2Fbtc-lib/lists"}