Skip to main content
KaleidoSwap operates on a decentralized architecture that combines the power of RGB Protocol with the scalability of the Lightning Network.

Core Components

RGB Protocol

Client-validated smart contracts on Bitcoin enabling scalable and private asset issuance

Lightning Network

Second-layer payment protocol providing instant, low-cost transactions

LSP Integration

Lightning Service Providers offering liquidity and channel management services

Desktop Client

Secure, user-friendly interface with full key control

System Architecture

KaleidoSwap System Architecture The platform consists of three client interfaces (desktop app, web app, and browser extension) that connect to RGB Lightning Nodes and Lightning Service Providers, all anchored to the Bitcoin blockchain for final settlement.

RGB Protocol

What is RGB?

RGB is a scalable and confidential smart contract system for Bitcoin. It uses client-side validation and single-use seals to enable complex smart contract functionality while maintaining Bitcoin’s security guarantees. Key Features:
  • Client-Side Validation: Contract state is validated by the recipient, not globally
  • Scalability: No blockchain bloat - contracts are off-chain
  • Privacy: Transaction details are only known to involved parties
  • Bitcoin Security: Anchored to Bitcoin blockchain for security

RGB Asset Types

RGB20 tokens are fungible assets similar to ERC-20 on Ethereum.Use Cases:
  • Stablecoins (USDT, USDC)
  • Tokenized commodities
  • Loyalty points
  • Currency tokens
Properties:
  • Divisible
  • Interchangeable
  • Fixed or variable supply

Lightning Network Integration

Why Lightning?

The Lightning Network provides the scalability layer for instant, low-cost RGB asset transfers. Benefits:
  • Instant Settlement: Transactions complete in milliseconds
  • 💰 Low Fees: Fraction of on-chain costs
  • 🔒 Security: Backed by Bitcoin’s security model
  • 📈 Scalability: Millions of transactions per second

How It Works

  1. Payment Channels: Users open bidirectional payment channels
  2. Off-Chain Transactions: Multiple transfers happen off-chain
  3. Channel State: Only final state is settled on Bitcoin blockchain
  4. Routing: Payments route through network of channels

RGB on Lightning

KaleidoSwap extends the Lightning Network to support RGB assets alongside native BTC:
  • Transfer USDT instantly through Lightning channels
  • Trade assets atomically via HTLC-based atomic swaps
  • Multi-asset channels supporting BTC + RGB20 tokens simultaneously

Lightning Service Providers (LSPs)

What are LSPs?

LSPs provide essential services to Lightning Network users:
LSPs open channels with users, providing inbound liquidity for receiving payments
Automatic channel rebalancing, backup services, and monitoring
Optimal payment routing through the Lightning Network
Specialized support for RGB asset transfers and atomic swaps

RGB LSPS1 Specification

KaleidoSwap implements the RGB Lightning Service Provider Specification (RGB-LSPS1):
  • Standardized Interface: Common API for LSP interactions
  • Asset Allocation: Specify RGB assets when opening channels
  • Swap Support: Built-in atomic swap functionality
  • Fee Transparency: Clear fee structure for all operations

Desktop Client Architecture

Non-Custodial Design

Everything runs on your device. The desktop application communicates directly with your RGB Lightning Node, which manages keys locally, controls channels, and validates contracts. No third party ever has access to your funds. Security Principles:
  • 🔐 Your Keys, Your Coins: Private keys never leave your device
  • 🔒 Encrypted Storage: All sensitive data encrypted locally
  • 🛡️ No Custody: No third party can access your funds
  • Client Validation: You validate all RGB contracts

Component Layers

  1. UI Layer: React-based desktop interface
  2. Business Logic: State management and workflow orchestration
  3. Node Interface: Communication with RGB Lightning node
  4. Network Layer: P2P connections and LSP integration

Data Flow

Atomic Swap Process

Atomic Swap Flow The atomic swap uses Hash Time-Locked Contracts (HTLCs) to ensure trustless execution:
  1. Request Quote — Taker requests a price for the asset pair
  2. Init Swap — Taker initiates the swap, creating an HTLC
  3. Lock Assets — Both sides lock their assets (BTC and RGB) in HTLCs
  4. Reveal & Claim — The secret is revealed, allowing both parties to claim
  5. Complete — Both parties receive their swapped assets atomically

Security Model

Multi-Layer Security

1

Bitcoin Base Layer

Final settlement and security anchoring on Bitcoin blockchain
2

Lightning Layer

HTLC-based atomic swaps ensuring trustless execution
3

RGB Layer

Client-side validation preventing double-spending
4

Application Layer

Encrypted storage and secure key management

Trustless Trading

  • No Counterparty Risk: Atomic swaps execute atomically or fail completely
  • No Custodians: Users maintain control of their keys and assets
  • No Trust Required: Cryptographic guarantees, not trust in intermediaries

Scalability

Transaction Throughput

LayerThroughputFinalityCost
Bitcoin On-Chain~7 TPS10-60 minHigh
Lightning NetworkMillions TPSInstantVery Low
RGB ContractsUnlimitedClient-sideMinimal

Why This Matters

  • Mass Adoption: Can scale to billions of users
  • Micro-Transactions: Economically viable even for tiny amounts
  • Real-Time Trading: No waiting for blockchain confirmations

Next Steps