SanR — Messenger Update!

Clement Lee
SanR
4 min readJul 31, 2023

--

SanR has just released a new peer-to-peer messaging feature where players can now directly contact one another through encrypted messages through the blockchain, all on the SanR platform!

How do we do it?

In the exciting world of Ethereum dApps, implementing private peer-to-peer messaging has been challenging with limited options. After careful consideration, we chose to leverage the powerful features of MetaMask’s browser extension API. Specifically, we utilized eth_getEncryptionPublicKey and eth_decrypt to enable secure messaging within our platform.

While this approach has some limitations, we’re always looking ahead to explore even better solutions. We might explore alternatives, such as the Waku protocol in the near future. Stay tuned as we continue to innovate and improve your dApp experience!

Here is how to get started with messaging on SanR

For example, if you want to send a private message to a user named Bob on SanR, you would share your public encryption keys with SanR to facilitate this.

To begin, each player will be presented with the option to try out messaging on SanR and enable communication with other users by sharing their public key on the landing page. Enabling the feature is quick and easy, so you can get started in no time!

prompt to enable messaging on SanR
encryption request on MetaMask

Once provided with the public key, players will be directed to the message tab on your profile page, where they can start messaging each other!

sending a message to bob on the messaging page

On here, you can initiate direct conversations with other players who have already enabled their messenger feature! To send each message, you will need to sign a signature request for it to be successfully delivered.

Once sent out, the message will then be encrypted using the sender’s and receiver’s public encryption keys, resulting in two strings as shown below.

let message = 'Hello, Bob!';
let messageEncryptedWithAliceKey = encrypt(message, aliceKey); // 0bFNKQUF2...
let messageEncryptedWithBobKey = encrypt(message, bobKey); // XVzVINzkx...
encrypted message to bob

Afterwards, both messages are transformed into NFTs and placed on the SanR blockchain. Since the messages are fully encrypted, anyone can see that a user sent a message to Bob, but the actual contents remain hidden. Only the sender and Bob possess the ability to decrypt and read the messages using their MetaMask browser extension.

the decryption of sent messages using metamask

Once the messages have been decrypted through Metamask the contents of the decrypted messages can then be freely seen on the app whenever your wallet is connected.

That’s all there is to the messenger feature for SanR! We hope you have a great time exploring it and building strong relationships with other traders in the community. Enjoy your journey!

Thanks for reading! We hope to see you all participate and join the community for some fun! 🥳 🥳

Follow us:

SanR — check out other forecasters and post signals of your own

Sanbase Alerts for SanR — get on-time alerts for SanR assets

SanR Activity Feed — get personalized signals from the people you follow

SanR 🐲 Telegram — engage with our community!

--

--