An application for real-time messaging between users using WebSocket, including a basic backend server and logic for encrypting and authenticating messages with zero-knowledge proof using o1js.
This Zkapp provides Zero-Knowledge (ZK) proof-based secure messaging on the Mina Berkeley Network using the o1js library. Users can send messages with verifiable authenticity and integrity without exposing sensitive content.
app.ts:
* The main entry point for Zkapp.
* Imports basic ZK libraries.
* Deploys zkProof and zkVerifier contracts.
* Initializes the `Chat` component for the messaging interface.
components/Chat.tsx:
* Primary messaging interface.
* Processes user input for sending messages.
* Handles ZK proof generation and verification logic.
components/Message.tsx:
* Creates individual messages in chat history.
components/User.tsx:
* Shows user information (username, public key, etc.).
contracts/zkProof.ts:
o1js module containing the logic to generate ZK proofs for message authenticity.
contracts/zkVerifier.ts:
o1js module defining the logic for validating ZK proofs.
node_modules:
* Contains o1js and other project dependencies.
package.json:
* lists project dependencies and configurations for Zkapp and Mina Berkeley Network.
tests/Chat.test.ts:
* Unit tests to ensure Zkapp functionality and robustness.
- User authentication: Securely identify users before exchanging messages.
- Message history: Store and retrieve past messages for reference.
- Group chats: Support messaging between groups of users.
- Alice and Bob install ZK Messaging Zkapp and Mina connects to Berkeley Network.
- Alice creates a message in the
Chat
interface and presses "Send". - The Zkapp generates a ZK proof attesting to the message's authenticity and origin.
- The message and proof are transmitted to Bob.
- Bob's Zkapp verifies the ZK proof. If valid, the message is displayed.
* Obtain a Mina Berkeley Network account.
* Deploy the Zkapp to the network.
* Start the Zkapp and connect it to your Mina Berkeley Network account.
This Zkapp offers a basic foundation for ZK-powered messaging. Feel free to contribute by:
* Extending features (e.g., file sharing, rich media support).
* Enhancing security and privacy aspects.
* Optimizing ZK proof generation and verification for efficiency.
- Please reach out if you have any questions or would like to discuss this project further.