# Running an RLN membership on the LEZ testnet

**As of 2026-10-20.** A practical guide: how a Logos Delivery node gets an RLN membership on the LEZ testnet, what it costs, and how to reproduce it. Verified end to end on a headless node (`logosctl`).

## The short version

You do **not** register a membership by hand. Run the latest Delivery + RLN modules; the RLN module **derives its own LEZ account** ("payer") on startup; **fund that account** on the LEZ testnet; the module then **registers the membership automatically**.

- **LEZ RPC:** `https://testnet.lez.logos.co/`
- **Channel:** `0101010101010101010101010101010101010101010101010101010101010101` (32× `01`)
- **Registry:** `logos:testnet:fd322d32…7775b971`

These three come from the `logos.test` preset — you don't configure them by hand.

## What it costs

The module tells you the exact amount via `get_membership_state`:

| | Native units | What |
|---|---|---|
| Membership price | 1,000,000 | `price_per_unit` 10,000 × minimum rate limit 100 (messages / 600 s epoch) |
| Fee reserve (asked) | 181,800,000 | upper bound for the registration transaction's gas |
| **Asked up front** | **182,800,000** | fund at least this |
| **Actually spent** | **~74,200,000** | 1M price + ~73.2M gas at base fee 8 |

The fee reserve is an upper bound: at today's base fee only ~40% was used. The rest (~108.8M in the verified run) **stays on the payer** — the module has no transfer-out call, so fund the full stated amount and expect most of the reserve to sit there unused.

The rate limit is **100 messages per 600 s epoch** (the registry allows 100–600; the module picks the minimum).

## Module versions

From the official catalog (`logos-co/logos-modules-release`):

- `delivery_module` **0.4.0** (same code as the re-released 0.3.3)
- `liblogos_rln_module` **0.12.0**
- `liblogos_lez_rln_module` **5.1.0**

`logosctl package install -y delivery_module` pulls the two RLN modules as optional dependencies. Older `lez_rln` modules can't sync the zone.

> Note: delivery 0.4.0 has a reliable-channel receive bug ([logos-delivery-module#169](https://github.com/logos-co/logos-delivery-module/issues/169)) — fine for RLN, but bad for app sync.

## Step by step

In an isolated session (its own `HOME` and `LOGOSCTL_CONFIG_DIR`):

```
daemon start -d
module load liblogos_rln_module          # BEFORE createNode
module load delivery_module
call delivery_module createNode '{"preset":"logos.test","mode":"Core"}'
call delivery_module start
```

1. **The preset carries the config** — registry, LEZ RPC and channel. After start, `rlnState` → `Ready` (epoch 600 s, plus an `rlnIdentifier`, e.g. `5e269b6a…`).
2. **Read the payer address** (once the chain syncs, ~1 min):
   `call liblogos_lez_rln_module wallet_status` → `.payer` (64-hex). The log also prints "derived the payer …".
3. **Ask what it needs:**
   `call liblogos_rln_module get_membership_state <registryId> <rlnIdentifier>` → "needs N native (price + fee reserve)", step `awaiting_funding`.
4. **Fund** that payer with ≥ N on the LEZ testnet (bridge, or ask someone to send).
5. **Watch it register:**
   `get_native_balance <payer>`, then `get_membership_state` until `active`; or `logosctl watch liblogos_rln_module` for `membership_state_changed`.
   Registration goes `awaiting_funding → pending → active` on its own, no manual step. (Occasional sequencer `tx_included … connection timed out` retries itself.)
6. **Keep the data dir.** The wallet and keystore live under the session's `cfg/data/`. **Lose it and you lose the membership.**

## Replicating on another node

**Each node derives its own payer and holds its own keystore.** You **cannot copy a membership** between nodes. To add RLN to another node (a second machine, a hub, someone else's Basecamp), repeat steps above on that node with **fresh funding** of its own payer.

## Caveats

- **Apps don't use RLN today.** `loam_core` deliberately joins `logos.test` with RLN **off**, and the testnet does not validate proofs yet. Turning RLN on for an app is a `loam_core` change plus a membership per sending node. This is a test / future-switch capability, not a current fix.
- **End-to-end receipt only partly shown** in the verified run: the node reports the membership `Active` and sends propagate, but cross-node receipt of RLN-gated messages wasn't conclusively demonstrated (likely local relay flakiness, and proofs aren't validated on the testnet today).
