{"id":24144953,"url":"https://github.com/plebhash/bitcoin_diff_calc","last_synced_at":"2026-06-08T04:32:48.055Z","repository":{"id":260355174,"uuid":"881059939","full_name":"plebhash/bitcoin_diff_calc","owner":"plebhash","description":"a convenient toolkit for calculations on Bitcoin mining difficulty","archived":false,"fork":false,"pushed_at":"2024-10-31T03:41:19.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T15:14:23.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plebhash.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2024-10-30T21:04:12.000Z","updated_at":"2024-11-01T05:08:47.000Z","dependencies_parsed_at":"2024-10-30T22:18:08.447Z","dependency_job_id":"e98f6f59-03b9-4add-ad4d-ae3a81c9f702","html_url":"https://github.com/plebhash/bitcoin_diff_calc","commit_stats":null,"previous_names":["plebhash/bitcoin_diff_calc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/plebhash/bitcoin_diff_calc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plebhash%2Fbitcoin_diff_calc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plebhash%2Fbitcoin_diff_calc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plebhash%2Fbitcoin_diff_calc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plebhash%2Fbitcoin_diff_calc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plebhash","download_url":"https://codeload.github.com/plebhash/bitcoin_diff_calc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plebhash%2Fbitcoin_diff_calc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34048681,"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-08T02:00:07.615Z","response_time":111,"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":[],"created_at":"2025-01-12T06:13:33.005Z","updated_at":"2026-06-08T04:32:48.032Z","avatar_url":"https://github.com/plebhash.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n⛏ bitcoin_diff_calc 🎯\n\u003cbr\u003e\n\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003e\na convenient toolkit for calculations on Bitcoin mining difficulty\n\u003c/h3\u003e\n\n## features\n\n- **Library Functions**: Reusable functions for calculating:\n    - Mining difficulty based on hashrate and block time.\n    - Mining difficulty of some specific hash.\n    - Target value based on difficulty.\n    - Compact target representation.\n- **Command-Line Interface (CLI)**:\n    - `difficulty` subcommand: Calculate mining difficulty based on hashrate and block time.\n    - `difficulty-from-hash` subcommand: Calculate mining difficulty of some specificy hash.\n    - `compact` subcommand: Calculate the compact target for a given difficulty.\n\n## CLI\n\n```shell\n$ ./target/release/bitcoin_diff_calc -h\na convenient toolkit for calculations on Bitcoin mining difficulty\n\nUsage: bitcoin_diff_calc \u003cCOMMAND\u003e\n\nCommands:\n  difficulty  Calculate difficulty based on hashrate and average block time\n  difficulty-from-hash  Calculate difficulty based on some specific hash\n  compact     Calculate compact target for some difficulty (as floating point)\n  help        Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help  Print help\n```\n\n### `difficulty` subcommand\n\nThis command is useful for estimating the difficulty based on:\n- hashrate (in H/s)\n- how often you expect the blocks (or shares) to be found (on average)\n\n```shell\n$ ./target/release/bitcoin_diff_calc difficulty -h\nCalculate difficulty based on hashrate and average block time\n\nUsage: bitcoin_diff_calc difficulty --hashrate \u003cHASHRATE\u003e --block-time \u003cBLOCK_TIME\u003e\n\nOptions:\n  -r, --hashrate \u003cHASHRATE\u003e      network hashrate (H/s)\n  -b, --block-time \u003cBLOCK_TIME\u003e  average block time (s)\n  -h, --help                     Print help\n```\n\nFor example, imagine:\n- hashrate: 100 TH/s (100_000_000_000_000 H/s)\n- average block time: 5 minutes (5 * 60 = 300 s)\n\n```shell\n$ ./target/release/bitcoin_diff_calc difficulty -r 100_000_000_000_000 -b 300\ndifficulty: 6984919\n```\n\n### `difficulty-from-hash` subcommand\n\nThis command is useful for calculating the difficulty of some specific hash:\n\n```shell\n$ ./target/release/bitcoin_diff_calc difficulty-from-hash -h\nCalculate difficulty based on some specific hash\n\nUsage: bitcoin_diff_calc difficulty-from-hash --hash \u003cHASH\u003e\n\nOptions:\n  -s, --hash \u003cHASH\u003e  hash\n  -h, --help         Print help\n```\n\nFor example:\n```shell\n$ ./target/release/bitcoin_diff_calc difficulty-from-hash -s 000000000008e36f853a1a994299a21faf7b8f1465ed7f33f732c479f4780a08\ndifficulty: 7373.076084262154\n```\n\n### `compact` subcommand\n\nBitcoin block headers carry the current target in the `bits` (a.k.a `nBits`) field [under compact representation](https://learnmeabitcoin.com/technical/block/bits/).\n\nThis command is useful for finding the compact representation of some specific target by providing the corresponding difficulty.\n\n```shell\n$ ./target/release/bitcoin_diff_calc compact -h\nCalculate compact target for some difficulty (as floating point)\n\nUsage: bitcoin_diff_calc compact --diff \u003cDIFF\u003e\n\nOptions:\n  -d, --diff \u003cDIFF\u003e  difficulty (as floating point)\n  -h, --help         Print help\n```\n\nFor example:\n```shell\n$ ./target/release/bitcoin_diff_calc compact -d 95672703408223.94\ncompact target: 0x1702f128\n```\n\n## license\n\nGNU General Public License v3.0","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplebhash%2Fbitcoin_diff_calc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplebhash%2Fbitcoin_diff_calc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplebhash%2Fbitcoin_diff_calc/lists"}