๐Ÿงช
atomiq.exchange
  • ๐ŸŒŸIntroduction
  • โš—๏ธLiquidity provider nodes (LPs)
    • ๐Ÿƒโ€โ™‚๏ธRunning LP node
    • โŒRunning LP node (deprecated)
  • ๐Ÿ”“Security
  • ๐Ÿ”ฑSubmarine swaps (lightning)
    • ๐ŸŒฉ๏ธSolana -> Bitcoin Lightning
    • โšกBitcoin Lightning -> Solana
  • ๐ŸชถBitcoin light client (on-chain)
    • ๐Ÿ”—Solana -> Bitcoin on-chain
    • โ›“๏ธBitcoin on-chain -> Solana
  • SPV swaps (on-chain)
Powered by GitBook
On this page
  • Requirements
  • Parties
  • Process
  • Successful payment
  • Payee went offline
  • Diagram
  1. Submarine swaps (lightning)

Bitcoin Lightning -> Solana

Requirements

  • lightning invoice has to have a fixed amount

Parties

  • payee - recipient of the solana/spl token, using intermediary to do the swap

  • LP node - handling the swap, sends solana or spl token and receives lightning network payment

  • payer - the one paying on bitcoin lightning network

Process

  1. Payee creates a secret S and payment hash P that is produced by hash of secret H(S)

  2. Payee queries the LP node off-chain, with payment hash P and an amount he wishes the receive, LP node creates a bitcoin lightning invoice using payment hash P, with the amount specified and returns it to payee

  3. Payee sends this lightning invoice to the payer

  4. LP node receives an incoming lightning network payment from payer, but cannot settle it because LP node doesn't know secret S yet.

  5. Payee queries the LP node off-chain to obtain a specific message Mi (initialize) signed by LP node allowing payee to create an HTLC on Solana with funds pulled from LP node's vault, an HTLC is constructed:

    • paying the funds to payee if he can supply a valid secret S, such that hash of secret H(S) is equal to payment hash P, but only until a specific time in the future - locktime T

    • refunding the payer, but only after locktime T

    NOTE: locktime T is determined by LP node based on lightning invoice's min_cltv_delta - the minimal timeout delta for last lightning network HTLC in chain (last hop of the lightning network payment) as LP node needs to have a knowledge of secret S before then to successfully receive a payment

Successful payment

  1. Upon confirmation of HTLC creation's transaction on Solana, payee submits a second transaction revealing the secret S and claiming the funds from HTLC

  2. LP node observes this transaction on Solana and uses the revealed secret S to settle the lightning network payment.

Payee went offline

  1. LP node waits till the expiry of locktime T and then refunds his funds back from the HTLC

Diagram

PreviousSolana -> Bitcoin LightningNextBitcoin light client (on-chain)

Last updated 1 year ago

Bitcoin Lightning -> Solana swap process (Intermediary = LP Node, Smart chain = Solana)
๐Ÿ”ฑ
โšก