{"id":49587212,"url":"https://github.com/devasmodeus/hope-hash","last_synced_at":"2026-05-03T23:01:13.817Z","repository":{"id":354840758,"uuid":"1225382473","full_name":"devAsmodeus/Hope-Hash","owner":"devAsmodeus","description":"Educational Bitcoin solo miner in pure Python — Stratum V1, double-SHA-256, merkle root from scratch.","archived":false,"fork":false,"pushed_at":"2026-04-30T11:20:19.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-30T13:08:59.984Z","etag":null,"topics":["bitcoin","cryptocurrency","educational","mining","python","stratum"],"latest_commit_sha":null,"homepage":null,"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/devAsmodeus.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":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-30T08:13:42.000Z","updated_at":"2026-04-30T11:34:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/devAsmodeus/Hope-Hash","commit_stats":null,"previous_names":["devasmodeus/hope-hash"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/devAsmodeus/Hope-Hash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devAsmodeus%2FHope-Hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devAsmodeus%2FHope-Hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devAsmodeus%2FHope-Hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devAsmodeus%2FHope-Hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devAsmodeus","download_url":"https://codeload.github.com/devAsmodeus/Hope-Hash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devAsmodeus%2FHope-Hash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32587823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: 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","cryptocurrency","educational","mining","python","stratum"],"created_at":"2026-05-03T23:01:12.996Z","updated_at":"2026-05-03T23:01:13.810Z","avatar_url":"https://github.com/devAsmodeus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hope-Hash\n\n[English](#english) · [Русский](#russian)\n\n![Python](https://img.shields.io/badge/python-3.11%2B-blue)\n![License](https://img.shields.io/badge/license-MIT-green)\n![Tests](https://img.shields.io/badge/tests-242-brightgreen)\n![Stdlib only](https://img.shields.io/badge/deps-stdlib%20only-informational)\n\n---\n\n## English\n\n\u003e A pure-stdlib solo Bitcoin miner you can read in one sitting.\n\u003e Zero runtime dependencies. Built to be understood, not profitable.\n\n### What is this\n\nHope-Hash is a tiny but real solo Bitcoin miner written entirely in Python's\nstandard library. It speaks Stratum V1 over a raw TCP socket, builds the\n80-byte block header from scratch (BIP-141 witness commitment included for\nsolo mode), grinds SHA-256 in pure Python with mid-state caching, and submits\nshares the way a real miner does.\n\nThe point is education, not income. Your CPU at 2–5 MH/s versus the network\nat ~700 EH/s means the lottery odds are roughly 1 in 10^15 per day. The\ncodebase is small enough that you can step through every protocol message,\nevery byte of the header, and every endianness flip — see\n[`docs/architecture.en.md`](docs/architecture.en.md).\n\n### Status (v0.7.0)\n\n- Stratum V1 client with multi-pool failover (`--pool` repeatable).\n- Solo mode via `getblocktemplate` (`--solo --rpc-url ... --rpc-cookie ...`).\n- Multiprocessing nonce search, mid-state SHA-256, optional ctypes libcrypto.\n- Curses TUI, web dashboard with SSE, Prometheus `/metrics`, `/healthz`.\n- SQLite share journal, Telegram outbound + opt-in inbound commands.\n- Docker compose stack (miner + Prometheus + Grafana) with provisioning.\n- Bilingual docs (English / Russian) for users, deployers, and contributors.\n\n### Install\n\nPython ≥ 3.11. No third-party dependencies.\n\n```bash\npython -m pip install -e .\n# Windows:\npy -3.11 -m pip install -e .\n```\n\n### Run\n\nA mainnet wallet address you control (P2PKH `1...`, P2SH `3...`, bech32\n`bc1q...`, or Taproot `bc1p...`) is mandatory.\n\n```bash\nhope-hash bc1q5n2x4pvxhq8sxc7ck3uxq8sxc7ck3uxqzfm2py mylaptop\n# equivalent:\npython -m hope_hash bc1q5n2x4pvxhq8sxc7ck3uxq8sxc7ck3uxqzfm2py mylaptop\n```\n\nThe address is validated locally (BIP-173 / BIP-350 / Base58Check) before\nthe first network round-trip — typos fail fast with a precise message.\n\n### Advanced flags\n\n| Flag | Purpose |\n| --- | --- |\n| `--workers N` | Worker processes (default `cpu_count - 1`). |\n| `--db PATH` | SQLite journal file (`hope_hash.db` by default). `--no-db` disables. |\n| `--metrics-port PORT` | Prometheus `/metrics` + `/healthz` (default 9090, 0 = off). |\n| `--web-port PORT` | Web dashboard with SSE (default 0 = off). Loopback only by default. |\n| `--web-host HOST` | Bind host for the web dashboard (default `127.0.0.1`). |\n| `--tui` | Curses dashboard. Quit with `q` / `ESC`. |\n| `--pool HOST:PORT` | Repeatable. Round-robin failover after `--rotate-after-failures`. |\n| `--solo` | Solo mining via `getblocktemplate`. Requires `--rpc-url` plus auth. |\n| `--rpc-cookie PATH` | Cookie auth for bitcoind (overrides `--rpc-user/--rpc-pass`). |\n| `--sha-backend {auto,hashlib,ctypes}` | SHA-256 backend; auto picks ctypes if libcrypto loads. |\n| `--suggest-diff DIFF` | Send `mining.suggest_difficulty` after authorize (vardiff). |\n| `--demo` | Offline mode against a synthetic header. |\n| `--benchmark` | Hashrate microbenchmark, no networking. |\n| `--log-file PATH` | Mirror logs to a file (handy with `--tui`, which clears stderr). |\n| `--no-banner` | Skip the ASCII banner (cron / systemd). |\n\nFull help: `hope-hash --help`.\n\n### Demo\n\nNo address, no network, no shares — useful as a smoke test.\n\n```bash\nhope-hash --demo                         # synthetic header, --demo-diff 0.001\nhope-hash --demo --workers 4 --demo-diff 0.0001\n```\n\n### Benchmark\n\n```bash\nhope-hash --benchmark --bench-duration 5 --workers 4\nhope-hash --benchmark --backends         # hashlib mid-state vs ctypes\n```\n\nSample output on Intel i7-12700H, 4 workers, mid-state hashlib:\n\n```\n[bench] cpu:      16 logical cores\n[bench] workers:  4, duration: 5.0s\n[bench] === result ===\n[bench]   total hashes:   11,436,032\n[bench]   wall time:           5.01s\n[bench]   hashrate:        2.28 MH/s\n[bench]   per-worker:    570.23 KH/s\n```\n\n### Architecture\n\nOne process, several threads: a network supervisor reconnects with\nexponential backoff; a Stratum reader updates the shared `current_job`\nunder a `Lock`; the main thread feeds N multiprocessing workers that grind\nnonces with a cached mid-state. Optional daemons publish state to TUI,\nthe web dashboard, Prometheus, Telegram, and `/healthz`.\n\nSee [`docs/architecture.en.md`](docs/architecture.en.md) for the full\nthreading model, the hot-path explanation, and the BIP references.\n\n### Realistic expectations\n\n| Metric | Value |\n| --- | --- |\n| Hashrate (Python, 1 worker) | 50–200 KH/s |\n| Hashrate (4 workers, mid-state) | ~2–3 MH/s |\n| Bitcoin network hashrate | ~700 EH/s = 7 × 10²⁰ H/s |\n| Your share of the network | ~10⁻¹⁵ |\n| Expected blocks per day | 144 |\n| Solo block expectation | ~10¹³ days |\n\nThis is a lottery ticket with cosmically low odds. The interesting part is\nthe protocol, not the payout — for actual revenue use a pooled miner on\npurpose-built hardware.\n\n### Contributing\n\n- [`CLAUDE.md`](CLAUDE.md) — invariants the agent and humans must respect\n  (stdlib only, endianness rules, hot-path discipline).\n- [`ROADMAP.md`](ROADMAP.md) — feature backlog grouped by difficulty.\n- [`docs/getting-started.en.md`](docs/getting-started.en.md) — first-run\n  walkthrough for users with no Bitcoin background.\n- [`docs/deploy.en.md`](docs/deploy.en.md) — Docker compose, Prometheus,\n  Grafana, Telegram, healthchecks.\n\n---\n\n## Russian\n\n\u003e Соло-майнер биткоина на чистом stdlib, который можно прочитать за вечер.\n\u003e Ноль runtime-зависимостей. Цель — понять, как работает майнинг, а не\n\u003e заработать.\n\n### Что это\n\nHope-Hash — крошечный, но настоящий соло-майнер биткоина целиком на\nстандартной библиотеке Python. Он говорит на Stratum V1 поверх голого TCP,\nсобирает 80-байтовый block header руками (включая witness commitment по\nBIP-141 для solo-режима), крутит SHA-256 на pure-Python с mid-state\nкэшированием и отправляет шары как настоящий майнер.\n\nЦель — образовательная, не монетарная. CPU на 2–5 MH/s против сети с\n~700 EH/s — это лотерея с шансом примерно 1 к 10¹⁵ в день. Кода мало\nровно настолько, чтобы можно было пройти отладчиком каждое сообщение\nпротокола, каждый байт заголовка и каждый endianness-перевод. Подробности\nв [`docs/architecture.ru.md`](docs/architecture.ru.md).\n\n### Статус (v0.7.0)\n\n- Stratum V1 клиент с multi-pool failover (`--pool` повторяемый).\n- Solo-режим через `getblocktemplate` (`--solo --rpc-url ... --rpc-cookie ...`).\n- Multiprocessing-перебор nonce, mid-state SHA-256, опциональный ctypes-libcrypto.\n- Curses TUI, web-дашборд с SSE, Prometheus `/metrics`, `/healthz`.\n- SQLite-журнал шар, Telegram outbound + opt-in inbound-команды.\n- Docker compose стек (miner + Prometheus + Grafana) с provisioning.\n- Двуязычная документация (English / Русский) для пользователей, devops и контрибьюторов.\n\n### Установка\n\nPython ≥ 3.11. Сторонних зависимостей нет.\n\n```bash\npython -m pip install -e .\n# Windows:\npy -3.11 -m pip install -e .\n```\n\n### Запуск\n\nНужен реальный mainnet-адрес кошелька, который ты контролируешь (P2PKH\n`1...`, P2SH `3...`, bech32 `bc1q...` или Taproot `bc1p...`).\n\n```bash\nhope-hash bc1q5n2x4pvxhq8sxc7ck3uxq8sxc7ck3uxqzfm2py mylaptop\n# то же самое:\npython -m hope_hash bc1q5n2x4pvxhq8sxc7ck3uxq8sxc7ck3uxqzfm2py mylaptop\n```\n\nАдрес проверяется локально (BIP-173 / BIP-350 / Base58Check) до первого\nсетевого round-trip — опечатки отлавливаются с конкретным сообщением.\n\n### Расширенные флаги\n\n| Флаг | Назначение |\n| --- | --- |\n| `--workers N` | Число воркер-процессов (по умолчанию `cpu_count - 1`). |\n| `--db PATH` | SQLite-журнал (`hope_hash.db` по умолчанию). `--no-db` выключает. |\n| `--metrics-port PORT` | Prometheus `/metrics` + `/healthz` (default 9090, 0 — выкл). |\n| `--web-port PORT` | Web-дашборд с SSE (default 0 — выкл). По умолчанию только loopback. |\n| `--web-host HOST` | Bind-хост для web-дашборда (default `127.0.0.1`). |\n| `--tui` | Curses-дашборд. Выход на `q` / `ESC`. |\n| `--pool HOST:PORT` | Повторяемый. Round-robin failover после `--rotate-after-failures`. |\n| `--solo` | Solo-майнинг через `getblocktemplate`. Требует `--rpc-url` + auth. |\n| `--rpc-cookie PATH` | Cookie-auth для bitcoind (приоритет над `--rpc-user/--rpc-pass`). |\n| `--sha-backend {auto,hashlib,ctypes}` | SHA-256 backend; auto = ctypes если libcrypto загружается. |\n| `--suggest-diff DIFF` | Отправляет `mining.suggest_difficulty` после авторизации. |\n| `--demo` | Offline-режим с синтетическим заголовком. |\n| `--benchmark` | Микробенчмарк хешрейта без сети. |\n| `--log-file PATH` | Дублировать логи в файл (полезно с `--tui`, которая зачищает stderr). |\n| `--no-banner` | Без ASCII-баннера (cron / systemd). |\n\nПолная справка: `hope-hash --help`.\n\n### Demo\n\nБез адреса, без сети, без шар — удобно для smoke-теста.\n\n```bash\nhope-hash --demo                         # синтетический заголовок, --demo-diff 0.001\nhope-hash --demo --workers 4 --demo-diff 0.0001\n```\n\n### Бенчмарк\n\n```bash\nhope-hash --benchmark --bench-duration 5 --workers 4\nhope-hash --benchmark --backends         # hashlib mid-state vs ctypes\n```\n\nПример вывода на Intel i7-12700H, 4 воркера, mid-state hashlib:\n\n```\n[bench] cpu:      16 logical cores\n[bench] workers:  4, duration: 5.0s\n[bench] === result ===\n[bench]   total hashes:   11,436,032\n[bench]   wall time:           5.01s\n[bench]   hashrate:        2.28 MH/s\n[bench]   per-worker:    570.23 KH/s\n```\n\n### Архитектура\n\nОдин процесс, несколько нитей: сетевой supervisor переподключается с\nэкспоненциальным backoff; Stratum-reader обновляет общий `current_job`\nпод `Lock`; main thread кормит N multiprocessing-воркеров, перебирающих\nnonce с кэшированным mid-state. Опциональные демоны публикуют состояние\nв TUI, web-дашборд, Prometheus, Telegram и `/healthz`.\n\nПодробная threading-модель, hot-path и BIP-ссылки — в\n[`docs/architecture.ru.md`](docs/architecture.ru.md).\n\n### Реалистичные ожидания\n\n| Метрика | Значение |\n| --- | --- |\n| Хешрейт (Python, 1 воркер) | 50–200 KH/s |\n| Хешрейт (4 воркера, mid-state) | ~2–3 MH/s |\n| Хешрейт сети Bitcoin | ~700 EH/s = 7 × 10²⁰ H/s |\n| Доля от сети | ~10⁻¹⁵ |\n| Блоков в день | 144 |\n| Ожидание блока соло | ~10¹³ дней |\n\nЭто лотерейный билет с космически низкими шансами. Интересна не выплата,\nа протокол — для реальных доходов нужен пуловый майнер на специальном\nжелезе.\n\n### Контрибьюция\n\n- [`CLAUDE.md`](CLAUDE.md) — инварианты, которые соблюдают и агент, и\n  люди (только stdlib, правила endianness, дисциплина hot-path).\n- [`ROADMAP.md`](ROADMAP.md) — список фич, сгруппированный по сложности.\n- [`docs/getting-started.ru.md`](docs/getting-started.ru.md) — первый\n  запуск для пользователей без bitcoin-опыта.\n- [`docs/deploy.ru.md`](docs/deploy.ru.md) — Docker compose, Prometheus,\n  Grafana, Telegram, healthchecks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevasmodeus%2Fhope-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevasmodeus%2Fhope-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevasmodeus%2Fhope-hash/lists"}