# Ledger Relay Messaging

The Ledger Relay Messaging (LRM) feature in TextRP introduces a method for messaging securely across the XRPL. This section provides a detailed overview of the LRM algorithm, its purpose, and functionality, particularly in handling scenarios where the recipient has not yet onboarded to the TextRP platform.

**Purpose of LRM:** LRM in TextRP aims to enhance inclusivity and connectivity. It allows users to send messages to any XRP wallet address, extending communication capabilities beyond the confines of app users.

**Functionality:**

1. **Messaging Non-Onboarded Users:** When a TextRP user sends a message to an XRPL wallet address not registered with TextRP, LRM steps in.
2. **Message Storage:** The message is securely stored within TextRP's infrastructure, awaiting recipient onboarding.
3. **Notification via XRPL:** LRM sends a microtransaction to the recipient's wallet address. This transaction includes a memo field, which carries a notification about the pending message.
4. **Recipient Onboarding:** If the recipient visits TextRP, they seamlessly onboard via XRP wallet confirmation and have access the stored message.

**LRM Algorithm Steps:**

1. **User Initiates Message:** A TextRP user composes a message and sends it to an XRPL wallet address.
2. **Check Recipient Status:** TextRP checks if the recipient wallet address is associated with an existing user.
3. **If the recipient is onboarded**, the message is handled via the [Matrix](https://matrix.org/) protocol.
4. **LRM Activation for Non-Onboarded Recipients:** If the recipient is not on TextRP, LRM securely stores the message and triggers a microtransaction with a message notification.
5. **Recipient Receives Notification:** The recipient sees the transaction and memo in their XRPL wallet, alerting them of a pending message.
6. **Accessing Messages Post-Onboarding:** If the recipient joins TextRP and links their wallet, they can access all messages sent to them while they were non-onboarded.

This innovative approach ensures that no message is lost due to the recipient's absence from the platform and fosters a more inclusive communication environment.
