Introduction to Multi-Currency Payments
Multi-currency payments enable value transfer across different currencies, both fiat and cryptocurrency. Blockchain technology introduces atomic swaps, decentralized exchanges, and programmable currency conversion, fundamentally changing how cross-currency payments work.
Traditional vs. Blockchain Multi-Currency
| Feature | Traditional FX | Blockchain FX |
|---|---|---|
| Settlement | 2 days (T+2) | Seconds to minutes |
| Intermediaries | Multiple banks | Smart contracts |
| Operating Hours | Business hours | 24/7/365 |
| Transparency | Opaque rates | On-chain rates |
| Minimum | $1,000+ | Any amount |
| Fee | 1â3% | 0.1â1% |
Currency Conversion Mechanisms
On-Chain Exchange (DEX)
Decentralized exchanges enable peer-to-peer currency conversion:
Atomic Swaps
Atomic swaps enable trustless cross-chain currency exchange:
Hash Time-Locked Contract (HTLC) Atomic Swap
Atomic Swap Protocol
Where ensures atomicity â if Alice doesn't reveal on ETH, she can't claim BTC, and both get refunds.
Cross-Chain Atomic Swap Support
| Chain Pair | Status | Time | Trust Model |
|---|---|---|---|
| BTC â ETH | Production | 10â60 min | HTLC |
| BTC â LTC | Production | 10â60 min | HTLC |
| ETH â BSC | Production | 2â5 min | Bridge |
| BTC â SOL | Limited | Variable | Bridge |
| ETH â ATOM | Production | 7 sec | IBC |
Multi-Hop Routing
For currencies without direct liquidity, multi-hop routing finds optimal paths:
Routing Algorithm
Path Finding Comparison
| Path | Hops | Total Fee | Slippage | Total Cost |
|---|---|---|---|---|
| XRP â BTC â DOGE | 2 | 0.3% + 0.3% = 0.6% | 0.5% | 1.1% |
| XRP â ETH â DOGE | 2 | 0.2% + 0.2% = 0.4% | 0.3% | 0.7% |
| XRP â USDC â DOGE | 2 | 0.1% + 0.1% = 0.2% | 0.1% | 0.3% |
| XRP â USDT â USDC â DOGE | 3 | 0.15%Ã3 = 0.45% | 0.2% | 0.65% |
Exchange Rate Oracles
Oracles provide real-time exchange rates for on-chain conversion:
Oracle Architecture
Price Feed Security
| Oracle | Update Frequency | Deviation Limit | Sources |
|---|---|---|---|
| Chainlink | 15 sec â 1 hr | 0.5â5% | 21+ nodes |
| Band Protocol | 10 sec | 1â2% | 100+ validators |
| API3 | 1 min | 1% | First-party |
| TWAP (Uniswap) | 30 min | 2â5% | DEX pool |
Slippage Management
Slippage is the difference between expected and actual execution price:
Slippage Formula
Slippage Tolerance
| Transaction Size | Pool Liquidity | Recommended Slippage |
|---|---|---|
| Small (<$1K) | High | 0.1â0.5% |
| Small (<$1K) | Low | 0.5â1% |
| Medium (10K) | High | 0.5â1% |
| Medium (10K) | Low | 1â3% |
| Large ($10K+) | High | 1â2% |
| Large ($10K+) | Low | 3â5% |
Price Impact
Where is the trade size and is the pool reserve.
Liquidity Pools for Multi-Currency
Pool Types
| Pool Type | Examples | Slippage | Impermanent Loss |
|---|---|---|---|
| Constant Product | Uniswap V2 | Moderate | High |
| Concentrated | Uniswap V3 | Low | High |
| Stable | Curve | Very Low | Low |
| Weighted | Balancer | Variable | Medium |
| Cross-Chain | Thorchain | Moderate | Medium |
Pool Economics
Real-World Examples
Thorchain
Decentralized cross-chain liquidity protocol enabling native BTC â ETH swaps without wrapping. Uses continuous liquidity pools and economic security through RUNE token staking.
Ren Protocol
Enables cross-chain liquidity through renBTC, renETH, and other renAssets. Locks assets on one chain and mints wrapped versions on another, facilitating multi-currency DeFi.
Curve Finance
Specialized in low-slippage stablecoin swaps, processing $2B+ daily volume. Critical infrastructure for multi-currency stablecoin payments with near-zero slippage.
Trade-Offs
| Advantage | Disadvantage |
|---|---|
| Atomic trustless swaps | Limited cross-chain pairs |
| Lower fees than traditional FX | Impermanent loss for LPs |
| 24/7 availability | Smart contract risks |
| Programmable rates | Oracle manipulation risk |
| No intermediaries | Liquidity fragmentation |
Interview Questions
-
Explain how an atomic swap works between Bitcoin and Ethereum, including the role of HTLCs.
An atomic swap uses hash time-locked contracts on both chains. Alice generates a hash H(r) and shares it with Bob. Bob creates a BTC HTLC paying to H(r) with a 48-hour refund. Alice creates an ETH HTLC paying to H(r) with a 24-hour refund. Alice claims ETH by revealing r, which Bob observes. Bob then uses r to claim BTC. If either party doesn't cooperate, both get refunds after their respective timelocks. The 24-hour difference ensures atomicity â Alice can't cheat because Bob has more time to claim.
-
How do DEX aggregators find optimal routing paths for multi-currency payments, and what factors influence the path selection?
Aggregators (1inch, Paraswap) model the market as a graph where nodes are tokens and edges are liquidity pools. They run modified Dijkstra's or Bellman-Ford algorithms considering: (1) Direct fees at each pool; (2) Price impact based on trade size vs pool liquidity; (3) Gas costs for each hop; (4) Multi-hop opportunities through intermediate tokens. The algorithm minimizes total cost including fees, slippage, and gas. For large trades, splitting across multiple paths reduces price impact. Real-time quotes are generated by simulating each path.
-
What is impermanent loss in liquidity pools, and how does it affect multi-currency payment systems?
Impermanent loss occurs when a token's price changes relative to its pair, causing LP positions to be worth less than simply holding the tokens. For example, if ETH doubles vs USDC, the AMM sells ETH for USDC, leaving the LP with less ETH than they started. For multi-currency payments, this means LPs bear directional risk. Mitigations include: stable pools (Curve) for like-assets, concentrated liquidity (V3) for fee capture, and insurance protocols. The loss is "impermanent" until liquidity is withdrawn, but affects LP returns and willingness to provide liquidity.
Quiz Questions
-
In an atomic swap, why is the timelock on the second HTLC set shorter than the first?
- a) To reduce gas fees
- b) To ensure the initiator can claim first and reveal the preimage before the other party's refund
- c) To speed up the swap
- d) To prevent front-running
-
What is the primary function of a price oracle in a multi-currency payment system?
- a) To execute swaps automatically
- b) To provide real-time exchange rates for on-chain conversion calculations
- c) To store private keys securely
- d) To validate transaction signatures
-
In a constant product AMM (x à y = k), what happens to price when a large buy order executes?
- a) Price decreases proportionally
- b) Price increases with slippage
- c) Price remains constant
- d) Price becomes zero