Metadata-Version: 2.4
Name: bit-byte-block
Version: 0.1.1
Summary: Local Bitcoin Stratum proxy and upstream status tooling for solo.ckpool.org.
Author-email: Cason Konzer <casonk@umich.edu>
License: MIT License
        
        Copyright (c) 2026
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/casonk/bit-byte-block
Project-URL: Repository, https://github.com/casonk/bit-byte-block
Project-URL: Changelog, https://github.com/casonk/bit-byte-block/blob/main/CHANGELOG.md
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: wallet
Requires-Dist: cryptography; extra == "wallet"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: black; extra == "dev"
Dynamic: license-file

# bit-byte-block

Local Bitcoin mining ingress and monitoring for `solo.ckpool.org`.

`bit-byte-block` runs a lightweight Stratum TCP proxy on your local network so
ASIC miners can point at one stable LAN endpoint while the proxy forwards their
traffic upstream to Solo CKPool. The initial scope is intentionally small:
transport relay, upstream failover, and pool-status inspection.

## Why This Repo Exists

- Keep miner configuration pointed at one local host instead of hard-coding the
  public pool hostname into every device.
- Centralize upstream defaults for Solo CKPool.
- Provide a small place to grow local operational tooling without bundling pool
  software or ASIC-specific firmware.

## Upstream Defaults

Solo CKPool documents these defaults on the public pool homepage:

- Primary host: `solo.ckpool.org`
- Standard port: `3333`
- High-difficulty rentals port: `4334`
- Username format: `BTC_ADDRESS.worker`
- Password: ignored by the pool

Regional notes from the same upstream:

- Europe and Africa: `eusolo.ckpool.org`
- Oceania: `ausolo.ckpool.org`
- IPv4-only: `solo4.ckpool.org`
- IPv6-only: `solo6.ckpool.org`

## Install On Fedora

An RPM with a ready-to-enable systemd service is built from each release:

```bash
sudo dnf copr enable casonk/tools
sudo dnf install bit-byte-block
sudo systemctl enable --now bit-byte-block
```

Settings live in `/etc/bit-byte-block/bit-byte-block.env`. See
[packaging/README.md](packaging/README.md) for firewalld, local builds, and
releases.

## Quick Start

```bash
./bootstrap.sh
bash scripts/run_proxy.sh
```

`bootstrap.sh` creates `.venv`, installs the package in editable mode, verifies
the `bit-byte-block` command runs, and seeds `config/bit-byte-block.env` from
the example if you do not already have one. An existing config is never
overwritten.

Use `./bootstrap.sh --no-dev` to skip the test and lint dependencies, or
`./bootstrap.sh --venv PATH` to build the environment elsewhere.

<details>
<summary>Why not <code>pip install -e ".[dev]"</code> directly?</summary>

Since [PEP 668](https://peps.python.org/pep-0668/), Debian, Ubuntu, Arch and
openSUSE mark the system Python as externally managed, and pip refuses to
install into it:

```
error: externally-managed-environment
```

Fedora still allows it, which is why the old instruction worked on some
machines and not others. Installing into a virtualenv is correct on all of
them, and on macOS and Windows too.

</details>

The wrapper script loads `config/bit-byte-block.env` if present, then starts the
proxy. Point miners at the host running this repo, for example:

- Pool host: `192.168.1.50`
- Pool port: `3333`
- Username: `YOUR_BTC_ADDRESS.s19-01`
- Password: `x`

## CLI

```bash
# Start the local proxy with env-file defaults
python3 -m bit_byte_block proxy --env-file config/bit-byte-block.env

# Show the upstream pool-status snapshot
python3 -m bit_byte_block status --env-file config/bit-byte-block.env
```

The status command fetches the public status document exposed by the upstream
pool and prints a compact summary of connected workers, hashrate windows, share
counts, and best share.

## Local Validation

```bash
pre-commit run --all-files
pytest -q
```

## Contributing

See `CONTRIBUTING.md`.

## License

MIT. See `LICENSE`.
