Hello everybody. My idea is to create chat mobile application that is powered by Zcash blockchain. I already did PoC of this approach. You can look at it here. Here is my proposal how to progress from PoC stage to the final product which can be used by users and other developers.
Title:
Chat mobile app powered by Zcash blockchain
Pitch: A one-liner elevator pitch version of your proposal
Implement a mobile chat app (and mobile SDK) that uses the Zcash blockchain to encrypt and transfer messages.
Applicant background:
I started with iOS development in 2008 right after the first iOS SDK was released. Throughout my career, I have gone through a lot. I learned how to start new projects and I also learned how to join big projects which are already in progress. I also experienced different roles throughout my career. I worked at different companies in different positions (iOS Developer, iOS Tech leader, iOS Team leader).
I worked for the ECC from October 2022 until May 2023. My main responsibility was to take care of the Zcash iOS SDK. During that time I designed and implemented the new architecture concepts the current SDK builds upon. Thanks to this I know this technology very well.
I don’t have much practical experience with Android development. But lately, I studied Kotlin a bit and I think I can deliver what I’ve described in this proposal.
Description of Problem or Opportunity:
I spent some time with the Zcash SDK and realized it can be used to build a simple chat app (Messenger). It started as a fun project but at some point, when the prototype was done, it was obvious not only it can be done but there’s a huge potential in it. With some help and support from friends and later Zcash community members, the pile of ideas and possible road map convinced me to push the project even further. This proposal builds on mistakes and experiences gained from the work on a prototype (https://www.youtube.com/shorts/qFgqpj0weWc) of the messenger and takes it a huge step forward with much bigger potential and possible use cases.
Proposed Solution: Describe the solution at a high level.
Each Zcash transaction has a memo field. It is possible to send any arbitrary data in this field. My idea is to use this memo field to attach chat messages to the transactions. Then the chat app can read data from the memo field and visualize them as chat messages, not as a feed of transactions. Users see a list of chats and a list of messages in each chat as in any other messenger instead of a list of raw transactions. The cost of each transaction is only a network fee. Using this app isn’t free but the cost is very low. And any user gets a high level of security.
Solution Format: What is the exact form of the final deliverable you’re creating?
The prototype is a standalone iOS app which means no Android app and no one can reuse it or simply integrate it into their apps. Therefore I decided to build:
- iOS SDK that provides API which allows any other app to implement chat functionality. This SDK also includes a configurable UI (ready for both SwiftUI and UIKit) so the 3rd party apps can integrate the chat with as little code as possible (as close to one line of code to integrate as possible).
- iOS messenger app using this SDK.
- Android SDK that provides API which allows any other app to implement chat functionality.
Note: Android Messenger is out of the scope of the proposal, the goal is to provide the Android SDK and leave the door open for either a different proposal or contributors. It should be easy when following the principles of iOS Messenger and use of iOS SDK
Technical Approach: Dive into the how of your project. Describe your approaches, components, workflows, methodology, etc. Bullet points and diagrams are appreciated!
Transaction’s memo field is used to transfer chat messages and any information required by the chat. I defined a very simple protocol that is used by the chat application. Each message contains 22 bytes of protocol header and the rest of the available memo bytes can be used to send the message itself (or any data in general). Thanks to that protocol the chat application can then uniquely identify messages, group messages into the right chat and sort the messages.
The protocol header looks like this:
- ZIP-302 arbitrary memo byte
- 1 bytes
- Value 0xff is defined in ZIP-302.
- Prefix
- 3 bytes
- “}b.” - three unique characters used to identify chat transactions. A wallet can contain a mix of financial transactions and chat transactions.
- Version
- 1 byte
- Protocol version.
- ChatID
- 8 bytes
- Unique identifier of one discussion between two people.
- This is used to correctly group messages into chats.
- This is generated by using timestamp and random number.
- Timestamp
- 5 bytes
- A moment when the messages were created.
- This is used to correctly sort messages.
- MessageID
- 3 bytes
- The random number that is part of the message unique ID.
- When MessageID and Timestamp are combined then unique ID is generated.
- Message type
- 1 byte
- Next to the visible user messages the chat app also sends some “invisible” messages. For example initial message with a verification code that marks the start of the chat. So it is necessary to have a mechanism how to recognize different type of messages.
- Message content
- Rest of the memo field.
- Actual content of the message.
Verification problem
With Zcash it is not possible to verify who sent the transaction. This creates a problem how to verify that the person on the other side of the chat is the expected person.
I built a verification mechanism that solves this.
Let’s say that Person A wants to create a chat to talk to Person B:
- Person B gives the unified address of his/her wallet to the person A.
- Person A creates a new chat and uses person’s B unified address.
- When a new chat is created unique verification code is generated for that chat.
- Person A now sees in the chat app a newly created chat with a verification code.
- Person B now sees in the chat app a new unverified chat.
- Person A sends (by some different communication channel) his/her unified address together with the verification code for the new chat to Person B.
- Person B inputs A’s address and verification code into the app. If both information is right new chat is now verified. And both parties can be sure that the right person is on the other side of the chat.
Dependencies: What external entities is your project dependent on? What involvement is required from ZF, ECC, and/or other external organizations? Who would have to incorporate your work in order for it to be usable?
I must make a small change in the Zcash SDK. I can make the change on my own. I only require support from ECC to integrate this change into the Zcash SDK upstream. Other than that my project isn’t dependent on any 3rd party.
Execution risks: What obstacles do you expect? What is most likely to go wrong? Which unknown factors could jeopardize success? Who would have to incorporate your work in order for it to be usable?
I already did prototype of this project. So I know that it works in principle. There shouldn’t be any major blockers which could tank the project delivery.
To make my usable the iOS chat application must be released to the Appstore. Or any other app must use chat SDK and integrate it.
Unintended Consequences: What are the negative ramifications if your project is successful? Consider usability, stability, privacy, integrity, availability, decentralization, interoperability, maintainability, technical debt, requisite education, etc.
Zcash network performance
If this chat is used by a lot of users it increases the number of transactions in the Zcash network by a lot. Can the network handle this? Won’t be the network overloaded?
Quantum attack
A disadvantage of using blockchain technology for chat is that chat messages are stored in the blockchain forever. If somebody can crack Zcash encryption by using a Quantum computer (or any other method) then that person can read all the messages that were ever sent.
Evaluation plan: What metrics for success will you share with the community once you’re done? In addition to quantitative metrics, what qualitative metrics will you commit to report?
All the that I write will be available in public git repository under MIT license. During development anybody will be able to see my progress. And when I am dony anybody will be able to use all my code.
Budget
Hardware/Software total budget:
$0
Please provide justification for the total hardware/software budget:
N/A
Services total budget (cloud, hosting, etc.):
$0
Please provide justification for the total services budget:
N/A
Compensation total budget:
$83200
Please provide justification for the total compensation budget:
This covers me as one engineer on this project. Cost is $100 per hour. Each milestone is scheduled for one month. And I plan to deliver 80 hours of work each month. This doesn’t apply to the Milestone 9 (Android SDK). It will take me more time and more learning to deliver Milestone 9. Therefore Milestone 9 is scheduled for three months and the cost is $80 per hour.
Schedule and Milestones: What is your timeline for the project? Include concrete milestones and the major tasks required to complete each milestone.
How was the project timeline determined?
I divided whole project to the smaller tasks. Then I estimated how long will it take to implement each task. Then I put tasks that can together take 80 hours to make into each milestone.
How did you learn about Zcash Community Grants?
I worked for the ECC in past and I learned there about Zcash Community Grants.
Milestones
Milestone 1 - delivery date (month of a work, 80 hours of work per month)
Month after the project start.
Milestone 1 - Payment
$8000
Deliverable 1.1
- Design iOS SDK API and architecture.
Deliverable 1.2
- Extract everything related to the chat protocol from the iOS prototype and include it in the iOS SDK. Update the code from prototype quality to production quality.
Deliverable 1.3
- Update the existing code from prototype quality to production quality. And implement what is missing to have first of the first iOS SDK with basic functionality.
Milestone 2 - delivery date
Two months after the project start.
Milestone 2 - Payment (month of a work, 80 hours of work per month)
$8000
Deliverable 1.1
- Update Zcash iOS SDK upstream. Some small updates are required by the chat SDK.
Deliverable 1.2
- Cover the iOS SDK with tests.
Milestone 3 - delivery date
Three months after the project start.
Milestone 3 - Payment (month of a work, 80 hours of work per month)
$8000
Deliverable 1.1
- Design and prototype configurable UI that will be provided by the iOS SDK
Deliverable 1.2
- Prepare a project for the iOS Chat app that will use the iOS SDK.
Milestone 4 - delivery date
Four months after the project start.
Milestone 4 - Payment (month of a work, 80 hours of work per month)
$8000
Deliverable 1.1
- Implement start screen for the iOS app (create new/restore account).
Deliverable 1.2:
- Implement “create new account” UI and flow for the iOS SDK.
Deliverable 1.3:
- Implement “restore account” UI and flow for the iOS app.
Milestone 5 - delivery date
Five months after the project start.
Milestone 5 - Payment (month of a work, 80 hours of work per month)
$8000
Deliverable 1.1
- Implement a “chats list” UI for the iOS app.
Deliverable 1.2
- Implement a “new chat” UI and flow for the iOS app.
Deliverable 1.3
- Implement a “messages list” UI for the iOS app.
Milestone 6 - delivery date
Six months after the project start.
Milestone 6 - Payment (month of a work, 80 hours of work per month)
$8000
Deliverable 1.1:
- Implement a “chat verification” UI and flow for the iOS app
Deliverable 1.2
- Implement additional smaller screens for the iOS app. For example about or debug screen.
Milestone 7 - delivery date
Seven months after the project start.
Milestone 7 - Payment (month of a work, 80 hours of work per month)
$8000
Deliverable 1.1
- Finalize the iOS app. Use all the functionality that is provided by the iOS SDK.
Deliverable 1.2
- Add support for biometric authentication (FaceID/TouchID) to the iOS app.
Milestone 8 - delivery date
Eight months after the project start.
Milestone 8 - Payment (month of a work, 80 hours of work per month)
$8000
Deliverable 1.1
- Add additional features to the iOS SDK and use those new features in the UI.
- Soft delete of the messages or chats.
- Making chat aliases (names) permanent.
Deliverable 1.2
- Start with preparations for the Android SDK. Setup the project.
Milestone 9 - delivery date
Eleven months after the project start.
Milestone 9 - Payment (3 month of a work, 80 hours of work per month, 160 hours total)
$19200
Deliverable 1.1
- Implement the Android SDK with all the functionality that the iOS SDK has.