Zelda

sms

Home
Legend
Demo

1. Introduction

2. Getting started with Phantom

3. Connect your wallet

4. Switching to devnet

5. Understanding fees

6. Airdrop

7. Using Zelda

8. Troubleshooting

9. Sending Messages

10. Reclaiming fees

11. About Web3 messaging

Introduction

Zelda utilizes the Solana blockchain in the place of a server for the backend of a chat messaging application. By using Zelda you will be familiarized with Web3 basics as well as both the advantages and limitations of blockchain infrastructure. Fundamental differences start with the authentication system. Authentication is baked into Web3 and to get you started you will need your Web3 passport, your first wallet.

Download Phantom

Click

Here

Select the extension based on your browser.

Create your Wallet

Your Secret Key

The secret key is your real password and is unique to you. You may recover your wallet from anywhere with this phrase and your phrase should never be shown to anyone if you plan on keeping your data and assets secure. If you lose your secret phrase you will lose your ability to recover and port your wallet from devices.

Select your Wallet

Hit “Select Wallet” in the top right of the Navigation bar.

Connect your Wallet

From the modal that pops up confirm your Phantom wallet by clicking on it on the modal.

Allow Zelda

Approve the Zelda application to interact with your wallet by hitting connect. The following permission will give read access from your wallet to the app and allow the app to request transactions from your wallet.

Congratulations, you are connected!

Switching to Devnet

This step is optional but will help make sense of the experience. Blockchain is new and exciting and in order to simulate test work in a proper environment Devnet exists. Devnet is analogous to main-net, the real network, with the key difference being that the funds of Devnet do not have real world value and can be printed on a whim.

Configure your Wallet

Click on your wallet and hit the cog icon in the bottom right corner.

Configuring your wallet...

Scrolldown and select “Change Network”.

Wallet Configued

Select Devnet.

Congratulations, you are connected to devnet!

Understanding Fees

Blockchain transactions have fees. A blockchain is as strong as its weakest unit and by requiring performant hardware for each node, Solana is fast and transactions take a low percentage of the network's resources. Typically it will cost a hundredth of a cent to perform an action on Solana. However, when an action requires storing data, there is extra cost associated. Storage is not infinite and you must pay a proportionate rent for the space you are using.

What this means

Sending funds will be close to free but creating new accounts to store that data will cost a few cents for “rent”. You may have your rent be returned by closing these accounts. Space is not infinite so it needs to have a cost which for now is the effort in closing the account. As hardware improves and better tools are created on the network, space will have lower cost and become more of an automatic process.

Airdrop

To get some devnet funds click on the airdrop page from the sidebar and hit the Aidrop button to collect some devnet sol.

Check your Airdrop

After the app notifies you the airdrop was successful, check your wallet and you should have 1 Sol. Make sure you are on devnet and not main-net if you wish to see your funds.

Using Zelda

After connecting and funding your wallet, select the messages Icon from the sidebar and you will be introduced to the messaging application.

Chats

Most likely you currently have no chats. Let’s change that! Hit the add chat icon to start your first chat.

Adding a chat

Enter the public key of someone you want to chat with. This can be almost anyone but there are a few rules.

You cannot start a chat with yourself. This constraint is at the program level on the blockchain and there is no way to circumvent this.

You cannot have more than 6 outgoing chats and 6 receiving chats at the same time. This constraint was created at the client level and can be arbitrarily adjusted by another programmer. This is a lazy way to address spam.

First Transaction

Hit the approve button to sign the transaction. This will send the request to create a chat to the blockchain just like how you would normally send the request to a server.

Success!

If everything went correctly you should see a chat created notification and your first chat.

Troubleshooting

1. Check your DEVNET funds. The transaction should cost roughly 0.003 Sol or 9.3 cents in today's conversion. If you do not have enough funds, claim an airdrop from the airdrop page

2. You are breaking a constraint. Likely the person you are trying to chat with already has 6 receiving chats. Confirm the error notification.

3. The transaction is timing out. If you have waited too long to confirm your transaction after initializing it(or there were latency issues) the blockhash being used may have timed out. The error message will be very clear so just resend your transaction.

