{"id":50712727,"url":"https://github.com/aguimaraes/btc-keygen","last_synced_at":"2026-06-09T16:32:25.276Z","repository":{"id":344533434,"uuid":"1182123352","full_name":"aguimaraes/btc-keygen","owner":"aguimaraes","description":"Minimal offline Bitcoin key generator for cold storage","archived":false,"fork":false,"pushed_at":"2026-04-14T18:50:23.000Z","size":151,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T20:28:05.537Z","etag":null,"topics":["air-gapped","bech32","bitcoin","cli","cold-storage","cryptocurrency","key-generator","offline","rust","secp256k1","segwit","wif"],"latest_commit_sha":null,"homepage":"https://aguimaraes.github.io/btc-keygen","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aguimaraes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE-APACHE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"aguimaraes","custom":["bitcoin:bc1q45yhck0lu4tk66at7jh2fqdn2n2pfq7y8dlydm"]}},"created_at":"2026-03-15T04:17:07.000Z","updated_at":"2026-04-14T18:50:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aguimaraes/btc-keygen","commit_stats":null,"previous_names":["aguimaraes/btc-keygen"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/aguimaraes/btc-keygen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguimaraes%2Fbtc-keygen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguimaraes%2Fbtc-keygen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguimaraes%2Fbtc-keygen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguimaraes%2Fbtc-keygen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aguimaraes","download_url":"https://codeload.github.com/aguimaraes/btc-keygen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aguimaraes%2Fbtc-keygen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34116457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["air-gapped","bech32","bitcoin","cli","cold-storage","cryptocurrency","key-generator","offline","rust","secp256k1","segwit","wif"],"created_at":"2026-06-09T16:32:19.838Z","updated_at":"2026-06-09T16:32:25.268Z","avatar_url":"https://github.com/aguimaraes.png","language":"Rust","funding_links":["https://github.com/sponsors/aguimaraes","bitcoin:bc1q45yhck0lu4tk66at7jh2fqdn2n2pfq7y8dlydm"],"categories":[],"sub_categories":[],"readme":"# btc-keygen\n\nMinimal offline Bitcoin key generator for cold storage.\n\n## What it does\n\nGenerates a Bitcoin private key and its corresponding native SegWit (Bech32) address in a single execution. Prints both to stdout, keeps no state, and exits. Designed to run on an air-gapped machine for cold storage key ceremonies.\n\n```\n$ btc-keygen generate\naddress: bc1q...\nwif: K...\n```\n\nEvery run creates a new keypair. The tool does not store secrets. If you lose the output, there is no way to recover the key.\n\n## Features\n\n- Cryptographically secure randomness from the OS\n- secp256k1 validation using Bitcoin Core's libsecp256k1\n- Compressed public keys, native SegWit (Bech32) addresses\n- WIF private key export\n- Optional hex and public key output\n- JSON output for scripting\n- Memory zeroization of secret material on exit\n- Zero network code — fully offline\n- Automated tests including known-answer vectors from the Bitcoin wiki\n- Cross-platform: Linux, macOS, Windows, BSDs\n\n## Library usage\n\nAdd to your project:\n\n```\ncargo add btc-keygen\n```\n\n```rust\nlet key = btc_keygen::generate()?;\nlet wif = btc_keygen::encode_wif(\u0026key);\nlet pubkey = btc_keygen::derive_pubkey(\u0026key);\nlet address = btc_keygen::derive_address(\u0026pubkey);\n```\n\n| Function                        | Input                 | Output                                         |\n| ------------------------------- | --------------------- | ---------------------------------------------- |\n| `generate()`                    | —                     | `Result\u003cPrivateKey, Error\u003e`                    |\n| `PrivateKey::from_bytes(bytes)` | `[u8; 32]`            | `Result\u003cPrivateKey, Error\u003e` (validated scalar) |\n| `PrivateKey::from_hex(hex)`     | `\u0026str` (64 hex chars) | `Result\u003cPrivateKey, Error\u003e` (validated scalar) |\n| `encode_wif(\u0026key)`              | `\u0026PrivateKey`         | `String` (starts with `K` or `L`)              |\n| `derive_pubkey(\u0026key)`           | `\u0026PrivateKey`         | `[u8; 33]` (compressed public key)             |\n| `derive_address(\u0026pubkey)`       | `\u0026[u8; 33]`           | `String` (Bech32 address, `bc1q...`)           |\n\n`PrivateKey` zeroizes its bytes when dropped. Full API docs at [docs.rs/btc-keygen](https://docs.rs/btc-keygen).\n\n## Install (CLI)\n\nDownload a pre-built binary from the\n[latest release](https://github.com/aguimaraes/btc-keygen/releases/latest),\nverify the SHA256 checksum, and run it.\n\nOr build from source:\n\n```\ngit clone https://github.com/aguimaraes/btc-keygen.git\ncd btc-keygen\ncargo build --release\n./target/release/btc-keygen generate\n```\n\nRequires [Rust](https://www.rust-lang.org/tools/install) and a C compiler.\n\n## Usage\n\n```\nbtc-keygen generate              # address + WIF\nbtc-keygen generate --hex        # also show raw private key hex\nbtc-keygen generate --pubkey     # also show compressed public key\nbtc-keygen generate --json       # JSON output\nbtc-keygen generate --hex --pubkey --json   # everything\n\n# Provide your own 64-character hex private key instead of OS entropy:\nbtc-keygen generate --from-hex \u003cHEX\u003e\n```\n\n## Security\n\nThis tool is designed for air-gapped cold storage key generation. See the\n[website](https://aguimaraes.github.io/btc-keygen) for a plain-language\nexplanation, or the [docs/](docs/) directory for the full threat model,\nsecurity assumptions, and dependency analysis.\n\n## License\n\nLicensed under either of\n\n- [MIT license](LICENSE-MIT)\n- [Apache License, Version 2.0](LICENSE-APACHE)\n\nat your option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faguimaraes%2Fbtc-keygen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faguimaraes%2Fbtc-keygen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faguimaraes%2Fbtc-keygen/lists"}