kesa 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 (107) hide show
  1. kesa-0.1.0/LICENSE +21 -0
  2. kesa-0.1.0/PKG-INFO +510 -0
  3. kesa-0.1.0/README.md +480 -0
  4. kesa-0.1.0/kesa/__init__.py +16 -0
  5. kesa-0.1.0/kesa/backends/__init__.py +115 -0
  6. kesa-0.1.0/kesa/backends/base.py +920 -0
  7. kesa-0.1.0/kesa/backends/blink.py +750 -0
  8. kesa-0.1.0/kesa/backends/nostr.py +450 -0
  9. kesa-0.1.0/kesa/backends/nwc.py +1019 -0
  10. kesa-0.1.0/kesa/backends/relay.py +252 -0
  11. kesa-0.1.0/kesa/cli.py +933 -0
  12. kesa-0.1.0/kesa/config.py +461 -0
  13. kesa-0.1.0/kesa/csv_io.py +540 -0
  14. kesa-0.1.0/kesa/desktop.py +439 -0
  15. kesa-0.1.0/kesa/drafts.py +291 -0
  16. kesa-0.1.0/kesa/fees.py +195 -0
  17. kesa-0.1.0/kesa/held.py +656 -0
  18. kesa-0.1.0/kesa/history.py +148 -0
  19. kesa-0.1.0/kesa/keepawake.py +140 -0
  20. kesa-0.1.0/kesa/keystore.py +512 -0
  21. kesa-0.1.0/kesa/models.py +193 -0
  22. kesa-0.1.0/kesa/planner.py +330 -0
  23. kesa-0.1.0/kesa/report.py +755 -0
  24. kesa-0.1.0/kesa/runlock.py +134 -0
  25. kesa-0.1.0/kesa/runner.py +1187 -0
  26. kesa-0.1.0/kesa/runs.py +472 -0
  27. kesa-0.1.0/kesa/serve.py +6662 -0
  28. kesa-0.1.0/kesa/split.py +495 -0
  29. kesa-0.1.0/kesa/static/fonts/IBMPlexMono-Medium-Latin1.woff2 +0 -0
  30. kesa-0.1.0/kesa/static/fonts/IBMPlexMono-Regular-Latin1.woff2 +0 -0
  31. kesa-0.1.0/kesa/static/fonts/IBMPlexSans-Medium-Latin1.woff2 +0 -0
  32. kesa-0.1.0/kesa/static/fonts/IBMPlexSans-Regular-Latin1.woff2 +0 -0
  33. kesa-0.1.0/kesa/static/fonts/IBMPlexSans-Regular-Pi.woff2 +0 -0
  34. kesa-0.1.0/kesa/static/fonts/IBMPlexSans-SemiBold-Latin1.woff2 +0 -0
  35. kesa-0.1.0/kesa/static/fonts/IBMPlexSans-SemiBold-Pi.woff2 +0 -0
  36. kesa-0.1.0/kesa/static/fonts/OFL.txt +93 -0
  37. kesa-0.1.0/kesa/static/icon.svg +12 -0
  38. kesa-0.1.0/kesa/static/kesa.ico +0 -0
  39. kesa-0.1.0/kesa/static/kesa.png +0 -0
  40. kesa-0.1.0/kesa/static/wordmark.svg +6 -0
  41. kesa-0.1.0/kesa/timefmt.py +58 -0
  42. kesa-0.1.0/kesa.egg-info/PKG-INFO +510 -0
  43. kesa-0.1.0/kesa.egg-info/SOURCES.txt +105 -0
  44. kesa-0.1.0/kesa.egg-info/dependency_links.txt +1 -0
  45. kesa-0.1.0/kesa.egg-info/entry_points.txt +5 -0
  46. kesa-0.1.0/kesa.egg-info/requires.txt +11 -0
  47. kesa-0.1.0/kesa.egg-info/top_level.txt +1 -0
  48. kesa-0.1.0/pyproject.toml +71 -0
  49. kesa-0.1.0/setup.cfg +4 -0
  50. kesa-0.1.0/tests/test_audit_2026_11_29.py +407 -0
  51. kesa-0.1.0/tests/test_audit_l1_l2.py +520 -0
  52. kesa-0.1.0/tests/test_audit_l3_l4.py +441 -0
  53. kesa-0.1.0/tests/test_audit_low_info.py +677 -0
  54. kesa-0.1.0/tests/test_backlog_30_36.py +514 -0
  55. kesa-0.1.0/tests/test_blink.py +208 -0
  56. kesa-0.1.0/tests/test_blink_invoice.py +174 -0
  57. kesa-0.1.0/tests/test_blink_stop.py +300 -0
  58. kesa-0.1.0/tests/test_budget_refusal.py +57 -0
  59. kesa-0.1.0/tests/test_change_password.py +188 -0
  60. kesa-0.1.0/tests/test_check_reuse.py +540 -0
  61. kesa-0.1.0/tests/test_check_wait.py +470 -0
  62. kesa-0.1.0/tests/test_csv_io.py +104 -0
  63. kesa-0.1.0/tests/test_desktop.py +699 -0
  64. kesa-0.1.0/tests/test_double_pay_hunt.py +918 -0
  65. kesa-0.1.0/tests/test_drafts_runs.py +600 -0
  66. kesa-0.1.0/tests/test_encrypted_key_only.py +342 -0
  67. kesa-0.1.0/tests/test_fee_display.py +100 -0
  68. kesa-0.1.0/tests/test_fees.py +506 -0
  69. kesa-0.1.0/tests/test_fix_marked_not_sent.py +214 -0
  70. kesa-0.1.0/tests/test_given_up_wording.py +44 -0
  71. kesa-0.1.0/tests/test_hardening.py +362 -0
  72. kesa-0.1.0/tests/test_held_rows.py +944 -0
  73. kesa-0.1.0/tests/test_home_test_fixes.py +82 -0
  74. kesa-0.1.0/tests/test_hostile_servers.py +300 -0
  75. kesa-0.1.0/tests/test_input_hardening.py +150 -0
  76. kesa-0.1.0/tests/test_installer_licence.py +26 -0
  77. kesa-0.1.0/tests/test_keep_awake.py +386 -0
  78. kesa-0.1.0/tests/test_keystore.py +283 -0
  79. kesa-0.1.0/tests/test_launch_secret.py +189 -0
  80. kesa-0.1.0/tests/test_lookup_per_row.py +495 -0
  81. kesa-0.1.0/tests/test_never_pay_twice.py +1329 -0
  82. kesa-0.1.0/tests/test_nostr_crypto.py +249 -0
  83. kesa-0.1.0/tests/test_notices.py +27 -0
  84. kesa-0.1.0/tests/test_nwc_app.py +299 -0
  85. kesa-0.1.0/tests/test_nwc_audit_fixes.py +1056 -0
  86. kesa-0.1.0/tests/test_nwc_backend.py +663 -0
  87. kesa-0.1.0/tests/test_nwc_relay.py +205 -0
  88. kesa-0.1.0/tests/test_pentest_fixes.py +180 -0
  89. kesa-0.1.0/tests/test_planner.py +88 -0
  90. kesa-0.1.0/tests/test_pre_g3.py +176 -0
  91. kesa-0.1.0/tests/test_provider_breaker.py +776 -0
  92. kesa-0.1.0/tests/test_pypi_release.py +183 -0
  93. kesa-0.1.0/tests/test_repeat_payouts.py +858 -0
  94. kesa-0.1.0/tests/test_report.py +202 -0
  95. kesa-0.1.0/tests/test_resolve_and_cli.py +93 -0
  96. kesa-0.1.0/tests/test_round1.py +859 -0
  97. kesa-0.1.0/tests/test_round4a.py +1286 -0
  98. kesa-0.1.0/tests/test_round4b.py +619 -0
  99. kesa-0.1.0/tests/test_runner.py +167 -0
  100. kesa-0.1.0/tests/test_serve.py +679 -0
  101. kesa-0.1.0/tests/test_serve_g1.py +622 -0
  102. kesa-0.1.0/tests/test_serve_g2.py +856 -0
  103. kesa-0.1.0/tests/test_split.py +414 -0
  104. kesa-0.1.0/tests/test_split_stamp.py +73 -0
  105. kesa-0.1.0/tests/test_stop_run.py +530 -0
  106. kesa-0.1.0/tests/test_ux_open_items.py +862 -0
  107. kesa-0.1.0/tests/test_wait_setting.py +299 -0
