Protocol V4.0 β€” Production Hardened

How MumbleChat Protocol Works

Native decentralized messaging on Ramestta. Real BouncyCastle X25519+AES-256-GCM encryption, wallet-signed authentication, SQLCipher encrypted storage, and rate-limited relay network.

πŸ” BouncyCastle Crypto
⛓️ On-Chain Identity
πŸ›‘οΈ Wallet Auth
πŸ—„οΈ SQLCipher

Protocol Architecture

V8 Split Architecture: Registry (Identity) + RelayManager (Nodes) + ProofVerifier

Decentralized P2P Network Architecture

Split Contract Architecture

MumbleChat V8 uses a split smart contract design for modularity and upgradeability:

Registry V7 β€” On-chain identity, public key storage, user blocking, and endpoint discovery.
RelayManager V13 β€” Node registration, staking tiers, verified relay proofs, and reward distribution.
ProofVerifier V1 β€” Commit-verify flow for on-chain relay proof validation.
MCT Token V8 β€” ERC-20 with fee pool, halving, and governance.

πŸ“ Registry V7 πŸ“‘ RelayManager V13 πŸ” ProofVerifier V1 πŸͺ™ MCT Token V8

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   MUMBLECHAT PROTOCOL V4.0 STACK                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                          β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚   β”‚   RamaPay   β”‚     β”‚   Chrome    β”‚     β”‚   Desktop   β”‚   CLIENTS    β”‚
β”‚   β”‚   Android   β”‚     β”‚  Extension  β”‚     β”‚ Relay Node  β”‚               β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜               β”‚
β”‚          β”‚                   β”‚                   β”‚                       β”‚
β”‚          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
β”‚                              β–Ό                                           β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚   β”‚                MumbleChat Core Layer (Hardened)                β”‚      β”‚
β”‚   β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚      β”‚
β”‚   β”‚  β”‚ BouncyCastleβ”‚  β”‚ MessageCodecβ”‚ β”‚ ChatServiceβ”‚              β”‚      β”‚
β”‚   β”‚  β”‚ X25519+GCM β”‚  β”‚ Binary Wire β”‚  β”‚ Orchestratorβ”‚            β”‚      β”‚
β”‚   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚      β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                              β”‚                                           β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚   β”‚              Security Layer (Production Hardened)              β”‚      β”‚
β”‚   β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚      β”‚
β”‚   β”‚  β”‚ Wallet-Signβ”‚  β”‚  SQLCipher  β”‚  β”‚ Rate       β”‚              β”‚      β”‚
β”‚   β”‚  β”‚ Auth (ECDSA)β”‚ β”‚ Encrypted DBβ”‚  β”‚ Limiter    β”‚              β”‚      β”‚
β”‚   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚      β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                              β”‚                                           β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚   β”‚              V8 Smart Contracts (Ramestta Mainnet)             β”‚      β”‚
β”‚   β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚      β”‚
β”‚   β”‚  β”‚MCT Token β”‚ β”‚Registry  β”‚ β”‚RelayMgr  β”‚ β”‚ProofVeri β”‚        β”‚      β”‚
β”‚   β”‚  β”‚  V8      β”‚ β”‚  V7      β”‚ β”‚  V13     β”‚ β”‚  V2      β”‚        β”‚      β”‚
β”‚   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚      β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                                                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                

πŸ”‘ On-Chain Identity

Your wallet address is your identity. Public keys stored immutably on blockchain. No emails. No phone numbers. Self-sovereign.

Registration Flow

// 1. Generate X25519 keypair (BouncyCastle)
val keyPair = X25519KeyPairGenerator().generateKeyPair()

// 2. Sign with wallet (ECDSA authentication)
val signature = wallet.signMessage(publicKey)

// 3. Store public key on-chain
registry.register(
    publicKeyX: keyPair.publicKey,
    displayName: "alice.rama"
)

// 4. Identity now discoverable on-chain
// Anyone can lookup by wallet address
                    

Identity Struct (Solidity)

