docs: forming a confederation without its NIP-17 room, a report and a plan, and Phase 0's checks (confederation-dkg-inboxes, Phase 0)

The report finds the key ceremony needs no NIP-17 room: its rounds can travel the bridge the
confederation's signing already uses. The plan builds that in eight phases.

Phase 0's checks are kept as ConfederationDkgInboxesPremiseJvmTest: 30379 is free; one role's
dealing size is an exact formula of T, the inner thresholds and the roles; a ceremony room's id
is any NIP-17 chat among the same people; every admin holds the group's inbox key. The byte
budget comes out at 26,000, not the planned 32,000, because NIP-44 pads in steps and a wrap
crosses 64 KiB well before its plaintext limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5.5 committed 2026-11-23 12:39:02 +02:00
1 parent 24991e1c5c
commit 6a6ce0066c
4 files changed
+1211

No files matched your search

@@ -0,0 +1,217 @@
package mobi.giza.compose.managers
import androidx.room3.Room
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.crypto.EventHasher
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent
import fr.acinq.bitcoin.ByteVector32
import fr.acinq.bitcoin.PrivateKey
import fr.acinq.bitcoin.crypto.confederation.ConfederationDkg
import kotlin.test.AfterTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import kotlinx.coroutines.runBlocking
import mobi.giza.compose.database.GENESIS_AT
import mobi.giza.compose.database.GizaDatabase
import mobi.giza.compose.database.builder.getRoomDatabase
import mobi.giza.compose.database.model.ChatRoom
import mobi.giza.compose.database.model.NostrEvent
import mobi.giza.compose.database.model.Profile
import mobi.giza.compose.extensions.toHex
import mobi.giza.compose.nostr.RetiredKinds
import mobi.giza.compose.nostr.confederation.ConfederationKinds
import mobi.giza.compose.nostr.confederation.ConfederationRitualEvents
import mobi.giza.compose.nostr.confederation.ConfederationRosterBuilder
import mobi.giza.compose.nostr.confederation.ConfederationSigningEvents
import mobi.giza.compose.nostr.inbox.InboxSeal
import mobi.giza.compose.nostr.inbox.InboxWire
import mobi.giza.compose.nostr.inbox.InboxWrap
/**
* What docs/confederation-dkg-inboxes.md rests on, checked before anything is built on it (Phase 0,
* checks 1 to 5). Check 6 is arithmetic, recorded in the plan.
*/
class ConfederationDkgInboxesPremiseJvmTest {
private val databases = mutableListOf<GizaDatabase>()
private var groups: ConfederationTestGroups? = null
@AfterTest
fun close() {
databases.forEach { it.close() }
groups?.close()
}
// ---- check 1: the ceremony envelope's kind is free ------------------------------------
@Test
fun `30379 is no kind the app or its retired wallets use`() {
val taken = ConfederationKinds.ALL + ConfederationKinds.CHANGE_KINDS + ConfederationKinds.VOUCHER +
ConfederationSigningEvents.ALL + ConfederationSigningEvents.CARRIED + ConfederationSigningEvents.VOUCHER +
ConfederationRitualEvents.ALL + setOf(30380, 30383, 30386, 30388, 30389)
assertTrue(30379 !in taken)
assertTrue(30379 !in RetiredKinds.WALLET)
}
// ---- checks 2 and 3: how big a dealings round is, and what it fits in ------------------
/** A plan of [groupCount] groups of [admins] admins each, `T` = [threshold], each group's `t_g` = [inner]. */
private fun plan(groupCount: Int, admins: Int, threshold: Int, inner: Int): Pair<ConfederationRosterBuilder.Plan, Map<HexKey, PrivateKey>> {
val people = (0 until groupCount * admins).associate { n ->
val key = PrivateKey(ByteArray(32).also { it[0] = 0x71; it[30] = (n shr 8).toByte(); it[31] = (n + 1).toByte() })
key.publicKey().xOnly().value.toHex() to key
}
val byGroup = people.keys.chunked(admins)
val groupKeys = (1..groupCount).map { ConfederationStatementFixture.key(it) }
val npubs = groupKeys.map(ConfederationStatementFixture::npub)
val proposal = ConfederationStatementFixture.proposal(groupKeys[0], npubs, byGroup[0], threshold = threshold, innerThreshold = inner)
val acceptances = groupKeys.drop(1).mapIndexed { i, key ->
ConfederationStatementFixture.acceptance(key, proposal, byGroup[i + 1], threshold = inner).toJson()
}
val planned = ConfederationRitualManager.planFrom(ConfederationRitualEvents.Basis(proposal.toJson(), acceptances))
return (planned as fr.acinq.bitcoin.utils.Either.Right).value to people
}
/** One role's 30382 value, as `ConfederationRitualEvents.encodeDealings` writes it, in bytes. */
private fun dealingBytes(groupCount: Int, admins: Int, threshold: Int, inner: Int): Int {
val (plan, people) = plan(groupCount, admins, threshold, inner)
val hostKeys = plan.seats.associate { seat ->
seat.roleId to ConfederationRosterBuilder.hostPublicKey(people.getValue(seat.admin).value.toByteArray(), seat.group, plan.proposal.id)
}
val roster = (plan.roster(hostKeys) as fr.acinq.bitcoin.utils.Either.Right).value
val seat = plan.seats.first()
val host = ConfederationRosterBuilder.hostSecretKey(people.getValue(seat.admin).value.toByteArray(), seat.group, plan.proposal.id)
val dealing = ConfederationDkg.participantStep1(roster, seat.roleId, host, ByteVector32(ByteArray(32) { 7 }), ByteVector32(ByteArray(32) { 9 })).right!!
return ConfederationRitualEvents.encodeDealings(
mapOf(seat.group to ConfederationRitualEvents.Dealing(dealing.record.data.toHex(), dealing.ciphertexts.data.toHex()))
).length
}
private val author = PrivateKey(ByteArray(32).also { it[0] = 0x72; it[31] = 1 })
private val inboxSecret = ByteArray(32).also { it[0] = 0x73; it[31] = 1 }
private val group = ConfederationStatementFixture.npub(9)
/** A signed ritual event of [bytes] of content, as Phase 3 makes them. */
private fun signedEvent(bytes: Int, n: Int): Event =
NostrSignerSync(KeyPair(author.value.toByteArray())).sign(
1_790_000_000L + n, ConfederationRitualEvents.DEALINGS,
arrayOf(arrayOf(ConfederationRitualEvents.SESSION_TAG, "ab".repeat(32))), "{\"g\":\"" + "a".repeat(bytes - 8) + "\"}",
)
/**
* The sizes an envelope of [events] reaches as `ConfederationBridge.carryOut` would send it: the
* envelope's content, the seal's plaintext (the rumor's JSON), and the wrap's JSON. Null for a
* layer NIP-44 refused.
*/
private fun envelopeSizes(events: List<Event>): Triple<Int, Int?, Int?> {
val content = ConfederationSigningEvents.encodeCarried(events)
val pubKey = author.publicKey().xOnly().value.toHex()
val tags = arrayOf(arrayOf(ConfederationRitualEvents.PROPOSAL_TAG, "cd".repeat(32)))
val id = EventHasher.hashId(pubKey, 1_790_000_000L, 30379, tags, content)
val rumor = Event(id, pubKey, 1_790_000_000L, 30379, tags, content, "")
val rumorJson = InboxSeal.rumorJson(rumor)
val key = InboxWire.publicKeyOf(inboxSecret)
val sealed = runCatching { InboxWire.encrypt(rumorJson, InboxWire.conversationKey(author.value.toByteArray(), key)) }.getOrNull()
?: return Triple(content.length, null, null)
val seal = NostrSignerSync(KeyPair(author.value.toByteArray())).sign<SealEvent>(1_789_900_000L, InboxSeal.KIND, emptyArray(), sealed)
val wrap = runCatching { InboxWrap.wrap(seal, group, key) }.getOrNull()
return Triple(content.length, rumorJson.length, wrap?.toJson()?.length)
}
@Test
fun `an envelope of the byte budget seals and wraps under NIP-44's and a relay's limits`() {
// Measured: NIP-44 pads its plaintext to the next step -- a multiple of a power of two
// an eighth the size of the next power of two -- before each base64, so a wrap's size
// jumps rather than grows. A wrap stays under a relay's 64 KiB only while the rumor pads to
// 28,672 bytes or less (its seal then pads to 40,960). 32,000, the plan's first guess, and
// even 28,700 make wraps of 66 KB. 26,000 bytes of content leave room for the escaping
// real dealings carry.
val budget = 26_000
val events = mutableListOf<Event>()
while (ConfederationSigningEvents.encodeCarried(events + signedEvent(1_950, events.size)).length <= budget) {
events += signedEvent(1_950, events.size)
}
val (content, sealPlain, wrap) = envelopeSizes(events)
println("Envelope at the budget: content $content, seal plaintext $sealPlain, wrap $wrap bytes")
assertTrue(content in budget - 3_000..budget, "the envelope fills the budget: $content")
assertNotNull(sealPlain, "the rumor seals")
assertTrue(sealPlain <= 28_672, "the rumor pads to at most 28,672: $sealPlain")
assertNotNull(wrap, "the seal wraps")
assertTrue(wrap <= 65_536, "under a relay's 64 KiB event: $wrap")
// Past the step it does not: 28,700 bytes of content already make a wrap over 64 KiB.
val over = (0 until 12).map { signedEvent(1_950, it) }
val (overContent, _, overWrap) = envelopeSizes(over)
assertTrue(overContent > 28_000 && (overWrap == null || overWrap > 65_536), "past the step the wrap overflows: $overContent, $overWrap")
}
@Test
fun `a dealings round grows with the roles, and one person's message is bounded by their seats`() {
val small = dealingBytes(3, 3, 2, 2)
val sixty = dealingBytes(12, 5, 7, 3)
val big = dealingBytes(12, 10, 7, 6)
println("One role's 30382 value: 9 roles $small, 60 roles $sixty, 120 roles $big bytes")
assertTrue(small < sixty && sixty < big)
// A group's whole round at 120 roles is several envelopes; at 9 roles, one.
assertTrue(big * 10 > 26_000, "a group of ten's dealings at 120 roles need splitting")
assertTrue(small * 3 < 26_000)
// The value is exactly 2 * (210 + 33T + sum(4 + 33(t_g - 1)) + 32R) + 89: what Phase 5's
// eligibility computes a roster's largest message from, before anyone deals.
assertEquals(2 * (210 + 33 * 2 + 3 * (4 + 33) + 32 * 9) + 89, small)
assertEquals(2 * (210 + 33 * 7 + 12 * (4 + 66) + 32 * 60) + 89, sixty)
assertEquals(2 * (210 + 33 * 7 + 12 * (4 + 165) + 32 * 120) + 89, big)
// One person's message at one, two and three seats, as one signed event in one envelope.
val bySeats = (1..3).associateWith { seats ->
val event = NostrSignerSync(KeyPair(author.value.toByteArray())).sign<Event>(
1_790_000_000L, ConfederationRitualEvents.DEALINGS, emptyArray(), "x".repeat(big * seats),
)
envelopeSizes(listOf(event)) to event.toJson().length
}
bySeats.forEach { (seats, sizes) -> println("At 120 roles, $seats seat(s): envelope ${sizes.first}, signed event ${sizes.second} bytes") }
// Two seats at 120 roles fit one envelope and one wrap; three do not, on this path or on
// NIP-17's, which seals and wraps the same way. The line is a signed event of 26,000 bytes.
listOf(1, 2).forEach { seats ->
val (sizes, event) = bySeats.getValue(seats)
assertTrue(event <= 26_000, "$seats seat(s): a signed event of $event")
assertTrue(sizes.third != null && sizes.third!! <= 65_536, "$seats seat(s) wrap: ${sizes.third}")
assertTrue(event < 64 * 1024, "and fit an MLS message into the group's room")
}
val (three, threeEvent) = bySeats.getValue(3)
assertTrue(threeEvent > 26_000 && (three.third == null || three.third!! > 65_536), "three seats at 120 roles do not")
}
// ---- check 4: a founders' chat shares the ceremony room's id ---------------------------
@Test
fun `the ceremony's room is any NIP-17 conversation among exactly the same people`() = runBlocking {
val people = (1..4).map { PrivateKey(ByteArray(32).also { b -> b[0] = 0x74; b[31] = it.toByte() }).publicKey().xOnly().value.toHex() }
val db = getRoomDatabase(Room.inMemoryDatabaseBuilder<GizaDatabase>()).also { databases += it }
people.forEach { key ->
val eventId = "f$key".take(64)
db.nostrEventDao().insert(NostrEvent(id = eventId, pubKey = key, kind = 0, tags = emptyArray(), content = "{}", sig = "", createdAt = GENESIS_AT))
db.profileDao().insertPlaceholderProfile(Profile(displayName = "…", publicKey = key, createdAt = GENESIS_AT, nostrEventId = eventId))
}
val room = assertNotNull(db.nostrNip17Dao().createNip17ChatRoom(userPublicKey = people[0], participantPublicKeys = people.drop(1), subject = "Atlas"))
assertEquals(ChatRoom.deriveChatRoomId(people.toSet()), room.chatRoom.id, "the id is the people, not the subject or what the room is for")
}
// ---- check 5: every admin holds the group's inbox key once the inbox is set up ---------
@Test
fun `every admin of every group holds an announced inbox key`() = runBlocking {
val network = ConfederationTestGroups().also { groups = it }
network.setUp()
network.groups.forEach { g ->
g.devices.forEach { device ->
assertNotNull(
ConfederationManager.announcedInboxKey(device.db, g.roomId, device.publicKey),
"${device.publicKey.take(8)} of ${g.name} holds its inbox key",
)
}
}
}
}
+2
View File
@@ -19,6 +19,8 @@ the [retired](./retired/) notes now.
| [confederation-without-coordinator.md](./confederation-without-coordinator.md) | a confederation nobody coordinates: a phased plan, built but for its device run and behind flags that are off in release. The proposal and every answer travel as NIP-17 messages between the groups' NIP-4E inboxes, each sealed by its group's quorum, so every admin of every group reads every admin list and computes the outcome, and the key ceremony derives its room and session seed and computes the coordinator's broadcast on every device. Covers why a group could be the DKG's coordinator and does not need to be, why the admin lists stop being a payload encrypted to one person, why a confederation names at most twelve groups, how a group that says different things to different groups is caught, and who makes the confederation's room when nobody is in charge |
| [confederation-profile.md](./confederation-profile.md) | a formed confederation's nostr profile, decided by its groups: a phased plan, built but for its device run and behind flags that are off in release. The confederation gets its own screen, reached from each member group's screen, and an edit there is a statement by the editing group, sealed by its quorum and sent to every member group's inbox, which the others endorse or object to by their own quorums. Once `T` groups have endorsed, each group's signed voucher is a role holder's consent, so the confederation signs and publishes the profile with nobody asked again. Covers why the rule is `T` of `N`, why a transferable voucher is needed beside the non-transferable seals, who starts the signing, and how the confederation's room and the key ceremony's room come to say what they are |
| [confederation-room-removal.md](./confederation-room-removal.md) | taking away the confederation's own Marmot room: a phased plan, built but for its device run and behind flags that are off in release. A role holder's signing messages go into their own group's room, each group's admins carry them between groups through the inboxes, one at a time in order, and the posts, charter and signing attempts the room offered move to the confederation's screen. Covers why the nested signing still has to cross between groups every round, why each message becomes a signed event so it can be carried, why a demoted founder keeps signing and a removed one stops, and dropping the rooms already on devices while refusing a Welcome back into one |
| [confederation-dkg-without-nip17-room.md](./confederation-dkg-without-nip17-room.md) | a report, not built: whether a confederation can be formed without the NIP-17 room its key ceremony runs in, with the rounds carried between the groups' inboxes and each group's admins coordinating in their own room. Finds that it can, over the bridge signing already uses, since every person in the ceremony is an admin who reads their group's inbox and every step is rebuilt from stored messages. Covers why a group can carry its admins' dealings but never combine them, the three ways to move a round and what each costs, the size of a dealings round against NIP-44's and a relay's limits, the fallback when a group's carriers are away, and a founders' chat that shares the ceremony room's id |
| [confederation-dkg-inboxes.md](./confederation-dkg-inboxes.md) | the phased plan for the report above, not built, behind flags that are off in release: the confederation's key ceremony moves off its NIP-17 room onto the groups' rooms and inboxes, carried by each group's admins as signing already is. Covers the ceremony envelope (30379) and why it is its own kind, the bridge's second scope keyed by proposal so carriers need not have joined, envelopes split by bytes, schema 54, the join that needs the group's inbox key, and a migration that removes ceremony rooms without taking a founders' chat that shares their id |
| [confederation-proposals.md](./confederation-proposals.md) | everything a formed confederation signs -- its profile, its posts, its charter -- decided by its groups the way its profile already was, behind flags that are off in release. A post or the charter is a 9435 like a profile change, endorsed or objected to by each group's quorum, and signed with nobody asked once `T` groups have vouched; the per-person approve and decline, and the Signing screen, are gone. The confederation's screen lists them all as Proposals |
| [confederation-upstream.md](./confederation-upstream.md) | the work below Giza that unblocks the confederation's Parts B and C: a phased plan, not built, across secp256k1-zkp, secp256k1-kmp and bitcoin-kmp. Covers why the one-process DKG and signing cannot simply be exposed step by step (the coordinator derives everyone's key state, acknowledgment is signed before the share is stored, nonce randomness is derived from the session id), why every DKG step can stay stateless, the storage contract a device follows, and Prefractal as an all-groups-must-sign path that needs no upstream work |
| [automatic-key-ceremony.md](./automatic-key-ceremony.md) | joining is the only approval: a phased plan, built but for its device session, that makes a key ceremony run by itself after a member joins. Covers why contributing and confirming were never decisions a person could add to, the resume sweep that replaces the tap, the coordinator's follow-up steps and the one key state a device can sign without asking, and why abandon stays |
+567
View File
@@ -0,0 +1,567 @@
# The confederation's key ceremony through its groups' inboxes
A phased plan to take the NIP-17 room out of the confederation's key ceremony. Each person's rounds
go into the Marmot room of each group they hold a seat in. Each group's admins carry them, one at a
time and in order, to every member group's inbox, which is how the confederation's signing already
travels ([confederation-room-removal.md](./confederation-room-removal.md)). When this plan is done,
no device makes a NIP-17 room for a confederation, and forming one and signing for it run on one
transport.
The reasoning lives in the report this plan implements,
[confederation-dkg-without-nip17-room.md](./confederation-dkg-without-nip17-room.md): why the room is
only a transport, why a group can carry its admins' dealings but never combine them, the three ways to
move a round and what each costs, and the size of a dealings round. Read it first. This document says
what to build, in what order, and how each phase is checked. Where it says *report D4*, it means that
report's decision D4.
Read [confederation-without-coordinator.md](./confederation-without-coordinator.md) D8 to D10 for the
ceremony as it runs, and [confederation-room-removal.md](./confederation-room-removal.md) D2 to D4 for
the bridge.
Written against `24991e1c`, on 2026-11-23. **Not built.** Behind `ExperimentalFeatures.confederation`
and `ExperimentalFeatures.groupInbox`, both off in release. Paths starting `K/` are under
`composeApp/src/commonMain/kotlin/mobi/giza/compose/`, and test paths starting `T/` are under
`composeApp/src/jvmTest/kotlin/mobi/giza/compose/`.
| phase | what | leaves the NIP-17 room |
|---|---|---|
| 0 | this document, and six checks | working |
| 1 | pin today | working |
| 2 | storage, schema 54: what was heard, and the bridge's second scope | working |
| 3 | every ceremony message signed, in an envelope | working |
| 4 | the bridge carries ceremonies; messages go into seat groups' rooms as well | working, beside the new path |
| 5 | **the switch**: no NIP-17 room is made | gone from new ceremonies |
| 6 | the screens and the lines | gone from the screens |
| 7 | the ceremony rooms already on devices | gone from devices |
| 8 | the network run, the record, and devices | — |
---
## What is settled before code
The report left four things open. This plan settles them, and Phase 0 checks each.
| question | settled as | checked by |
|---|---|---|
| the ceremony envelope's kind (report D3) | **30379**, `ConfederationRitualEvents.CARRIED`. 30380 and 30383 are retired and stay retired; 30386, 30388 and 30389 are named in confederation.md for unbuilt things. 30379 is in no code, doc, NIP table or quartz at `24991e1c` | Phase 0 check 1 |
| the byte budget (report D4) | **26,000 bytes** of envelope content (first planned as 32,000; Phase 0 measured it), `ConfederationKinds.MAX_CARRIED_BYTES`, for signing and the ceremony alike, beside the existing `MAX_CARRIED` count | Phase 0 check 2 |
| the schema | **54**, one auto-migration with a spec, with Phases 2, 5 and 7 folded in. Nothing at 54 ships between them, as confederation-room-removal.md folded 52 | — |
| the fallback when a group's carriers are away (report D4) | **no new code.** Every author is an admin holding the inbox key (report D8, Phase 5), so the author's own device already has a turn at carrying its own message, at its place in the order. The fallback is a test, not a feature | Phase 5's tests |
Two names this plan uses throughout:
- **The scope.** What the bridge carries for. Today that is only a formed confederation, keyed by its
id. This plan adds a running key ceremony, keyed by its **proposal id**, since attempts share one
carrier set. `ConfederationBridge` takes a `CarryScope`:
```kotlin
sealed interface CarryScope {
val id: HexKey
data class Signing(override val id: HexKey) : CarryScope // a confederation's id
data class Ceremony(override val id: HexKey) : CarryScope // a proposal's id
}
```
- **The carry plan.** What the bridge needs to know about a scope: the groups to carry to, and who
holds a seat in which group. For signing it is `ConfederationSigningManager.held(...).plan`. For a
ceremony it is `ConfederationRitualManager.planFrom(basisFor(proposalId))`, which every admin of
every group can build once the proposal is accepted on their device, **whether or not they have
joined** (report D2). A carrier never needs a ceremony row.
---
## Phases
One commit per phase in the repository's style (`feat: … (confederation-dkg-inboxes, Phase n)`).
Every phase leaves these green:
- `./gradlew :composeApp:jvmTest`
- `:composeApp:m3Audit`
- `compileDebugKotlinAndroid`
- the brand and wallet audits in `check`
Until Phase 5, the NIP-17 room is the channel that works. Each phase before it adds the new path
beside the room without removing anything, so Phase 5 can switch without a gap.
### Phase 0: this document, and six checks
This document, its row in [README.md](./README.md), and a line at the top of the report pointing here.
Then scratch tests, kept as pins where they stay true, in
`T/managers/ConfederationDkgInboxesPremiseJvmTest.kt`:
1. **30379 is free.** It appears nowhere in `RetiredKinds`, `ConfederationKinds`,
`ConfederationSigningEvents`, `ConfederationRitualEvents`, quartz's kind constants or Bennu's kinds.
2. **The byte budget.** On `ConfederationReachableJvmTest`'s roster builder, deal a round for
12 groups of 10 (`R` = 120, `t_g` = 6, `T` = 7). Seal and wrap envelopes of 32,000 bytes of
content the way `ConfederationBridge.carryOut` does. Record:
- the wrap's serialized size against 64 KiB;
- the seal's plaintext against NIP-44's 65,535.
If 32,000 overflows either, lower `MAX_CARRIED_BYTES` until it fits, and record the number here.
3. **The largest single message.** Record the size of one person's 30382 at 1, 2 and 3 seats in that
roster, as:
- a NIP-17 wrap today;
- an MLS application message into a group's room (`MarmotJson.MAX_INPUT_BYTES`, 64 KiB);
- a 30379 envelope of one event.
The largest roster whose single messages all fit is the limit Phase 5's eligibility enforces
(`ConfederationKinds.MAX_CEREMONY_MESSAGE_BYTES`). Record the seat and role counts where it breaks.
4. **The founders' chat shares the room's id.** `createNip17ChatRoom` over the roster's people, and a
plain NIP-17 group chat started by one of them over the same people, give the same `ChatRoom.id`.
This is what Phase 7's migration must respect (report D9).
5. **A seat's inbox key at join.** On `ConfederationTestGroups`, every admin of every group holds an
`ANNOUNCED` inbox key once the inbox ceremony is done (`ConfederationManager.announcedInboxKey`).
Then promote a member in one group's harness without running the rotation, and record whether their
device holds one. This is the case Phase 5's join check exists for.
6. **The hops.** Count the legs a ceremony takes on the new path: four per-person rounds, each going
room → carrier → inbox. Write down the worst-case extra delay at `k = 0` and at `k = 2`, for the
device run to beat.
**Done when** all six are recorded here, and checks 1, 2, 4 and 5 are tests.
**Done**, on 2026-11-23. `ConfederationDkgInboxesPremiseJvmTest` keeps checks 1 to 5.
| check | result |
|---|---|
| 1. the kind | **free.** 30379 is in no confederation kind set, no ritual or signing kind, no retired wallet kind, and none of 30380, 30383, 30386, 30388 or 30389 |
| 2. the budget | **26,000, not 32,000.** NIP-44 pads its plaintext to the next step before each base64, so a wrap's size jumps rather than grows. A wrap stays under a relay's 64 KiB only while the rumor's JSON pads to 28,672 bytes or less, and its seal then pads to 40,960. Envelopes of 32,000 bytes and of 28,700 bytes both made wraps of 66 KB or more; one of 23,941 made a wrap of 55,121. NIP-44's own 65,535 is never the binding limit. `MAX_CARRIED_BYTES` = 26,000, leaving room for the escaping real dealings carry |
| 3. one message | **one role's 30382 is exactly `2 · (210 + 33T + Σ_g (4 + 33(t_g − 1)) + 32R) + 89` bytes**: 1,439 at 9 roles, 6,491 at 60, 12,707 at 120. At 120 roles one person's signed message is 13,053 bytes at one seat, 25,760 at two (wrap 55,121) and 38,467 at three (wrap 76,965). Three seats at 120 roles fail on NIP-17 today as well. `MAX_CEREMONY_MESSAGE_BYTES` is the same 26,000: an envelope of one event is that event and two brackets. Phase 5 computes each person's largest message from the formula, before anyone deals |
| 4. the founders' chat | **holds.** The ceremony room's id is `ChatRoom.deriveChatRoomId(people)`, whatever its subject, so any NIP-17 conversation among exactly the roster's people is the same room. Phase 7 has to leave such a room standing |
| 5. inbox keys | **every admin of every group holds an `ANNOUNCED` inbox key** once `ConfederationTestGroups` has set up. The promoted-admin half is a reading, not a test: the three-group harness cannot promote. `InboxRotation` rotates on every admin change (group-inbox.md D14), and until it reaches a new admin's device that device holds no announced key. That is the gap Phase 5's join check closes |
| 6. hops | four per-person rounds, each room → carrier → every inbox: four relay legs against today's four, plus one MLS leg a round. At `k = 0` the extra is one MLS round trip a round, about four in all; at `k = 2`, also `4 × 40 s` = 160 s at worst. Nothing in the ceremony is lost to the wait, since every step is rebuilt from stored messages |
### Phase 1: pin today
Written to pass now, and each flipped on purpose by a later phase. These go in
`T/managers/ConfederationCeremonyJvmTest.kt` beside the cases they will replace, since they need its
nine devices:
| pin | flipped by |
|---|---|
| a ceremony message leaves as one `GiftWrapPayload`, p-tagged to every other person, in the room whose id is `deriveChatRoomId(people)` | Phase 5: it leaves as an envelope in each seat group's room, and nothing is p-tagged to a person |
| an unsigned ritual rumor from a person in the roster is recorded | Phase 3: dropped |
| `ConfederationBridge.heardInRoom` carries nothing for a proposal that is not yet a confederation | Phase 4: the ceremony scope carries it |
| `ConfederationBridge.sweep` puts every due event into one envelope, whatever its bytes | Phase 4: split at `MAX_CARRIED_BYTES` |
| a ceremony row cannot be written without a `ChatRoom` row (the foreign key) | Phase 5: the column goes |
**Done when** all five pass on the current code, each with a KDoc line naming its phase.
### Phase 2: storage, schema 54
`AutoMigration(53, 54, spec = ConfederationCeremonyInboxMigration::class)`. Phases 5 and 7 add to the
same spec.
**`ConfederationCeremonyHeard`** (`K/database/model/ConfederationSigningAttempt.kt`, beside
`ConfederationSigningHeard`, its twin):
```kotlin
@Entity(indices = [Index("proposalId"), Index("sessionId"), Index("heardAt")])
data class ConfederationCeremonyHeard(
@PrimaryKey val id: HexKey, // the signed event's id
val proposalId: HexKey,
val sessionId: String, // the ceremony: ConfederationAttestation.ceremonyId(proposal, attempt)
val kind: Kind,
val pubKey: HexKey,
val eventJson: String,
val heardAt: Instant = Clock.System.now(),
)
```
It has no foreign key, because a round can arrive before its owner joins, and so before the ceremony
row exists. `ConfederationCeremonyDao` gains:
- `insertCeremonyHeard`, with `IGNORE`;
- `getCeremonyHeardForSession(sessionId)`;
- `deleteCeremonyHeardForSession`;
- `getCeremonyHeardOlderThan(at)`.
**`ConfederationCarry.scope`**, a `TEXT NOT NULL DEFAULT 'SIGNING'` column, with values `SIGNING` and
`CEREMONY`. Rows written before it are signing's, which is all of them. The `confederationId` column
keeps its name and now holds the scope's id: a proposal id for a ceremony. Its KDoc says so. A rename
would touch every signing query for nothing.
**Retention.** `ProtocolRetention` / `DisappearingMessageSweeper` release a `ConfederationCeremonyHeard`
row in either case:
- the ceremony named by its `sessionId` exists on this device and is not running;
- no ceremony with that id exists here, and the row is older than `DisappearingMessages.CEREMONY_FLOOR`.
This is the rule `ConfederationSigningHeard` follows, with the ceremony's floor.
**Filed from today's path too.** `ConfederationRitualManager.process` files every message it is
handed into `ConfederationCeremonyHeard` before `record`. `replayStoredMessages` reads
`getCeremonyHeardForSession` first and falls back to `GiftWrapPayload` by kind. The fallback goes in
Phase 5. Today's messages are unsigned rumors, so `eventJson` holds the rumor with an empty `sig`
until Phase 3.
**Tests:**
- `T/managers/ConfederationStorageJvmTest.kt`:
- a heard row is filed with no ceremony row;
- it is released once its ceremony fails;
- it is released after the floor with no ceremony.
- `T/database/migrations/ShippedProfileUpgradeJvmTest.kt` comes out at 54.
- A new `T/database/migrations/ConfederationCeremonyInboxMigrationJvmTest.kt` opens a v53 database holding a
`ConfederationCarry` row and reads it back as `SIGNING`.
- `ConfederationCeremonyJvmTest` passes unchanged.
### Phase 3: every ceremony message signed, in an envelope (report D1, D3)
`K/nostr/confederation/ConfederationRitualEvents.kt`:
- `CARRIED: Kind = 30379`, with a KDoc saying it is the ceremony's sibling of
`ConfederationSigningEvents.CARRIED` and why it is a kind of its own: the expiry floor.
- `ALL` gains `CARRIED`. A new `SIGNED = PER_PERSON + FAILURE` is the set an envelope may carry.
- `encodeCarried` and `decodeCarried`, delegating to `ConfederationSigningEvents`' pair. The format is
the same: a JSON array of events.
- `PROPOSAL_TAG` goes on the envelope as well as on each event inside it, so an envelope says which
scope it is for without opening its events.
`K/nostr/DisappearingMessages.kt`: `CARRIED` goes into `CEREMONY_KINDS` through
`ConfederationRitualEvents.ALL`, so it needs no edit there. `DisappearingMessagesTest` (in `commonTest`)
fails if it did not.
`K/managers/ConfederationRitualManager.kt`:
- `broadcast` signs the event with `NostrSignerSync(KeyPair(nostrPrivateKey))`. It keeps the session,
proposal and attempt tags and the expiry stamp, and **drops the `p` tags**. It then queues one
30379 envelope of that one event as the room's `GiftWrapPayload`, p-tagged as today, since the
NIP-17 room is still the channel. `publishOwn` and `failOut` pass the key through. `abandon` and
`fail` take it, since they sign a 30387. `DatabaseConfederationRepository.abandonCeremony` passes it.
- `process` reads only 30379 envelopes. It drops a bare ritual rumor with a warning (the Phase 1 pin
flips). For each event in the envelope it:
1. verifies the signature;
2. checks the kind is in `SIGNED` and the proposal tag matches the envelope's;
3. files it in `ConfederationCeremonyHeard`;
4. calls `record`.
- `record` keeps its rules, applied to `event.pubKey`. They now hold for a signed author, where before
they held for a seal's.
- `replayStoredMessages` builds events from `eventJson` and verifies them again, since what was stored
as heard could be from before this phase.
`K/database/dao/NostrDao.kt:1095`: the ritual branch already matches by `isRitualKind`, which now
includes 30379, so it needs no change but its comment.
**Tests** (`ConfederationCeremonyJvmTest`, on `ConfederationPeople`): every existing case passes
unchanged, which shows the signatures cost the protocol nothing. Three new cases:
- an event whose content was changed after signing is dropped on every device, and the ceremony waits
on its author;
- an event signed by someone outside the roster is dropped;
- **one person's two different 30382s, both signed, for one attempt**: the first heard is recorded, and
the second is kept in `ConfederationCeremonyHeard` as evidence. The failure names the person and the
two event ids instead of only "received different dealings". This is the provable-equivocation
point of the report: `record` checks a second signed message of a kind it already holds from that
person and fails out naming them (`ConfederationRitualManager.describeEquivocation`).
### Phase 4: the bridge carries ceremonies, and the seat groups' rooms carry them too (report D2, D4)
**The bridge's second scope** (`K/managers/ConfederationBridge.kt`):
- `heardInRoom`, `heardInInbox` and `markCarried` take a `CarryScope` in place of `confederationId`.
The carry plan comes from a new private `planOf(database, scope)`:
- `Signing`: `ConfederationSigningManager.held(...)?.plan`;
- `Ceremony`: `ConfederationRitualManager.carryPlan(database, proposalId)`, a new internal function
returning `planFrom(basisFor(...))` or null.
Only the scope decides which; every rule after it is the same.
- `sweep` groups due rows by `(groupRoomId, scope, id, direction)`, reading `scope` from the row.
- **Byte-aware envelopes.** `sweep` fills an envelope in `createdAt` order until adding the next event
would pass `MAX_CARRIED_BYTES` of encoded content, or `MAX_CARRIED` events, and starts another. An
event larger than the budget on its own goes alone and is logged. Phase 5's eligibility keeps such
rosters out, and signing never makes one. This applies to signing too, which never neared the
budget.
- `carryOut` takes the envelope's kind and scope tag from the scope:
- `Signing`: 30398 with `["confederation", id]`, as today;
- `Ceremony`: 30379 with `["confederation_proposal_id", id]`.
The expiry stamp follows from the kind. The recipients are the carry plan's groups, as today.
- `carryIn` takes the scope, and for `Ceremony` queues through `ConfederationRitualManager.queueEnvelope`.
The bridge's rule already sends nothing in when every seated person is an admin, which in a ceremony
is always. The code path is kept so the rule stays one rule.
**Writing into the seat groups' rooms** (`K/managers/ConfederationRitualManager.kt`):
- `roomsFor(database, plan, userPublicKey)`: the room of every group the person holds a seat in, that
this device holds with MLS state. It is the signing manager's function of the same name, lifted to a
shared helper in `ConfederationFormation`.
- `broadcast` **also** writes the signed event, in a 30379 envelope tagged with the room, into each of
those rooms as a `MarmotInnerEvent`, the way `ConfederationSigningManager.carry` does. It then calls
`ConfederationBridge.heardInRoom(..., CarryScope.Ceremony(proposalId), ...)`. The NIP-17 copy still
goes. Duplicates are harmless: `ConfederationCeremonyMessage` and `ConfederationCeremonyHeard` both
insert with `IGNORE`.
- `processFromRoom(database, groupRoom, envelope, user, key)`: verify, file as heard, tell the bridge,
then `record` and `advance` for the ceremony this device's owner has joined, if any. A device whose
owner holds no seat and is not one of the group's admins files nothing. That is a member who is not an
admin, who has nothing to do with the ceremony (report D7).
- `receiveFromInbox(database, inboxRoom, envelope, user, key?)`: the same, from the inbox, telling the
bridge it crossed. Without a key it only files.
- `queueEnvelope(database, groupRoomId, proposalId, user, events)`, for the bridge's carry-in.
**Routing:**
- `K/database/dao/NostrDao.kt`, the MLS application-message branch near `:1732`: a new arm,
`ConfederationRitualEvents.isRitualKind(inner.kind) -> ConfederationRitualManager.processFromRoom`,
behind `ExperimentalFeatures.confederation`, beside the signing arm.
- `K/managers/GroupInboxManager.kt` `open`, near `:107`: `rumor.kind == ConfederationRitualEvents.CARRIED`
goes to `ConfederationRitualManager.receiveFromInbox` and is marked opened, before the statement arm.
`T/managers/GroupSealRoutingJvmTest` gains the case.
**Tests:**
- `T/managers/ConfederationSigningJvmTest`: passes unchanged on the bridge's new signature.
- A new case in `T/managers/ConfederationBridgeJvmTest.kt` (new file): a round of 40 events of 2 KB
splits into three envelopes, each under the budget, and every event arrives once. This is the
Phase 1 sweep pin, flipped.
- `T/managers/ConfederationCeremonyJvmTest`, on `ConfederationPeople.withGroupRooms()`:
- each person's messages appear in each seat group's room on every device of that group;
- the group's first admin carries them;
- every device holds every message twice over, once by NIP-17 and once by inbox, and forms one key.
The Phase 1 bridge pin flips.
- **Lift the signing test's pump.** `ConfederationSigningJvmTest`'s private `pump(at, away, hold)`,
which ferries group rooms, runs every admin's turn and delivers inbox wraps, moves into
`T/managers/ConfederationPeople.kt` as `pumpGroups(at, away, hold)`, taking the envelope kinds to
ferry. The signing test calls it unchanged, and the ceremony tests use it from here on.
### Phase 5: the switch (report D5, D8, D10)
**No room.** In `K/managers/ConfederationRitualManager.kt`:
- `join` no longer calls `createNip17ChatRoom` or `ensureProfiles`. It throws, with a reason a person
can read, when this device holds the room of none of its owner's seat groups.
- `broadcast` writes only into the seat groups' rooms (Phase 4's write). The `GiftWrapPayload` queue
goes, and the `localChatRoom` parameter goes from `advance`, `publishOwn`, `failOut` and `broadcast`.
- `advance`, `resumeRunning`, `abandon` and `join` stop looking up a room. A seat group whose room this
device does not hold is a failure said out loud ("This device no longer holds Agora's room"), not a
silent return.
- `process` (the NIP-17 entry) goes. `replayStoredMessages` reads `ConfederationCeremonyHeard` only.
**The column goes.** `ConfederationCeremony.chatRoomId` and its foreign key go: `@DeleteColumn` in
`ConfederationCeremonyInboxMigration`, folded into 54. Room rebuilds the table without the key. Every
reader is updated:
- `ConfederationCeremonyDao` queries by `chatRoomId`;
- `DatabaseChatRepository.keyCeremonyOfRoom`, which Phase 6 deletes; until then it returns null;
- anything else a grep for `ceremony.chatRoomId` and `ConfederationCeremony(` finds.
The Phase 1 foreign-key pin flips.
**Eligibility** (report D8). `eligibility` adds two checks:
- this device holds the announced inbox key of every group its owner has a seat in ("This device
can't read the groups' messages yet; set up the group's inbox first");
- no single message of this roster would pass `MAX_CEREMONY_MESSAGE_BYTES` (Phase 0 check 3): "This
confederation has too many admins for one person in several groups to send their part".
The second is also checked in `ProposeConfederationViewModel`, so the form refuses the roster before
anyone signs. It does that from each group's admin count, which the form already fetches.
**The NIP-17 branch.** `K/database/dao/NostrDao.kt:1095-1125` stops calling the manager. A ritual kind
in a gift wrap is dropped with a warning, and the room is not made. The feature has never been on in a
release, so no peer sends one (report D9).
**Tests.** `ConfederationCeremonyJvmTest` moves entirely onto `pumpGroups`:
| case | change |
|---|---|
| three groups of three make one key | as before, and **no device holds a NIP-17 room over the roster** (the Phase 1 room pin, flipped) |
| nobody opens it, no 30380 or 30383 | unchanged |
| a person who is an admin of two groups | writes into both rooms, both groups' carriers may carry, one role each recorded |
| an admin who never joins stalls it | unchanged |
| *a member who has not joined finds the ceremony from the room* | **replaced**: finds it from the proposal (`joinable`), and joining replays what their group's room and inbox already heard |
| an abandoned attempt is tried again | unchanged |
| a group that told two groups different things | unchanged |
| two devices dealt different things | now named by the two signed 30382s (Phase 3) |
| admins changed; not every acceptance | unchanged |
| messages before joining are replayed | from `ConfederationCeremonyHeard` |
| outside the roster | unchanged |
| **new: a carrier away** | the first admin of Agora is away; the second carries after 20 s on the test clock, and not before |
| **new: every admin of a group away but the author** | each author's own turn carries their own message; the ceremony forms, slower |
| **new: a seat without the inbox key** | Phase 0 check 5's promoted admin cannot join, with the reason |
| **new: a 120-role dealings round** | on a roster at `MAX_ROLES` − 8, dealings split into several envelopes per group and reassemble; one key forms |
| **new: a roster past `MAX_CEREMONY_MESSAGE_BYTES`** | refused at eligibility and on the form |
`ConfederationProfileNetworkJvmTest.formed()` forms its confederation through
`ConfederationTestGroups.pumpConfederation`, over real inboxes, instead of its own NIP-17 pump. Its
three cases pass.
### Phase 6: the screens and the lines (report D6)
**Lines.** `ConfederationRitualManager.announce` writes into each seat group's room, by this device
for itself, never sent. It sets `frostSigningSessionId = proposalId`, the way signing's lines carry the
id they open, and `senderPublicKey` = this device's owner. The started, failed and complete lines keep
their types.
In `K/ui/composable/widgets/chat/ChatTranscript.kt`:
- a new callback, `onOpenKeyCeremony: (proposalId: HexKey) -> Unit`;
- the three ceremony types become a `RitualNotice` that opens it;
- `ChatRoomMessagingScreen` passes `ConfederationRitualRoute(activeUser, proposalId)`.
`NotificationClassifier` keeps the three types where they are.
**Removed:**
- `ChatRepository.keyCeremonyOfRoom` and its implementation;
- `KeyCeremonyLink` and `FormedConfederation` in `ChatRoomMessagingUIState`, if nothing else reads
them;
- `KeyCeremonyBanner` and the `keyCeremony` field;
- `ConfederationRitualManager.proposalOfRoom`;
- the ceremony room's composer hiding from confederation-profile.md D10, wherever it reads
`keyCeremony`;
- the strings only they used. `the_key_ceremony_for_is_complete` is one; a grep finds the rest.
**The ritual screen's carrying wait.** `ConfederationRitualUIState.Step` gains `waitingToCross`. It
lists the names of the groups this device belongs to that have a person's message for this step in
their room with no `ConfederationCarry` row done, read through a new `ConfederationCeremonyDao` query
on the carry table by scope id. The screen shows "Sent; waiting for an admin of Agora to pass it on"
under the step. A device cannot see what another group has not yet carried, so the line is only ever
about the device's own groups. That is the honest scope of what it knows.
**Strings**, in `composeResources/values/strings.xml`, sentence case, none saying "inbox",
"envelope", "carry" or "room" to a person:
- `confederation_ritual_waiting_to_cross`: "Sent; waiting for an admin of %1$s to pass it on"
- `confederation_ceremony_needs_inbox`: "This device can't read the groups' messages yet. Set up the
group's inbox first."
- `confederation_ceremony_too_large`: "This confederation has too many admins for one person in
several groups to send their part"
The two refusals are read in the composable and shown where `join`'s exception is shown today.
**Tests:**
- `T/ui/ConfederationScreensJvmTest`:
- the lines in each seat group's room open the ritual screen;
- the waiting-to-cross line appears while a carry is due, and goes once it is done;
- no screen offers a ceremony room.
- `ChatRoomMessagingViewModel`'s tests lose the banner case.
- `m3Audit` stays at budget.
### Phase 7: the ceremony rooms already on devices (report D9)
Added to `ConfederationCeremonyInboxMigration.onPostMigrate`, still 54. The column is gone by the time
`onPostMigrate` runs, so ceremony rooms are found by what they hold, not by the column:
1. Every `ChatRoom` id that holds a `GiftWrapPayload` of a kind in `ConfederationRitualEvents.ALL`
(30381 to 30387, and 30379 from development builds of Phases 3 and 4) is a ceremony room.
2. In each, delete those `GiftWrapPayload` rows, the `ChatMessage` lines of the three ceremony types,
and any `ChatMessage` pointing at a deleted payload.
3. **Delete the `ChatRoom` row only if nothing else remains**: no `ChatMessage` and no
`GiftWrapPayload` of any other kind. A founders' plain chat that shared the id keeps its room, its
messages and its members (Phase 0 check 4). The room row goes the way
confederation-room-removal.md's did: by walking `PRAGMA foreign_key_list` from `ChatRoom` and
deleting dependents children first, since Room migrates with foreign keys off.
4. `ProtocolRetention`'s rule for `GiftWrapPayload`s of ritual kinds goes. None is written any more,
and the migration removed the ones that were.
**Tests** (`ConfederationCeremonyInboxMigrationJvmTest`): a v53 database holding:
- a completed ceremony's room, with its payloads and lines;
- a second ceremony room whose id is also a plain chat among the founders, holding two written
messages;
- a running ceremony.
It opens at 54 with:
- the first room gone;
- the second room present with its two messages and no ceremony payloads;
- every `ConfederationCeremony` row present without `chatRoomId`;
- the confederation's record untouched.
### Phase 8: the network run, the record, and devices
- **The network run.** In `T/managers/ConfederationNetworkJvmTest`, three groups of three, each with a
real inbox ceremony (`ConfederationTestGroups`), go end to end with no NIP-17 room on any device:
1. propose, accept and form;
2. sign the confederation's profile with nobody asked;
3. one founder away for the whole ceremony, whose group's other admins carry for everyone else.
- **The record.** This document's header and a progress table, and a *what the plan said / what it
turned out to be* table. Add the README row's status. Add *since* notes pointing here in
confederation-without-coordinator.md D8, confederation-profile.md D10 and Phase 7, and
confederation-room-removal.md's *Out of scope* line about the key ceremony. Mark the report
"implemented by" this plan.
- **Device run**, three groups of three on at least five devices or emulators, each group with an
inbox, one person an admin of two groups:
1. propose and accept; every admin is offered **Join**;
2. join on every device; no NIP-17 room appears in any chat list; the lines appear in each group's
room;
3. close the phone of each group's first admin mid-ceremony; it still forms, and the delay is within
Phase 0 check 6's number;
4. a development device that ran a ceremony before this plan upgrades, its ceremony room goes, and a
plain chat among the same people stays.
---
## Who is asked what
Nothing a person is asked changes.
| step | who is asked | what they decide | automatic after that |
|---|---|---|---|
| ceremony | each admin of each group | **to join** | every round; writing into their seat groups' rooms |
| carrying | nobody | — | each group's admins' devices, in order, `k × 20 s` |
| a retry | any person in the roster | **to try again** | as above |
## Risks
| risk | where it is handled |
|---|---|
| 26,000 bytes is wrong for real relays | Phase 0 check 2 measured it on the app's own sealing; the constant is one place |
| a roster whose single message cannot fit anywhere | Phase 0 check 3 sets `MAX_CEREMONY_MESSAGE_BYTES`; Phase 5 refuses it at the form and at join |
| the bridge's new scope breaks signing | Phase 4 runs every signing test unchanged on the new signature before anything else uses it |
| dual delivery in Phase 4 hides a bug in one path | Phase 5's tests run on the new path alone; the NIP-17 path is gone by then |
| the migration deletes a founders' real chat | Phase 7 step 3, and its test with exactly that room |
| a development device between Phases 2 and 7 holds a 54 that later phases changed | the header says to clear its data, as confederation-room-removal.md said for 52 |
| a wrap lost on another group's relays stalls a round | as today; out of scope here, and named in the report as a follow-up (**Send again**) |
## Out of scope
- **Send again** for a ceremony: re-carrying every heard message to a group being waited on.
- Changing the dealings' encoding from hex to base64.
- The group's own ChillDKG ceremony, which stays on NIP-17.
- Threshold-ECDH member groups, as in every confederation plan.
---
## Order and size
| phase | rough size | depends on |
|---|---|---|
| 0 | scratch tests, this document | — |
| 1 | ~150 test | 0 |
| 2 | ~200 main, ~200 test, an auto-migration with a spec | 1 |
| 3 | ~200 main, ~250 test | 2 |
| 4 | ~450 main, ~550 test, ~150 moved | 3 |
| 5 | ~250 main net, ~600 test | 4 |
| 6 | ~250 main, ~200 test, removing ~150 | 5 |
| 7 | ~150 main, ~200 test | 5 |
| 8 | ~250 test, docs, a device session | all |
About 1,750 lines of main code and 2,400 of tests. Phases 6 and 7 can be built side by side once 5 is
in. Everything else is in order:
1. storage before anything writes it;
2. signatures before anything carries them;
3. the new path beside the old before the switch.
Phase 4 is the one to review closely, since it changes the bridge signing already depends on.
## Checking the work
```bash
./gradlew :composeApp:compileDebugKotlinAndroid :composeApp:jvmTest
```
```bash
./gradlew :composeApp:m3Audit
```
```bash
./gradlew check
```
One new kind, 30379, in no `RetiredKinds` and in `CEREMONY_KINDS` through
`ConfederationRitualEvents.ALL`. No new `mantra/…` tag: the envelope is wire, not a hash input, and the
ceremony's attestation, seed and host-key tags are unchanged. Bennu is named nowhere but in comments.
@@ -0,0 +1,425 @@
# The confederation's key ceremony without its NIP-17 room
A report on one question: **can a confederation be formed without the NIP-17 room its key ceremony
runs in today**, with the ceremony's rounds carried between groups by their inboxes (NIP-4E, the
group-to-group messages the statements already use) and each group's admins coordinating in their
own group?
**Short answer: yes.** Nothing in the ceremony needs the room. The room is a transport and a place
to write lines, and every piece that would replace it has already been built for the
confederation's signing ([confederation-room-removal.md](./confederation-room-removal.md)): signed
events that anyone can carry, envelopes sealed to group inboxes, admins who take turns carrying them,
and a store of what was heard that does not depend on a room. The ceremony is a better fit for that
transport than signing was. Every person in the ceremony is an admin who reads their group's inbox,
so nothing has to be carried back into a room, and every step is rebuilt from stored messages, so the
extra hop costs time and never correctness.
There is one real obstacle, and it is size, not protocol. A round of dealings is far larger than
anything the bridge carries today. A whole group's dealings in one envelope do not fit under NIP-44's
plaintext limit, or a relay's event limit, once a confederation has more than about sixty roles. The
bridge has to learn to split envelopes by bytes, not by count.
What the question cannot mean is the groups doing the *cryptography* among themselves, with each
group's admins producing one combined contribution for the group. Upstream's DKG has every role deal
on its own, under its own host key, and every device needs every dealing whole. What a group's admins
can do together is move their group's messages. They cannot merge them. See *The constraint*, below.
Written against `24991e1c`, on 2026-11-23. **A report. Nothing here is built.** It proposes phases at
the end in the repository's usual shape, for the owner to take up or not. The phased plan that implements it
is [confederation-dkg-inboxes.md](./confederation-dkg-inboxes.md). Paths starting `K/` are
under `composeApp/src/commonMain/kotlin/mobi/giza/compose/`.
Read [confederation-without-coordinator.md](./confederation-without-coordinator.md) first, for the
ceremony as it runs now (D8 to D10), then
[confederation-room-removal.md](./confederation-room-removal.md), whose bridge this report reuses.
[group-inbox.md](./group-inbox.md) covers the inboxes.
---
## What the NIP-17 room does today
Traced through the code at `24991e1c`.
**The room is made on join.** `ConfederationRitualManager.join` calls
`createNip17ChatRoom(userPublicKey, plan.people − me, subject = name)`
(`K/managers/ConfederationRitualManager.kt:209-213`). Its id is derived from the set of people, so
every device makes the same room without anyone choosing it (coordinator-free D8). Before that,
`ensureProfiles` writes a placeholder profile for every stranger in the roster, because a NIP-17
room's members are foreign keys onto `Profile` (`:662-675`).
**It does five jobs:**
| job | where | what it really needs |
|---|---|---|
| sending a round | `broadcast` (`:595-626`) queues one `GiftWrapPayload` p-tagged to every other person; the NIP-17 pipeline wraps it once per person, to each person's own 10050 relays | a way to get one person's message to every other person, authenticated as theirs |
| receiving a round | `NostrDao`'s gift-wrap branch for `ConfederationRitualEvents.isRitualKind` makes or finds the room from the p-tags and calls `process` (`K/database/dao/NostrDao.kt:1095-1125`) | routing an inbound message to the manager |
| holding what came before joining | `replayStoredMessages` reads `GiftWrapPayload` by kind, **from any room** (`:629-639`) | a store of heard ceremony messages, keyed by ceremony |
| the transcript lines | `announce` writes started, failed and complete lines into the room (`:642-655`) | somewhere a person sees the ceremony move |
| saying what the room is for | `proposalOfRoom` (`:172-177`) feeds `keyCeremonyOfRoom`, the room's banner linking to the proposal (`K/database/repository/DatabaseChatRepository.kt:405-414`); confederation-profile.md D10 closes the room's composer once the ceremony ends | nothing, once there is no room |
**And it is tied into storage.** `ConfederationCeremony.chatRoomId` is a foreign key onto `ChatRoom`
with `ON DELETE CASCADE` (`K/database/model/ConfederationCeremony.kt:28`). `resumeRunning`, `abandon`
and `join` look the room up and return **silently** without it (`:193`, `:249`, `:257`), which is
the same failure confederation-room-removal.md found in signing: take the room away and nothing fails
out loud.
**Only the transport is NIP-17's.** `advance` is a pure function of `ConfederationCeremonyMessage`
rows (`:350-492`), and `record` takes any `Event` with a pubkey it can trust (`:294-341`). The
cryptography never sees the room. Only `broadcast`, `replayStoredMessages`, `announce`, the room
lookups and the foreign key do.
### What the rounds carry, and who may read them
| kind | from | content | secret? |
|---|---|---|---|
| 30381 | each person | a host public key per role, a 32-byte seed contribution, the attestation, the statement ids it was built from | no |
| 30382 | each person | per role: a `DealerRecord`, signed by the role's host key, and the evaluation vector, one `ciphertext32` for every role | **the vector is**, but it is already encrypted: each entry is padded by an ECDH between the dealer's ephemeral key and the recipient's **host key** (upstream §6.2, §7.1) |
| 30384 | each person | per role: an authorization of the genesis, plus the hash of the broadcast this device computed | no |
| 30385 | each person | per role: an acknowledgment | no |
| 30387 | anyone in the roster | failure or abandonment, with a reason | no |
Every person's message is **the same bytes for every recipient**. The NIP-17 room sends one rumor
gift-wrapped `P` times. It does not send `P` different messages. So the room's encryption is not what
keeps the shares secret. The host-key pads do that, and they work over any channel. All the room adds
is that only the roster's people see the round at all, plus an author for each message (the seal,
signed by the person's nostr key). That author is what binds a host key to a person in the 30381.
---
## The constraint: the groups can carry, not combine
The user's framing has each group's admins "coordinate with each other in their own respective
groups". It is worth being exact about what that can and cannot mean, because the signing work ran
into the same wall (confederation-room-removal.md, *The constraint that shapes the plan*).
Upstream's nested DKG (§7) has **every role deal individually**:
- each role draws its own random polynomials and publishes a `DealerRecord` with its outer and inner
commitments, a proof of possession, an ephemeral nonce, the digest of its evaluation vector, and a
BIP340 signature by **its own host key**;
- the broadcast (`coordinatorStep1`, which every device now runs itself) lists **one record per role
in roster order** and sums the vectors;
- each role checks every record's signature and every digest before it authorizes anything.
So a group cannot pre-combine its admins' dealings and send one. The ciphertexts would add up
(they are homomorphic), but every dealer's `evaluation_digest` and `record_signature` cover that
dealer's own vector, so a pre-summed vector verifies against nobody's record. A group dealing as one
entity, with its existing FROST shares running a threshold dealer, would be a new protocol upstream.
It is not a transport choice (*Appendix*).
What a group's admins *can* do together is what they do for signing: gather their group's messages
in the group's own room and carry them across as one batch per group, so that a round costs one
envelope per group instead of one per person.
Sending each round as the **group's** sealed word, with a seal signed by the group's FROST quorum the
way statements are, is possible and not worth it. It would put `t_g` approvals behind every round of
every group, four rounds deep, to sign values that each person already signs as themselves. And the
host key it would vouch for belongs to a person, not to the group. The coordinator-free plan rejected
the same thing for the coordinator's messages (*The two questions*).
---
## Three ways to move a round
`P` is the number of people in the roster, `N` the number of groups, `c` the number of envelopes a
group's round splits into (1 unless it is a dealings round of a large confederation; see *Size*).
| | **today**: the NIP-17 room | **A. direct to inboxes**: each person seals to every group's inbox | **B. the bridge**: each person writes into their group's room, and an admin carries the batch to every inbox |
|---|---|---|---|
| wraps per round | ≈ `P²` | `P × N` | `N² × c`, plus `P` MLS messages |
| 3 groups of 3 (`P` = 9) | 81 | 27 | 9, plus 9 MLS |
| 12 groups of 5 (`P` = 60) | 3,600 | 720 | 144 × c, plus 60 MLS |
| relays it touches | every person's own 10050 | every group's 10050 | every group's 10050, and each group's Marmot relays |
| who sees a round | the roster | the roster | the roster; and **each group's members** see their own group's admins' messages in their room |
| extra delay per round | none | none | one MLS leg, plus `k × 20 s` when the first carrier is away |
| new machinery | — | a person-to-inbox send (the bridge's `carryOut`, without the room) | the bridge, generalised to ceremonies |
| needs personal 10050s and stranger profiles | yes | no | no |
| one transport with signing | no | no | **yes** |
### Why A works for the ceremony when it did not for signing
confederation-room-removal.md D2 turned down "every message straight to every group's inbox, as a
person" for two reasons: the wraps, and **demoted founders**, whose devices lose the inbox key
(`GroupInboxManager.forgetIfNotAdmin`) and so could not read the rounds. The second reason does not
apply to the key ceremony. Its roster *is* the groups' admin lists, and `eligibility` refuses to join
if any group's admins have changed since it accepted (`:138-146`). So at the time of a ceremony,
**every person in it is a current admin** of each group they hold a seat in. A person can seal to
every inbox and read their own group's inbox.
### Why B is still the recommendation
- **It is one transport.** A formed confederation already depends on the bridge for everything it
signs. Forming one through the same path means one set of carriers, turns, envelopes and tests,
instead of the ceremony keeping a transport nothing else uses.
- **It is the user's design.** Each group's admins see one another's rounds in their own room, and
one of them carries the group's part across.
- **It is the fewest wraps**: `N²` against A's `P × N`, which is a factor of the group size (five
times fewer at five admins a group). A dealings round is the largest message the app sends, so
that factor matters most where the bytes are.
- **The delay costs nothing here.** Signing had to cross while nonces sat in memory, so the bridge
waits twenty seconds and not ten minutes. The ceremony persists everything: dealer seeds until they
are dealt, every message as it arrives, every step re-derived on resume. A slow carrier makes a
ceremony slower. It never makes one fail.
- **Equivocation becomes provable.** Today a person who sends two different dealings sends them in
deniable NIP-17 seals, and the mismatch is caught only by the broadcast hash in the 30384 ("…
received different dealings than this device did", `:438-441`), with no evidence that can be shown
to anyone else. Under B every message is signed by its author, so two different messages for one
round from one person are a transferable proof, and the screen can name that person and show it.
A is the right fallback (*D4*) and the right choice if the owner would rather not have members who
are not admins see their admins' ceremony messages (*D7*).
---
## Proposed decisions
### D1. The ceremony's rounds are signed events, carried
Every 30381, 30382, 30384, 30385 and 30387 is signed with its author's nostr key, as signing messages
have been since confederation-room-removal.md D3. It is never published. It names its ceremony,
proposal and attempt, as today, and drops its `p` tags, since it no longer goes to people.
`record` keeps its rules (one message per person per kind, one value per role, a failure only from
someone in the roster). It applies them to `event.pubKey` once the signature verifies. The 30381's
binding of host keys to a person now comes from that signature, not from a seal.
### D2. A role holder writes into their seat groups' rooms; admins carry, by the existing turns
As confederation-room-removal.md D2 and D4, unchanged in shape:
- **Out.** A person's round goes into the Marmot room of each group they hold a seat in, inside a
ceremony envelope (D3). An admin of that group who holds its announced inbox key carries the waiting
messages to every member group's inbox, its own included, at `k × 20 s` by their place among the
group's admins. The group's own copy coming back through its inbox marks the messages crossed on
every other admin's device.
- **In.** Not needed. Every seated person is an admin and reads the group's inbox, so the bridge's
carry-in rule (`seated.all { it in admins }`, `K/managers/ConfederationBridge.kt:112`) already
sends nothing.
- **Carriers need not have joined.** A carrier works from the *basis* (`basisFor(proposalId)`), which
every admin of every group holds once the proposal is accepted (coordinator-free D7). It does not
work from a ceremony row, which exists only after its owner joins. Today's
`ConfederationSigningManager.held` keys the bridge on a formed confederation (`:88`, `:109`, `:163`),
so the bridge needs a second scope: a running ceremony, keyed by its proposal.
A person in two groups writes into both rooms, and both groups' carriers may carry the same event.
Messages are filed with `OnConflictStrategy.IGNORE` by event id, so the second copy changes nothing,
as `ConfederationSharedSeatsSigningJvmTest` already shows for signing.
### D3. Its own envelope kind, for the ceremony's expiry
The ceremony and signing expire on different floors: `CEREMONY_FLOOR` is seven days ("a DKG round has
no resend"), and `SIGNING_FLOOR` is one day (`K/nostr/DisappearingMessages.kt:58-85`). `classOf` is a
function of the kind, so the ceremony needs **its own envelope kind**, a sibling of 30398, in
`CEREMONY_KINDS`. Phase 0 picks the number, as it picked 30398. 30380 and 30383 are retired and should
stay retired. 30386, 30388 and 30389 are named in confederation.md for things not built.
`ProtocolRetention` gets the rule `ConfederationSigningHeard` has: a heard ceremony message is
released once its ceremony is complete or failed on this device, or after the ceremony floor when
there is no ceremony here at all.
### D4. Envelopes split by bytes
The bridge caps an envelope at `MAX_CARRIED` = 256 **events** (`ConfederationBridge.kt:143`). A
signing round is small, so the cap was never reached. A dealings round is not small (*Size*). The
sweep has to fill envelopes up to a **byte** budget and send several when one would overflow. Phase 0
sets the budget. The arithmetic below puts it near 32 KB of carried events; measured, it is 26,000 bytes, because NIP-44 pads each layer in steps ([confederation-dkg-inboxes.md](./confederation-dkg-inboxes.md), Phase 0).
A single event larger than the budget cannot be carried at all. Such an event is one person's 30382
for several seats in a confederation near `MAX_ROLES`. It would also fail today, since a NIP-17 wrap
has the same limits. Phase 0 measures where that line is, and the propose screen should refuse a
roster past it, saying why, as it already refuses a thirteenth group.
**Fallback to A.** If a person's message has not crossed for their group after every admin's turn
has passed, the author's own device seals it directly to every inbox. The author is an admin and holds
the key. One person away then delays their group by a few turns and never stops the ceremony.
### D5. A store of heard ceremony messages, and no room
- `ConfederationCeremonyHeard`, the ceremony's twin of `ConfederationSigningHeard`: every ceremony
message this device has heard by any path, signed, keyed by event id, with the ceremony id, kind and
author. `replayStoredMessages` reads it instead of `GiftWrapPayload`.
- `ConfederationCeremony.chatRoomId` and its foreign key go. Nothing about a ceremony hangs off a room.
`join`, `abandon` and `resumeRunning` stop looking one up, and a seat group whose room this device
does not hold is said out loud, not returned from silently.
- `ensureProfiles` goes with the room. The ritual screen names people through
`ConfederationManager.nameOf`, which does not need a placeholder row.
### D6. The lines go into each seat group's room, and the screens carry the rest
As confederation-room-removal.md D9: `announce` writes its started, failed and complete lines into
the room of each group the person holds a seat in, written by each device for itself, never sent. A
line opens `ConfederationRitualScreen`, which already has the join, the waits by name, **Try again**
and abandon, and needs no room. `keyCeremonyOfRoom`, `proposalOfRoom`, the `KeyCeremonyBanner` and
confederation-profile.md D10 (closing the room's composer) all go, since there is no room to describe.
The ritual screen gains one thing it never needed: for a group whose messages for the current round
have not crossed, "Waiting for an admin of Agora to send its messages on". Today a wait could only
be on a person.
### D7. Who sees the rounds
Under B, the members of a group who are not admins see their own admins' ceremony messages in their
group's room. They see host keys, a seed contribution, ids of statements, dealer records and
**ciphertexts padded to host keys they cannot open**, plus authorizations and acknowledgments. None of
it is secret, and none of it names another group's admins. The other groups' envelopes arrive only in
the inbox, which those members do not read. They already see, through their own group's signing
sessions, that their group accepted a confederation (coordinator-free D6).
What relays see gets better. Today every wrap p-tags a person, so a relay can watch the same sixty
npubs get bursts of gift wraps at the same moments, four times over. Under B the wraps go to the
groups' npubs, `N` of them.
If the owner would rather members who are not admins see nothing at all, A does that, at `P × N` wraps
a round.
### D8. A join needs this device to hold the group's inbox key
The ceremony now reads its rounds through the inbox. `eligibility` therefore adds
coordinator-free D6's first check: this device holds the announced inbox key of every group its owner
has a seat in ("This device can't read the groups' messages yet"). An admin promoted just before the
proposal, whose rotation has not reached their device, is told so instead of waiting forever.
### D9. The NIP-17 branch goes, and the rooms on devices are cleaned up carefully
The feature has never been on in a release, so there is no peer to stay compatible with. `NostrDao`'s
gift-wrap branch for ritual kinds is removed, and a ritual kind arriving in a gift wrap is dropped with
a warning.
**Careful with the migration.** A ceremony room's id is `deriveChatRoomId(people)`, the id of
**any** NIP-17 conversation among exactly those people. If the founders also have a plain group chat
among themselves, it is the same room. The migration must delete only the ceremony's
`GiftWrapPayload`s and lines. It may delete the `ChatRoom` row only when nothing written by a person
remains in it. confederation-room-removal.md did not have this problem: a confederation's Marmot room
id could only ever be the confederation's.
### D10. Behind both flags
`ExperimentalFeatures.confederation` and `ExperimentalFeatures.groupInbox`, as every confederation plan
since the coordinator went. The inbox is already a precondition for taking part (coordinator-free D5),
so this adds no requirement a group does not already meet.
---
## Size
The bridge's only real risk. Per role, a 30382 is hex-encoded, so twice:
```
DealerRecord ≈ role id + 4 + 33·T + Σ_g (4 + 33·(t_g − 1)) + 64 (pop) + 33 (nonce) + 32 (digest) + 64 (sig)
vector = 32 · R R = roles across every group
on the wire ≈ 2 · (record + vector)
```
| confederation | roles `R` | one role's 30382 | one group's dealings round |
|---|---|---|---|
| 3 groups of 3, `t_g` 2, `T` 2 | 9 | ≈ 1.4 KB | ≈ 4 KB |
| 12 groups of 5, `t_g` 3, `T` 7 | 60 | ≈ 6.4 KB | ≈ 32 KB |
| 12 groups of 10, `t_g` 6, `T` 7 | 120 | ≈ 12.6 KB | ≈ 126 KB |
**The limits it meets:**
- **NIP-44 v2 encrypts at most 65,535 bytes of plaintext.** The seal encrypts the rumor and the wrap
encrypts the seal, so the rumor is limited twice.
- **A relay's event limit**, commonly 64 KiB. Each layer of NIP-44 is base64, so a wrap is about
1.8 × its rumor, and a rumor past about 36 KB makes a wrap a relay may refuse.
- **Marmot's decoder bound**, 64 KiB on a whole application payload (`MarmotJson.MAX_INPUT_BYTES`, as
`ChronicleEvent.MAX_PAGE_BYTES` records). One person's 30382 into their group's room is at most a
few roles' worth, well inside it.
So a group's dealings fit one envelope up to about sixty roles, and need splitting above that (D4).
The other rounds are small: a 30384 is 64 bytes of signature and a hash per role. At 120 roles, a
group's dealings take about four envelopes, which is still `N² × 4` = 576 wraps for the round, against
the NIP-17 room's 14,400.
**Today's path has the same ceiling for one person.** A person seated in three groups of a 120-role
confederation sends a 30382 of about 38 KB, whose NIP-17 wrap is over 64 KiB. That is not this
report's to fix, but Phase 0 should measure it on both paths. Hex to base64 would save a quarter on
either, at the cost of a wire change.
---
## Liveness
| failure | today | under B |
|---|---|---|
| a person is away | the ceremony waits on them by name | the same |
| an admin carrier is away | — | the next admin carries after 20 s; with every admin of a group away, the author's own device seals directly (D4) |
| a wrap is lost on a relay | nobody resends a NIP-17 ceremony wrap | the group's own copy coming back is the only receipt; a copy lost on *another* group's relays is not noticed. **The same gap as today**, moved from people's relays to groups' |
| a device restarts mid-round | every step is re-derived from stored messages | the same; and the carry turns are rows (`ConfederationCarry`), so they survive too |
| a group rotates its inbox mid-ceremony | — | a rotation means an admin change, which `eligibility` already refuses on; the old key keeps reading |
The lost-wrap gap deserves its own small plan in either world: a **Send again** on the ritual screen
that re-carries every heard message of the ceremony to the inbox of the group being waited on. It
would be the first resend a confederation ceremony has had (frost-session-resend.md is signing's).
---
## Phases, if the owner takes this up
One commit a phase in the repository's style (`feat: … (confederation-dkg-inboxes, Phase n)`). Each
leaves `jvmTest`, `m3Audit` and the brand and wallet audits green.
| phase | what | rough size |
|---|---|---|
| 0 | this report as a plan; checks: the envelope kind is free; the byte budget, measured by sealing and wrapping a 12 × 10 dealings round; the largest single 30382 on today's path and on B; the founders' plain chat sharing the ceremony room's id (D9) | scratch tests |
| 1 | `ConfederationCeremonyHeard`; `replayStoredMessages` reads it; `ProtocolRetention` and the sweeper; every message heard by the NIP-17 path is also filed there. The NIP-17 room still works | ~200 main, ~200 test, an auto-migration |
| 2 | every ritual message signed by its author (D1), still sent through the room; `record` verifies. `ConfederationCeremonyJvmTest` passes unchanged, plus a changed message and an outsider's dropped | ~150 main, ~150 test |
| 3 | the bridge's second scope: a ceremony by proposal, carriers from the basis; the ceremony envelope kind (D3); the byte-aware sweep (D4); `GroupInboxManager.open` and `NostrDao`'s MLS branch route the new envelope. Messages go into seat groups' rooms **as well as** the NIP-17 room | ~500 main, ~600 test |
| 4 | **the switch**: `join` makes no room; `broadcast` writes only into seat groups' rooms; the foreign key goes; the fallback to direct sealing; D8's join check. Tests on `ConfederationTestGroups` with real inboxes: nine devices form a key with no NIP-17 room anywhere; a carrier away; every admin of a group away and the authors' fallback; a person in two groups; a 120-role dealings round split and reassembled; an equivocating dealer named by two signed messages | ~400 main, ~700 test |
| 5 | the lines into seat groups' rooms; the ritual screen's group wait; the banner, `proposalOfRoom` and confederation-profile.md D10 go; strings in sentence case, none saying "inbox", "envelope" or "room" to a person | ~300 main, ~200 test |
| 6 | the NIP-17 branch removed; D9's careful migration; the record, *since* notes in coordinator-free D8 and confederation-profile.md D10, the README row; a device run of three groups of three forming a confederation with no NIP-17 room | ~150 main, ~250 test, a device session |
About 1,700 lines of main code and 2,100 of tests, less than the room removal, because the bridge,
envelopes, carry turns and heard-store pattern are reused rather than built.
---
## Risks
| risk | what to do |
|---|---|
| a dealings round does not fit, or the split is wrong | D4's byte budget measured in Phase 0; a test that splits and reassembles the largest round |
| one person's 30382 is too large for any single message | refuse the roster on the propose screen, saying why, at the size Phase 0 measures; it fails today as well |
| the migration deletes a real NIP-17 chat among the founders | D9: delete only the ceremony's payloads and lines; the room's row only when nothing else is in it; an upgrade test with a founders' chat in the same room |
| members who are not admins dislike seeing ceremony traffic | D7: nothing in it is secret; A if the owner decides otherwise |
| an admin carrier withholds | the next admin's turn, then the authors' own fallback (D4); a carrier cannot change a signed event |
| a wrap lost on another group's relays stalls a round | as today; **Send again** as a follow-up (*Liveness*) |
| the bridge becomes a single point of failure for both forming and signing | it already is for signing; the fallback makes the ceremony less dependent on it than signing is |
## What this does not change
- **The group's own key ceremony** still runs over NIP-17 ([shared-key-ceremony.md](./shared-key-ceremony.md)).
There is no group yet, so there is no room or inbox to carry it.
- **The statements.** Proposal, acceptance, rejection and withdrawal stay group-sealed rumors between
inboxes (coordinator-free D1 to D7).
- **The cryptography.** The same `ConfederationDkg` calls in the same order, the same seed, attestation,
broadcast hash and attempts.
- **Every admin of every group must still join** (confederation.md D11).
- **Re-seating admins** after formation, which is still confederation.md Phase 15's unbuilt half.
---
## Appendix: considered and not chosen
| idea | why not |
|---|---|
| each group deals as one entity, its admins running a threshold dealer over their FROST shares | upstream's §7 has one signed `DealerRecord` per role and a broadcast listing every one; a group-level dealer is a new protocol in secp256k1-zkp, not a transport ([confederation-upstream.md](./confederation-upstream.md)) |
| a group pre-sums its admins' ciphertext vectors and sends one | the sum is valid arithmetic, but each dealer's `evaluation_digest` and host signature cover its own vector, so the pre-sum verifies against no record |
| every round as the group's own sealed statement, signed by its FROST quorum | `t_g` approvals per round per group, four rounds deep, to vouch for values each person already signs; and the host key it would vouch for is a person's |
| A (direct to inboxes) as the only path | it works, and is the fallback; but it costs a factor of the group size in wraps and keeps the ceremony on a transport nothing else uses |
| keep the NIP-17 room for the ceremony and use the bridge only for signing | it is the status quo: a room over the founders as people, which confederation-profile.md set out to stop, needing every founder's personal 10050 and placeholder profiles of strangers, at `P²` wraps a round |
| carry each round into every group's room too, so non-admin members see the whole ceremony | nobody who is not an admin takes part in the ceremony; it doubles the traffic for nothing |
## Checking the work, if built
```bash
./gradlew :composeApp:compileDebugKotlinAndroid :composeApp:jvmTest
```
```bash
./gradlew :composeApp:m3Audit
```
```bash
./gradlew check
```