03Cyphered Chat on XRPL
Cyphered Chat on XRPL
This session will explore how to use the memo field present on every transaction on the XRP Ledger to send encrypted messages, effectively creating a chat engine.
While nothing is encrypted forever, we propose this activity to explore the basic principles of cryptography and using the memo field.
In this section
- 01Set upDescription of key libraries
- 02Set up KeysFirst, we need to get the public key of the person we want to chat with. \ \ To do so, we can go on the block explorer and look at the transactions the address has sent. From there, by looking at the raw transaction data, we can find their public key. \ \ Once we have their public key, we can use it to encrypt messages that only they can decrypt.
- 03Cypher the messageNow that we have their public key, we can encrypt our secret message. \ Remember our "outside-in" principle: we use THEIR public (outside) key to encrypt the message, which ensures that only THEIR private (inside) key can decrypt it. \ \ The message gets transformed into a scrambled format that is completely unreadable to anyone who might intercept it - only the owner of the matching private key can convert it back to the original text. Each encrypted message is unique, even if you encrypt the same text multiple times, adding an extra layer of security.
- 04Set up the memo & send the txNow that we have our encrypted message, we can send it through the XRPL network. \ \ We'll create a transaction with a minimal amount (1 drop) and include our encrypted message in the transaction's memo field. \ The memo field is perfect for this as it can store arbitrary data, making it an ideal place for our encrypted message. \ \ Once the transaction is validated, our secret message will be securely stored on the blockchain - visible to everyone but readable only by the intended recipient who holds the matching private key.
- 05Get the message and decypher itWhen you receive a 1-drop transaction, it might contain a hidden message for you. \ \ By checking the raw transaction data in your block explorer and looking at the memo field, you can find an encrypted message. You'll see a scrambled string of characters - this is your encrypted message. Since this message was encrypted using your public (outside) key, only your private (inside) key can decrypt it. \ \ By copying this encrypted text and using your private key, you can transform this unreadable data back into the original message that was meant for your eyes only.