← Back to Blog

Lightning Network: How Quantum Affects HTLC and Channels

Lightning Network: How Quantum Affects HTLC and Channels - QNSQY post-quantum encryption guide

The Lightning Network is the largest layer-two scaling solution for Bitcoin. It moves payments off-chain into bidirectional payment channels, settling only the final balances on the base layer. This makes Bitcoin transactions cheap, fast, and frequent enough to actually use for retail. The whole construction relies on a tower of cryptographic assumptions: ECDSA signatures, hash-locked contracts, secp256k1 elliptic curves, and Schnorr signatures (since Taproot). Every one of those building blocks rests on math that a sufficiently large quantum computer can break.

If you care about Bitcoin and you care about cryptography, you should care about how Lightning fares against a quantum adversary. The on-chain story for Bitcoin is bad enough. Lightning makes things worse in a specific way, because Lightning channels publish public keys to the network during routing. That gives a quantum adversary more material to work with than a clean cold-storage Bitcoin address ever would.

This article walks through the cryptography in Lightning, where the quantum vulnerabilities are, what the Lightning specifications say today, and what migration to post-quantum primitives might look like.

How Lightning Channels Work

A Lightning channel is a 2-of-2 multisignature output on Bitcoin. Two parties lock funds in this output by signing a funding transaction. After that, they exchange off-chain commitment transactions that update each side's balance without touching the chain. Either party can broadcast the latest commitment to close the channel, and the chain enforces that only the most recent state can be claimed (older states are punishable).

This is enabled by a cleverly designed contract called the commitment transaction. Each commitment carries:

  • A balance for each party
  • A revocation secret structure so old commitments become punishable
  • HTLCs (hash time-locked contracts) for in-flight payments
  • Per-commitment public keys derived from per-commitment seeds

The funding output is a 2-of-2 multisig. Closing the channel requires both parties' signatures on a final transaction. The commitment transactions include signatures from both parties, but only one party holds a particular commitment. If they broadcast it on chain, the signatures embedded inside it become public.

This is where the quantum issue starts to bite.

Public Keys Get Exposed Constantly

In standard Bitcoin, the long-recommended practice is to use addresses based on hashes of public keys (P2PKH, P2WPKH, etc.). The actual public key is only revealed when you spend the coins. Until that moment, only the hash is on chain. A quantum adversary watching the chain sees nothing but hashes, and recovering the private key from a hash before Shor's algorithm can finish is impossible without first revealing the public key.

For more on Bitcoin's per-script-type quantum risk, see our Bitcoin and quantum detail article.

Lightning breaks this discipline. Channels constantly broadcast and verify public keys: the funding output public key, per-commitment keys for revocation, HTLC keys, and (post-Taproot) the joint Schnorr key. Routing nodes publish their channel announcements, signed with bitcoin keys, into the gossip protocol. Every node in the network gets a copy of every other node's public keys and their corresponding signatures.

If a quantum adversary harvests these gossip messages today, they have all the material they need to run Shor's algorithm on every Lightning node in the network at some future date. Once they recover even one private key, they can drain that node's open channels.

ECDSA in Commitment Transactions

The original Lightning specifications (BOLT 02 and BOLT 03 on the lightning.network specifications) describe pre-Taproot channels. These use standard ECDSA signatures over the secp256k1 curve. ECDSA is broken by Shor's algorithm in polynomial time, which means a quantum computer could derive the private key from any signed message and corresponding public key.

Commitment transactions in pre-Taproot channels are 2-of-2 P2WSH (pay-to-witness-script-hash) outputs. The script reveals both public keys when the channel closes. That makes those keys quantum-recoverable from the moment the script is published, not just from the moment the spend happens.

For a channel that has been open for a while and accumulated history, the per-commitment keys (used for revocation) form a tree. Each per-commitment secret is derived from a master seed, and the derivation uses elliptic-curve arithmetic. If the master seed leaks (because a quantum adversary derives it from the public per-commitment keys), the entire revocation tree is broken.

Taproot and Schnorr

