localnet-lite 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. localnet_lite-0.1.0/LICENSE +21 -0
  2. localnet_lite-0.1.0/PKG-INFO +199 -0
  3. localnet_lite-0.1.0/README.md +168 -0
  4. localnet_lite-0.1.0/pyproject.toml +80 -0
  5. localnet_lite-0.1.0/pyproject.toml.orig +65 -0
  6. localnet_lite-0.1.0/src/localnet_lite/__init__.py +33 -0
  7. localnet_lite-0.1.0/src/localnet_lite/_connect.py +297 -0
  8. localnet_lite-0.1.0/src/localnet_lite/cli.py +443 -0
  9. localnet_lite-0.1.0/src/localnet_lite/defaults/localnet_capture.json +3962 -0
  10. localnet_lite-0.1.0/src/localnet_lite/defaults/weights.json +82 -0
  11. localnet_lite-0.1.0/src/localnet_lite/dev_keys.py +79 -0
  12. localnet_lite-0.1.0/src/localnet_lite/doctor.py +323 -0
  13. localnet_lite-0.1.0/src/localnet_lite/errors.py +126 -0
  14. localnet_lite-0.1.0/src/localnet_lite/lite/__init__.py +1 -0
  15. localnet_lite-0.1.0/src/localnet_lite/lite/client.py +444 -0
  16. localnet_lite-0.1.0/src/localnet_lite/lite/commitments.py +277 -0
  17. localnet_lite-0.1.0/src/localnet_lite/lite/crv3.py +169 -0
  18. localnet_lite-0.1.0/src/localnet_lite/lite/defaults.py +221 -0
  19. localnet_lite-0.1.0/src/localnet_lite/lite/fixed.py +75 -0
  20. localnet_lite-0.1.0/src/localnet_lite/lite/memstats.py +23 -0
  21. localnet_lite-0.1.0/src/localnet_lite/lite/mlkem.py +48 -0
  22. localnet_lite-0.1.0/src/localnet_lite/lite/pool.py +210 -0
  23. localnet_lite-0.1.0/src/localnet_lite/lite/prices.py +76 -0
  24. localnet_lite-0.1.0/src/localnet_lite/lite/server.py +215 -0
  25. localnet_lite-0.1.0/src/localnet_lite/lite/service.py +164 -0
  26. localnet_lite-0.1.0/src/localnet_lite/lite/state.py +1555 -0
  27. localnet_lite-0.1.0/src/localnet_lite/lite/wire.py +36 -0
  28. localnet_lite-0.1.0/src/localnet_lite/lite/yuma.py +350 -0
  29. localnet_lite-0.1.0/src/localnet_lite/parity.py +419 -0
  30. localnet_lite-0.1.0/src/localnet_lite/real.py +645 -0
  31. localnet_lite-0.1.0/src/localnet_lite/real_setup.py +97 -0
  32. localnet_lite-0.1.0/src/localnet_lite/registration.py +42 -0
  33. localnet_lite-0.1.0/src/localnet_lite/runner.py +536 -0
  34. localnet_lite-0.1.0/src/localnet_lite/scaffold.py +70 -0
  35. localnet_lite-0.1.0/src/localnet_lite/scenario.py +238 -0
  36. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/README.md.tmpl +39 -0
  37. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/package/__init__.py +2 -0
  38. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/package/chain.py +99 -0
  39. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/package/miner.py +136 -0
  40. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/package/owner.py +49 -0
  41. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/package/protocol.py +37 -0
  42. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/package/validator.py +160 -0
  43. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/pyproject.toml.tmpl +10 -0
  44. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/scenario.yaml +18 -0
  45. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/tests/test_miner.py.tmpl +50 -0
  46. localnet_lite-0.1.0/src/localnet_lite/templates/subnet/tests/test_protocol.py.tmpl +19 -0
  47. localnet_lite-0.1.0/src/localnet_lite/top.py +228 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Juwonlo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: localnet-lite