kesa-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Kesa authors
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.
kesa-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,510 @@
1
+ Metadata-Version: 2.4
2
+ Name: kesa
3
+ Version: 0.1.0
4
+ Summary: Batch Lightning payouts from your own wallet: a list of recipients in, each one paid. Open source, runs on your computer.
5
+ Author: Glenn
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/BitcoinUbuntu/kesa
8
+ Project-URL: Issues, https://github.com/BitcoinUbuntu/kesa/issues
9
+ Project-URL: Changelog, https://github.com/BitcoinUbuntu/kesa/blob/main/CHANGELOG.md
10
+ Keywords: bitcoin,lightning,payouts,batch,blink
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Topic :: Office/Business :: Financial
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: httpx<1,>=0.28
21
+ Requires-Dist: httpcore<2,>=1.0
22
+ Requires-Dist: certifi
23
+ Requires-Dist: cryptography>=44
24
+ Requires-Dist: wsproto<2,>=1.2
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8; extra == "dev"
27
+ Provides-Extra: app
28
+ Requires-Dist: pywebview>=5.0; extra == "app"
29
+ Dynamic: license-file
30
+
31
+ <p>
32
+ <img src="https://raw.githubusercontent.com/BitcoinUbuntu/kesa/main/docs/brand/kesa-lockup-dark.png" alt="Kesa" width="360">
33
+ </p>
34
+
35
+ **Pay many people over Lightning, from your own wallet.** Kesa takes a list of recipients
36
+ and amounts, pays each one from **your** wallet, and keeps a record of every payment. It
37
+ pays any Lightning address (LUD-16), custodial or self-custodial. It's open source and
38
+ runs on your computer.
39
+
40
+ *Kesa* is from Igbo *késà*, "to share out widely". Say it KEH-sa.
41
+
42
+ > **Early alpha (v0.1.0): use with caution.** Kesa moves real money, and a Lightning
43
+ > payment can't be reversed. Start with small amounts and check your wallet after each
44
+ > run. Kesa is provided "as is", without warranty of any kind, under the
45
+ > [MIT licence](https://github.com/BitcoinUbuntu/kesa/blob/main/LICENSE): you use it at your own risk.
46
+
47
+ ## What it does
48
+
49
+ - **One list in, everyone paid.** Type the recipients in the app, or import a CSV. Set
50
+ each amount, or split a pot evenly or by shares.
51
+ - **Your wallet, your key.** Kesa sends from your own wallet: any wallet that offers
52
+ **NWC** (Nostr Wallet Connect), with a connection string, or [Blink](https://www.blink.sv)
53
+ where it's available, with an API key. Either is stored encrypted under your password,
54
+ and only unlocks when you type it: to send, and for a few other steps such as checking a
55
+ held payment with your wallet.
56
+ - **Straight from your wallet.** Kesa runs on your computer and tells your wallet to pay
57
+ each person. There's no sign-up and no Kesa server in between. What it does hold is
58
+ your wallet's key or connection string. Kesa never shares it: a Blink key is only ever
59
+ sent to Blink, and an NWC connection string never leaves your computer. It **can
60
+ spend**, though: cap what it can spend (see [Wallets](#wallets)).
61
+ - **Nothing sent by accident.** Every payout is a dry run until you confirm it with your
62
+ password. The balance is checked first.
63
+ - **No payment sent twice.** Every payment is recorded before it is sent. If Kesa can't tell
64
+ whether a payment went out (a timeout, a dropped connection), it holds that row and
65
+ never resends it by itself. A stopped payout picks up where it left off.
66
+ - **A record of everything.** Each payout keeps a results file (CSV) and a report of who
67
+ was paid, when, and the fee your wallet reported.
68
+
69
+ Grants, bounties, community rewards, sats payroll, event prizes: anything where many
70
+ people are paid at once.
71
+
72
+ ## Wallets
73
+
74
+ | Wallet | Status | What Kesa holds | How you cap it |
75
+ |---|---|---|---|
76
+ | **NWC** (Nostr Wallet Connect) | ✅ | a connection string | a budget on the connection, set in your wallet |
77
+ | [Blink](https://www.blink.sv) (its API isn't available in the US) | ✅ | an API key | spending limits and an expiry on the key, set in Blink |
78
+ | phoenixd, LND, CLN | planned | | |
79
+
80
+ **Tested with real sats:** Blink, plus Coinos, Primal and Minibits over NWC. Other NWC
81
+ wallets, such as Alby Hub, ZEUS and LNbits, should work:
82
+ [tell us](https://github.com/BitcoinUbuntu/kesa/issues) how it goes.
83
+
84
+ **Fees:** not every NWC wallet reports its fees, and some report them wrong (see Primal
85
+ below). The report shows what your wallet reports, or "–" when it reports none. For your
86
+ records and reconciling, use your wallet's own history.
87
+
88
+ **Wallet notes:**
89
+
90
+ - **Phone wallets** (e.g. Primal, Minibits): keep the app open for the whole run. Primal
91
+ doesn't answer otherwise.
92
+ - **Blink**: if it starts refusing payments, stop and resume later. Don't switch keys or
93
+ accounts to get past its limits.
94
+ - **Coinos**: it doesn't report fees (the report shows "–")
95
+ ([request](https://git.coinos.io/npub1w27mc4aa6m0ufe3xs5z3m6qyr52gc0rglept7vqlwx4xeaf72tasnqz70r/relay.coinos.io/coinos-server/issues/nevent1qythwumn8ghj7un9d3shjtn8d968gu3wwdcxzcm9qqszyn45s98c4xc8ugfscuqkfulns94nfz4jdr6m093wcf07qt4hejcp3uuwq)).
96
+ - **Primal**: it can report fees lower than they were
97
+ ([issue](https://github.com/PrimalHQ/primal-android-app/issues/1126)).
98
+ - **Minibits**: keep its balance small (Minibits calls itself experimental). It doesn't
99
+ report fees, and the balance it gives Kesa is what its spending limit still allows, not
100
+ what the wallet holds. It doesn't answer payment lookups, so Kesa can't check a held
101
+ payment with it: look in Minibits' own history (the answers are under **Answer
102
+ yourself**). If it shows paid, choose **It went out**. Only if it shows failed, choose
103
+ **Give up on it** and pay that person in a new payout. If it's pending or unclear,
104
+ leave it held.
105
+ - **LNbits**: use your own server. NWC needs its NWC Service Provider extension, which
106
+ only an admin can install.
107
+
108
+ Others can be added behind the same interface (`kesa/backends/base.py`); see
109
+ [CONTRIBUTING](https://github.com/BitcoinUbuntu/kesa/blob/main/CONTRIBUTING.md). Whether the funds themselves are custodial depends on
110
+ the wallet you connect: a Blink account is custodial (Blink holds the funds), an Alby Hub
111
+ is your own node.
112
+
113
+ ## What you need
114
+
115
+ - A wallet with sats in it, and either:
116
+ - **NWC**: a connection made for Kesa in your wallet, allowed to pay invoices, read the
117
+ balance and look up payments, **with a budget**. The app's **Docs → Connect an NWC
118
+ wallet** walks you through it.
119
+ - **Blink** (where available): an API key with **Read** and **Write** (not Receive). The
120
+ app's **Docs → Get a Blink key** walks you through it, including spending limits.
121
+
122
+ Kesa is a tool: you are responsible for the laws that apply to your payouts where you and
123
+ your recipients are (tax, payroll, exchange control, anti-money-laundering rules).
124
+
125
+ Kesa is for paying out from your own wallet. If you pay out on someone else's behalf,
126
+ check your wallet's terms: some forbid it without their approval
127
+ ([Blink](https://blink.sv/en/terms-conditions) §4.3(f),
128
+ [Minibits](https://minibits.cash/terms) §1.9).
129
+
130
+ ## Install
131
+
132
+ ### Windows: the desktop app
133
+
134
+ 1. Download `Kesa-<version>-setup.exe` from the
135
+ [Releases page](https://github.com/BitcoinUbuntu/kesa/releases).
136
+ 2. Run it. It installs for your user only (no admin prompt), adds Kesa to the Start menu,
137
+ and puts the `kesa` command on your PATH.
138
+ 3. **"Windows protected your PC".** The installer isn't code-signed yet (signing is
139
+ planned through the SignPath Foundation), so Windows SmartScreen stops it the first
140
+ time. Click **More info**, check the file name is `Kesa-<version>-setup.exe`, then
141
+ click **Run anyway**.
142
+
143
+ You can check the download first: compare its SHA-256 with `SHA256SUMS.txt` on the same
144
+ release.
145
+
146
+ ```powershell
147
+ Get-FileHash .\Kesa-0.1.0-setup.exe -Algorithm SHA256
148
+ ```
149
+
150
+ Kesa opens in its own window. It needs Microsoft Edge WebView2, which Windows 10 and 11
151
+ already include.
152
+
153
+ - Your settings, encrypted key, payment records (`runs\`) and drafts are kept in
154
+ `%APPDATA%\Kesa`. Uninstalling removes the program only, never that folder.
155
+ - Closing the window while a payout is sending doesn't stop it: Kesa asks, then closes by
156
+ itself when the run has finished.
157
+ - The command line comes with it (see the reference below), and shares the app's payment
158
+ records, so the never-pay-twice checks cover both. Open a **new** terminal after
159
+ installing so `kesa` is on your PATH.
160
+ - The licences of the software the app bundles (Python and its libraries) are in
161
+ `THIRD-PARTY-NOTICES.txt` in the install folder.
162
+ - To build the app yourself, see [docs/building.md](https://github.com/BitcoinUbuntu/kesa/blob/main/docs/building.md).
163
+
164
+ ### Mac, Linux (and Windows without the installer): with pip
165
+
166
+ You need Python 3.11 or newer. Install Kesa in a virtual environment:
167
+
168
+ ```bash
169
+ python3 -m venv kesa-env # Windows: py -m venv kesa-env
170
+ . kesa-env/bin/activate # Windows: kesa-env\Scripts\activate
171
+ pip install kesa
172
+ ```
173
+
174
+ Then make a folder for Kesa and start the app from it. Kesa keeps its settings, encrypted
175
+ key and payment records in the folder you start it from.
176
+
177
+ ```bash
178
+ mkdir ~/kesa && cd ~/kesa
179
+ kesa serve # then open the link it prints
180
+ ```
181
+
182
+ The link carries a secret made for this launch: only someone with it can use the app, so
183
+ keep it to yourself. Each start makes a new one. Best: open it in a private window used
184
+ only for Kesa (see [docs/security.md](https://github.com/BitcoinUbuntu/kesa/blob/main/docs/security.md), Known limits).
185
+
186
+ > **In a browser, extensions can read what you type on a page**: your API key once, and
187
+ > your password each time you send. Use a browser profile without extensions, or a private
188
+ > window (most browsers turn extensions off there), and don't let the browser save the
189
+ > password. The Windows app has its own window, with no extensions.
190
+
191
+ `kesa serve` only listens on your own computer (127.0.0.1), never on the network.
192
+
193
+ `kesa app` is the same app in its own window. Install it with
194
+ `pip install "kesa[app]"`. On Linux it also
195
+ needs GTK, which pip can't install. On Ubuntu or Mint, first run
196
+
197
+ ```bash
198
+ sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-webkit2-4.1
199
+ ```
200
+
201
+ and make the virtual environment with `python3 -m venv --system-site-packages kesa-env`.
202
+ The window is tested on Windows 11, macOS 11 (Intel) and Linux Mint 22.
203
+
204
+ ## Quick start
205
+
206
+ **In the app:**
207
+
208
+ 1. **Settings**: choose your wallet. For Blink, paste your API key and your BTC wallet's
209
+ ID; for NWC, paste the connection string. Choose a password (12+ characters) and
210
+ click **Save & connect**. Kesa checks the connection with your wallet (it reads your
211
+ balance, nothing is sent) before saving anything.
212
+ 2. **Build payout**: choose how to pay, add each recipient (or **Import CSV**), then
213
+ **Build payout**.
214
+ 3. **Review**: check who gets what, optionally **Check addresses**, then tick, enter your
215
+ password and send. The report shows each payment as it goes.
216
+
217
+ **On the command line:**
218
+
219
+ ```bash
220
+ kesa key set # connect Blink (key encrypted, wallet ID saved)
221
+ kesa key set --backend nwc # or an NWC wallet (connection string encrypted)
222
+ kesa pay payouts.csv # a dry run: the plan, nothing sent
223
+ kesa pay payouts.csv --confirm # send (asks for your password)
224
+ ```
225
+
226
+ ## The CSV format
227
+
228
+ A header row, then one row per payment. `address` and `amount_sats` are required; `name`,
229
+ `memo` and `id` are optional. Column order and spelling are flexible (`amount` or `sats`
230
+ work too). [`examples/payouts.csv`](https://github.com/BitcoinUbuntu/kesa/blob/main/examples/payouts.csv) is one to start from: with
231
+ `--no-resolve`, a dry run shows the plan without looking up its made-up addresses.
232
+
233
+ ```csv
234
+ name,address,amount_sats,memo,id
235
+ Alice,alice@example.com,21,Grant payout,g-001
236
+ Bob,bob@example.com,50,Bounty #42,g-002
237
+ ```
238
+
239
+ Each payout's results file holds the same columns plus `status, tx_id, fee_sats,
240
+ settled_at, error`. It is your receipt and what lets a stopped payout carry on.
241
+
242
+ **Resume:** run the same command on the same file again, or open the payout in the app.
243
+ Rows already `paid` are skipped, `failed` rows are tried again, and held rows (outcome
244
+ unknown) are **never** resent until you check your wallet and say what happened.
245
+
246
+ **Paying the same people again:** every payout stands alone. The dry run (and the app's
247
+ Review) tells you when an earlier run paid, holds or still owes someone in it. A row an
248
+ earlier run still owes is paid by resuming that run, not by adding it to a new payout. If
249
+ a run isn't finished and the new payout repeats it, both refuse it until that run is
250
+ finished. A row that can never be paid (a dead address) is moved out of its run with **Fix
251
+ failed rows** in the app.
252
+
253
+ ## Command-line reference
254
+
255
+ Every command has `--help`. Nothing is sent without `kesa pay ... --confirm`.
256
+
257
+ **`kesa serve`** – the app, in your browser (local only, 127.0.0.1).
258
+
259
+ ```bash
260
+ kesa serve # prints the link to open (port 8808)
261
+ kesa serve --port 8809 # another port (one copy per port)
262
+ kesa serve --config ~/kesa/kesa.toml
263
+ ```
264
+
265
+ **`kesa split`** – build a payout CSV from a list of people (the app's Build payout).
266
+ Each build is a payout of its own, with its own payout id; the file is named after it.
267
+
268
+ ```bash
269
+ kesa split team.csv # each row keeps its amount_sats
270
+ kesa split team.csv --pot 100000 # split 100,000 sats: evenly, or by a shares column
271
+ kesa split team.csv --memo "Payout {date} - {name}"
272
+ kesa split payout.csv # a new payout from an old one (same amounts)
273
+ ```
274
+
275
+ The list needs an `address` column; `name`, `amount_sats`, `shares`, `memo` and `id`
276
+ are optional. It writes `team.p-20261126-1500-ab12.csv` (or `--out PATH`).
277
+
278
+ **`kesa pay`** – pay a payout CSV from your wallet.
279
+
280
+ ```bash
281
+ kesa pay team.p-20261126-1500-ab12.csv # dry run: the plan, nothing sent
282
+ kesa pay team.p-20261126-1500-ab12.csv --confirm # send (asks for your key password)
283
+ ```
284
+
285
+ Running the same file again resumes it: paid rows are skipped, held rows are never
286
+ resent, failed rows are retried. Its results go to `runs/` beside the config, shared
287
+ with the app. `--fee-buffer SATS` sets a flat fee buffer for the balance check;
288
+ `--wait SECONDS` waits that long before each payment after the first. Ctrl-C during a
289
+ send stops it after the payment in progress (resume later); a second Ctrl-C quits at once.
290
+
291
+ **`kesa key set`** – connect your Blink wallet, as the app's Settings does: it asks for
292
+ your API key, your BTC wallet's ID and a password (12+ characters), checks them with
293
+ Blink (a balance read, nothing sent), then saves the key **encrypted** under that password
294
+ (`kesa.key.enc`) and the wallet ID in `kesa.toml`. With **`--backend nwc`** it asks for an
295
+ NWC connection string instead, checks it with your wallet (what it can do and its
296
+ balance, nothing sent) and saves it encrypted the same way. **`kesa key rotate`** changes
297
+ the password.
298
+
299
+ ```bash
300
+ kesa key set
301
+ kesa key set --backend nwc
302
+ kesa key rotate
303
+ ```
304
+
305
+ **`kesa resolve`** – after checking your wallet, settle one held row (outcome unknown).
306
+
307
+ ```bash
308
+ kesa resolve runs/kesa-run-ca3d977d6bdfb1d5548df4ad7cdc5ecd.results.csv 3 sent # it went out
309
+ kesa resolve runs/kesa-run-ca3d977d6bdfb1d5548df4ad7cdc5ecd.results.csv 3 not-sent # it didn't (password)
310
+ kesa resolve runs/kesa-run-ca3d977d6bdfb1d5548df4ad7cdc5ecd.results.csv 3 given-up # can't tell (password)
311
+ ```
312
+
313
+ `sent` marks it paid (never paid again). `not-sent` marks it failed: the next resume asks
314
+ your wallet first and pays it again only if the wallet confirms it didn't go out. When the
315
+ wallet can't confirm that, your answer counts 30 days after the payment was sent (a
316
+ Lightning payment can take that long to finish): mark it again then. `given-up` means the
317
+ row is never sent from that payout; if its payment did go through, paying the person again
318
+ pays them twice. The app does all of this on the report (with **Check with Blink**, or
319
+ **Check with your wallet** for NWC).
320
+
321
+ ## Your key and your settings
322
+
323
+ **Your API key or NWC connection string is only ever stored encrypted**, in
324
+ `kesa.key.enc`, by `kesa key set` or the app's Settings. A send asks for its password and
325
+ decrypts it in memory for that run only. Kesa never reads one from a settings file or an
326
+ environment variable: **never put it in `kesa.toml`.** If one is there, `kesa pay` stops
327
+ and says so, and the app warns you (saving Settings removes it). An NWC send also refuses
328
+ while any environment variable holds a connection string.
329
+
330
+ **Changing the password:** in Settings, **Change the password** (the current password,
331
+ then the new one twice; the key or connection string isn't entered again), or run
332
+ `kesa key rotate`. Replacing the saved wallet (**Connect a different wallet**) always needs
333
+ the current password. **Forgotten it?** Nothing can open the saved key, by design. Close Kesa, delete
334
+ `kesa.key.enc` (**Key file** in Settings shows where it is) and connect again with the key
335
+ or connection string from your wallet. Only the saved copy is lost; your payouts' records
336
+ stay.
337
+
338
+ **Disconnecting a wallet:** there is no button for it, on purpose (anyone using your open
339
+ app could otherwise swap in their own wallet). Delete or revoke the connection (or Blink
340
+ API key) in your wallet, which is what stops it spending; then close Kesa and delete
341
+ `kesa.key.enc`. Kesa shows "Not connected".
342
+
343
+ `kesa.toml` holds the ordinary settings, and Settings or `kesa key set` write it for you.
344
+ Which one a command uses: `--config`, else `kesa.toml` in the current folder, else the
345
+ desktop app's (`%APPDATA%\Kesa\kesa.toml`) when it exists. An environment variable beats
346
+ the file.
347
+
348
+ | Setting | Env | Meaning |
349
+ |---------|-----|---------|
350
+ | `backend` | | `blink` (the default) or `nwc` |
351
+ | `wallet_id` | `BLINK_WALLET_ID` | Blink: the BTC wallet to pay **from** |
352
+ | `api_url` | `BLINK_API_URL` | the Blink API; only `https://api.blink.sv/...` is accepted |
353
+ | `fee_per_payment` | `KESA_FEE_PER_PAYMENT` | fee buffer: sats per payment sent (default 10) |
354
+ | `fee_percent` | `KESA_FEE_PERCENT` | fee buffer: % of the total sent, decimals allowed (default 1) |
355
+ | `fee_buffer` | `KESA_FEE_BUFFER` | a flat fee buffer instead of the two above (`--fee-buffer N` too); in the file only when neither is set |
356
+ | `wait_seconds` | `KESA_WAIT_SECONDS` | seconds to wait before each payment after the first (default 0; `--wait N` too). For big payouts, see [Big payouts](#big-payouts-be-kind-to-providers) |
357
+ | `key_file` | `KESA_KEY_FILE` | where the encrypted key is (default: `kesa.key.enc` beside `kesa.toml`) |
358
+ | `nwc_relay` | | NWC: the relay's name, shown in the app (the connection itself comes only from the key file) |
359
+
360
+ The environment variables are for `kesa pay`; `kesa serve` reads the file only.
361
+
362
+ ## Your Blink API key: scopes and limits
363
+
364
+ Kesa only moves money *from* your wallet, so create the key with the **least
365
+ privilege that still works**, and lean on Blink's own server-side controls as a
366
+ backstop Kesa itself cannot provide.
367
+
368
+ **Scopes** – tick only:
369
+
370
+ | Scope | Kesa needs it? | Why |
371
+ |-------|----------------|-----|
372
+ | **Read** | ✅ | balance precheck + the wallet-history reconcile |
373
+ | **Write** | ✅ | the Lightning payment send |
374
+ | **Receive** | ❌ | Kesa never receives – a payout key should not be able to |
375
+
376
+ **Spending limits** (set them – Blink enforces these regardless of the client):
377
+
378
+ - **Daily** ≈ your largest expected batch total + routing fees + ~20% headroom.
379
+ High enough that one real batch (plus a retry run) clears, low enough that a bug
380
+ or a leaked key can't drain the wallet. If a send ever exceeds a limit, Blink
381
+ rejects it as a definite `FAILURE` (nothing moved – safe to resend after the
382
+ window resets), but it stalls the batch, so size with headroom.
383
+ - **Weekly / Monthly** ≈ your payout cadence sized up (weekly batches → weekly ≈
384
+ 2× a batch; monthly ≈ a month of batches + margin).
385
+ - Don't leave all four blank on a key that can pay.
386
+
387
+ Paying many people on one provider? See [Big payouts](#big-payouts-be-kind-to-providers).
388
+
389
+ ## Your NWC connection: permissions and budget
390
+
391
+ Make a connection just for Kesa in your wallet. Allow **pay invoices**, **read the
392
+ balance** and **look up payments** (Kesa uses the lookup to confirm a payment that
393
+ didn't answer clearly; without it, such a row waits for you to check by hand). Set a
394
+ **budget**: your wallet refuses anything over it, whatever Kesa does. When the wallet
395
+ reports the budget left (Alby Hub does; Coinos doesn't), Kesa also counts it in its
396
+ balance check, so a payout over it isn't started. Delete the connection in your wallet to
397
+ revoke it.
398
+
399
+ For a big payout, make sure the budget covers the whole payout plus fees. Paying many
400
+ people on one provider? See [Big payouts](#big-payouts-be-kind-to-providers).
401
+
402
+ **Two controls that matter more than the key or connection settings:**
403
+
404
+ - **Fund a dedicated payout wallet to roughly the batch amount.** Kesa pays only
405
+ from this one wallet, so a lightly-funded wallet is the hardest cap on the blast
406
+ radius – stronger than any API limit.
407
+ - **Use a short-lived key.** Create it for a run and revoke it after, or set an
408
+ expiry matching your payout cadence.
409
+
410
+ ## Big payouts: be kind to providers
411
+
412
+ Every payment asks the recipient's provider (the server behind their Lightning address)
413
+ for an invoice, then asks your wallet to pay it. Many of these services are run by small
414
+ teams, and they limit how much one user can ask of them. A big payout sent all at once can
415
+ hit those limits: the provider refuses for a while, and it may restrict your account or
416
+ block your connection, for a time or for good. Your own node removes your wallet
417
+ provider's limits, but not the recipients'.
418
+
419
+ - **Set a wait between payments** for big payouts (Settings, `wait_seconds`, or
420
+ `kesa pay --wait N`). For very big ones, a minute or two between payments, run
421
+ overnight, is kindest: check the report in the morning and resume anything that failed.
422
+ Kesa asks the computer not to sleep while a payout sends; the screen may still turn off.
423
+ Closing a laptop's lid can still put it to sleep.
424
+ - **Spread out payments to one provider.** If many recipients use the same provider,
425
+ split them over several payouts rather than one long burst.
426
+ - **When a provider keeps refusing, leave it be.** A recipient's provider may refuse to
427
+ make invoices after many in a short time, whichever wallet pays. When one refuses 3 in
428
+ a row, the run stops asking it and marks the rest of its rows "Not tried": nothing is
429
+ sent to them. Resume the run later, not straight away.
430
+
431
+ Kesa has no built-in caps per provider: limits change, and they are each provider's to
432
+ set. Using it considerately is up to you.
433
+
434
+ ## Safety
435
+
436
+ - **Payments go straight from your wallet.** Kesa only tells your wallet to pay; it has
437
+ no account or cloud service of its own: it runs on your computer. (Whether the funds
438
+ are custodial depends on your wallet: a Blink account is, Blink holds the funds in it.)
439
+ - **But its key can spend.** While your key or connection is unlocked for a send, Kesa
440
+ can pay from your wallet, up to the limits or budget set on it. Set those and keep the
441
+ payout wallet lightly funded (above).
442
+ - **Dry run by default.** A live send needs your confirmation and your password
443
+ (`--confirm` on the command line).
444
+ - **Balance check, fail closed.** It won't start if the balance can't be read, or is
445
+ below the total plus the fee buffer (by default 10 sats per payment plus 1% of the
446
+ total, kept back for routing fees).
447
+ - **Three outcomes, and the middle one is the trap.** Each payment is **paid**, a
448
+ definite **failure** (nothing moved, safe to send again), or **unknown** (a timeout, a
449
+ dropped connection, a server error: the money *may* have moved).
450
+ - **An unknown outcome is never resent automatically.** Kesa first checks your wallet
451
+ history for a matching payment; if it can't prove the payment went out, the row is held
452
+ for you to settle after checking your wallet (or by asking your wallet about that exact
453
+ payment). With NWC a payment counts as paid only with the wallet's proof (the preimage
454
+ of the invoice), and each one is requested once, never again by itself.
455
+ - **Recorded before sending.** A row is marked in the results file before its money
456
+ moves, so a crash mid-send leaves a held row, never a silent resend.
457
+ - **Awake while sending.** While a payout sends, Kesa asks the computer not to sleep, so
458
+ a long run isn't cut off mid-payment. The screen may still turn off.
459
+ - **Your key stays encrypted.** A Blink key is only ever sent to Blink's own API. An NWC
460
+ connection string never leaves your computer: Kesa signs and encrypts each request for
461
+ your wallet and passes it through the relay the string names.
462
+ - **Never logs secrets.**
463
+
464
+ More detail, and the known limits:
465
+ [docs/security.md](https://github.com/BitcoinUbuntu/kesa/blob/main/docs/security.md).
466
+
467
+ ## Privacy: no data collection
468
+
469
+ Kesa collects nothing. There are no accounts, no analytics, no tracking and no update check,
470
+ and nothing is ever sent to the people who make Kesa. Your settings, key, payouts and payment
471
+ records stay on your computer. Kesa only talks to:
472
+
473
+ - **your wallet** (Blink's API with your key, or for NWC the relay your connection string
474
+ names), to read your balance and send your payments;
475
+ - **each recipient's Lightning address server**, to get an invoice. That server learns the
476
+ amount and, if it accepts one, the memo.
477
+
478
+ ## How it works
479
+
480
+ - A small Python core with one payment-backend interface (`resolve` / `pay` / `status` /
481
+ `balance`). Two backends today, Blink (GraphQL) and NWC (NIP-47); others (phoenixd, LND,
482
+ CLN, BTCPay) can be added behind the same interface without touching the core.
483
+ - Every address is a Lightning address: Kesa asks it for an invoice (LUD-16) and pays
484
+ that invoice from your wallet.
485
+ - The results CSV is the state: no database. Resuming and the double-pay checks both read
486
+ it.
487
+ - The app (`kesa serve`) is a small local web server using only the Python standard
488
+ library; the Windows app shows it in its own window ([pywebview](https://pywebview.flowrl.com/)).
489
+
490
+ ```
491
+ kesa/ the program
492
+ backends/ payment rails (Blink and NWC today)
493
+ static/ the app's logo, icon and fonts
494
+ tests/ the offline test suite (no network, no real money)
495
+ packaging/ the Windows app build (PyInstaller, Inno Setup)
496
+ examples/ an example payout CSV
497
+ docs/ security notes, building the app, brand files
498
+ ```
499
+
500
+ ## Contributing
501
+
502
+ Bug reports and ideas are welcome: see [CONTRIBUTING.md](https://github.com/BitcoinUbuntu/kesa/blob/main/CONTRIBUTING.md). To report a
503
+ security problem privately, see [SECURITY.md](https://github.com/BitcoinUbuntu/kesa/blob/main/SECURITY.md). Changes between versions are in
504
+ [CHANGELOG.md](https://github.com/BitcoinUbuntu/kesa/blob/main/CHANGELOG.md).
505
+
506
+ ## Licence
507
+
508
+ [MIT](https://github.com/BitcoinUbuntu/kesa/blob/main/LICENSE). Provided "as is", without warranty of any kind.
509
+
510
+ Built by JigLab.