ElementsProject / ElementsProject/peerswap
Taproot upgrade for Liquid swaps: reference implementation and open questions
- Dominant language
- Go
- Stars
- 128
- Forks
- 84
- Avg merge
- 3h 1m
- Merged PRs (30d)
- 1
Description
Two spec proposals for upgrading Liquid swaps to Taproot (peerswap-spec
#7 and #12) have been open since 2022 with no resolution, and the current
protocol (v5) still uses P2WSH for the opening transaction. I wanted to
resurface this with some concrete implementation experience.
I've built a non-custodial escrow on Liquid using the same three-path
structure — preimage claim, CSV recovery, and cooperative exit — as
Taproot with Tapscript leaves: https://github.com/Antisys/ark-escrow.
It's tested on regtest/testnet, not mainnet. A few observations that may
be useful for a PeerSwap Taproot upgrade:
**Script structure:** The claim_by_invoice, claim_by_csv, and
claim_by_coop paths map cleanly to Tapscript leaves with a MuSig2 keypath
for cooperative exit. The keypath spend is indistinguishable on-chain from
any other Taproot output — a meaningful privacy improvement over the
current P2WSH which reveals the full script on spend.
**On the flexible amount proposal (peerswap-spec #7):** The OP_INSPECT*
opcodes defined in Elements tapscript would allow enforcing the change
output constraints directly in script, without requiring pre-signed
transactions for each possible swap amount.
**On the current coop_close design (peerswap-spec #4):** A Taproot upgrade
would also naturally resolve the private key sharing issue. With a MuSig2
keypath cooperative spend, both parties sign during contract setup rather
than one party transmitting their raw privkey to the counterparty at close
time.
Is there active interest in moving any of this forward? Happy to
contribute toward a spec or implementation.
Contributor guide
Assessment
This issue has not been assessed yet.