Commit Graph
23 Commits
Author SHA1 Message Date
Kgothatso NgakoandClaude Opus 5.5 3e4de464fe feat(lightning): the group node redials the LSP, and says why it was dropped
lightning-kmp never reconnects by itself. The identity's own node has Phoenix's connection
daemon for that; the group's node connected once, so a single drop left it offline for the
rest of the term.

It now redials after every drop, waiting two seconds and doubling up to five minutes. A
connection that ends within a minute counts as a failure, so an LSP that hangs up on our
features isn't redialled every two seconds. Each drop is logged with its reason. When the
LSP's init doesn't offer a feature we require, the log names it. The node waits up to a
second for that init, because the socket can read as closed before the init's event arrives.

Run against ACINQ's mainnet LSP on an emulator, every drop reads: "Connection closed: the
LSP does not offer simple_taproot_channels, which this node requires". The plan doc now
records that against Phase 0's first step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:37:54 +02:00
Kgothatso NgakoandClaude Opus 5.5 cf8ae0200e feat(lightning): the group Lightning wallet on mainnet only
The Lightning wallet now opens on the node's own network, mainnet,
where the group's onchain wallet already is, so the separate testnet3
onchain wallet and its row on the group's screen are gone.
GroupLightningRollout.allows takes mainnet and regtest, nothing else.

This lifts the plan's mainnet gate by decision, ahead of its condition:
an outside review of the Iceberg scheme and the DKG, and a month on
testnet3. The LSP's signing deadline was never measured either.
Meanwhile:

- Every co-signer refuses to sign for a mainnet channel over
  MAINNET_CHANNEL_CAP, 1,000,000 sats, so a bigger one never opens; none
  grows, since splices are refused.
- The opening screen says the scheme is unreviewed and names the cap.

Running the co-signing suite on mainnet (now a second test class) found a
bug that would have stopped everything there: every key manager was built
with a testnet swap-in tpub, which lightning-kmp rejects on mainnet. That
covers every co-signer and the operator's node. Mainnet now takes the
mainnet LSP's published xpub; nothing derives from it.

The full JVM suite (1,578 tests) and the regtest run pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:45:57 +02:00
Kgothatso NgakoandClaude Opus 5.5 5ff9380b03 feat(lightning): turn the group Lightning wallet on, on testnet3 (Phase 15)
GroupLightningRollout.ENABLED is now true. A Marmot group's screen offers
the Lightning wallet and the testnet3 onchain wallet it closes to, and
devices run the group nodes they are elected to. NIP-17 rooms still get
neither: they have no key to sign with. Mainnet is still refused by
GroupLightningRollout.allows, whatever a screen offers.

It was turned on before Phase 0's testnet3 measurement of how long the
LSP waits for a signature, so the 60-second signing deadline is a guess
until the first groups run there. The plan doc says so.

The wallet-row test now finds the onchain row by its title and status,
since the testnet3 row is also "Not opened yet". A new test checks that
the Lightning rows open the Lightning wallet and the testnet3 wallet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:25:37 +02:00
Kgothatso NgakoandClaude Opus 5.5 0939bd4c55 Merge branch 'bennu' into claude/lightning-wallet-iceberg-f20da1
Brings in an Electrum client for a profile with no node: IdentityElectrum
gives an nsec or npub profile a StandaloneElectrum of its own, so every
profile can watch the chain.

For the group Lightning wallet:

- GroupChainClients now sits on IdentityElectrum's client for the node's
  network, so group wallets and the watcher work on profiles with no node
  too.
- Each other network (testnet3, for the Lightning wallet) now gets a
  StandaloneElectrum instead of this branch's own connection loop. The
  old loop picked a server with ElectrumServers and connected directly,
  ignoring the profile's Tor setting, so a profile with Tor on would have
  reached a testnet3 server in the clear. The new one uses onion servers
  while Tor is on. A test covers it.
- The group's Lightning node takes its context and logger from the app,
  not the identity's Phoenix business, so a profile with no node that
  holds a share can be elected and run it.
- The member wallet's follow() keeps its network parameter.

The full JVM suite (1,568 tests) and the regtest run pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 21:28:17 +02:00
Kgothatso NgakoandClaude Opus 5.5 cb277d3269 Merge branch 'bennu' into claude/lightning-wallet-iceberg-f20da1
Brings in the guarded member wallets, guarded subgroup wallets, ceremony
creation, and the removal of the group's nostr profile, relays and posts.

Two clashes needed more than a textual resolution:

- Event kinds. The guarded-wallet family took 30333-30337, the numbers
  the Lightning family used for its ceremony. Nothing conflicted
  textually and nothing would have failed, since each side reads the
  other's events by kind. The Lightning family moves to a fresh run,
  30350-30366, which costs nothing: rumor kinds that never shipped.
  GroupLightningEventsTest now knows the guarded-wallet kinds and asserts
  the family starts past every kind the app uses.
- Schema versions. bennu used 27-31. This branch's four versions were
  never on an installed database, so they become one migration, 31 to 32,
  adding the 13 Lightning tables.

Also:

- bennu's new member-wallet calls (broadcast, confirmationsOf,
  guardianSpends, the fee suggestion) now take the network, because this
  branch made Electrum clients per network.
- bennu's watcher conflict check uses the transaction's own network.
- NEVER_BROADCAST is gone with the broadcast screen, and so is the test
  that checked the Lightning statements against it.

The full JVM suite (1,554 tests) and the regtest run pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:23:33 +02:00
Kgothatso NgakoandClaude Opus 5.5 d8d8d038f9 test(lightning): the group's wallet end to end on regtest, and what it found
`testing/regtest/` builds bitcoind, electrs, an eclair v0.14.4 LSP set up as
a Phoenix LSP, and a payer. `GroupLightningRegtestJvmTest` (run with
BENNU_REGTEST=1) drives four devices through it with a real lightning-kmp
node: open, receive on a channel opened on the fly, pay through the LSP's
trampoline, close mutually, then force-close a second channel and sweep its
delayed output with a FROST script-path spend. It passes from a fresh
network in about thirty seconds.

The run found four bugs in the operator's node, fixed here:

- It learned the chain's height only at the next block, and until then
  could answer no invoice request and take no payment. It now asks as it
  starts.
- It turned down every on-the-fly channel, because lightning-kmp's default
  liquidity policy caps fees at 2,000 sats and the statement's signed
  `maxLiquidityFeeSat` never reached it. The node's policy is now the
  statement's.
- A channel could ask for round one before the pool held it. The node now
  waits for a minimum pool before connecting, and otherwise refuses and
  retries.
- A force close waited forever for feerates, which lightning-kmp fetches
  only once. The node now refreshes them, and takes a flat rate on regtest.

Public eclair cannot route a Bolt11 payment to a wallet by its peer-id
route hint, so the run pays the group's Bolt12 offer. The offer is now part
of the wallet: every snapshot carries it, every member keeps it only if
its own copy of the seed derives it, and the receive screen shows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 22:30:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 bab4b67fca feat(lightning): the rollout gates, and who has not answered (Phase 15)
The gates are in code and stay closed. `GroupLightningRollout.ENABLED` is
false because its own condition, a regtest end-to-end run, has not been
met; mainnet is refused by `allows` whatever a screen offers.

The ceremony screen names every participant who has not answered the
proposal, with a word that their build may not know the new kinds: a
member on an old build is a co-signer who never answers, and the group
is smaller for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:12:54 +02:00
Kgothatso NgakoandClaude Opus 5.5 6140aef33a feat(lightning): the group re-keys its Lightning wallet when members change (Phase 14)
Iceberg cannot reshare, so a member who leaves keeps a share of the key
and the node's seed until the group opens a new wallet without them.

- A ceremony is now over the onchain key's holders who are still in the
  room (D1, narrowed), and a statement verifies when every participant
  holds the onchain key, so the wallets before and after a removal both
  stand.
- A room can have several wallets on a network. The highest-numbered is
  current, and a new statement takes the next number, under a key no
  wallet uses yet.
- The wallet screen names who has left and offers the new key or the new
  wallet. It lists earlier wallets with their balance, one decision to
  close every channel they still have, their sweeps, and a way to run
  their node when nobody does.
- `GroupLightningNodes` runs one node per wallet a device operates.
- Removing a member who holds a share says what the removal leaves.

A five-device test removes a member, refuses the leaver's own ceremony,
re-keys over the four who remain, opens wallet 1 beside wallet 0 with an
operator each, and closes wallet 0's channels in one session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 19:09:13 +02:00
Kgothatso NgakoandClaude Opus 5.5 b770b07472 feat(lightning): the group sweeps closed channels into its onchain wallet (Phase 13, part 2)
The operator's snapshot now lists what closing channels pay to the
group's basepoints, found by the fork's `GroupHeldOutputs`. Any member
proposes a sweep from the wallet screen. A sweep is a FROST session of its
own subject, `SWEEP`: every input is a taproot script-path spend, signed
under the leaf key each member derives from its own basepoints, and every
output must be a receive address of the onchain wallet. `GroupSweep.check`
refuses anything else.

A signed sweep is a `GroupTransaction` row like a spend, so the watcher
sends it, again every ten minutes until the network accepts it once the
delay is over. The approval screen, the proposal list and the onchain
wallet's history say what a sweep is.

A four-device test sweeps a to_remote and a to_local output built with
lightning-kmp's own scripts, and the interpreter accepts the result.
Splicing out is not built; the plan's doc says why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:53:43 +02:00
Kgothatso NgakoandClaude Opus 5.5 cb6934b806 feat(lightning): the group closes and force-closes its channels (Phase 13, part 1)
Two new authorisation actions on kind 30346, `close` and `force-close`,
each naming one channel and open for three days. The operator's node acts
on each once: a mutual close to the onchain wallet's first address, or
publishing our own commitment. Any member proposes one from the channel's
menu on the wallet screen.

Co-signers sign our own commitment only under a force-close
authorisation, only after rebuilding it, and never one more than a step
behind the counterparty commitment they last signed: anything older is
revoked. A four-device test force-closes with a signature that spends the
funding output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:40:32 +02:00
Kgothatso NgakoandClaude Opus 5.5 d69344fe1b feat(lightning): the group pays from its Lightning wallet (Phase 12)
A member proposes a payment from the new send screen: an invoice, the
amount when it names none, and a fee limit. The group signs it as an
authorisation (kind 30346, `pay`) like any decision; the summary leads
with the amount and the most the fee can be.

Every co-signer reads the signed authorisations as budgets, so the
operator can only make payments the group signed for. An expired one
closes to new HTLCs but still settles what is in flight. The operator's
node pays each authorised payment once.

The co-signers now also hold what the group offers at once under the
statement's in-flight cap, which nothing checked while nothing could be
offered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:32:21 +02:00
Kgothatso NgakoandClaude Opus 5.5 b4fbae748d feat(lightning): members receive into the group's Lightning wallet (Phase 11)
A member asks for an invoice (kind 30347) from the new receive screen; the
operator's running node finds each request no invoice answers yet, makes
one with lightning-kmp's `createInvoice`, and sends it to the room (kind
30348). Every member files an invoice only from the operator, and only if
it pays the node the group's statement names, so the screen never shows
an invoice that pays somebody else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:20:18 +02:00
Kgothatso NgakoandClaude Opus 5.5 33a1ef0ed2 feat(lightning): the operator reports the group's wallet to the room (Phase 10)
The running node sends a snapshot (kind 30345) as it starts, whenever its
channels or payments change, and every five minutes otherwise: the channels,
the payments it has seen, and the round-one label assignments, so whoever
operates next signs under the verification nonces this operator published.

A member believes a snapshot only from the operator the group elected for
the term it names, about the node the statement names. It files the newest
(schema 30) and keeps every payment, and the wallet screen shows balance,
channels and payments, each channel checked against what this device last
co-signed for it.

The invoice wire and its table land here too, because they share the
schema bump; Phase 11 puts them to use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:13:04 +02:00
Kgothatso NgakoandClaude Opus 5.5 dd0d4b003d feat(lightning): run the group's node on the operator's device (Phase 8)
GroupLightningNode builds a lightning-kmp Peer from the wallet's seed,
with the group's funding signer, basepoints and closing address
(GroupNodeKeyManager), on Phoenix's SQLite databases under names of its
own. It starts only on the elected operator's device, once that device
has heard from the room recently, and stops itself when a later term
begins, telling the room where its channels were. GroupLightningNodes
keeps one running per wallet this identity operates, behind the
rollout gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:59:10 +02:00
Kgothatso NgakoandClaude Opus 5.5 930ae341e8 feat(lightning): every member co-signs for the group's node (Phase 9)
GroupLightningCoSigner runs on every Iceberg participant. It publishes
round one ahead of time for a pool of labels, and checks each of the
operator's signing requests: the current operator in the current term,
a pool label it never answered, contributions from the members they
name, the funding output, and the transaction rebuilt with lightning-
kmp's own builder from the context the request carries. CoSignerPolicy
holds the group's claim on the channel against a floor that only
authorised payments lower. A member echoes the hash it would sign and
signs once n - t + 1 members echoed the same one. GroupIcebergTransport
is the operator's side: it assigns pool labels, sends requests and
collects shares. Schema 29 holds the pool, the ledgers and the echoes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:48:46 +02:00
Kgothatso NgakoandClaude Opus 5.5 900fe6be28 feat(lightning): open a group Lightning wallet and elect its operator (Phases 6-7)
The wallet statement (30338) binds the onchain wallet it closes to, the
Iceberg key and its holders, the node its seed produces, the LSP and a
policy, and every member checks it against what they can recompute. The
proposer sends the node seed to each participant encrypted to them, and
a device files it only after deriving the node id itself (schema 28).
The operator statement (30339) carries a term that only goes up; the
newest term wins, a tie goes to the lower event id, and only the
operator can step down. Both stay inside the group. A Lightning wallet
screen walks a room from no onchain wallet to an elected operator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:27:31 +02:00
Kgothatso NgakoandClaude Opus 5.5 99a2185463 feat(lightning): the group makes its Lightning wallet key (Phase 5)
IcebergRitualManager runs the Iceberg DKG in the group's Marmot room over
the people who hold the onchain wallet's key, behind the same three
approval gates the ChillDKG ceremony has. Contributions travel NIP-44
encrypted to the members who will hold them. Schema 27 adds the session
and message tables; a screen and transcript lines show who has done what.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 17:15:24 +02:00
Kgothatso NgakoandClaude Opus 5.5 3ebe01e1c1 feat(wallet): a group wallet on a second network (Phase 4)
GroupChainClients gives each network its own Electrum connection: the
node's client for the node's network, and one made on first use for any
other. The wallets and the transaction watcher take their client from
it, the wallet routes carry their chain, and a second wallet row for the
Lightning wallet's test network sits behind GroupLightningRollout, which
is off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:58:04 +02:00
Kgothatso NgakoandClaude Opus 5.5 ee40309e77 feat(lightning): a closing channel pays the group, not the node (Phase 3)
The fork's channel keys can take a group's payment and delayed-payment
basepoints, the node skips the claims it holds no key for, and
GroupHeldOutputs says where those outputs are and how to spend them. In
the app, GroupLightningDerivation derives the basepoints from the
group's threshold key, and a FROST quorum spends both kinds of output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:51:49 +02:00
Kgothatso NgakoandClaude Opus 5.5 fb5111fd45 feat(lightning): the funding signer waits for a remote group (Phase 2)
Moves the lightning-kmp-app submodule to the fork commit where the
signing methods of FundingSigner suspend, RemoteIcebergFundingSigner
reaches a group through a transport the app will supply, and pings are
answered outside the channel loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:38:25 +02:00
Kgothatso NgakoandClaude Opus 5.5 a1e87d92e5 feat(lightning): a distributed key generation for Iceberg (Phase 1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:23:15 +02:00
Kgothatso NgakoandClaude Opus 5.5 cd385ec82d feat(lightning): reserve the group Lightning wallet's kinds (Phase 0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:19:43 +02:00
Kgothatso NgakoandClaude Opus 5.5 3393cd2b3f docs: plan a group Lightning wallet held with an Iceberg key
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:10:08 +02:00