agent-bitcoin 26.2.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 (106) hide show
  1. agent_bitcoin-26.2.0/CHANGELOG.md +418 -0
  2. agent_bitcoin-26.2.0/LICENSE +21 -0
  3. agent_bitcoin-26.2.0/MANIFEST.in +10 -0
  4. agent_bitcoin-26.2.0/PKG-INFO +211 -0
  5. agent_bitcoin-26.2.0/README.md +170 -0
  6. agent_bitcoin-26.2.0/agent_bitcoin/__init__.py +65 -0
  7. agent_bitcoin-26.2.0/agent_bitcoin/agents/__init__.py +15 -0
  8. agent_bitcoin-26.2.0/agent_bitcoin/agents/base.py +0 -0
  9. agent_bitcoin-26.2.0/agent_bitcoin/agents/payment_decision.py +244 -0
  10. agent_bitcoin-26.2.0/agent_bitcoin/client.py +258 -0
  11. agent_bitcoin-26.2.0/agent_bitcoin/constants.py +116 -0
  12. agent_bitcoin-26.2.0/agent_bitcoin/exceptions.py +46 -0
  13. agent_bitcoin-26.2.0/agent_bitcoin/l402/__init__.py +10 -0
  14. agent_bitcoin-26.2.0/agent_bitcoin/l402/client.py +183 -0
  15. agent_bitcoin-26.2.0/agent_bitcoin/lightning.py +499 -0
  16. agent_bitcoin-26.2.0/agent_bitcoin/models.py +96 -0
  17. agent_bitcoin-26.2.0/agent_bitcoin/nostr/__init__.py +20 -0
  18. agent_bitcoin-26.2.0/agent_bitcoin/nostr/nip17.py +93 -0
  19. agent_bitcoin-26.2.0/agent_bitcoin/nostr/nip44.py +174 -0
  20. agent_bitcoin-26.2.0/agent_bitcoin/nostr/nip46.py +183 -0
  21. agent_bitcoin-26.2.0/agent_bitcoin/nostr/relay.py +331 -0
  22. agent_bitcoin-26.2.0/agent_bitcoin/nostr/swarm.py +88 -0
  23. agent_bitcoin-26.2.0/agent_bitcoin/nwc/__init__.py +73 -0
  24. agent_bitcoin-26.2.0/agent_bitcoin/nwc/bus.py +84 -0
  25. agent_bitcoin-26.2.0/agent_bitcoin/nwc/client.py +342 -0
  26. agent_bitcoin-26.2.0/agent_bitcoin/nwc/crypto.py +103 -0
  27. agent_bitcoin-26.2.0/agent_bitcoin/nwc/errors.py +21 -0
  28. agent_bitcoin-26.2.0/agent_bitcoin/nwc/flow.py +99 -0
  29. agent_bitcoin-26.2.0/agent_bitcoin/nwc/policy.py +180 -0
  30. agent_bitcoin-26.2.0/agent_bitcoin/nwc/relays.py +18 -0
  31. agent_bitcoin-26.2.0/agent_bitcoin/nwc/service.py +312 -0
  32. agent_bitcoin-26.2.0/agent_bitcoin/nwc/uri.py +123 -0
  33. agent_bitcoin-26.2.0/agent_bitcoin/prompts.py +24 -0
  34. agent_bitcoin-26.2.0/agent_bitcoin/spend_ledger.py +108 -0
  35. agent_bitcoin-26.2.0/agent_bitcoin/utils.py +51 -0
  36. agent_bitcoin-26.2.0/agent_bitcoin.egg-info/PKG-INFO +211 -0
  37. agent_bitcoin-26.2.0/agent_bitcoin.egg-info/SOURCES.txt +104 -0
  38. agent_bitcoin-26.2.0/agent_bitcoin.egg-info/dependency_links.txt +1 -0
  39. agent_bitcoin-26.2.0/agent_bitcoin.egg-info/requires.txt +18 -0
  40. agent_bitcoin-26.2.0/agent_bitcoin.egg-info/top_level.txt +1 -0
  41. agent_bitcoin-26.2.0/docs/backend.md +833 -0
  42. agent_bitcoin-26.2.0/docs/daily-ops-signet.md +83 -0
  43. agent_bitcoin-26.2.0/docs/index.md +55 -0
  44. agent_bitcoin-26.2.0/docs/l402-aperture.md +110 -0
  45. agent_bitcoin-26.2.0/docs/liquidity-automation.md +134 -0
  46. agent_bitcoin-26.2.0/docs/liquidity-topology-b.md +204 -0
  47. agent_bitcoin-26.2.0/docs/lnd-backup-restore.md +153 -0
  48. agent_bitcoin-26.2.0/docs/lnd-client.md +110 -0
  49. agent_bitcoin-26.2.0/docs/loop-autoloop.md +256 -0
  50. agent_bitcoin-26.2.0/docs/loop-multi-network.md +158 -0
  51. agent_bitcoin-26.2.0/docs/m3-production-swarm.md +116 -0
  52. agent_bitcoin-26.2.0/docs/mainnet-infra.md +223 -0
  53. agent_bitcoin-26.2.0/docs/mainnet-pilot.md +340 -0
  54. agent_bitcoin-26.2.0/docs/nip44-nwc-relays.md +75 -0
  55. agent_bitcoin-26.2.0/docs/nostr-agent-identity.md +617 -0
  56. agent_bitcoin-26.2.0/docs/nwc-automatic-wallets.md +345 -0
  57. agent_bitcoin-26.2.0/docs/public-routing-loop.md +401 -0
  58. agent_bitcoin-26.2.0/docs/security-hardening.md +377 -0
  59. agent_bitcoin-26.2.0/docs/setup.md +39 -0
  60. agent_bitcoin-26.2.0/docs/signet-dress-rehearsal.md +251 -0
  61. agent_bitcoin-26.2.0/docs/signet.md +512 -0
  62. agent_bitcoin-26.2.0/examples/agent_api_example.py +68 -0
  63. agent_bitcoin-26.2.0/examples/basic_usage.py +15 -0
  64. agent_bitcoin-26.2.0/examples/full_intelligent_agent_grok.py +97 -0
  65. agent_bitcoin-26.2.0/examples/full_intelligent_agent_ollama.py +95 -0
  66. agent_bitcoin-26.2.0/examples/grok_example.py +24 -0
  67. agent_bitcoin-26.2.0/examples/l402_pay.py +63 -0
  68. agent_bitcoin-26.2.0/examples/nip46_bunker_demo.py +30 -0
  69. agent_bitcoin-26.2.0/examples/nostr_agent_poc.py +408 -0
  70. agent_bitcoin-26.2.0/examples/nostr_common.py +171 -0
  71. agent_bitcoin-26.2.0/examples/nostr_phase_b_payment.py +447 -0
  72. agent_bitcoin-26.2.0/examples/nostr_phase_c_signer.py +506 -0
  73. agent_bitcoin-26.2.0/examples/nwc_decision_pay.py +190 -0
  74. agent_bitcoin-26.2.0/examples/nwc_dual_pay_runbook.py +42 -0
  75. agent_bitcoin-26.2.0/examples/nwc_mainnet_smoke.py +173 -0
  76. agent_bitcoin-26.2.0/examples/nwc_regtest_smoke.py +135 -0
  77. agent_bitcoin-26.2.0/examples/nwc_relay_client.py +94 -0
  78. agent_bitcoin-26.2.0/examples/nwc_relay_loopback.py +99 -0
  79. agent_bitcoin-26.2.0/examples/nwc_relay_service.py +157 -0
  80. agent_bitcoin-26.2.0/examples/ollama_example.py +65 -0
  81. agent_bitcoin-26.2.0/examples/payment_decision_agent.py +62 -0
  82. agent_bitcoin-26.2.0/examples/signet_product_path.py +216 -0
  83. agent_bitcoin-26.2.0/examples/swarm_registry_demo.py +39 -0
  84. agent_bitcoin-26.2.0/pyproject.toml +74 -0
  85. agent_bitcoin-26.2.0/setup.cfg +4 -0
  86. agent_bitcoin-26.2.0/tests/conftest.py +55 -0
  87. agent_bitcoin-26.2.0/tests/network_config.py +80 -0
  88. agent_bitcoin-26.2.0/tests/test_aws_integration.py +165 -0
  89. agent_bitcoin-26.2.0/tests/test_client.py +29 -0
  90. agent_bitcoin-26.2.0/tests/test_fee_collection.py +35 -0
  91. agent_bitcoin-26.2.0/tests/test_invoice_quote.py +143 -0
  92. agent_bitcoin-26.2.0/tests/test_l402.py +182 -0
  93. agent_bitcoin-26.2.0/tests/test_lnd_sdk_integration.py +131 -0
  94. agent_bitcoin-26.2.0/tests/test_lnd_transport.py +67 -0
  95. agent_bitcoin-26.2.0/tests/test_nip44.py +67 -0
  96. agent_bitcoin-26.2.0/tests/test_nostr_m3.py +67 -0
  97. agent_bitcoin-26.2.0/tests/test_nwc_client.py +98 -0
  98. agent_bitcoin-26.2.0/tests/test_nwc_flow.py +116 -0
  99. agent_bitcoin-26.2.0/tests/test_nwc_mainnet_policy.py +125 -0
  100. agent_bitcoin-26.2.0/tests/test_nwc_policy.py +72 -0
  101. agent_bitcoin-26.2.0/tests/test_nwc_relay_listen.py +272 -0
  102. agent_bitcoin-26.2.0/tests/test_nwc_service.py +160 -0
  103. agent_bitcoin-26.2.0/tests/test_nwc_uri.py +79 -0
  104. agent_bitcoin-26.2.0/tests/test_payment_amounts.py +143 -0
  105. agent_bitcoin-26.2.0/tests/test_payment_decision_policy.py +88 -0
  106. agent_bitcoin-26.2.0/tests/test_policy_killswitches.py +108 -0
