Security

Two-Layer Encryption: How Z-Text Protects Your Messages

Most encrypted messengers rely on a single layer of encryption. Z-Text uses two independent encryption layers, each protecting against different threat vectors.

Z-Text Team·Engineering
December 15, 20256 min read

Most encrypted messengers rely on a single layer of encryption. Z-Text uses two independent encryption layers, each protecting against different threat vectors. This article explains how they work together to provide defense-in-depth for your messages.

Layer 1: Blockchain Shielding

The first layer of encryption comes from the BitcoinZ blockchain itself. Shielded transactions use zk-SNARKs (Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge) to encrypt all transaction data.

When a Z-Text message is sent as a shielded transaction, the following are hidden from all network observers:

  • The sender's address
  • The recipient's address
  • The transaction amount
  • The memo field (where the message is stored)

Only the holder of the recipient's z-address viewing key can decrypt the memo field and read the message content. This protects against passive network surveillance and blockchain analysis.

Layer 2: Contact Key Encryption

The second layer adds end-to-end encryption on top of the blockchain shielding. During the handshake process, Z-Text establishes a shared secret key between two contacts using Elliptic Curve Diffie-Hellman (ECDH) key exchange.

Before any message is placed into the transaction memo, it is encrypted with this shared key. This means that even if someone obtains the z-address viewing key (through coercion, theft, or a future vulnerability), they still cannot read messages without the separately derived contact key.

The Handshake Key Exchange

The contact key is established through a trustless handshake protocol:

  1. Alice sends a handshake request to Bob's z-address, containing her ephemeral public key (encrypted in the memo of a shielded transaction)
  2. Bob accepts by sending his ephemeral public key back to Alice (also via shielded transaction)
  3. Both Alice and Bob independently derive the same shared secret using ECDH
  4. This shared secret becomes the symmetric encryption key for all future messages

The beauty of this approach is that even the key exchange is protected by Layer 1 shielding. An observer cannot see the public keys being exchanged or even that a handshake is occurring.

Why Two Layers Matter

Each layer protects against different attack scenarios:

  • Layer 1 alone protects against network observers and blockchain analysts, but is vulnerable to viewing key compromise
  • Layer 2 alone protects against viewing key compromise, but would be vulnerable if messages were sent in the clear on-chain
  • Both layers together require an attacker to compromise two independent cryptographic systems simultaneously

This is the principle of defense-in-depth applied to messaging encryption. No single point of failure can expose your messages.

Cryptographic Primitives

Z-Text's encryption stack uses well-established cryptographic primitives:

  • zk-SNARKs (Groth16) for Layer 1 shielded transactions
  • ECDH over Curve25519 for key exchange
  • ChaCha20-Poly1305 for Layer 2 symmetric encryption
  • BLAKE2b for key derivation

All cryptographic operations are performed in the Rust core of the application, leveraging constant-time implementations to prevent timing side-channel attacks.

Practical Implications

For the user, the two-layer encryption is completely transparent. The app handles all key exchange and encryption automatically. Messages appear in a familiar chat interface with no indication of the sophisticated cryptography happening underneath.

The result is a level of message security that exceeds what any centralized messenger can offer -- not because the cryptography is more complex, but because the trust model is fundamentally different. There is no server to subpoena, no company to coerce, and no single key that unlocks everything.

#encryption#zk-snarks#security#privacy
ShareTwitter

Related Articles

Z-Text logoZ-Text

Your keys. Your messages. Your freedom.
The ZkSNARK-shielded messenger BEYOND REACH OF CENSORSHIP.

Company

Z-Text Ltd

Trust Company Complex

Ajeltake Road, Ajeltake Island

Majuro, Marshall Islands

MH96960

Technical glossary

zk-SNARKs
Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge — cryptographic proofs that verify a statement without revealing the data behind it. Reference.
BitcoinZ (BTCZ)
Community-driven, no-premine cryptocurrency with ZkSNARKs shielded transactions, launched 2017. Launch announcement.
Equihash
Memory-hard proof-of-work algorithm used by BitcoinZ consensus; it is part of the network security model, not a standalone post-quantum guarantee. Reference.
AES-256-GCM
NIST-standard authenticated encryption used for local message payload encryption before on-chain broadcast. NIST SP 800-38D.
Ztext

Built with for privacy

Built by fighters for free speech and digital freedom

Version 1.0.0 (Beta)Last updated