---
eip: 627
label: EIP-627
title: Whisper Specification
status: Final
type: Standards Track
category: Networking
created: 2017-05-05
official: https://eips.ethereum.org/EIPS/eip-627
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-627.md
canonical: https://eips.huatuo.xyz/eip-627/
lang: en
tldr: "Specifies the wire format of Whisper v6, Ethereum's early peer-to-peer messaging protocol: packet codes, encrypted envelopes, proof-of-work and topic bloom filters."
tags: [networking, p2p, messaging, devp2p, whisper]
---

# EIP-627: Whisper Specification

> This EIP describes the format of Whisper messages within the ÐΞVp2p Wire Protocol. This EIP should substitute the existing specification. More detailed documentation on Whisper could be found here.

**TL;DR:** Specifies the wire format of Whisper v6, Ethereum's early peer-to-peer messaging protocol: packet codes, encrypted envelopes, proof-of-work and topic bloom filters.

## What problem does it solve?

In the original "Web3" vision, Ethereum had three pillars: the blockchain for consensus, Swarm for storage, and **Whisper** for messaging. Whisper let dapps send small, encrypted, short-lived messages to each other over the same peer-to-peer network that nodes already used, without a central server.

Different clients (go-ethereum, Parity) were building Whisper, so they needed one written spec to stay compatible. EIP-627 is that spec for **Whisper v6**. It runs as a sub-protocol of the devp2p (ÐΞVp2p) wire protocol.

## How it works

Every packet is an RLP list: `[packet_code, payload]`. Codes 0–127 are reserved for Whisper, and a node **must ignore** unknown codes so that newer versions do not break older peers.

| Code | Packet | Payload |
| --- | --- | --- |
| 0 | Status | version, PoW requirement, optional bloom filter (sent first after the handshake) |
| 1 | Messages | list of envelopes |
| 2 | PoW Requirement | 64-bit float, the minimum PoW this node accepts |
| 3 | Bloom Filter | 512-bit filter of topics this node wants |
| 126 | P2P Request (optional) | one envelope, e.g. a mail-client request |
| 127 | P2P Message (optional) | one envelope that should not be forwarded further |

An **envelope** is `[Expiry, TTL, Topic, Data, Nonce]`. `Topic` is 4 bytes that peers can filter on. `Data` is the encrypted message: ECIES with a secp256k1 key, or AES-GCM with a shared key. Inside the plaintext are flags, the payload, random padding (to hide the length), and an optional signature.

To slow down spam, the sender must search for a `Nonce` that gives the envelope's hash enough leading zero bits. Bigger or longer-lived messages need more work:

```
PoW = 2**leading_zero_bits(hash) / (size * TTL)
```

Nodes can raise or lower their minimum at runtime with packet 2, and can limit what they receive with packet 3.

## Sample code

How a 4-byte topic is folded into the 512-bit bloom filter, as given in the spec (pseudocode):

```python
def topic_to_bloom(topic: bytes) -> int:      # topic is 4 bytes
    bloom = 0
    for i in range(3):
        n = topic[i]
        if topic[3] & (1 << i):
            n += 256                           # use the upper half of the 512 bits
        bloom |= 1 << n                        # sets at most 3 bits per topic
    return bloom

# A node's filter is the OR of the blooms of all its topics
my_filter = topic_to_bloom(b"\xde\xad\xbe\xef") | topic_to_bloom(b"\x01\x02\x03\x04")
```

## Things to know

- Whisper never saw wide adoption, and go-ethereum later deprecated and removed it. The Status team's **Waku** protocol grew out of Whisper v6 and is maintained outside the EIP process.
- The spec says the Data field layout is "optional": nodes forward envelopes they cannot decrypt. Only the recipient needs to understand the plaintext format.
- Codes 126 and 127 exist so that a "mail server" can deliver expired messages directly to one peer, which normal forwarding rules would not allow.
- For the general devp2p forward-compatibility rule, ignoring what you do not understand, see [EIP-8](/eip-8/).


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-627
