# Encrypted delivery - one tick, two ticks, blue

> What changes when the server cannot read the message, and why every tick after the first is a device claim. The ticks are claims the server cannot check.

Source: https://tierslate.com/templates/whatsapp-delivery

Messaging & realtime · System design · deep · 8 step walkthrough · 5 tables

What changes when the server cannot read the message, and why every tick after the first is a device claim.

**Own this board: 800 credits.** The first act plays on the page. Owned once with credits, never a subscription.

## What this board gets wrong on purpose

The tension: The ticks are claims the server cannot check. Tick two and tick three are produced by the recipient's device and vouched for by nobody the server can audit, so a patched client shows blue ticks it never earned and a battery-saving OS shows none it did - and the server, holding only ciphertext, has no way to tell the two apart. The offline mailbox is worse: it is undecryptable bytes with no expiry policy drawn, so it can never be deduped, compacted or re-encrypted, and the retention period is a guess worth four orders of magnitude of storage. And because the server never held a key, a device added tomorrow gets no history at all - the fix for that, a sender-side history transfer, is not on this board.

## Practise this as an interview

Take Encrypted delivery - one tick, two ticks, blue as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.

## Start here

### Why this design

End-to-end encrypted messaging is the chat-system question with the server’s eyes taken away. Interviewers use it to see whether you notice that encryption changes the architecture and not only the security posture: fan-out moves onto the sender’s phone, the server can no longer dedupe, index or re-render, and every delivery status after the first is a claim made by a device. Real messengers live with exactly these consequences - multiple devices per person, offline mailboxes, and receipts that outnumber messages.

### What you will learn

- Why a message to one person with three devices is three ciphertexts from the sender’s phone, and how 8 billion messages a day become 32 billion envelopes - 1.11M writes a second at peak.
- What each tick actually means: our queue accepted the bytes, a device stored them, a device claims a human looked.
- Why receipts - 64 billion a day, 740,000 a second - outnumber messages eight to one and must merge as a set that only grows.
- How one retention sentence for undelivered mail moves the message store from 160 GB to 87 PB.
- Why the key directory is the one place the server is trusted, and why safety numbers exist because of it.
- How a push notification wakes a device without carrying a body, and why the connection edge is drained rather than restarted.

### How to read this board

1. The diagram follows the message left to right: THE SENDER · WHERE PLAINTEXT LIVES, then OUR SERVERS · ENVELOPES ONLY, then ONE PERSON · TWO DEVICES.
2. Then the two bands that come back: WAKE-UP · FOR A DEVICE WITH NO SOCKET, and THE THREE TICKS · CLAIMS, NOT FACTS. Press play for the eight-step walkthrough, which starts before anything is typed.
3. Page 1 · Requirements - the questions, the first of which moves every box on the board.
4. Pages 2 and 3 · Capacity and Storage - envelopes, receipts and retention.
5. Page 4 · Availability - the single points of failure, and what degrades rather than dies.
6. Page 5 · How it works, told end to end, then Page 6 · Deployment plan - home regions, the edge drain, two-release format changes.
7. The DATA MODEL at the bottom: five tables, and not one of them has a body column.
8. Finish on the deliberate weakness: the ticks are client claims the server cannot verify, the mailbox has no expiry, and a new device gets no history. Decide which of the three you would fix first, and what it costs.

## 1 · Requirements

### Ask these before drawing anything

Every one of these questions moves a box on the diagram. The first one moves all of them.

- Is the server allowed to read a message body? If yes, half this board disappears and search, backup and web clients become easy. If no, fan-out moves onto the sender's phone and stays there.
- One device per person or several? Multi-device is what turns a message into N ciphertexts and makes "history on a new device" a separate product.
- What ordering do we promise, and across what? Per conversation is achievable. Per sender across devices is not, without a sequencer the sender trusts.
- Can a user switch read receipts off? If so the third tick is optional and the UI must be honest about never getting it.
- How long do we hold an undelivered message - 30 days, or forever? This single sentence is worth four orders of magnitude of storage. See the storage page.
- How large may a group be? 1,024 members is a different fan-out problem from a pair, and the sender's uplink pays for it.
- Do we owe anyone server-side search, backup or a browser client? All three need plaintext, so all three become client features or become a compromise.

### Functional

- Send a message from one device to every device the recipient owns.
- Deliver immediately to a device that holds a connection; hold it durably for one that does not.
- Report three states to the sender: accepted by the server, received by a device, read by a human.
- Groups up to 1,024 members, with the same guarantees as a 1:1 chat.
- Carry media without putting bytes on the message path.
- Let a new device register keys and begin receiving new messages.

### Non-functional

- The server must never hold a key that can open a message body. This is a constraint on the design, not a feature of it.
- p99 send-accepted under 300 ms on a mobile network.
- p50 delivery to a connected device under 500 ms.
- 99.95% availability for accepting a send; 99.9% for delivering to a device that is connected.
- An undelivered message survives the loss of an availability zone.
- At-least-once delivery; the client deduplicates on message id.

### Out of scope, and why

- Server-side search and server-side backup: both need plaintext we do not have.
- Voice and video: a different transport with different failure modes.
- History for a newly added device: needs a sender-side transfer, which is a product on its own.

## The rest of this board

This page publishes the question. The answer - 5 more written pages, an 8-step narrated walkthrough and a 5-table schema - is the board itself, and it opens in Tierslate.

- 5 written pages
- 8 walkthrough steps
- 5 tables (33 columns)

5 pages behind this one:

- Capacity estimation
- Storage estimation
- Availability
- How it works
- Deployment plan

## Related system design templates

- [Chat and messaging system design](https://tierslate.com/templates/chat-messaging) - Delivery guarantees, presence and ordering across devices.
- [Transactional email system design](https://tierslate.com/templates/email-delivery) - Why getting an email into the inbox is a negotiation with a receiver whose rules you cannot see.
- [Presence system design](https://tierslate.com/templates/presence-service) - Why a green dot is a claim that expires, and why fanning it out costs more than every message sent.
- [Push notifications system design](https://tierslate.com/templates/push-notifications) - Why push failures are silent, and how token lifecycle keeps a dead token from counting as delivered.
- [Team channels system design](https://tierslate.com/templates/slack-channels) - Why a 30,000-member channel is not a big DM, and why the unread badge is the hardest number to keep.
- [Webhook delivery system design](https://tierslate.com/templates/webhook-delivery) - Why a webhook is a promise to keep calling until the receiver answers, and how retries avoid becoming an attack.
- [Notification router system design](https://tierslate.com/templates/notification-router) - How one event is turned into email, push or SMS by preferences and quiet hours, without sending it twice.

All 100 system design templates: https://tierslate.com/templates (Markdown: https://tierslate.com/templates.md)
