11# Enmarch
22
33Private messaging with local encryption, on-chain X-Wing identity, and
4- zk -verified message-root updates.
4+ ZK -verified registry-root and message-root updates.
55
66## What Is Live Today
77
8- - Wallet-authenticated chat clients
8+ - Wallet-authenticated web and Android chat clients
99- Invite-based encrypted conversations
1010- X-Wing public key registration on Solana
1111- Redis-backed realtime relay and message sync
12- - Backend-generated proofs for message-root updates
13- - Solana Explorer-visible message-root transactions
12+ - Backend-generated proofs for registry-root and message-root updates
13+ - Configurable MagicBlock Private Ephemeral Rollup (PER) submission path with
14+ direct Solana fallback
15+ - Solana-settled root updates
1416
1517## Current Architecture
1618
1719### Client
1820
1921- Solana wallet auth
20- - local messaging identity
22+ - local X25519 and X-Wing messaging identity
2123- invite creation and import
2224- local encryption and decryption
2325- on-chain X-Wing registry integration
26+ - React + Vite web client
27+ - Android Expo client with Mobile Wallet Adapter
2428
2529### Backend
2630
@@ -30,21 +34,30 @@ zk-verified message-root updates.
3034- offline sync
3135- commitment tracking
3236- native proof generation
33- - automatic ` update_message_root ` submission
37+ - automatic registry-root and message-root submission
38+ - configurable PER delegation, commit, and undelegation flow
39+ - direct Solana submission fallback
3440
3541### Solana
3642
3743- main Enmarch program
3844- verifier program
39- - root state PDAs
45+ - registry-root and message- root state PDAs
4046- append-only X-Wing registry PDA
47+ - PER permission and delegation instructions
48+
49+ ### ZK
50+
51+ - Noir circuit for valid Merkle-tree append transitions
52+ - native proof generation through Sunspot
53+ - verifier-gated root updates
4154
4255## What Is Not Fully Productized Yet
4356
4457- durable conversation and message metadata database
4558- backend-owned inbox and history model
46- - registry-root live submission path
47- - long-term replacement for bootstrap Merkle leaves in env
59+ - long-term replacement for message-root and registry-root bootstrap leaves in
60+ env
4861- production-ready X-Wing registry account design
4962
5063## Repo Layout
@@ -53,11 +66,14 @@ zk-verified message-root updates.
5366.
5467├── backend/ # Bun relay, sync API, on-chain submit path
5568├── frontend/ # React + Vite messaging app
69+ ├── mobile/ # Android Expo client with MWA wallet auth
5670├── packages/
5771│ ├── circuit/ # Noir circuit + proving artifacts
72+ │ ├── core/ # Shared messaging protocol helpers
5873│ ├── encryption/ # X-Wing + symmetric encryption helpers
5974│ ├── merkle-tree/ # Poseidon tree and witness helpers
60- │ └── onchain-client/ # TS Solana client helpers
75+ │ ├── onchain-client/ # Generated and low-level on-chain helpers
76+ │ └── solana-client/ # App-facing Solana client helpers
6177├── program/
6278│ └── enmarch_program/ # Pinocchio Solana program
6379└── setup.sh # local dev bootstrap script
@@ -126,11 +142,22 @@ At the repo root:
126142- ` SOLANA_RPC_URL `
127143- ` SOLANA_KEYPAIR_PATH `
128144- ` MESSAGE_ROOT_BOOTSTRAP_LEAVES_HEX `
145+ - ` REGISTRY_ROOT_BOOTSTRAP_LEAVES_HEX `
129146- ` SUNSPOT_GO_DIR `
130147- ` REDIS_HOST `
131148- ` REDIS_PORT `
132149- ` JWT_SECRET `
133150
151+ Optional MagicBlock PER path:
152+
153+ - ` MAGICBLOCK_ENABLED `
154+ - ` MAGICBLOCK_RPC_URL `
155+ - ` MAGICBLOCK_VALIDATOR_ADDRESS `
156+ - ` MAGICBLOCK_MESSAGE_* `
157+ - ` MAGICBLOCK_REGISTRY_* `
158+ - ` MAGICBLOCK_COMMIT_THRESHOLD `
159+ - ` MAGICBLOCK_COMMIT_INTERVAL_MS `
160+
134161In ` frontend/.env.local ` if needed:
135162
136163- ` VITE_API_BASE_URL `
@@ -150,8 +177,11 @@ In `mobile/.env` if needed:
150177
151178- Message payloads are still ephemeral and Redis-backed
152179- Conversation metadata is still partly client-side
153- - ` MESSAGE_ROOT_BOOTSTRAP_LEAVES_HEX ` currently bridges pre-existing on-chain
154- tree history until the backend owns durable tree state
180+ - ` MESSAGE_ROOT_BOOTSTRAP_LEAVES_HEX ` and ` REGISTRY_ROOT_BOOTSTRAP_LEAVES_HEX `
181+ currently bridge pre-existing on-chain tree history until the backend owns
182+ durable tree state
183+ - Root updates use MagicBlock PER when enabled and fully configured. The
184+ backend falls back to direct Solana submission otherwise.
155185
156186## Validation
157187
0 commit comments