Bitcoin’s peer-to-peer protocol spent fourteen years in the clear. Not because anyone thought that was ideal, but because the data being relayed is public by definition, so the obvious argument for encryption does not apply. The argument that does apply is about everything other than the data.
What was wrong with the plaintext protocol?
Three things, and the specification names them without softening.
First, metadata. A passive observer watching Bitcoin connections can identify the source and timing of a transaction — which node first announced it, and therefore, with reasonable confidence, who sent it. The payload is public; the fact that you were the first to say it is not.
Second, tampering. An unauthenticated plaintext connection can be modified in flight cheaply and often undetectably. An attacker can flip specific bytes — service flags, for instance — without holding any state, because there is nothing binding the stream together.
Third, and most consequentially, the protocol announces itself. Every v1 connection opens with fixed magic bytes followed by a version message, so a firewall doing deep packet inspection recognises Bitcoin traffic instantly. That is what makes network-level censorship cheap, and it is what makes targeted attacks — eclipsing a specific miner, for example — practical for anyone sitting on the right link.
Why encrypt without authenticating?
Because authentication needs identities, Bitcoin has no identities, and pretending otherwise would have cost more than it bought.
There is no registry of nodes, no certificate authority, and no natural notion of which peer you meant to connect to when your node picked an address out of a list. A full authenticated handshake in the style of TLS would require that infrastructure, and the complexity of adopting it is what kept this problem unsolved for a decade.
BIP 324’s answer is to encrypt opportunistically — both ends use v2 if both support it — and to export a session ID derived from the key exchange, so that authentication can be layered on afterwards by anyone who wants it. Two operators who deliberately connected their own nodes can compare session IDs out of band and detect a man in the middle. Nobody is obliged to, and the protocol is useful without it.
The gain from unauthenticated encryption is real even so. A passive eavesdropper has to become active — maintaining a full interception, or forcing a downgrade, or running enough nodes that honest peers connect to them. Each of those is more expensive than listening, and the deliberate cases are detectable.
How does a handshake with no magic bytes work?
By making the public keys indistinguishable from random noise, which took new cryptography to arrange.
A secp256k1 public key is not a random 32-byte string — only about half of all 256-bit values are valid x-coordinates on the curve, so a key is recognisable as a key. BIP 324 uses ElligatorSwift, an encoding in which every 512-bit string is a valid encoding of a curve point. The 64 bytes an initiator sends are therefore statistically indistinguishable from noise, at a cost the specification measures at around fifty per cent more work than plain ECDH — negligible, since connections are rare and long-lived.
Each side may then send up to 4,095 bytes of arbitrary garbage before the handshake completes. The point is shapability: without it, every v2 connection would begin with exactly 64 bytes before anything else, which is itself a pattern. With it, the handshake has no fixed length and the traffic can be shaped to resemble other protocols.
Detection of the old protocol is handled from the other direction. A
responder watches whether the incoming bytes match the v1 magic followed
by version; if they do, it speaks v1, and if they do not, it speaks v2.
A random v2 key colliding with that 16-byte prefix has probability
2⁻¹²⁸, which is to say never.
What does the encryption actually hide?
The contents and the pattern, not the existence of a connection.
Packets are encrypted with an AEAD construction and the lengths are encrypted separately, so an observer cannot read messages or infer their sizes. Keys are ratcheted forward, giving forward secrecy for all but the most recent packets: an attacker who later compromises a node cannot decrypt a recording of its past traffic. Common message types are identified by a single byte rather than a twelve-character ASCII command, which saves bandwidth and removes another recognisable pattern.
What remains visible is that two IP addresses are exchanging data, how much, and when. Timing and volume are not hidden — the specification is explicit that its confidentiality claims assume an attacker without timing and fragmentation information. A node that receives a burst of traffic and immediately emits a similar burst is relaying something, and an observer watching enough links can still infer a great deal.
This is why BIP 324 and Tor are complements rather than alternatives. Encryption hides what is being said and whether it is Bitcoin; an overlay network hides who is saying it. Each leaves exactly what the other covers.
Does this help the on-chain privacy problem?
No, and conflating the two is the most common mistake made about it.
Everything BIP 324 protects happens before a transaction is confirmed. It makes it harder to learn which node originated a payment, and harder for a network operator to know that Bitcoin is being used at all. Once the transaction is in a block, the ledger is as public as it ever was, and every clustering heuristic works exactly as before.
The two kinds of exposure have different adversaries, which is why they need different answers. On-chain analysis is done after the fact, by anyone, from data that is permanent. Network-level analysis is done live, by whoever can see the link, from data that disappears if nobody records it. A user can be perfectly protected against one and completely exposed to the other.
The useful way to hold it is that transport encryption raises the cost of learning who broadcast something, which is precisely the link that on-chain analysis cannot supply on its own. A chain analyst with an IP address attached to a first broadcast has something far stronger than a cluster. Removing that input does not fix the ledger; it removes the cheapest way to attach a name to it.
Can it still be downgraded?
Yes, and the design accepts that rather than pretending otherwise.
An active attacker can interfere with a v2 handshake so that both sides fall back to v1, and the fallback exists because it must — most of the network ran v1 when this shipped. The mitigation is cost rather than prevention: downgrading requires an active position on the connection, maintained, for every connection the attacker cares about.
The defence that actually matters is adoption. Bitcoin Core now defaults
to attempting v2 on every connection, with DEFAULT_V2_TRANSPORT set to
true in the source, so the fraction of connections that can be downgraded
without being noticed shrinks as nodes update. A protocol where the clear
version is a rare fallback is a different target from one where it is
normal.
Why did it take fourteen years?
Because the cost of a mistake at this layer is high and the benefit was easy to dismiss.
The proposal that became BIP 324 went through several designs over several years, including one built on the Noise framework that was eventually set aside. Part of the delay was the authentication question — early attempts tried to solve identity at the same time, which made the proposal large and contentious. Part was that no off-the-shelf protocol produced a pseudorandom bytestream, which meant the censorship-resistance goal could not be met by adopting TLS and moving on.
And part was simply the recurring argument that the data is public. Answering it required articulating why metadata matters, which is a claim about surveillance economics rather than about cryptography, and those take longer to settle in a project that prefers demonstrable arguments.
The eventual shape — encrypt now, authenticate later if anyone wants to, and make the stream unrecognisable — is narrower than what was first attempted and shipped because of it. That pattern recurs throughout Bitcoin’s history, and it is worth noticing which proposals get smaller over time and which only get larger.
Check it yourself
Your node reports the transport version per connection:
bitcoin-cli getpeerinfo | grep -c '"transport_protocol_type": "v2"'
bitcoin-cli getpeerinfo | grep -c '"transport_protocol_type": "v1"'
The ratio is a direct measurement of how much of your node’s traffic is still readable by anyone on the path. The session ID is there too, which is what you would compare with a peer operator you know:
bitcoin-cli getpeerinfo | grep session_id
Two nodes you control, connected deliberately, should agree on that value. If they do not, something is between them.
What remains uncertain
Whether traffic analysis defeats it in practice. The bytestream is pseudorandom, and the timing is not. Published work on transaction-source inference predates v2, and nobody has measured how much of it survives against encrypted links at realistic scale. The shapability the garbage affords is a capability rather than a deployed defence; almost nothing uses it.
What gets built on the session ID, if anything. The modular design was chosen so that someone could add it later. Years on, the layered authentication protocol the specification anticipated does not exist, which may mean nobody needs it or may mean the hard part was simply postponed.
The censorship case, which remains untested. The strongest argument for an unrecognisable protocol is that a network operator cannot block what it cannot identify. No major jurisdiction has seriously attempted protocol -level Bitcoin blocking, so the defence has never faced the adversary it was designed against.
Sources
- PrimaryBIP 324 — Version 2 P2P Encrypted Transport Protocol ↗
- PrimaryBIP 155 — addrv2 message ↗
- First-partyBitcoin Core — src/net.h ↗
- First-partyBitcoin Core — src/bip324.h ↗