@@ -0,0 +1,418 @@
1
+ ## v26.2.0 — 2026-08-16
2
+
3
+ First **pypi.org** release. Package metadata aligned with GitHub release **v.26.2.0** (L402 gateway + prior 26.x work). Install: `pip install agent-bitcoin==26.2.0`.
4
+
5
+ ---
6
+
7
+ ## Publish — agent-bitcoin on PyPI (2026-08-16)
8
+
9
+ ### Changed
10
+
11
+ - Release workflow publishes to **pypi.org** with GitHub Trusted Publishing (`environment: pypi`)
12
+ - Install docs use `pip install agent-bitcoin` (TestPyPI is no longer the install target)
13
+
14
+ ---
15
+
16
+ ## Add — Aperture L402 HTTP gateway (mainnet) (2026-08-15)
17
+
18
+ ### Added
19
+
20
+ - `docker-compose.l402.mainnet.yml` + `l402/aperture.mainnet.yaml`
21
+ - `./startup-l402-aws.sh mainnet` / `./shutdown-l402-aws.sh mainnet`
22
+
23
+ Price remains **1,000 sats**. Payer needs mainnet + autopay latches. Autoloop stays off. Live Mac→AWS paid GET **PASS** (2026-08-15).
24
+
25
+ ---
26
+
27
+ ## Add — Aperture L402 HTTP gateway (signet) (2026-08-15)
28
+
29
+ ### Added
30
+
31
+ - `docker-compose.l402.signet.yml` + `l402/aperture.signet.yaml` (AWS signet LND, `:8081`)
32
+ - `./startup-l402-aws.sh signet` / `./shutdown-l402-aws.sh signet`
33
+
34
+ Same 1,000 sat price and Mac `L402Client` as regtest. Stop the other L402 stack first (shared `:8081`). Live Mac→AWS paid GET **PASS** (2026-08-15).
35
+
36
+ ---
37
+
38
+ ## Add — Aperture L402 HTTP gateway (regtest) (2026-08-15)
39
+
40
+ ### Added
41
+
42
+ - Dummy origin + Aperture sidecar (`agent-l402-aperture` on `:8081`, **not** Loop `aperture`)
43
+ - `L402Client` pays a 1,000 sat challenge and retries with `Authorization: L402 …`
44
+ - `PaymentResult.preimage` from `lncli` / gRPC
45
+ - `examples/l402_pay.py`, `startup-l402-aws.sh`, [docs/l402-aperture.md](docs/l402-aperture.md)
46
+ - Security group default port **8081** (Mac IP `/32`)
47
+
48
+ Live regtest Mac→AWS paid GET **PASS** (2026-08-15). Signet and mainnet overlays are later PRs.
49
+
50
+ ---
51
+
52
+ ## Remove — platform / transaction fee (2026-08-15)
53
+
54
+ ### Removed
55
+
56
+ - Bundled platform fee (`DEFAULT_FEE_AMOUNT_SATS`, `fee_amount_sats()`, `FEE_AMOUNT_SATS` / `FEE_SATS`)
57
+ - Quote / HTTP fields `platform_fee_sats`, `transaction_fee_sats`, `collection`
58
+ - `AgentBitcoinClient.fee_amount_sats` and `create_invoice_quote(..., platform_fee_sats=)`
59
+ - Ignored `collect_platform_fee` argument on `pay_invoice_quote`
60
+
61
+ ### Changed
62
+
63
+ - BOLT11 is the requested amount **X** (`create_invoice`, `create_invoice_quote`, NWC `make_invoice`)
64
+ - `total_cost_sats` equals `amount_sats`
65
+ - Minimum payment remains **1,000 sats**; Lightning routing-fee limits and generic `send_onchain` are unchanged
66
+
67
+ Stale host `FEE_AMOUNT_SATS` / `FEE_SATS` env vars are ignored.
68
+
69
+ ---
70
+
71
+ ## Security — pin Actions SHAs and least-privilege tokens (2026-08-14)
72
+
73
+ ### Fixed
74
+
75
+ - CodeQL `actions/unpinned-tag` and `actions/missing-workflow-permissions` on CI / Docker / Release
76
+ - Third-party actions pinned to commit SHAs; `contents: read` (Docker also `actions: write` for GHA cache)
77
+
78
+ ---
79
+
80
+ ## Security — CodeQL code scanning (2026-08-14)
81
+
82
+ ### Added
83
+
84
+ - `.github/workflows/codeql.yml` — CodeQL on Python and GitHub Actions (PRs, `main`, weekly)
85
+ - Alerts appear under GitHub **Security → Code scanning**
86
+
87
+ ---
88
+
89
+ ## Docs — sync current fee, min, and NWC status (2026-08-14)
90
+
91
+ ### Documented
92
+
93
+ - Product policy: min **1,000** requested; **21** sat fee **inside** BOLT11; no `/send-fee`
94
+ - NWC public-relay read path PASS; `make_invoice` bills X+21
95
+ - HTTP `/invoices` quote shape; `ALLOW_MAINNET_FEE` is only generic `send_onchain`
96
+
97
+ ---
98
+
99
+ ## Remove — unused on-chain platform-fee APIs (2026-08-13)
100
+
101
+ ### Removed
102
+
103
+ - `AgentBitcoinClient.collect_transaction_fee()`
104
+ - Backend `POST /send-fee`
105
+ - `/pay` response fields `fee_sent` / `fee_address`
106
+
107
+ Platform fee remains bundled in the Lightning invoice (`FEE_AMOUNT_SATS`).
108
+
109
+ ---
110
+
111
+ ## Change — platform fee bundled into the Lightning invoice (2026-08-13)
112
+
113
+ ### Changed
114
+
115
+ - Payee BOLT11 is **requested amount + 21 sats** (`create_invoice`, `create_invoice_quote`, NWC `make_invoice`)
116
+ - Quote `collection` is **`lightning_bundled`**; payer pays one invoice
117
+ - No separate on-chain platform-fee send on the quote pay path
118
+
119
+ ---
120
+
121
+ ## Change — minimum Lightning payment is 1,000 sats (2026-08-13)
122
+
123
+ ### Changed
124
+
125
+ - `DEFAULT_MIN_PAYMENT_SATS` **2,000 → 1,000** (`MIN_PAYMENT_SATS`)
126
+ - NWC min follows the same default (`NWC_MIN_PAYMENT_SATS` unset → `min_payment_sats()`)
127
+ - Mainnet NWC **max** remains **2,000 sats**
128
+
129
+ ---
130
+
131
+ ## v.26.0.0 — 2026-08-13
132
+
133
+ Align package / `__version__` / git tag after NWC, 21-sat fee, and CI hygiene.
134
+
135
+ ### Highlights
136
+
137
+ - Public-relay NWC (NIP-44 v2) Mac ↔ AWS; listener no longer hangs or drops the second call
138
+ - Platform fee default **21 sats** (min payment still 2,000)
139
+ - Dependabot Actions + aiohttp / setuptools / cryptography 50
140
+ - Docker CI: pin `trivy-action` v0.36.0 by commit SHA
141
+
142
+ ---
143
+
144
+ ## Fix — pin Trivy action so Docker CI can resolve (2026-08-13)
145
+
146
+ ### Fixed
147
+
148
+ - `aquasecurity/trivy-action@0.28.0` no longer exists (tags moved to `v*` after the March 2026 supply-chain incident)
149
+ - Pin `trivy-action` to commit SHA of **v0.36.0**; scan stays non-blocking (`exit-code: 0`)
150
+
151
+ ---
152
+
153
+ ## Change — platform / transaction fee default is 21 sats (2026-08-13)
154
+
155
+ ### Changed
156
+
157
+ - `DEFAULT_FEE_AMOUNT_SATS` **1,000 → 21** (`FEE_AMOUNT_SATS` / backend `FEE_SATS`)
158
+ - Minimum Lightning payment remains **2,000 sats** (`MIN_PAYMENT_SATS`)
159
+ - Invoice quote `total_cost_sats` is now Lightning amount + 21 (e.g. 2,000 + 21 = 2,021)
160
+
161
+ ---
162
+
163
+ ## Fix — NWC listener handles a second Mac call (2026-08-12)
164
+
165
+ ### Fixed
166
+
167
+ - Re-send the kind-23194 REQ every poll (`run_sync` opens a new websocket and dropped the SUB after `get_info`)
168
+ - Publish 23195 on the live manager instead of a second `RelayManager` on the same Tornado IOLoop
169
+
170
+ ---
171
+
172
+ ## Fix — NWC public-relay listener does not hang on connect (2026-08-12)
173
+
174
+ ### Fixed
175
+
176
+ - Probe each relay in a side thread (~2s, hard skip ~3.5s) so a dead `wss://` cannot block `add_relay` / `run_sync`
177
+ - Long-lived SUB and client `wait_for_response` use `close_on_eose=False` (empty EOSE no longer drops the socket before 23195)
178
+ - Do not pass the 15–30s NWC wait as `RelayManager(timeout=…)` (that made the first poll look hung)
179
+ - AWS logs per-relay `connecting` / `ok` / `skip`, then **`subscribed, polling`** — start Mac only after that line
180
+
181
+ ---
182
+
183
+ ## Feat — NIP-44 v2 + public-relay NWC (2026-08-12)
184
+
185
+ ### Added
186
+
187
+ - `agent_bitcoin/nostr/nip44.py` — NIP-44 v2 (ECDH / HKDF / ChaCha20 / HMAC) + spec vector tests
188
+ - NWC client/service default encryption **`nip44_v2`** (NIP-04 only if `AGENT_BITCOIN_NWC_ALLOW_NIP04=1`)
189
+ - NIP-46 / NIP-17 payloads use the same NIP-44 facade
190
+ - Public-relay operator scripts: `nwc_relay_service.py` (AWS, reconnect), `nwc_relay_client.py` (Mac)
191
+ - Defaults: `wss://relay.damus.io`, `wss://nos.lol`
192
+ - Mainnet pay still multi-latch + 2k; Autopay off
193
+
194
+ ---
195
+
196
+ ## Feat — M3 production swarm primitives (2026-08-12)
197
+
198
+ ### Added
199
+
200
+ - [docs/m3-production-swarm.md](docs/m3-production-swarm.md): M3 scope vs NWC N1–N6
201
+ - `agent_bitcoin/nostr/`: NIP-46 bunker, NIP-17 gift-wrap (NIP-04 lab crypto), swarm registry, optional `WebsocketNWCRelay`
202
+ - Examples: `nip46_bunker_demo.py`, `swarm_registry_demo.py`, `nwc_relay_loopback.py`, `nwc_dual_pay_runbook.py`
203
+ - Tests: `tests/test_nostr_m3.py`
204
+ - Mainnet NWC `--pay` and always-on autopay remain **off** (2k Dual pay is operator-only)
205
+
206
+ ---
207
+
208
+ ## Ops — NWC mainnet invoice smoke PASS; session closed (2026-08-12)
209
+
210
+ ### Documented
211
+
212
+ - AWS live N6 invoice path **PASS** (`nwc_mainnet_smoke.py --yes-mainnet --amount 2000`)
213
+ - Payment hash `7afc7a2b0c0098a61aaa64ed4b7d433424faa3996ccca70db4bafdb7f47c28e6`
214
+ - Operator closed at invoice-only (no `--pay`); latches unset
215
+ - Further mainnet NWC pays require a **new written go**
216
+
217
+ ---
218
+
219
+ ## Feat — NWC mainnet tight-budget go (N6) (2026-08-12)
220
+
221
+ ### Added
222
+
223
+ - `AGENT_BITCOIN_NWC_ALLOW_MAINNET` + `assert_nwc_network_allowed()` (requires enable + LND mainnet latch)
224
+ - Mainnet NWC default max **2,000 sats** (`DEFAULT_NWC_MAINNET_MAX_SATS` / `NWC_MAX_PAYMENT_SATS`)
225
+ - `examples/nwc_mainnet_smoke.py` (`--yes-mainnet`, optional `--pay`)
226
+ - Tests: `tests/test_nwc_mainnet_policy.py`
227
+
228
+ ### Policy
229
+
230
+ - Operator go for human-attended mainnet NWC smoke only; unset latches after session
231
+ - Autoloop remains off
232
+
233
+ ---
234
+
235
+ ## Feat — NWC decision → pay product path (N5) (2026-08-12)
236
+
237
+ ### Added
238
+
239
+ - `agent_bitcoin/nwc/flow.py`: `decision_is_pay`, `nwc_pay_if_approved`, `rule_based_decision`
240
+ - `examples/nwc_decision_pay.py`: offline/mock (and optional LLM) gate then NWC settle
241
+ - SDK.md section for automatic wallets; tests in `tests/test_nwc_flow.py`
242
+ - PaymentDecisionAgent remains recommend-only; execution only via NWC after PAY
243
+
244
+ ---
245
+
246
+ ## Feat — NWC LND service (N4) (2026-08-12)
247
+
248
+ ### Added
249
+
250
+ - `NWCService`: authorize clients, enforce budgets/enable latch, dispatch to LND
251
+ - `create_nwc_service()`, `issue_connection()` → `nostr+walletconnect://` URI
252
+ - Offline tests with FakeLND (`tests/test_nwc_service.py`)
253
+ - `examples/nwc_regtest_smoke.py` (`--mock` or live docker LND)
254
+ - Mainnet still off unless `AGENT_BITCOIN_NWC_ENABLE=1` + separate go
255
+
256
+ ---
257
+
258
+ ## Feat — NWC client + mock bus (N3) (2026-08-12)
259
+
260
+ ### Added
261
+
262
+ - `NWCClient`: encrypted NIP-47 requests (`get_info`, `get_balance`, `make_invoice`, `pay_invoice`)
263
+ - `InMemoryNWCBus` + `attach_mock_wallet` for offline/lab tests (no WebSocket relays)
264
+ - NIP-04 payload crypto via pynostr; tests in `tests/test_nwc_client.py`
265
+ - No LND-backed service yet (N4)
266
+
267
+ ---
268
+
269
+ ## Feat — NWC scaffold URI + policy (N2) (2026-08-12)
270
+
271
+ ### Added
272
+
273
+ - `agent_bitcoin/nwc/`: `parse_nwc_uri`, `build_nwc_uri`, v1 method allowlist, amount budgets, `AGENT_BITCOIN_NWC_ENABLE` kill switch
274
+ - Offline tests: `tests/test_nwc_uri.py`, `tests/test_nwc_policy.py`
275
+ - No client/service wire protocol yet (N3–N4)
276
+
277
+ ---
278
+
279
+ ## Docs — NWC automatic wallets design (2026-08-12)
280
+
281
+ ### Added
282
+
283
+ - [docs/nwc-automatic-wallets.md](docs/nwc-automatic-wallets.md): NIP-47 automatic wallets ADR — architecture, allowlist, budgets, phases N0–N6
284
+ - Policy go: **design + regtest implementation**; mainnet NWC remains frozen
285
+ - Cross-links: index, mainnet-pilot, nostr-agent-identity
286
+
287
+ ---
288
+
289
+ ## Ops — Nostr mainnet M2 Dual 2k SUCCESS (2026-08-12)
290
+
291
+ ### Done
292
+
293
+ - Private dual channel Mac↔AWS: 25k capacity, push 12k to Mac (`b76115f9…1002:0`)
294
+ - Phase B signed bus: request → AWS invoice → Mac pay **2000 sats SUCCEEDED** (fee 0)
295
+ - Payment hash `f87a39a3597a59859436d6d947e3788cc6e1dc5cea9dc092f0d715a70fa8ca71`
296
+ - Phase B defaults `LND_TRANSPORT=docker` to avoid stale signet gRPC `:30009` failures
297
+
298
+ ### Hard stop
299
+
300
+ - No further Nostr mainnet pays without a new N budget; Autoloop/NWC/autopay remain off
301
+
302
+ ---
303
+
304
+ ## Ops/docs — Nostr mainnet M2 Dual go (2026-08-12)
305
+
306
+ ### Policy
307
+
308
+ - **M2 go:** Dual path (Mac alice → AWS bob), **2,000 sats** max, human-attended, autopay off
309
+ - Capital HOLD still covers deposits / new channels / Loop / Autoloop
310
+ - Live pay pending Stage 3 (Mac wallet unlock + outbound path) and Stage 5 dry-run
311
+
312
+ ### Documented
313
+
314
+ - Expanded dual-host runbook Stages 3–6 in [docs/nostr-agent-identity.md](docs/nostr-agent-identity.md)
315
+
316
+ ---
317
+
318
+ ## Ops/docs — Nostr mainnet Stage 2 Phase C (2026-08-12)
319
+
320
+ ### Done
321
+
322
+ - Phase C local policy signer **PASS** for alice + bob against `.nostr-poc-mainnet` keys (client never loaded nsec; policy deny verified)
323
+ - CLI: `nostr_phase_c_signer.py` accepts `--agent` / `--dir` before **or** after the subcommand
324
+ - M2 pay still deferred; Dual path reserved
325
+
326
+ ---
327
+
328
+ ## Ops/docs — Nostr mainnet M1 identity (2026-08-12)
329
+
330
+ ### Done
331
+
332
+ - **Stage 0 go:** M1 only; Dual path reserved for later M2; capital HOLD unchanged
333
+ - **M1:** dedicated alice/bob keys under gitignored `.nostr-poc-mainnet/`; Phase A offline crypto **PASS**
334
+ - `.gitignore` covers `.nostr-poc-mainnet/`; no nsec/passphrase in git
335
+ - ADR + pilot post-pilot table record M1 complete; M2/M3 still deferred
336
+
337
+ ---
338
+
339
+ ## Docs — Nostr mainnet process (not yet executed) (2026-08-11)
340
+
341
+ ### Documented
342
+
343
+ - Confirmed Nostr Phase A/B live on **regtest + signet only**; mainnet identity/pay and NWC remain **frozen** without a new go
344
+ - Step-by-step mainnet process (M1 identity → M2 2k smoke → M3 roadmap) in [docs/nostr-agent-identity.md](docs/nostr-agent-identity.md)
345
+ - Cross-links in [docs/mainnet-pilot.md](docs/mainnet-pilot.md) and [docs/index.md](docs/index.md)
346
+ - Phase B example prints `LND_NETWORK` and mainnet warning; live mainnet still gated by `AGENT_BITCOIN_ALLOW_MAINNET=1` in `LNDClient`
347
+
348
+ ---
349
+
350
+ ## Docs — topology A′ Loop Out complete + capital HOLD (2026-08-11)
351
+
352
+ ### Documented
353
+
354
+ - First mainnet **Loop Out SUCCESS** (250k; ~841 sats total cost) and dual **public** channels (ACINQ + LNBiG, 500k each)
355
+ - **Capital intent: HOLD as-is** — no further opens, deposits, or swaps without a new go; Autoloop remains **off**
356
+ - Updated [docs/public-routing-loop.md](docs/public-routing-loop.md): execution log, P0–P3 checkmarks, steady-state HOLD ops
357
+ - Updated [docs/mainnet-pilot.md](docs/mainnet-pilot.md): post-pilot decision table + cross-links
358
+ - [docs/index.md](docs/index.md) index line for A′ status
359
+
360
+ ### Ops note (not automated)
361
+
362
+ - L402 `timeout_seconds` fix remains in [docker/loop-timeout-fix/](docker/loop-timeout-fix/) (merged PR #56)
363
+
364
+ ---
365
+
366
+ ## Docs — public routing + Loop design (2026-08-10)
367
+
368
+ ### Added
369
+
370
+ - [docs/public-routing-loop.md](docs/public-routing-loop.md): post-pilot **topology A′** — single AWS LND opens **public** channels to external peers; **loopd** manages liquidity; Mac not permanent partner; no second AWS agent required
371
+ - P0–P4 operator checklist (policy, harden, open, Loop, product integration)
372
+
373
+ ### Changed
374
+
375
+ - [docs/mainnet-pilot.md](docs/mainnet-pilot.md): cooperative close in pilot log; post-pilot table points at public-routing design
376
+ - Cross-links in index, liquidity-automation, loop-multi-network, loop-autoloop
377
+
378
+ ---
379
+
380
+ ## Docs — mainnet Phase 8 ops pilot (2026-08-10)
381
+
382
+ ### Documented
383
+
384
+ - **Phase 8 ops complete:** dual-node mainnet private channel (43k sats), fund ≤50k, **N=5** human-attended Lightning pays via `lncli`
385
+ - Updated [docs/mainnet-pilot.md](docs/mainnet-pilot.md): pilot log, BIP-110 freeze historical, **pilot-complete checklist**, post-pilot non-goals
386
+ - Aligned [docs/mainnet-infra.md](docs/mainnet-infra.md), [docs/loop-multi-network.md](docs/loop-multi-network.md), [docs/liquidity-topology-b.md](docs/liquidity-topology-b.md), [docs/index.md](docs/index.md), README
387
+
388
+ ### Still out of scope (unchanged policy)
389
+
390
+ - Mainnet Autoloop / raising loss budget / autonomous autopay without a new go decision
391
+ - SDK mainnet pay path remains optional post-pilot validation
392
+
393
+ ---
394
+
395
+ ## [23.1.0] - 2026-07-14
396
+
397
+ ### Major Changes
398
+ - **Split architecture support**: AWS backend (`agent-payment-decision-lnd` + `bitcoind`) + Mac counterparty node
399
+ - **Persistent chain mode**: New `startup-aws.sh` (no aggressive reset) and `startup-aws-reset.sh` for full reset when needed
400
+ - **Improved startup scripts**: `startup-mac.sh` and `shutdown-mac.sh` for local testing
401
+ - **Better Docker Compose separation**: `docker-compose.regtest.aws.yml` and `docker-compose.regtest.mac.yml`
402
+
403
+ ### Added
404
+ - Channel opening and Lightning payments between Mac and AWS nodes
405
+ - Automatic wallet detection (create vs unlock)
406
+ - Pre-warming and mining logic for faster startup
407
+ - TestPyPI publishing workflow
408
+
409
+ ### Fixed
410
+ - Port binding and firewall issues on AWS (18443/9735)
411
+ - LND sync and "block height out of range" errors
412
+ - Wallet unlock reliability across restarts
413
+ - Docker service name and volume management
414
+
415
+ ### Dependencies
416
+ - Updated to support latest Lightning Labs LND (v0.17.5-beta / v0.18.5-beta)
417
+
418
+ [Compare with previous version](https://github.com/gpu7/agent-bitcoin/compare/23.0.0...23.1.0)
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2026 [Richard Casey]
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,10 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include pyproject.toml
5
+
6
+ recursive-include docs *.md
7
+ recursive-include examples *.py
8
+ recursive-include tests *.py
9
+ global-exclude *.pyc
10
+ global-exclude __pycache__/
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-bitcoin
3
+ Version: 26.2.0
4
+ Summary: Lightning Bitcoin payments for autonomous AI Agents.
5
+ Author-email: Richard Casey <richardcaseyhpc@protonmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/gpu7/agent-bitcoin
8
+ Project-URL: Repository, https://github.com/gpu7/agent-bitcoin
9
+ Project-URL: Documentation, https://github.com/gpu7/agent-bitcoin/blob/main/README.md
10
+ Project-URL: Issues, https://github.com/gpu7/agent-bitcoin/issues
11
+ Project-URL: Changelog, https://github.com/gpu7/agent-bitcoin/blob/main/CHANGELOG.md
12
+ Keywords: bitcoin,lightning,lightning-network,ai-agents,sdk,crypto-payments
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: Office/Business :: Financial
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: pydantic>=2.0
25
+ Requires-Dist: python-dotenv>=1.0.0
26
+ Requires-Dist: fastapi>=0.115.0
27
+ Requires-Dist: uvicorn[standard]>=0.30.0
28
+ Requires-Dist: grpcio>=1.60.0
29
+ Requires-Dist: grpcio-tools>=1.60.0
30
+ Requires-Dist: lnd-grpc-client>=0.5.0
31
+ Requires-Dist: langchain-ollama>=1.1.0
32
+ Requires-Dist: langchain-xai>=1.2.2
33
+ Provides-Extra: langchain
34
+ Requires-Dist: langchain-core>=0.3.0; extra == "langchain"
35
+ Requires-Dist: langchain-ollama>=0.1.0; extra == "langchain"
36
+ Requires-Dist: langchain-xai>=0.1.0; extra == "langchain"
37
+ Provides-Extra: nostr
38
+ Requires-Dist: pynostr[websocket-client]>=0.6.0; extra == "nostr"
39
+ Requires-Dist: cryptography>=50.0.0; extra == "nostr"
40
+ Dynamic: license-file
41
+
42
+ <br>
43
+
44
+ <p align="center">
45
+ <img src="./images/dark-factory-image.jpg" alt="Dark Factory Agent Bitcoin" width="700"/>
46
+ </p>
47
+
48
+ <br>
49
+
50
+ [![PyPI](https://img.shields.io/pypi/v/agent-bitcoin)](https://pypi.org/project/agent-bitcoin/)
51
+ [![Python](https://img.shields.io/badge/Python-3.10%20|%203.11%20|%203.12-blue)](https://www.python.org/)
52
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
53
+ [![GitHub Release](https://img.shields.io/github/v/release/gpu7/agent-bitcoin)](https://github.com/gpu7/agent-bitcoin/releases/latest)
54
+ [![GitHub Repo](https://img.shields.io/badge/GitHub-gpu7/agent--bitcoin-black)](https://github.com/gpu7/agent-bitcoin)
55
+
56
+ <br>
57
+
58
+ ## Lightning Bitcoin payments for autonomous AI Agents
59
+
60
+ A lightweight Python SDK that enables AI agents to send and receive Lightning/Bitcoin payments.
61
+
62
+ | Doc | Who it's for |
63
+ |-----|----------------|
64
+ | **[SDK.md](SDK.md)** | App & agent developers (install, API, fees, quotes, LLM agents, HTTP API) |
65
+ | **[docs/backend.md](docs/backend.md)** | Operators: AWS/Mac **regtest** dual-node lab |
66
+ | **[docs/signet.md](docs/signet.md)** | Operators: dual-node **signet** (current pre-mainnet lab) |
67
+ | **[docs/mainnet-pilot.md](docs/mainnet-pilot.md)** | Mainnet pilot **Phases 0–8** (ops complete; ≤50k dual-node) |
68
+ | **[docs/public-routing-loop.md](docs/public-routing-loop.md)** | Topology A′: public channels + first Loop Out done; capital HOLD; Autoloop off |
69
+
70
+ ---
71
+
72
+ ## Features
73
+
74
+ - Simple, agent-friendly API (`create_client`)
75
+ - Create and pay Lightning invoices (**payee** creates, **payer** pays)
76
+ - **Explicit invoice quotes** for independent agents (`create_invoice_quote` / `pay_invoice_quote`) — one BOLT11 for the requested amount
77
+ - LND transports: **docker** `lncli` (lab default) or **gRPC** + macaroon ([docs/lnd-client.md](docs/lnd-client.md))
78
+ - Networks: **regtest** (default), **signet**, testnet; **mainnet** only with explicit latch
79
+ - Pydantic models and structured errors
80
+ - Optional LLM **payment decision** agent (PAY / REJECT / CONFIRM — never executes pays)
81
+ - Balance checks (Lightning and on-chain)
82
+ - Operator tooling: dual-node health, SCB backup, daily ops ([docs/index.md](docs/index.md))
83
+ - Optional **Aperture L402** HTTP gateway (regtest PoC; Mac pays AWS `:8081`) — [docs/l402-aperture.md](docs/l402-aperture.md)
84
+
85
+ ---
86
+
87
+ ## Roles: payee and payer
88
+
89
+ | Role | Does |
90
+ |------|------|
91
+ | **Payee** | Creates the invoice (and quote); receives **X sats** over Lightning |
92
+ | **Payer** | Validates quote / budget; pays the BOLT11 amount (plus optional Lightning routing fee limit) |
93
+
94
+ Either physical node (AWS agent LND or Mac counterparty LND) can act as payee or payer depending on who creates the invoice.
95
+
96
+ ---
97
+
98
+ ## Payment amounts
99
+
100
+ There is **no platform / transaction fee**. A requested payment of **X** sats creates and pays a BOLT11 for **exactly X**. Lightning **routing** fees (the `fee_limit_sats` / `routing_fee_limit_sats` cap) are separate and still apply when paying.
101
+
102
+ | Rule | Default |
103
+ |------|--------|
104
+ | Platform / transaction fee | **None** |
105
+ | Minimum Lightning invoice amount | **1,000 sats** (`MIN_PAYMENT_SATS`) |
106
+
107
+ For independent agents, prefer **`create_invoice_quote`** so the payer sees `amount_sats` / `total_cost_sats` without shared env. Details: **[SDK.md](SDK.md#transaction-fees-and-limits)**.
108
+
109
+ There is no `collect_transaction_fee` / `POST /send-fee`. Mainnet **pays** stay latch-gated — see [docs/mainnet-pilot.md](docs/mainnet-pilot.md).
110
+
111
+ ---
112
+
113
+ ## Installation
114
+
115
+ ### From PyPI
116
+
117
+ ```bash
118
+ pip install agent-bitcoin
119
+ ```
120
+
121
+ ### From source
122
+
123
+ ```bash
124
+ git clone https://github.com/gpu7/agent-bitcoin.git
125
+ cd agent-bitcoin
126
+ uv sync
127
+ ```
128
+
129
+ More detail (optional LangChain / Grok / Ollama deps): **[SDK.md](SDK.md#installation)**.
130
+
131
+ ---
132
+
133
+ ## Quick start
134
+
135
+ ```python
136
+ from agent_bitcoin import create_client
137
+
138
+ client = create_client()
139
+
140
+ # Payee: invoice + explicit quote for independent payers
141
+ quote = client.create_invoice_quote(memo="Test payment", amount_sats=2000)
142
+ # quote.payment_request, amount_sats, total_cost_sats (equals amount)
143
+
144
+ # Payer: validate / decision inputs, then pay Lightning amount
145
+ inputs = client.build_payer_decision_inputs(quote, routing_fee_limit_sats=200)
146
+ if inputs.quote_valid:
147
+ result = client.pay_invoice_quote(quote, routing_fee_limit_sats=200)
148
+ if result.success:
149
+ print(f"Paid {result.amount} sats (LN); total_cost was {quote.total_cost_sats}")
150
+ ```
151
+
152
+ Bare `create_invoice` / `pay_invoice` remain available for simple lab flows.
153
+
154
+ Configure LND via env (`LND_NETWORK`, `LND_TRANSPORT=docker|grpc`, container or gRPC cert/macaroon).
155
+ Full API → **[SDK.md](SDK.md)**.
156
+ Regtest operators → **[docs/backend.md](docs/backend.md)**.
157
+ Signet operators → **[docs/signet.md](docs/signet.md)**.
158
+
159
+ ---
160
+
161
+ ## Security
162
+
163
+ Agent-Bitcoin is developed with security in mind:
164
+
165
+ - **Secrets stay out of the repository** — API keys, wallet material, and host credentials are configured via environment and local ops practice, not committed source
166
+ - **Least privilege** for network and node access (admin/API/RPC not left open to the whole internet in operator deployments)
167
+ - **Conservative defaults** for payment amounts and fees (see [SDK.md](SDK.md))
168
+ - **Authenticated payment APIs** — backend balance/invoice/pay routes require an API key when deployed
169
+ - **Bounded autonomous payment decisions** — hard amount limits in code before any LLM approval
170
+ - **Mainnet kill switches** — e.g. `AGENT_BITCOIN_ALLOW_MAINNET`, `AGENT_BITCOIN_ALLOW_AUTOPAY`, daily spend caps
171
+ - **Operator health checks** — dual-node signet health, backups ([docs/daily-ops-signet.md](docs/daily-ops-signet.md), [docs/security-hardening.md](docs/security-hardening.md))
172
+ - **Regtest / signet first** for lab work; mainnet is never the implicit default (pilot ops complete under ≤50k dual-node — [docs/mainnet-pilot.md](docs/mainnet-pilot.md))
173
+
174
+ Report vulnerabilities privately — see **[SECURITY.md](SECURITY.md)**. Do not open public issues for security reports.
175
+
176
+ ---
177
+
178
+ ## Documentation
179
+
180
+ | Link | Description |
181
+ |------|-------------|
182
+ | [SDK.md](SDK.md) | Python SDK, quotes, fees, LLM agents, Backend HTTP API |
183
+ | [docs/index.md](docs/index.md) | Full docs index (signet, mainnet readiness, backup, health, liquidity) |
184
+ | [docs/backend.md](docs/backend.md) | Regtest dual-node workflow |
185
+ | [docs/signet.md](docs/signet.md) | Signet dual-node lab |
186
+ | [docs/mainnet-pilot.md](docs/mainnet-pilot.md) | Mainnet pilot Phases 0–8 (ops complete; ≤50k dual-node) |
187
+ | [docs/public-routing-loop.md](docs/public-routing-loop.md) | Public routing + Loop on AWS (topology A′; HOLD) |
188
+ | [examples/](examples/) | Runnable sample scripts (incl. signet product path) |
189
+ | [CHANGELOG.md](CHANGELOG.md) | Release history |
190
+ | [SECURITY.md](SECURITY.md) | Security policy and vulnerability reporting |
191
+
192
+ ---
193
+
194
+ ## Repository
195
+
196
+ - GitHub: https://github.com/gpu7/agent-bitcoin
197
+ - PyPI: https://pypi.org/project/agent-bitcoin/
198
+
199
+ ---
200
+
201
+ ## License
202
+
203
+ MIT License — see [LICENSE](LICENSE).
204
+
205
+ ---
206
+
207
+ ## Support
208
+
209
+ Richard Casey
210
+ richardcaseyhpc@protonmail.com
211
+ +1 970-980-5975