Skip to content

RFP-003: Atomic Swaps with LEZ#21

Merged
fryorcraken merged 2 commits intomasterfrom
atomic-swaps
Mar 27, 2026
Merged

RFP-003: Atomic Swaps with LEZ#21
fryorcraken merged 2 commits intomasterfrom
atomic-swaps

Conversation

@fryorcraken
Copy link
Copy Markdown
Collaborator

No description provided.

@fryorcraken fryorcraken requested a review from hackyguru March 20, 2026 04:20
Copy link
Copy Markdown
Collaborator

@hackyguru hackyguru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks solid already. i suggest we merge this, we should already be able to get some proposals/feedback for this externally


#### Performance

1. Document the compute unit usage for each LEZ program operation (initialise escrow,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. my earlier investigation indicated that it might be really expensive to run adaptor-based sig schemes in zkVM

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide more details, see if having a precompiled program would be a solution of some sort?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-posting from the Discord thread: The cost difference comes down to the cryptographic operations involved. I understand the math of the cryptographic sigs involved in adaptor signs at a very high level right now.

For HTLCs, the only operation inside the zkVM is a SHA-256 hash - compute SHA256(preimage) and compare. SHA-256 has a dedicated accelerated circuit in Risc0, so it costs ~thousands of cycles (milliseconds to prove).

For adaptor signatures, instead of a hash check, we'll be doing multiple elliptic curve scalar multiplications - heavy 256-bit math on curves like secp256k1/ed25519. A single ECDSA verify costs ~5M cycles without acceleration, 870K with it (https://github.com/risc0/risc0/blob/release-3.0/examples/ecdsa/k256/README.md)). A full adaptor sig protocol needs 3-4x that (2-4M cycles even with acceleration).

On precompiles: Risc0 seems to offer accelerated crates (k256, curve25519-dalek) that speed up individual EC operations ~5-10x but these accelerate the building blocks, not the full protocol - there's no "adaptor signature" precompile in any zkVM. Building one would mean designing custom STARK circuits
I'm not an expert at writing circuits at all but looking at this PR that adds acceleration for EC operations, it was 30+ commits over weeks by a core ZK-engineer

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread RFPs/RFP-003-atomic-swaps.md Outdated

### General

- [eth-lez-atomic-swaps](https://github.com/logos-blockchain/eth-lez-atomic-swaps) — ETH–LEZ HTLC-based swap (reference implementation and LEZ program structure)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [eth-lez-atomic-swaps](https://github.com/logos-blockchain/eth-lez-atomic-swaps) — ETH–LEZ HTLC-based swap (reference implementation and LEZ program structure)
- [eth-lez-atomic-swaps](https://github.com/logos-co/eth-lez-atomic-swaps) — ETH–LEZ HTLC-based swap (reference implementation and LEZ program structure)

Comment thread RFPs/RFP-003-atomic-swaps.md Outdated

Build a unified atomic swap application that enables trustless, non-custodial exchanges
between LEZ and three major chains: **Bitcoin**, **Monero**, and **Ethereum**. The LEZ
side is implemented as a Risc0 guest program that locks funds contingent on the appropriate cryptographic proof for each chain. A reference implementation for ETH–LEZ swaps already exists ([eth-lez-atomic-swaps](https://github.com/logos-blockchain/eth-lez-atomic-swaps));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
side is implemented as a Risc0 guest program that locks funds contingent on the appropriate cryptographic proof for each chain. A reference implementation for ETH–LEZ swaps already exists ([eth-lez-atomic-swaps](https://github.com/logos-blockchain/eth-lez-atomic-swaps));
side is implemented as a Risc0 guest program that locks funds contingent on the appropriate cryptographic proof for each chain. A reference implementation for ETH–LEZ swaps already exists ([eth-lez-atomic-swaps](https://github.com/logos-co/eth-lez-atomic-swaps));

Comment thread RFPs/RFP-003-atomic-swaps.md Outdated
stagenet node options.
10. Provide step-by-step documentation for configuring an **Ethereum Web3 RPC
provider** for Sepolia testnet. All Ethereum interactions in the application must
use the existing [Logos Ethereum module](https://github.com/logos-blockchain/logos-execution-zone/);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the link to LEZ. not sure where the Ethereum module lives

on-chain scripting.
4. Trustless swaps between LEZ and **Ethereum** are supported using HTLCs or adaptor
signatures. Ethereum interactions must use the **Logos Ethereum module**.
5. The LEZ escrow program (Rust, Risc0) locks funds contingent on the appropriate
Copy link
Copy Markdown

@danisharora099 danisharora099 Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LEZ escrow lock is two transactions: LSSA programs can't debit accounts they don't own, so you must transfer funds to the escrow PDA first, then call Lock to set the HTLC rules. A crash between the two leaves funds unprotected. Unlike Ethereum's payable lock() which is atomic, this isworth flagging in the RFP for people unfamiliar with LSSA.

Copy link
Copy Markdown
Collaborator Author

@fryorcraken fryorcraken Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume then that the design needs to be changed? can't you Lock first and then move funds?

@fryorcraken fryorcraken changed the title RFP-003 — Atomic Swaps with LEZ RFP-003: Atomic Swaps with LEZ Mar 25, 2026
@fryorcraken fryorcraken merged commit dd91f0a into master Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants