Overview
Medusa Wallet integrates submarine swap technology to seamlessly convert between Lightning Network funds and on-chain Bitcoin. Powered by Boltz, these trustless swaps allow you to move funds between layers without custodial risk.Submarine swaps use Hash Time-Locked Contracts (HTLCs) to ensure atomic, trustless exchanges between Lightning and on-chain Bitcoin.
What are Submarine Swaps?
Submarine swaps are a mechanism for exchanging:- Lightning → On-chain (Reverse Swap): Send Lightning, receive on-chain Bitcoin
- On-chain → Lightning (Normal Swap): Send on-chain Bitcoin, receive Lightning funds
- Trustless: No counterparty can steal funds
- Atomic: Either the swap completes fully or funds are returned
- Non-custodial: You maintain control throughout the process
Swap Types
Normal Swaps
Convert on-chain Bitcoin to Lightning funds in your wallet
Reverse Swaps
Convert Lightning funds to on-chain Bitcoin at your address
Auto Swaps
Automatically convert Lightning balance to on-chain when threshold is reached
Lightning to On-chain (Reverse Swap)
Convert your Lightning funds to on-chain Bitcoin:Initiating a Reverse Swap
- Select the wallet with Lightning funds to swap
- Navigate to the Swap feature
- Choose “Lightning to On-chain”
- Enter the amount to swap
- Choose between:
- Send Amount: Specify how much Lightning you want to send
- Receive Amount: Specify how much on-chain Bitcoin you want to receive
- Enter your Bitcoin address where you want to receive funds
- Review fees and expected amount
- Confirm the swap
Swap Process
- Swap Created: Medusa creates the swap with Boltz
- Lightning Payment: Your Lightning funds are locked
- On-chain Settlement: Boltz sends Bitcoin to your address
- Confirmation: You receive on-chain Bitcoin
On-chain transactions require block confirmations. Your Bitcoin will appear in your wallet once confirmed.
Instant Settlement
Medusa uses instant settlement for reverse swaps:- Faster completion times
- Reduced waiting for confirmations
- Boltz assumes confirmation risk
On-chain to Lightning (Normal Swap)
Add Lightning funds by sending on-chain Bitcoin:Initiating a Normal Swap
- Select the destination wallet for Lightning funds
- Navigate to the Swap feature
- Choose “On-chain to Lightning”
- Enter the amount you want to receive in Lightning
- Provide a refund address (in case swap fails)
- Confirm the swap
Receiving Swap Details
Medusa provides:- Bitcoin Address: Where to send your on-chain Bitcoin
- Amount: Exact amount to send (including fees)
- QR Code: For easy scanning from other wallets
- Timeout: Block height when the swap expires
Completing the Swap
- Send the specified amount to the provided address
- Wait for on-chain confirmation
- Boltz detects the transaction
- Lightning funds are credited to your wallet automatically
Auto Swap Feature
Automate your Lightning to on-chain conversions:What is Auto Swap?
Auto Swap automatically converts Lightning funds to on-chain Bitcoin when your wallet balance reaches a specified threshold. Perfect for:- Regular savings to cold storage
- Automatic channel rebalancing
- Risk management strategies
Setting Up Auto Swap
- Select the wallet to monitor
- Enable Auto Swap in swap settings
- Set the threshold amount (in satoshis)
- Provide your Bitcoin address for automatic sends
- Configure instant settlement preference
- Save the auto swap configuration
How Auto Swap Works
- Monitoring: Medusa monitors your wallet balance
- Trigger: When balance exceeds threshold, swap initiates
- Automatic Execution: Funds are swapped without manual intervention
- Repeat: Process repeats each time threshold is reached
Managing Auto Swaps
View and manage your auto swap configurations:- Status: See active auto swaps and their trigger amounts
- History: Track how many times each auto swap has executed
- Deletion: Remove auto swap when no longer needed
You can have one auto swap configuration per wallet.
Swap Monitoring
Viewing Active Swaps
Access your swap history and active swaps:- Navigate to the Swap section
- View list of all swaps across all wallets
- See both normal and reverse swaps
- Monitor auto swap activity
Swap Card Information
Each swap displays:- Direction: Lightning → On-chain or On-chain → Lightning
- Wallet: Which wallet is involved
- Amount: Swap amount in satoshis
- Expected Amount: What you’ll receive (after fees)
- Status: Current swap state
- Timeout Block Height: When the swap expires
- Created Date: When the swap was initiated
Swap Status Values
- Pending: Waiting for on-chain confirmation or Lightning payment
- Transaction Mempool: On-chain transaction broadcasted
- Transaction Confirmed: On-chain transaction confirmed
- Invoice Set: Lightning invoice has been set
- Invoice Paid: Lightning payment completed
- Completed: Swap successfully finished
- Failed: Swap failed (funds returned)
- Expired: Swap timed out (check refund address)
Swap Details
Viewing On-chain Details
For swaps involving on-chain transactions:- Tap the swap card
- View detailed information including:
- Bitcoin address
- Transaction ID
- Block confirmations
- Fee breakdown
- Tap “Mempool” to view transaction on Mempool.space
Understanding Fees
Swap fees consist of:- Service Fee: Boltz swap service fee
- Mining Fee: On-chain transaction fees
- Routing Fee: Lightning network routing fees (minimal)
Fees vary based on network congestion and swap amount. Larger swaps typically have better percentage rates.
Timeout and Safety
Swap Timeouts
Every swap has a timeout measured in block height:- Normal Swaps: Timeout after ~24 hours
- Reverse Swaps: Timeout after ~24 hours
- Expired Swaps: Funds returned to refund address
Current Block Height
Medusa displays the current Bitcoin block height alongside swap timeouts:- Monitor how much time remains
- Warning indicators for expiring swaps
- Timeout alerts when swaps are at risk
Refund Addresses
For normal swaps:- Refund address is required before creating swap
- Must be a valid Bitcoin address
- Should be an address you own and can access
Boltz Configuration
Medusa automatically fetches Boltz swap limits:- Minimum Swap Amount: Smallest swap supported
- Maximum Swap Amount: Largest swap supported
- Fee Structure: Current fee percentages
- Network Limits: Based on current conditions
Best Practices
For All Swaps
- Verify Addresses: Double-check all Bitcoin addresses before confirming
- Monitor Status: Keep track of swap progress until completion
- Understand Fees: Review total fees before initiating swaps
- Save Details: Screenshot or note important swap information
For Normal Swaps
- Send Exact Amount: Always send precisely the amount specified
- Act Promptly: Complete swap before timeout
- Valid Refund Address: Use an address you definitely control
For Reverse Swaps
- Confirmed Address: Triple-check the destination Bitcoin address
- Amount Selection: Choose “Receive Amount” for exact on-chain targets
- Wait for Confirmations: On-chain transactions need time
For Auto Swaps
- Test First: Try a manual swap before enabling auto swap
- Appropriate Threshold: Set threshold based on your strategy
- Monitor Activity: Regularly check auto swap execution history
- Address Security: Use secure addresses (ideally hardware wallet)
Technical Details
Boltz Integration
Medusa integrates with Boltz API for:- Swap creation and management
- Configuration fetching
- Status monitoring
- Fee calculation
HTLC Security
Submarine swaps use Hash Time-Locked Contracts:- Preimage Secret: Ensures atomic execution
- Timelock: Provides refund mechanism
- Trustless: No counterparty risk
Instant Settlement
Reverse swaps with instant settlement:- Boltz sends on-chain Bitcoin immediately
- Boltz assumes confirmation risk
- Faster user experience
- Slightly higher fee for the service
Troubleshooting
Swap Stuck in Pending
- Check on-chain transaction status on Mempool.space
- Verify correct amount was sent
- Wait for required confirmations
- Contact support if timeout is approaching
Swap Failed
- Funds automatically return to refund address
- Check refund address for returned funds
- Review error message for details
- Verify network conditions weren’t unusual
Can’t Create Swap
- Ensure amount is within min/max limits
- Verify sufficient balance (including fees)
- Check internet connection
- Try again if Boltz service was temporarily unavailable
Next Steps
Security Features
Learn about keeping your wallet secure
Payment Features
Master Lightning Network payments