struct Identity {
    bytes32 publicKeyX;      // X25519 public key
    bytes32 publicKeyY;      // Reserved
    uint256 registeredAt;    // Timestamp
    uint256 lastUpdated;     // Key rotation
    bool isActive;           // Active status
    string displayName;      // Optional name
}
                    

Key Features

πŸ” Self-Sovereign

You own your identity. No platform can ban or censor you.

πŸ”„ Key Rotation

Update your public key anytime via updatePublicKey().

πŸ” Discoverable

Anyone can lookup your public key by wallet address.

πŸ” End-to-End Encryption

Real BouncyCastle X25519 ECDH + AES-256-GCM. Production-grade, audited security.

End-to-end encryption

How E2E Encryption Works

1. Lookup recipient's X25519 public key from blockchain
2. Generate ephemeral X25519 keypair (forward secrecy)
3. Derive shared secret via ECDH agreement
4. Derive AES key using HKDF with unique salt
5. Encrypt with AES-256-GCM (authenticated encryption)
6. Sign with Ed25519 for message authenticity
7. Package: [ephemeral key | nonce | ciphertext | auth tag]

πŸ”‘ Ephemeral Keys πŸ›‘οΈ Forward Secrecy ✍️ Ed25519 Signed
πŸ”‘

X25519 ECDH

Elliptic-curve Diffie-Hellman using BouncyCastle library. Each message uses a unique ephemeral key for perfect forward secrecy.

πŸ›‘οΈ

AES-256-GCM

Authenticated encryption with 256-bit key. Provides confidentiality AND integrity verification in one operation.

πŸ”’

SQLCipher Storage

All messages encrypted at rest with SQLCipher. Even physical device access can't compromise your chat history without your wallet key.

πŸ“¨ Message Protocol

How messages are structured, routed, and delivered in the MumbleChat network.

Message Structure (Binary Wire Format)

data class MumbleChatMessage(
    val version: Int = 1,                    // Protocol version
    val type: MessageType,                   // TEXT, FILE, PAYMENT
    val senderKeyHash: ByteArray,            // keccak256(sender)[:8]
    val recipientKeyHash: ByteArray,         // keccak256(recipient)[:8]
    val ephemeralPubKey: ByteArray,          // 32 bytes (X25519)
    val nonce: ByteArray,                    // 12 bytes (GCM)
    val ciphertext: ByteArray,               // Encrypted content
    val authTag: ByteArray,                  // 16 bytes (GCM auth)
    val timestamp: Long,                     // Unix millis
    val signature: ByteArray                 // Ed25519 signature
)
                

πŸ”— Direct Delivery (Online)

When recipient is online, messages go directly through the managed hub.

// 1. Connect to hub (WebSocket)
hub.connect(walletSignature)

// 2. Encrypt message with recipient's key
encrypted = E2E.encrypt(message, recipientPubKey)

// 3. Send through hub (opaque blob)
hub.send(encrypted)  // Hub can't read content

// 4. Receive delivery confirmation
ack = hub.receiveAck()
                    

πŸ“¦ Relay Delivery (Offline)

When recipient is offline, relay nodes queue messages (200 per user cap).

// 1. Recipient not online
if (!hub.isOnline(recipient)) {

    // 2. Queue encrypted message on relay
    relay.queue(encrypted, ttl = 7.days)
    
    // 3. Rate limited: 10 msg/sec
    // Queue cap: 200 msg/user, 50K total
    
    // 4. Relay earns MCT for delivery
}
                    

🌐 Relay Network

Decentralized nodes that store encrypted messages for offline users and earn MCT rewards. Protection against abuse with queue caps and rate limiting.

Relay Node Infrastructure

Hardened Relay Architecture

Relay nodes store encrypted blobs only β€” they never see plaintext content. V13 includes on-chain verified relay proofs: nodes must commit message hashes before claiming rewards.

Anti-abuse protections: 10 msg/sec rate limiting, 256KB max payload, 200 messages per user queue cap, 50K total message cap, and 35s commit cooldown.

πŸ“‘ Multi-Node πŸ” Encrypted Blobs ⚑ Rate Limited βœ… Verified Proofs