Bitcoin's Taproot soft fork (BIPs 340, 341, 342) introduced Schnorr signatures and pay-to-taproot outputs. BIP 340 specifies the Schnorr signature scheme on secp256k1. Lightning is in the middle of a long migration to Taproot channels, sometimes called PTLCs (point time-locked contracts) when the hash locks get replaced with adaptor signatures.

Schnorr brings advantages: aggregation (MuSig2 lets two or more parties produce a single Schnorr signature that looks like a normal one on chain), better privacy (Taproot outputs look the same regardless of underlying script complexity), and small witness sizes. None of these advantages help against a quantum adversary. Schnorr signatures on secp256k1 are just as broken under Shor's algorithm as ECDSA on secp256k1.

The advantage Taproot does provide is that key spends use the on-chain key directly, without revealing any script. So a Taproot channel that closes cooperatively (just a key-spend with both parties' signatures) leaves only the joint Schnorr key on chain. That is one public key per channel, plus the joint Schnorr signature. Compared to pre-Taproot channels, this exposes less material on chain.

But the gossip layer still publishes every individual node key, and the channel's joint key is still derivable from those. So Taproot helps a tiny bit on chain but does nothing about the ambient public-key exposure that Lightning generates.

The Routing Gossip Problem

Lightning nodes find paths through the network using a flooded gossip protocol. Each node announces its channels with a channel_announcement message, signed by both endpoints' bitcoin keys and by their gossip-layer node keys. Node operators also publish node_announcement messages with their advertised features and metadata.

These messages travel to every public Lightning node in the world. There is no way to undo this. If a quantum adversary connects a single passive listener to the gossip network for a year, they collect the public keys and signatures of every node in the network.

Once Q-day arrives, those keys become recoverable. The question is what the adversary does with them. They cannot directly sign new commitment transactions because those require the channel partner's cooperation. But they can:

  • Steal funds from channels where they are the partner of the recovered key
  • Forge gossip messages to redirect routing
  • Impersonate the recovered node for any purpose where a signature alone is sufficient

If the recovered key still controls funds at Q-day (whether in open channels or in associated wallets that share the key), those funds are also at direct risk.

HTLCs and Adaptor Signatures

Hash time-locked contracts (HTLCs) are the building block of Lightning payments. A payment is routed by setting up a chain of HTLCs along the path: each hop holds a contract that says "if you reveal the preimage of this hash before time T, you can claim this output." The preimage trickles back through the chain, settling each HTLC.

HTLCs use SHA-256 for the hash. SHA-256 is symmetric and survives Grover's algorithm with reasonable margin. The hash itself is fine post-quantum. The signatures on the HTLC outputs are the problem, just like everywhere else in Lightning.

PTLCs (point time-locked contracts) replace the hash with an elliptic-curve point. Instead of revealing a preimage, the receiver reveals a scalar that completes an adaptor signature. PTLCs improve privacy (the same payment looks different on each hop) and enable atomic multi-path payments without secrets being shared across hops. But they introduce another elliptic-curve dependency. Shor's algorithm breaks PTLCs as cleanly as it breaks ECDSA.

Channel Close Vulnerability Windows

The most concerning quantum scenario for Lightning is what happens during a channel force-close. When one party broadcasts a commitment transaction without their counterparty's cooperation, the chain enforces a delay (typically 144 blocks, about a day) before the broadcasting party can claim their balance. This window exists so the counterparty has time to publish a punishment transaction if the broadcasted commitment is stale.

For a quantum adversary watching the chain and the gossip network, this window is a target. They harvest the public keys, run Shor's algorithm, and try to spend the contested output before the legitimate party. If their quantum computer is fast enough, they can race the punishment transaction.

This is the core threat. Bitcoin block times mean roughly 10 minutes per block. A quantum adversary who can crack a key in under 10 minutes (probably an unrealistic assumption for early quantum computers, but eventually possible) can intercept channel closes. To put context on the threat, see harvest now decrypt later.

What Lightning Migration Could Look Like

Migrating Lightning to post-quantum cryptography is harder than migrating Bitcoin itself, because Lightning's cryptographic assumptions are deeper and more numerous. A few possible directions:

Option 1: Keep ECDSA/Schnorr until Bitcoin migrates. Lightning fundamentally depends on Bitcoin scripts. Until Bitcoin supports a post-quantum signature opcode, Lightning channels cannot use post-quantum signatures for the on-chain enforcement. The gossip and node identity layers could migrate independently, which would protect the routing layer. But channel close enforcement would have to wait for Bitcoin script changes.

Option 2: Hybrid signatures everywhere. Sign every gossip message and every commitment with both ECDSA/Schnorr and a post-quantum signature like ML-DSA. Verifiers check both. This would balloon the size of every message but limits damage if either algorithm fails. Our hybrid encryption explainer covers the broader pattern.

Option 3: Channel-level upgrades with fallback. New channels open with PQ-aware constructions, while old channels stay on classical primitives. Force-closes on old channels become risky after Q-day, but channel rotation moves funds out over time. This is probably the most realistic approach.

Option 4: Sidechain or layer-three. Move Lightning-like functionality to a Bitcoin sidechain or rollup with native post-quantum support. The base layer Bitcoin transactions remain quantum-vulnerable, but day-to-day payments use a quantum-safe layer. This is speculative and would take years to deploy.

What Operators Can Do Today

If you run a Lightning node, here is the practical advice. The post-quantum migration is years away, so do not panic. But take the long view.

Rotate channels. If you have channels open for years, the attack surface grows. Closing and reopening channels rotates the per-commitment seeds and gives you a fresh start with the latest protocol features.

Avoid hot wallets with large balances. Lightning nodes need keys online to sign updates. Never keep more than your operating budget on a routing node. The cold-storage Bitcoin holdings should stay separate.

Keep software updated. Implementations like LND, Core Lightning, and Eclair are tracking BIP discussions and post-quantum proposals. The first deployments will probably be opt-in features that users have to enable manually.

Encrypt backups with post-quantum tools. Channel state backups, seed phrases, and watchtower data all leak information if recovered. Encrypting these with a tool that uses ML-KEM and ML-DSA gives you a layer of protection that does not depend on Lightning protocol upgrades.

FAQ

Are my Lightning channels at risk today? No. Quantum computers capable of breaking secp256k1 do not exist yet. The risk is for the future, especially if your channels stay open for many years and channel public keys get harvested in the meantime.

Will closing my channels protect me? It helps. Closing channels rotates the active per-commitment keys and moves funds back to base-layer Bitcoin. But the historical gossip messages have already propagated, and the keys you used remain in the public record. Move the resulting Bitcoin to a fresh address that has not been published.

What about Taproot channels? Taproot channels expose less public-key material on chain in cooperative closes, but they still publish node and channel keys in gossip and they still use secp256k1. Quantum-wise, they are slightly better than legacy channels but not safe.

When will Lightning add post-quantum support? There is no committed timeline. Lightning depends on Bitcoin scripts, so on-chain enforcement of post-quantum signatures requires Bitcoin protocol upgrades first. Expect years of research and proposal work before deployment.

Can I protect Lightning data with QNSQY? Yes. Use QNSQY to encrypt channel backups, static channel backups, and watchtower data. ML-KEM-1024 plus X25519 hybrid encryption gives you confidentiality that survives both classical and quantum attacks.

Sources

  1. NIST FIPS 203 (ML-KEM): https://csrc.nist.gov/pubs/fips/203/final
  2. NIST FIPS 204 (ML-DSA): https://csrc.nist.gov/pubs/fips/204/final
  3. Bitcoin BIP 340 (Schnorr Signatures): https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
  4. Bitcoin BIP 341 (Taproot): https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki
  5. Lightning Network BOLT Specifications: https://github.com/lightning/bolts
  6. Lightning Network Site: https://lightning.network/

Related Articles

Protect Your Data Before Q-Day Arrives

QNSQY's NIST-standardized post-quantum encryption protects files against both current and quantum-era threats.

Try QNSQY