3
+ Version: 0.1.0
4
+ Summary: Test Bittensor subnets on a laptop: a lightweight simulated chain, a remote real chain, and a parity check between them.
5
+ Keywords: bittensor,subnet,localnet,testing,simulator
6
+ Author: Juwonlo
7
+ Author-email: Juwonlo <141815043+Paulo-byt@users.noreply.github.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Software Development :: Testing
17
+ Requires-Dist: psutil>=6.0
18
+ Requires-Dist: pydantic>=2.7
19
+ Requires-Dist: pyyaml>=6.0
20
+ Requires-Dist: rich>=13.7
21
+ Requires-Dist: typer>=0.12
22
+ Requires-Dist: bittensor==11.3.7 ; extra == 'sdk'
23
+ Requires-Dist: bittensor-core==0.1.14 ; extra == 'sdk'
24
+ Requires-Python: ==3.13.*
25
+ Project-URL: Homepage, https://github.com/Paulo-byt/localnet-lite
26
+ Project-URL: Documentation, https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md
27
+ Project-URL: Issues, https://github.com/Paulo-byt/localnet-lite/issues
28
+ Project-URL: Changelog, https://github.com/Paulo-byt/localnet-lite/blob/main/CHANGELOG.md
29
+ Provides-Extra: sdk
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Localnet Lite
33
+
34
+ [![CI](https://github.com/Paulo-byt/localnet-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/Paulo-byt/localnet-lite/actions/workflows/ci.yml)
35
+ [![Parity with the official localnet](https://github.com/Paulo-byt/localnet-lite/actions/workflows/real-mode.yml/badge.svg)](https://github.com/Paulo-byt/localnet-lite/actions/workflows/real-mode.yml)
36
+ [![Docs run as written](https://github.com/Paulo-byt/localnet-lite/actions/workflows/fresh-user.yml/badge.svg)](https://github.com/Paulo-byt/localnet-lite/actions/workflows/fresh-user.yml)
37
+ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/Paulo-byt/localnet-lite)
38
+
39
+ Test a Bittensor subnet on an ordinary laptop, including 8 GB Windows machines (developed and
40
+ measured on a [7.9 GB Windows 11 laptop](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/DECISIONS.md)), without Docker and without
41
+ building the Rust chain locally.
42
+
43
+ ## Quick start
44
+
45
+ You need [git](https://git-scm.com/downloads) and [uv](https://docs.astral.sh/uv/) (uv
46
+ installs Python 3.13 for you). Install it as a package, in a new folder:
47
+
48
+ **Windows (PowerShell)**
49
+
50
+ ```powershell readme
51
+ uv venv --python 3.13
52
+ uv pip install "localnet-lite[sdk] @ git+https://github.com/Paulo-byt/localnet-lite" --only-binary bittensor-core `
53
+ --find-links https://github.com/Paulo-byt/localnet-lite/releases/expanded_assets/bittensor-core-0.1.14-win_amd64-r5
54
+ uv run lnl up
55
+ ```
56
+
57
+ **macOS and Linux**
58
+
59
+ ```bash readme
60
+ uv venv --python 3.13
61
+ uv pip install "localnet-lite[sdk] @ git+https://github.com/Paulo-byt/localnet-lite" --only-binary bittensor-core
62
+ uv run lnl up
63
+ ```
64
+
65
+ That starts the Lite chain with the dev accounts funded. `uv run lnl top` shows it live, and
66
+ `uv run lnl down` stops it. To run a miner and a validator against it and create your own
67
+ subnet, follow **[docs/QUICKSTART.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md)** (about 5 minutes; Windows first,
68
+ then macOS/Linux). CI runs both of these on all three OSes exactly as written, installing a
69
+ wheel built from the commit under test.
70
+
71
+ - **Not on PyPI yet.** Until the first release ([docs/PUBLISHING.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/PUBLISHING.md)) the
72
+ package comes from GitHub; afterwards the spec is just `"localnet-lite[sdk]"`.
73
+ - **`--only-binary bittensor-core`** means nothing is ever compiled. Upstream has no Windows
74
+ wheel for the SDK's native part, so on Windows `--find-links` takes the one this project
75
+ builds and attests ([below](#windows)).
76
+ - **With pip instead of uv:** make a Python 3.13 venv, activate it, and run `pip install`
77
+ with the same arguments. CI tests pip and uv on all three OSes.
78
+
79
+ To work on Localnet Lite itself, or to run the bundled examples, clone it instead:
80
+
81
+ ```sh readme-clone
82
+ git clone https://github.com/Paulo-byt/localnet-lite
83
+ cd localnet-lite
84
+ uv run lnl up
85
+ ```
86
+
87
+ ## What it does
88
+
89
+ | Mode | What runs where |
90
+ |---|---|
91
+ | **Lite** | A small simulated chain on your laptop, shared by your miner and validator processes. Yuma consensus and emissions are ported from the official runtime. |
92
+ | **Real** | The official subtensor localnet in a GitHub Codespace, forwarded to your laptop (`lnl up --real`). |
93
+ | **Parity** | The same scenario on Lite and on Real, with every difference reported (`lnl parity`). |
94
+
95
+ Your code connects with one line, `client = localnet_lite.connect()`. `LNL_MODE` picks Lite,
96
+ Real, or (unset) the normal SDK client.
97
+
98
+ **Network:** once installed, Lite needs no network, unless a subnet turns commit-reveal
99
+ weights (or timelocked commitments) on. Then, as the real chain does, it fetches drand
100
+ beacon pulses to reveal them. Offline, `lnl status` says the beacon can't be reached and how
101
+ many commits are waiting; as on the chain, a weight commit not revealed by the end of its
102
+ reveal epoch is dropped. Commit-reveal is off by default on Lite.
103
+
104
+ | Command | |
105
+ |---|---|
106
+ | `lnl doctor` | Checks RAM, ports and Python, and recommends Lite or Real mode |
107
+ | `lnl up` / `lnl down` / `lnl status` / `lnl top` | Starts, stops, inspects and watches the Lite chain |
108
+ | `lnl up --real` / `lnl down --real` | Real mode in one GitHub Codespace ([REAL_MODE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/REAL_MODE.md)) |
109
+ | `lnl scenario run <file>` | Runs a scenario ([scenarios/](https://github.com/Paulo-byt/localnet-lite/tree/main/scenarios)) on a private Lite chain |
110
+ | `lnl parity <file>` | Runs it on Lite and Real, and reports matches and differences |
111
+ | `lnl new subnet <name>` | Scaffolds a ready-to-run subnet project from the reference subnet |
112
+
113
+ ## Proof
114
+
115
+ Each claim links to the run or file that shows it.
116
+
117
+ | Claim | Evidence |
118
+ |---|---|
119
+ | Lite and the official localnet agree on every field parity compares, in every scenario: steps, Yuma's consensus, incentive, dividends, emission and bonds, every stake to the rao, and every pool, three subnets emitting at once included. Each scenario runs on its own fresh official localnet, 0 expected differences ([staking_gap.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/staking_gap.md), [run 47331475059](https://github.com/Paulo-byt/localnet-lite/actions/runs/47331475059)) | Every push: [Real mode and parity](https://github.com/Paulo-byt/localnet-lite/actions/workflows/real-mode.yml) (official image at the captured digest). Live codespace: [parity report](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/parity_live_basic.txt) |
120
+ | Real mode works end to end on a live codespace: node ready in about 80 s warm and 130 s cold; the `gh` forwarder uses about 40 MB on the laptop | [live run, 1 Dec](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/real_mode_live_2026-12-01.md), [first run, 30 Nov](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/real_mode_live_2026-11-30.md) |
121
+ | Neuron registration through a remote link was fixed after a root-cause investigation: 0 of 20 landed before; 15 of 15 since, all on the first attempt, in the permanent CI test through a 300 ms-RTT proxy (30 Nov to 2 Dec) | [investigation](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/registration_investigation.md), [every CI run](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/remote_link_ci_history.md) |
122
+ | Chain + miner + validator together use about 170 MB of RAM; the chain process alone (the RSS `lnl status` shows) peaks at about 30–46 MB | [DECISIONS.md D9](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/DECISIONS.md), re-measured on 2 Dec after Yuma and staking were added |
123
+ | Every scenario, and a freshly scaffolded subnet's, runs end to end on Lite on Windows with the real SDK (7 of 7) | [CI: sdk-windows, 4 Dec](https://github.com/Paulo-byt/localnet-lite/actions/runs/47337527199/job/145056600790) |
124
+ | The miner and validator run natively on Windows (for development) | [CI: sdk-windows](https://github.com/Paulo-byt/localnet-lite/actions/workflows/ci.yml) |
125
+ | A Windows build of `bittensor-core`, built in CI from the official sdist, with checksums and a provenance attestation | [release](https://github.com/Paulo-byt/localnet-lite/releases/tag/bittensor-core-0.1.14-win_amd64-r5), [windows-wheel.yml](https://github.com/Paulo-byt/localnet-lite/blob/main/.github/workflows/windows-wheel.yml) |
126
+ | The SDK's call surface is pinned by a trace from the official localnet, and a weekly job checks the latest SDK release against it | [latest-SDK drift](https://github.com/Paulo-byt/localnet-lite/actions/workflows/sdk-drift.yml) |
127
+ | The docs work as written | [fresh-user](https://github.com/Paulo-byt/localnet-lite/actions/workflows/fresh-user.yml) |
128
+
129
+ **Limitations:** everything Lite doesn't do, or does differently from the real chain, is listed
130
+ in [docs/LIMITATIONS.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/LIMITATIONS.md), each item FIXED (with evidence), UPSTREAM,
131
+ BY DESIGN or NOT YET.
132
+
133
+ ## The bittensor SDK
134
+
135
+ The SDK is an optional extra (`[sdk]`), pinned in `pyproject.toml`. The install above
136
+ includes it. In a clone: `uv sync --extra sdk` on Linux and macOS; Windows needs the steps in
137
+ [QUICKSTART.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md#from-a-clone).
138
+
139
+ ### Windows
140
+
141
+ Upstream publishes no Windows wheel for `bittensor-core`, the SDK's native part, so a plain
142
+ install would try to compile Rust. This repository builds that wheel in CI from the official
143
+ PyPI sdist and attaches it to a GitHub Release, with a `SHA256SUMS` file and a
144
+ build-provenance attestation. Python 3.13 is required on Windows: on older Pythons the SDK
145
+ can't write wallet files (`lnl doctor` warns you).
146
+
147
+ The install above fetches it through `--find-links`; the clone steps download it and check
148
+ its checksum. To verify the build provenance of a downloaded copy too:
149
+
150
+ ```powershell
151
+ gh attestation verify wheels/bittensor_core-0.1.14-cp310-abi3-win_amd64.whl --repo Paulo-byt/localnet-lite `
152
+ --signer-workflow Paulo-byt/localnet-lite/.github/workflows/windows-wheel.yml
153
+ ```
154
+
155
+ The attestation proves the wheel came from `.github/workflows/windows-wheel.yml` at a specific
156
+ commit of this repository. At that commit, `uv.lock` fixes the sdist's sha256, and the
157
+ workflow refuses to build unless the downloaded sdist matches both `uv.lock` and PyPI.
158
+
159
+ `uv run` keeps the installed SDK packages. A plain `uv sync` removes them (it syncs exactly),
160
+ so re-run the install lines after it.
161
+
162
+ ### Dev keys: no wallet files
163
+
164
+ For local testing, `localnet_lite.dev_keys` gives the well-known Substrate development
165
+ accounts (`//Alice`, `//Bob`, ...) as in-memory wallets that every SDK `wallet=` parameter
166
+ accepts. Nothing is written to disk. Their secrets are public, so `dev_wallet()` refuses
167
+ unless `LNL_MODE` is `lite` or `real`.
168
+
169
+ ```python
170
+ import os
171
+ from localnet_lite.dev_keys import dev_wallet
172
+
173
+ os.environ["LNL_MODE"] = "lite"
174
+ alice = dev_wallet("alice") # coldkey //Alice, hotkey //Alice//hot
175
+ ```
176
+
177
+ ## More
178
+
179
+ - [docs/QUICKSTART.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md): install to your own subnet
180
+ - [docs/TROUBLESHOOTING.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/TROUBLESHOOTING.md): every error message and its fix
181
+ - [docs/REAL_MODE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/REAL_MODE.md): Real mode, its costs, and any Docker host instead
182
+ - [docs/ARCHITECTURE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/ARCHITECTURE.md) and [docs/DECISIONS.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/DECISIONS.md): design and decisions
183
+ - [docs/WALKTHROUGH.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/WALKTHROUGH.md): a step-by-step demo
184
+
185
+ Built for the 2026 Bittensor Global Hackathon, Developer Tools & Infrastructure track.
186
+
187
+ ## Development
188
+
189
+ ```sh
190
+ uv run pytest
191
+ uv run ruff check .
192
+ uv run ruff format --check .
193
+ ```
194
+
195
+ Repository rules for contributors (and for AI assistants) are in [CLAUDE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/CLAUDE.md).
196
+
197
+ ## License
198
+
199
+ MIT. See [LICENSE](https://github.com/Paulo-byt/localnet-lite/blob/main/LICENSE).
@@ -0,0 +1,168 @@
1
+ # Localnet Lite
2
+
3
+ [![CI](https://github.com/Paulo-byt/localnet-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/Paulo-byt/localnet-lite/actions/workflows/ci.yml)
4
+ [![Parity with the official localnet](https://github.com/Paulo-byt/localnet-lite/actions/workflows/real-mode.yml/badge.svg)](https://github.com/Paulo-byt/localnet-lite/actions/workflows/real-mode.yml)
5
+ [![Docs run as written](https://github.com/Paulo-byt/localnet-lite/actions/workflows/fresh-user.yml/badge.svg)](https://github.com/Paulo-byt/localnet-lite/actions/workflows/fresh-user.yml)
6
+ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/Paulo-byt/localnet-lite)
7
+
8
+ Test a Bittensor subnet on an ordinary laptop, including 8 GB Windows machines (developed and
9
+ measured on a [7.9 GB Windows 11 laptop](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/DECISIONS.md)), without Docker and without
10
+ building the Rust chain locally.
11
+
12
+ ## Quick start
13
+
14
+ You need [git](https://git-scm.com/downloads) and [uv](https://docs.astral.sh/uv/) (uv
15
+ installs Python 3.13 for you). Install it as a package, in a new folder:
16
+
17
+ **Windows (PowerShell)**
18
+
19
+ ```powershell readme
20
+ uv venv --python 3.13
21
+ uv pip install "localnet-lite[sdk] @ git+https://github.com/Paulo-byt/localnet-lite" --only-binary bittensor-core `
22
+ --find-links https://github.com/Paulo-byt/localnet-lite/releases/expanded_assets/bittensor-core-0.1.14-win_amd64-r5
23
+ uv run lnl up
24
+ ```
25
+
26
+ **macOS and Linux**
27
+
28
+ ```bash readme
29
+ uv venv --python 3.13
30
+ uv pip install "localnet-lite[sdk] @ git+https://github.com/Paulo-byt/localnet-lite" --only-binary bittensor-core
31
+ uv run lnl up
32
+ ```
33
+
34
+ That starts the Lite chain with the dev accounts funded. `uv run lnl top` shows it live, and
35
+ `uv run lnl down` stops it. To run a miner and a validator against it and create your own
36
+ subnet, follow **[docs/QUICKSTART.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md)** (about 5 minutes; Windows first,
37
+ then macOS/Linux). CI runs both of these on all three OSes exactly as written, installing a
38
+ wheel built from the commit under test.
39
+
40
+ - **Not on PyPI yet.** Until the first release ([docs/PUBLISHING.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/PUBLISHING.md)) the
41
+ package comes from GitHub; afterwards the spec is just `"localnet-lite[sdk]"`.
42
+ - **`--only-binary bittensor-core`** means nothing is ever compiled. Upstream has no Windows
43
+ wheel for the SDK's native part, so on Windows `--find-links` takes the one this project
44
+ builds and attests ([below](#windows)).
45
+ - **With pip instead of uv:** make a Python 3.13 venv, activate it, and run `pip install`
46
+ with the same arguments. CI tests pip and uv on all three OSes.
47
+
48
+ To work on Localnet Lite itself, or to run the bundled examples, clone it instead:
49
+
50
+ ```sh readme-clone
51
+ git clone https://github.com/Paulo-byt/localnet-lite
52
+ cd localnet-lite
53
+ uv run lnl up
54
+ ```
55
+
56
+ ## What it does
57
+
58
+ | Mode | What runs where |
59
+ |---|---|
60
+ | **Lite** | A small simulated chain on your laptop, shared by your miner and validator processes. Yuma consensus and emissions are ported from the official runtime. |
61
+ | **Real** | The official subtensor localnet in a GitHub Codespace, forwarded to your laptop (`lnl up --real`). |
62
+ | **Parity** | The same scenario on Lite and on Real, with every difference reported (`lnl parity`). |
63
+
64
+ Your code connects with one line, `client = localnet_lite.connect()`. `LNL_MODE` picks Lite,
65
+ Real, or (unset) the normal SDK client.
66
+
67
+ **Network:** once installed, Lite needs no network, unless a subnet turns commit-reveal
68
+ weights (or timelocked commitments) on. Then, as the real chain does, it fetches drand
69
+ beacon pulses to reveal them. Offline, `lnl status` says the beacon can't be reached and how
70
+ many commits are waiting; as on the chain, a weight commit not revealed by the end of its
71
+ reveal epoch is dropped. Commit-reveal is off by default on Lite.
72
+
73
+ | Command | |
74
+ |---|---|
75
+ | `lnl doctor` | Checks RAM, ports and Python, and recommends Lite or Real mode |
76
+ | `lnl up` / `lnl down` / `lnl status` / `lnl top` | Starts, stops, inspects and watches the Lite chain |
77
+ | `lnl up --real` / `lnl down --real` | Real mode in one GitHub Codespace ([REAL_MODE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/REAL_MODE.md)) |
78
+ | `lnl scenario run <file>` | Runs a scenario ([scenarios/](https://github.com/Paulo-byt/localnet-lite/tree/main/scenarios)) on a private Lite chain |
79
+ | `lnl parity <file>` | Runs it on Lite and Real, and reports matches and differences |
80
+ | `lnl new subnet <name>` | Scaffolds a ready-to-run subnet project from the reference subnet |
81
+
82
+ ## Proof
83
+
84
+ Each claim links to the run or file that shows it.
85
+
86
+ | Claim | Evidence |
87
+ |---|---|
88
+ | Lite and the official localnet agree on every field parity compares, in every scenario: steps, Yuma's consensus, incentive, dividends, emission and bonds, every stake to the rao, and every pool, three subnets emitting at once included. Each scenario runs on its own fresh official localnet, 0 expected differences ([staking_gap.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/staking_gap.md), [run 47331475059](https://github.com/Paulo-byt/localnet-lite/actions/runs/47331475059)) | Every push: [Real mode and parity](https://github.com/Paulo-byt/localnet-lite/actions/workflows/real-mode.yml) (official image at the captured digest). Live codespace: [parity report](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/parity_live_basic.txt) |
89
+ | Real mode works end to end on a live codespace: node ready in about 80 s warm and 130 s cold; the `gh` forwarder uses about 40 MB on the laptop | [live run, 1 Dec](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/real_mode_live_2026-12-01.md), [first run, 30 Nov](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/real_mode_live_2026-11-30.md) |
90
+ | Neuron registration through a remote link was fixed after a root-cause investigation: 0 of 20 landed before; 15 of 15 since, all on the first attempt, in the permanent CI test through a 300 ms-RTT proxy (30 Nov to 2 Dec) | [investigation](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/registration_investigation.md), [every CI run](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/evidence/remote_link_ci_history.md) |
91
+ | Chain + miner + validator together use about 170 MB of RAM; the chain process alone (the RSS `lnl status` shows) peaks at about 30–46 MB | [DECISIONS.md D9](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/DECISIONS.md), re-measured on 2 Dec after Yuma and staking were added |
92
+ | Every scenario, and a freshly scaffolded subnet's, runs end to end on Lite on Windows with the real SDK (7 of 7) | [CI: sdk-windows, 4 Dec](https://github.com/Paulo-byt/localnet-lite/actions/runs/47337527199/job/145056600790) |
93
+ | The miner and validator run natively on Windows (for development) | [CI: sdk-windows](https://github.com/Paulo-byt/localnet-lite/actions/workflows/ci.yml) |
94
+ | A Windows build of `bittensor-core`, built in CI from the official sdist, with checksums and a provenance attestation | [release](https://github.com/Paulo-byt/localnet-lite/releases/tag/bittensor-core-0.1.14-win_amd64-r5), [windows-wheel.yml](https://github.com/Paulo-byt/localnet-lite/blob/main/.github/workflows/windows-wheel.yml) |
95
+ | The SDK's call surface is pinned by a trace from the official localnet, and a weekly job checks the latest SDK release against it | [latest-SDK drift](https://github.com/Paulo-byt/localnet-lite/actions/workflows/sdk-drift.yml) |
96
+ | The docs work as written | [fresh-user](https://github.com/Paulo-byt/localnet-lite/actions/workflows/fresh-user.yml) |
97
+
98
+ **Limitations:** everything Lite doesn't do, or does differently from the real chain, is listed
99
+ in [docs/LIMITATIONS.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/LIMITATIONS.md), each item FIXED (with evidence), UPSTREAM,
100
+ BY DESIGN or NOT YET.
101
+
102
+ ## The bittensor SDK
103
+
104
+ The SDK is an optional extra (`[sdk]`), pinned in `pyproject.toml`. The install above
105
+ includes it. In a clone: `uv sync --extra sdk` on Linux and macOS; Windows needs the steps in
106
+ [QUICKSTART.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md#from-a-clone).
107
+
108
+ ### Windows
109
+
110
+ Upstream publishes no Windows wheel for `bittensor-core`, the SDK's native part, so a plain
111
+ install would try to compile Rust. This repository builds that wheel in CI from the official
112
+ PyPI sdist and attaches it to a GitHub Release, with a `SHA256SUMS` file and a
113
+ build-provenance attestation. Python 3.13 is required on Windows: on older Pythons the SDK
114
+ can't write wallet files (`lnl doctor` warns you).
115
+
116
+ The install above fetches it through `--find-links`; the clone steps download it and check
117
+ its checksum. To verify the build provenance of a downloaded copy too:
118
+
119
+ ```powershell
120
+ gh attestation verify wheels/bittensor_core-0.1.14-cp310-abi3-win_amd64.whl --repo Paulo-byt/localnet-lite `
121
+ --signer-workflow Paulo-byt/localnet-lite/.github/workflows/windows-wheel.yml
122
+ ```
123
+
124
+ The attestation proves the wheel came from `.github/workflows/windows-wheel.yml` at a specific
125
+ commit of this repository. At that commit, `uv.lock` fixes the sdist's sha256, and the
126
+ workflow refuses to build unless the downloaded sdist matches both `uv.lock` and PyPI.
127
+
128
+ `uv run` keeps the installed SDK packages. A plain `uv sync` removes them (it syncs exactly),
129
+ so re-run the install lines after it.
130
+
131
+ ### Dev keys: no wallet files
132
+
133
+ For local testing, `localnet_lite.dev_keys` gives the well-known Substrate development
134
+ accounts (`//Alice`, `//Bob`, ...) as in-memory wallets that every SDK `wallet=` parameter
135
+ accepts. Nothing is written to disk. Their secrets are public, so `dev_wallet()` refuses
136
+ unless `LNL_MODE` is `lite` or `real`.
137
+
138
+ ```python
139
+ import os
140
+ from localnet_lite.dev_keys import dev_wallet
141
+
142
+ os.environ["LNL_MODE"] = "lite"
143
+ alice = dev_wallet("alice") # coldkey //Alice, hotkey //Alice//hot
144
+ ```
145
+
146
+ ## More
147
+
148
+ - [docs/QUICKSTART.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md): install to your own subnet
149
+ - [docs/TROUBLESHOOTING.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/TROUBLESHOOTING.md): every error message and its fix
150
+ - [docs/REAL_MODE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/REAL_MODE.md): Real mode, its costs, and any Docker host instead
151
+ - [docs/ARCHITECTURE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/ARCHITECTURE.md) and [docs/DECISIONS.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/DECISIONS.md): design and decisions
152
+ - [docs/WALKTHROUGH.md](https://github.com/Paulo-byt/localnet-lite/blob/main/docs/WALKTHROUGH.md): a step-by-step demo
153
+
154
+ Built for the 2026 Bittensor Global Hackathon, Developer Tools & Infrastructure track.
155
+
156
+ ## Development
157
+
158
+ ```sh
159
+ uv run pytest
160
+ uv run ruff check .
161
+ uv run ruff format --check .
162
+ ```
163
+
164
+ Repository rules for contributors (and for AI assistants) are in [CLAUDE.md](https://github.com/Paulo-byt/localnet-lite/blob/main/CLAUDE.md).
165
+
166
+ ## License
167
+
168
+ MIT. See [LICENSE](https://github.com/Paulo-byt/localnet-lite/blob/main/LICENSE).
@@ -0,0 +1,80 @@
1
+ [project]
2
+ name = "localnet-lite"
3
+ version = "0.1.0"
4
+ description = "Test Bittensor subnets on a laptop: a lightweight simulated chain, a remote real chain, and a parity check between them."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = "==3.13.*"
9
+ keywords = [
10
+ "bittensor",
11
+ "subnet",
12
+ "localnet",
13
+ "testing",
14
+ "simulator",
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Software Development :: Testing",
24
+ ]
25
+ dependencies = [
26
+ "psutil>=6.0",
27
+ "pydantic>=2.7",
28
+ "pyyaml>=6.0",
29
+ "rich>=13.7",
30
+ "typer>=0.12",
31
+ ]
32
+
33
+ [[project.authors]]
34
+ name = "Juwonlo"
35
+ email = "141815043+Paulo-byt@users.noreply.github.com"
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/Paulo-byt/localnet-lite"
39
+ Documentation = "https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md"
40
+ Issues = "https://github.com/Paulo-byt/localnet-lite/issues"
41
+ Changelog = "https://github.com/Paulo-byt/localnet-lite/blob/main/CHANGELOG.md"
42
+
43
+ [project.scripts]
44
+ lnl = "localnet_lite.cli:app"
45
+
46
+ [project.optional-dependencies]
47
+ sdk = [
48
+ "bittensor==11.3.7",
49
+ "bittensor-core==0.1.14",
50
+ ]
51
+
52
+ [dependency-groups]
53
+ dev = [
54
+ "pytest>=8.3",
55
+ "ruff>=0.8",
56
+ ]
57
+
58
+ [build-system]
59
+ requires = ["uv_build>=0.13.10,<0.14.0"]
60
+ build-backend = "uv_build"
61
+
62
+ [tool.ruff]
63
+ line-length = 100
64
+ target-version = "py313"
65
+
66
+ [tool.ruff.lint]
67
+ select = [
68
+ "E",
69
+ "F",
70
+ "W",
71
+ "I",
72
+ "B",
73
+ "UP",
74
+ "SIM",
75
+ "RUF",
76
+ ]
77
+
78
+ [tool.pytest.ini_options]
79
+ testpaths = ["tests"]
80
+ addopts = "-ra"
@@ -0,0 +1,65 @@
1
+ [project]
2
+ name = "localnet-lite"
3
+ version = "0.1.0"
4
+ description = "Test Bittensor subnets on a laptop: a lightweight simulated chain, a remote real chain, and a parity check between them."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [
9
+ { name = "Juwonlo", email = "141815043+Paulo-byt@users.noreply.github.com" }
10
+ ]
11
+ requires-python = "==3.13.*"
12
+ keywords = ["bittensor", "subnet", "localnet", "testing", "simulator"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: Software Development :: Testing",
21
+ ]
22
+ dependencies = [
23
+ "psutil>=6.0",
24
+ "pydantic>=2.7",
25
+ "pyyaml>=6.0",
26
+ "rich>=13.7",
27
+ "typer>=0.12",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/Paulo-byt/localnet-lite"
32
+ Documentation = "https://github.com/Paulo-byt/localnet-lite/blob/main/docs/QUICKSTART.md"
33
+ Issues = "https://github.com/Paulo-byt/localnet-lite/issues"
34
+ Changelog = "https://github.com/Paulo-byt/localnet-lite/blob/main/CHANGELOG.md"
35
+
36
+ [project.scripts]
37
+ lnl = "localnet_lite.cli:app"
38
+
39
+ [project.optional-dependencies]
40
+ sdk = [
41
+ "bittensor==11.3.7",
42
+ # the version CI tests on every OS, and the one with our attested Windows wheel (D22)
43
+ "bittensor-core==0.1.14",
44
+ ]
45
+
46
+ [dependency-groups]
47
+ dev = [
48
+ "pytest>=8.3",
49
+ "ruff>=0.8",
50
+ ]
51
+
52
+ [build-system]
53
+ requires = ["uv_build>=0.13.10,<0.14.0"]
54
+ build-backend = "uv_build"
55
+
56
+ [tool.ruff]
57
+ line-length = 100
58
+ target-version = "py313"
59
+
60
+ [tool.ruff.lint]
61
+ select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF"]
62
+
63
+ [tool.pytest.ini_options]
64
+ testpaths = ["tests"]
65
+ addopts = "-ra"
@@ -0,0 +1,33 @@
1
+ """Localnet Lite: test Bittensor subnets on a laptop.
2
+
3
+ import localnet_lite
4
+ client = localnet_lite.connect() # LNL_MODE=lite | real | unset (plain SDK client)
5
+
6
+ Importing this package stays light (no bittensor import) so `lnl doctor` keeps its budget.
7
+ """
8
+
9
+ from importlib.metadata import PackageNotFoundError, version
10
+
11
+ from .errors import LiteUnsupportedError
12
+
13
+ try:
14
+ __version__ = version("localnet-lite")
15
+ except PackageNotFoundError: # running from a source tree without an install
16
+ __version__ = "0.0.0+unknown"
17
+
18
+
19
+ def connect(network=None, **kw):
20
+ """An async bittensor Client chosen by LNL_MODE (see localnet_lite._connect)."""
21
+ from ._connect import connect as _connect
22
+
23
+ return _connect(network, **kw)
24
+
25
+
26
+ def connect_blocking(network=None, **kw):
27
+ """A blocking bittensor Subtensor chosen by LNL_MODE (see localnet_lite._connect)."""
28
+ from ._connect import connect_blocking as _connect_blocking
29
+
30
+ return _connect_blocking(network, **kw)
31
+
32
+
33
+ __all__ = ["LiteUnsupportedError", "__version__", "connect", "connect_blocking"]