P2P Markets over Nostr and Lightning shows the trading protocols that use these primitives. This note covers the primitives themselves — the three ways bitcoin can be put under a contract without an intermediary holding the keys.
Summary
| Mechanism | Trust anchor | Funds locked on | Privacy on-chain | Maturity |
|---|---|---|---|---|
| 2-of-3 multisig escrow | An arbitrator who can co-sign a release | Funding tx, 2-of-3 address | 2-of-3 is a common pattern; modest | Decade+ of practice (Bisq, marketplaces) |
| Lightning hold invoice | The receiver's app holds the preimage | Nothing on-chain until settle; HTLC routed off-chain | Routing hops see only an HTLC | Production (Mostro, RoboSats) since ~2019 |
| Discreet Log Contract | An oracle who signs an outcome but never sees the contract | Funding tx, looks like an ordinary 2-of-2 | Indistinguishable from ordinary transactions | Spec in progress (dlcspecs); tooling early; consumer apps closed 2024–2025 |
The direction of travel matters for a parallel economy: escrow puts a human referee in the loop, hold invoices keep the referee but move the enforcement to Lightning's own timelocks, and DLCs replace the referee with a signature that arrives whether or not anyone is using it.
Part 1 — 2-of-3 multisig escrow
The oldest pattern and the easiest to reason about. Buyer, seller and an arbitrator each hold a key to a 2-of-3 address:
- Happy path: buyer and seller sign together. The arbitrator never learns the transaction existed.
- Dispute path: the winning party plus the arbitrator sign. The loser's key is unused.
Bisq's trade protocol is the reference deployment: the arbitrator (a registered "mediator" or "refund agent") collects the trade's contract data — IDs, amounts, payout addresses hashed into the deposit transaction — so a dispute can be decided against what both parties actually signed, not against anyone's later claims. The security argument is that the arbitrator can move funds only to one of the two parties, never to themselves, because every possible 2-of-3 combination that includes the arbitrator still requires one honest party's key... which is exactly its weakness too: an arbitrator colluding with either party steals outright, and a coerced or compromised arbitrator is a single point of failure with a bounty on it. A practical mitigation is multiple arbitrators chosen after the dispute, or threshold arrangements (k-of-n over an arbitrator set), which cost complexity.
Two operational details decide whether a 2-of-3 escrow is honest:
- The prepared dispute data must be inside the transaction both parties signed. If payout addresses live only in a chat log, the arbitrator adjudicates against claims, not commitments.
- Timeouts. If no one signs and the arbitrator disappears, funds sit in the address forever unless one party has a unilateral exit — which is why serious protocols add a timelocked refund path back to the buyer (a 2-of-2 with
OP_CHECKSEQUENCEVERIFY, the same relative-timelock mechanism Inheritance and Dead Man's Switches uses for heirs).
Part 2 — Lightning hold invoices
A hold invoice (implemented in LND since March 2019, PR #2022) inverts who owns the preimage. Normally a receiver's node generates the preimage and settles automatically on arrival. With a hold invoice the application generates the preimage, hands the node only the hash, and the node holds the inbound HTLC in an ACCEPTED state:
OPEN → ACCEPTED: payment arrived along the route; the sender can no longer revoke it, the receiver has not yet claimed it.ACCEPTED → SETTLED: the app callsSettleInvoicewith the preimage; payment completes and propagates back through every hop.ACCEPTED → CANCELED: the app callsCancelInvoice; the HTLC fails and funds return to the sender.- Do nothing: the HTLC times out via its CLTV expiry and funds return to the sender anyway.
This is escrow without an escrow agent for the seller-side guarantee: Mostro and RoboSats hold the seller's payment hostage between "money arrived" and "counterparty satisfied", and the dispute window is literally the width of the cltv_expiry. lncli addholdinvoice --hash=$hash --amt=100000, lncli settleinvoice $preimage, lncli cancelinvoice $hash — three RPCs, no new script, no consensus change.
Three failure modes are structural, not bugs:
- Preimage loss. If the app crashes after
ACCEPTEDand the preimage was in memory, the seller cannot claim; the HTLC expires back to the sender. The preimage belongs in persistent storage before the invoice is published. - Channel pressure. An
ACCEPTEDHTLC occupies the local channel for the whole hold. Every routed payment in that window is exposed to the same timeout, and a node that holds too long can have its channel force-closed on it. Hold windows must stay well under the CLTV budget of every hop on the route. - Unbalanced trust. The mechanism guarantees the sender a refund on timeout. It does not stop a seller from cancelling with the goods in the post, or a buyer from stalling past the expiry. The protocol around the invoice (Mostro's rating and dispute flow) still does the adjudication; the invoice just makes the money time-locked while it happens.
Part 3 — Discreet Log Contracts
DLCs (Dryja, MIT DCI, 2018) are the only mechanism of the three in which the referee is cryptographically blind. An oracle publishes, before the event: a public key V, a nonce point R = kG, and a description of what R will be used to sign. After the event, the oracle signs the outcome — say m = "101,050" — with s = k − H(m,R)·v, and publishes s. The oracle never learns which contracts, if any, used R.
The contract works because of adaptor signatures. For every outcome mᵢ the parties precompute the point sᵢ·G = R − H(mᵢ,R)·V — computable by anyone, but whose discrete log nobody knows. They then build a Contract Execution Transaction (CET) per outcome, cross-sign those CETs with adaptor signatures locked on the corresponding sᵢ·G, and fund a single 2-of-2 that looks on-chain like an ordinary channel open. When the oracle publishes s for the real outcome, the winning party adds it to their adaptor signature and broadcasts the matching CET. Every other CET is unusable. A timelocked refund transaction guarantees neither party can be bricked by a silent oracle.
Properties that matter for a parallel economy:
- On-chain indistinguishability. The funding output is a plain 2-of-2 (or a Taproot key-path spend on modern designs). The terms, the existence of the bet, and the oracle's identity never touch the chain. This is the "discreet" in the name — a pun on the discrete logarithm that gives the protocol its security.
- Oracle fraud is provable. A signature on the wrong outcome is a publicly verifiable, publishable object. Optech's topic page frames this as the security argument over earlier oracle schemes: misbehaviour leaves evidence, not just loss.
- Threshold oracles. k-of-n oracle sets are in the spec's design space, trading privacy and complexity for censorship resistance of the outcome itself. Non-attesting oracles are ignored; a colluding majority still loses to the refund path.
- No consensus changes. Everything is built from signatures, timelocks and PSBT workflows that exist today (Schnorr/BIP-340 originally; ECDSA adaptor variants for pre-Taproot compatibility).
The construction has passed through a decade of implementation reality: Suredbits' bitcoin-s executed the first mainnet DLC; Crypto Garage's cfd-dlc and rust-dlc carry the interoperability spec forward (dlcspecs, still marked work-in-progress with Taproot DLCs and DLC-in-Lightning on its future-work list); dlcdevkit wraps rust-dlc with BDK and a Nostr transport. The consumer wave broke: 10101 — the first self-custodial DLC trading app, and the main production test of DLC channels (DLCs settled inside a Lightning-like channel with buffer and settle transactions instead of per-outcome CETs) — shut down in November 2024 citing traction and scalability limits; Atomic Finance's options vaults (~$140m cumulative volume) were sunset and the technology absorbed into institutional lending (Lygos); DLC Markets now runs OTC derivatives on mainnet against the Pythia oracle. The protocol outlived the companies, which is the normal lifecycle for pre-product primitives and should be priced in before building a business on DLC tooling.
Trade-offs
- 2-of-3 escrow is the only scheme whose dispute resolution can weigh evidence beyond a binary outcome — but it concentrates trust in one human and exposes both parties to that human's compromise, coercion or collusion. On-chain, the escrow address is visible and linkable across a marketplace's trades if arbitrator keys are reused.
- Hold invoices need no agent and no chain footprint until settlement — but the hold window taxes a live Lightning channel, the guarantee is one-directional (sender-refund only), and routing nodes between buyer and seller observe an HTLC's amount, timing and hold duration, which is metadata a disciplined analyst can read.
- DLCs remove the trusted human entirely and hide the contract's existence — but they only settle what an oracle attests. They cannot adjudicate "was the goods as described", which is precisely the case a marketplace needs. For outcomes an oracle can attest (prices, election results, asset attestation), they are strictly the most private option; for everything else, they are a settlement rail, not a judge.
- Complexity budget. 2-of-3 works with any PSBT wallet today. Hold invoices need an LND-family node and app logic that respects CLTV budgets. DLCs need dedicated libraries that are still pre-1.0 by their own maintainers' admission. Match the mechanism to the value at risk.
- Refund paths are non-negotiable. All three schemes must answer "what happens when the other side disappears": a CSV refund path, a CLTV expiry, or a refund CET. A protocol without one is a donation protocol.
Attack surface
- Arbitrator compromise or collusion (2-of-3): single key steals with one accomplice. Mitigate with post-dispute arbitrator selection, thresholds, and published adjudication records.
- Preimage loss / app crash (hold invoices): funds return to sender; seller loses revenue. Persistent preimage storage before invoice publication.
- CLTV exhaustion and channel force-close (hold invoices): long holds starve the channel; hops time out the HTLC and the channel may be closed at a loss. Keep hold windows well inside the minimum CLTV delta of the route.
- Routing metadata (hold invoices): amount, route shape and hold duration leak to forwarding nodes. Trampoline or direct-peer payment paths reduce exposure; nothing eliminates it.
- Oracle key compromise (DLCs): whoever holds
vcan sign any outcome for every contract watching that oracle. Threshold oracle keys, short nonce lifetimes, and oracle transparency logs are the spec-level answers; an oracle's own transparency depends on it publishingRvalues where third parties can archive them. - Oracle suppression (DLCs): an oracle that never signs strands the contract until the refund timelock — censorship of the outcome, not theft. Multiple independent oracles are the only mitigation.
- Nonce reuse (DLC oracles): reusing
kacross messages leaks the oracle key exactly as Schnorr/ECDSA nonce reuse leaks wallet keys. Deterministic-nonce schemes are banned by the protocol design precisely for this reason. - Adaptor-signature leakage between counterparties: the adaptor secret revealed on settlement is the oracle's signature
s, not a party key — but a buggy implementation that reuses adaptor points across CETs can leak more. Use spec-conformant libraries; do not hand-roll adaptor signatures.
Evidence
| Claim | Source | Read |
|---|---|---|
| DLC definition, oracle blindness, on-chain indistinguishability, fraud evidence | Bitcoin Optech, "Discreet Log Contracts" topic page | 2026-11-23 |
Original construction: (A,R) as pubkey, oracle signs with pre-committed nonce, CET-per-outcome |
T. Dryja, Discreet Log Contracts, MIT DCI paper | 2026-11-23 |
Adaptor-signature variant: CETs cross-signed with adaptors on P_m = s_m·G |
N. Kohen, "How DLCs Work [Adaptor Version]" | 2026-11-23 |
| Spec status: work-in-progress; future work = transfers, option-style, Taproot DLCs, DLC-in-Lightning | discreetlogcontracts/dlcspecs README + roadmap |
2026-11-23 |
Hold invoice RPCs: AddHoldInvoice (hash supplied by app), SettleInvoice, CancelInvoice, SubscribeSingleInvoice states |
LND invoicesrpc/invoices.proto, Lightning Labs API reference |
2026-11-23 |
| Hold invoice merged into LND 2019-03-15 | lightningnetwork/lnd PR #2022 |
2026-11-23 |
| ACCEPTED-state semantics: sender irrevocable, receiver unclaimed; settle/cancel/CLTV-timeout; preimage-loss warning; default final-hop CLTV delta | Lightning Labs hold-invoice docs and lnd invoice registry source |
2026-11-23 |
| 10101 (first self-custodial DLC app, DLC channels) wound down 2024-11-03, citing traction and scalability | 10101 shutdown post, 2024-09-09 | 2026-11-23 |
| Implementation landscape: rust-dlc (Crypto Garage), dlcdevkit, bitcoin-s, cfd-dlc; DLC Markets mainnet OTC; Atomic Finance → Lygos | DLC ecosystem status survey (spark.money research, cross-checked against project repos) | 2026-11-23 |
Related
- P2P Markets over Nostr and Lightning — Mostro's hold-invoice escrow and NIP-99 listings in practice
- Lightning Network Deep Dive — HTLCs, CLTV and the routing layer hold invoices ride on
- Inheritance and Dead Man's Switches — the same relative-timelock primitives used for refund paths
- Value for Value — Lightning payment patterns without an escrow step
- Payjoin and Ark — shared-UTXO construction, a different shape of cooperative transaction
Primary sources
- Bitcoin Optech: Discreet Log Contracts
- Dryja, Discreet Log Contracts (paper)
- discreetlogcontracts/dlcspecs
- LND invoices.proto (hold invoices)
- lnd PR #2022: hold invoices
- BIP 11: M-of-N standard transactions
Page history
- Updated
- 2026-11-23
- Origin
- Compiled from the ungovernable.tech research notes.
- Improve this page
- Suggest an edit — issues and pull requests are welcome.