4. The devnet is undergoing maintenance. An easy way to check this out is by verifying the transaction from your wallet(below).

Transaction Details

You can see details regarding the flow of your transaction by opening your wallet, clicking the lightning icon at the bottom, then clicking on your most recent transaction. This should open up the explorer and give you details regarding the flow of your transaction as well as if there was an error or if there are network issues.

Open the chat

The selected chat will appear highlighted. Click on a chat to select it. You may add more or refresh the chat list to see if someone has started a chat with you. Data is queried fast. As the blockchain stores accounts in a hashmap, whether there are 5 messages or 200 they will be retrieved in O(1) time!

Collapse the chat list to get a better view before sending a message.

Your First Message

Just type in the text field and hit the arrow to send your message. This is a transaction like creating or deleting a chat. There is an arbitrary max message length of 212 characters.

Message Sent

After approving the transaction you should see your message in the chat list.

Receiving Messages

Messages will appear automatically if received, there is no need to refresh. This is working through a websocket with the blockchain.

Deleteing Messages

Messages you have sent and only your messages may be individually deleted by hovering your message and clicking the red X. This is a transaction like before.

Reclaim

It is inconvenient to manually delete messages to reclaim your Sol. To make the process easier, the Reclaim tool was created. It works by gathering all existing accounts you have and then selecting message accounts that no longer have a corresponding chat account. If there are chats that have been deleted but not all of the messages were deleted you can delete them with the Reclaim tool to reclaim your Sol. If you have a chat account with a lot of messages and you want to reclaim your Sol then delete the chat account and use this tool to delete the messages in one go.

Reclaiming

From the Reclaim page, hit the "Load" button to load your data.

Reclaiming...

The load button will turn into a ready button. Approve the transaction and your messages will be deleted and your sol will be reclaimed.

Check your updated blance in your wallet!

About the future of Web3 messaging

While new technology is cool, there are mountains to be moved going forwards. The UX for messaging on blockchain is more cumbersome than traditional messaging apps but it does not have to be. The main burden here is not actually the approval of transactions at every step, it is actually the cost of storing data on the blockchain. If the costs were not so high, intermediary wallets could handle transaction approval with similar costs to a data center and the UX would be equivalent to traditional messaging.

Compressing On-Chain data

By compressing On-chain data, costs can be greatly reduced. By implementing a merkle tree On-chain and utilizing off-chain indexers to serve proofs, we can achieve costs at an expected fraction of 1/2400 of the current cost. 1/2400 was the cost fraction reduction for NFT’s and allows 1 million NFT’s to be created for 5 sol or roughly 150$ USD at current value.

Compressing Message data

For a messaging protocol like Zelda, the cost reduction can be even greater. To achieve O(1) indexing, zelda requires extra data to be stored in message accounts in order to map what data goes where. Approximately 26% of the data in a max length message is for indexing. In shorter messages over 90% of the data might be just for indexing. By taking this part off-chain, blockchain messaging becomes a serious option for a disruptive technology.

Benefits of On-Chain Messaging

Blockchain technologies are at the base, permissionless. If I want to message someone on Youtube but I have Facebook, I cannot do so without creating a Youtube account and now that chat is seperated from the rest of my messages on Facebook. If I want to message someone on Magic Eden, an NFT marketplace on Solana, I can send them a message through Zelda and both exist on Solana, the user base is shared. They still need to open Zelda to see the message, but no new account had to be made because the interfacing layer is present. The user base is open, connected, and secured through the Wallet infrastructure.

Composability

The main implication of this is composability. By sharing the same authentication layer, on-chain applications are naturally integrated with one another. Integrating a traditional server API into another app requires con-joining database resolvers which is time consuming, and error prone. On-chain applications can still be tweaked client side if desired but can also be integrated to work with your user base with essentially 0 friction.

Conclusion

If a web3 app like the NFT marketplace Magic Eden wanted a messaging service they could include a page on their website which used The Exact Same Code as the Zelda messaging page without ANY edits and work flawlessly. Compare this process with how you might integrate a chat app on your site and have to include new interfacing in your backend and the entire landscape and programming barrier of scaling services into future applications has just been shifted permanently.