Sparkle Protocol

Trustless Atomic Swaps for Bitcoin Ordinals via Lightning Network

TL;DR: Pay Lightning, get Ordinal. Trustlessly. No custody risk.

Core Innovation: Sparkle Swap
Taproot hashlock scripts enable atomic swaps where Lightning payment reveals the preimage that unlocks on-chain ordinal claim.
Trustless Non-Custodial Trading
Atomic Both Parties Satisfied or Nothing
Lightning Instant Payment Settlement
Open Source MIT Licensed

What Sparkle Protocol Does

Sparkle Protocol enables trustless atomic swaps for trading Bitcoin Ordinals using Lightning Network payments.

The Problem:

  • Current ordinal trading is either custodial (marketplace holds your asset) or slow (PSBT-based)
  • Buyers must trust marketplaces not to steal their funds or ordinals
  • No native Lightning payment support for ordinal purchases

The Solution - Sparkle Swap:

  • Trustless: Taproot hashlock scripts - no custody required
  • Atomic: Either both parties get what they want, or nothing happens
  • Lightning-native: Pay with any BOLT-compatible Lightning wallet
  • Delta-safe: 2x timelock safety margin protects against race conditions

How It Works:

  1. Seller locks ordinal in Taproot address with hashlock + timelock paths
  2. Buyer pays Lightning invoice (same payment hash as hashlock)
  3. Payment reveals preimage → buyer claims ordinal on-chain
  4. If buyer never pays, seller reclaims after timeout

Why This Exists

Sparkle Protocol provides a trustless mechanism for trading Bitcoin Ordinals with Lightning payments:

  • Sparkle Swap: Taproot hashlock scripts enabling atomic swaps - pay Lightning, claim ordinal trustlessly.
  • Non-custodial coordinator: Facilitates trades but cannot steal funds. Run your own to eliminate censorship risk.
  • Delta-safe timelocks: 2x safety margin prevents race conditions during blockchain reorgs.
  • Buyer deposits: 1% non-refundable deposit prevents free option exploit.

If you're building ordinal marketplace infrastructure and want Lightning payments without custody risk, Sparkle Swap provides the atomic swap mechanism.

How to Read This Site

1. Overview Track (15–30 minutes)

For curious readers who want the big picture.

2. Design Track (1–2 hours)

For protocol designers, security engineers, and researchers.

3. Implementation Track (for Builders)

For developers considering a proof‑of‑concept.

Security Model & Trade-offs

Sparkle Protocol's security model is based on cryptographic guarantees, not trust:

  • Non-Custodial Coordinator: The coordinator facilitates trades but cannot steal funds. It never holds keys or preimages. Worst case: censorship, which is mitigated by running your own coordinator.
  • Atomic Settlement: Lightning payment reveals preimage that unlocks on-chain ordinal claim. Either both parties get what they want, or neither transaction completes.
  • Timelock Protection: CLTV timelocks allow sellers to reclaim ordinals if buyers never pay. Standard Bitcoin security model applies.
  • Ownership Timing: Lightning payments settle instantly; on-chain ownership requires standard Bitcoin confirmations (~10 minutes).

Sparkle provides the first trustless atomic swap mechanism specifically designed for ordinal trading with Lightning settlement.

For Developers

Sparkle Protocol provides working implementations for building ordinal trading infrastructure:

  • 1. Sparkle Swap: Taproot hashlock atomic swaps - trustless ordinal trading with Lightning settlement.
  • 2. Sparkle Indexer: Protocol-aware indexer that discovers {"p": "sparkle"} inscriptions and composes traits.
  • 3. Sparkle Coordinator: Non-custodial trade facilitation service with WebSocket real-time updates.
  • 4. Batch Inscriber: Production-tested 10K NFT inscription pipeline with parent-child recursive references.

Technical Stack: Node.js, bitcoinjs-lib, better-sqlite3, @scure/btc-signer for Taproot script construction.

Protocol Overview

Sparkle Protocol is an experimental standard for Lightning-aware Bitcoin Ordinals metadata and atomic trading flows.

The protocol defines metadata structures for Bitcoin Ordinals inscriptions that enable Lightning Network payment integration and recursive parent-child composition patterns.

Protocol Scope

  • Metadata Standards: JSON schemas for Ordinals inscriptions with Lightning-compatible trade fields (SIP-1)
  • Recursive Composition: Parent-child inscription references for reduced on-chain data redundancy
  • Atomic Swaps: Lightning-settled Ordinal trades via HTLC mechanisms (SIP-3, draft)
  • Trustless Trading: Coordinator-mediated atomic swaps without custodial risk (SIP-4, draft)

Technical Approach

Instead of inscribing redundant data N times for a collection of N Ordinals, Sparkle defines a pattern where:

  1. Shared trait data is inscribed once as parent inscriptions
  2. Individual Ordinals reference parents by inscription ID
  3. Clients compose final representations by fetching referenced inscriptions
  4. Lightning payments settle atomically with on-chain ownership transfer

All data remains on Bitcoin. No off-chain storage or centralized databases required.

Authorship

Sparkle Protocol was created and is actively researched by David A. Michael as an experimental standard for integrating Bitcoin Ordinals with Lightning-style payment flows.

Non-Goals

Sparkle Protocol does NOT:

  • Replace or modify the Bitcoin Ordinals protocol
  • Provide custodial trading services or marketplace infrastructure
  • Guarantee trustlessness without coordinator infrastructure
  • Offer production-ready, audited implementations

For Researchers and Developers

Sparkle Protocol is suitable for:

  • Researchers exploring Lightning-Ordinals integration patterns
  • Developers building experimental testnet applications
  • Protocol designers evaluating recursive inscription architectures
  • Academic study of Bitcoin L2 scaling mechanisms

Protocol Specification

1. Sparkle Swap Script

// Buyer Claim Path (hashlock)
OP_SHA256 <payment_hash> OP_EQUALVERIFY
<buyer_pubkey> OP_CHECKSIG

// Seller Refund Path (timelock)
<locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP
<seller_pubkey> OP_CHECKSIG

2. Atomic Swap Flow

Trade Execution:

1. Seller locks ordinal in Taproot address
2. Seller creates LN invoice (same payment_hash)
3. Buyer pays invoice → learns preimage
4. Buyer claims ordinal with preimage + sig
5. If no payment: seller refunds after timeout

3. Security Assumptions

  • Bitcoin Finality: Relies on standard Bitcoin confirmation security (6+ blocks recommended)
  • Lightning Settlement: HTLC timeout must exceed PSBT confirmation target + safety margin
  • Coordinator Trust: Coordinator can censor but cannot steal funds; run your own to mitigate
  • Reorg Risk: Deep reorgs (6+ blocks) may revert ownership; standard Bitcoin risk applies

Trading Model Comparison

Ordinal Trading Approaches

Approach Trust Model Payment Speed Custody Risk Lightning Support
Custodial Marketplace Trust marketplace Instant High - they hold your assets Varies
PSBT-based Trading Trustless ~10 min (on-chain) None No
Sparkle Swap Trustless (atomic) Instant (Lightning) None Native

Note: Sparkle Swap combines the speed of custodial solutions with the trust model of PSBT trading.

Marketplace Integration Framework

Proposed Marketplace Integration Path

Sparkle Protocol is designed for integration with existing NFT marketplaces through a standardized detection and trading mechanism. Marketplaces can identify Sparkle-enabled ordinals by parsing inscription metadata for protocol markers.

Detection and Badge System

Ordinals inscribed with Sparkle Protocol metadata display a distinctive badge on marketplace interfaces, signaling Lightning Network trading capability. This is achieved through indexer modification to detect the protocol signature: {"p": "sparkle", "v": 1}

Reinscription Bridge for Existing Collections

A critical innovation is the reinscription bridge mechanism, allowing existing ordinals to be upgraded with Lightning capability without modifying the original inscription:

{
  "p": "sparkle",
  "op": "upgrade",
  "original": "existing_ordinal_inscription_id",
  "lightning": {
    "enabled": true,
    "bridged_at": block_height
  }
}

This preserves the provenance and authenticity of the original inscription while adding Lightning Network functionality. The reinscription creates a child inscription that references the parent, maintaining the chain of ownership.

Trading Flow Architecture

Component Function Integration Point
Marketplace UI Display Sparkle badge Frontend modification
Indexer Detect protocol metadata Parser enhancement
Lightning Backend Handle Lightning payments via LND or Core Lightning Backend integration
Trade Executor Atomic swap coordination Sparkle coordinator layer

The integration requires minimal changes to existing marketplace infrastructure, primarily involving Lightning node integration (LND or Core Lightning) and UI modifications to display Lightning-enabled status. Sparkle Protocol provides the complete coordination layer.

System Architecture

System Architecture

Layer Components Function
Layer 2: Lightning Lightning Nodes, HTLC Channels, State Channels Sub-second payment, ~10min ownership
Protocol Layer Sparkle Coordinator, Trade Validators, Indexers Non-custodial trade facilitation and state management
Layer 1: Bitcoin Ordinal Inscriptions, Taproot Scripts, Bitcoin Blockchain Base layer security and finality

Taproot Security

Schnorr signatures and Tapscript enable compact, private atomic swaps on Bitcoin.

Lightning Native

BOLT-compatible payment hash links Lightning invoice to on-chain ordinal claim.

Delta-Safe Timelocks

2x safety margin on refund timeout protects against race conditions and reorgs.

What Makes Sparkle Swap Different

Feature Custodial Markets PSBT Trading Sparkle Swap
Trust Required Full custody trust None None (atomic)
Payment Speed Instant ~10 min on-chain Instant (Lightning)
Lightning Support Some No Native
Can Steal Funds Yes (they hold keys) No No

Honest Assessment

What Sparkle Swap Is

A trustless atomic swap mechanism for trading Bitcoin Ordinals via Lightning payments. Uses established hashlock cryptography (HTLC pattern) applied specifically to ordinal trading.

What It's Not

  • Not a new cryptographic primitive (hashlocks exist since 2013)
  • Not recursive inscriptions (that's native ord functionality)
  • Not a marketplace (just the swap mechanism)

Value Proposition

If you want to trade ordinals with Lightning payments and zero custody risk, Sparkle Swap provides the atomic swap mechanism. Open source, MIT licensed.

Reference Implementation

Quick Start: Inscribe with Sparkle Protocol

import { SparkleSDK } from '@sparkleprotocol/sdk';

// Initialize Sparkle Protocol SDK
const sparkle = new SparkleSDK({
    network: 'testnet',
    lightning: {
        node: 'your-lightning-node',
        capacity: 1000000
    }
});

// Deploy collection with Lightning support
const collection = await sparkle.deploy({
    name: 'ExampleCollection',
    traits: ['backgrounds', 'bodies', 'eyes', 'accessories'],
    lightning: true
});

// Mint NFT with instant Lightning trading
const nft = await sparkle.mint({
    collection: collection.id,
    traits: [trait1, trait2, trait3],
    recipient: 'bc1p...',
    enableLightning: true
});

// Trade via Lightning (instant, <$0.01 fee)
await sparkle.lightning.trade({
    nft: nft.id,
    price: 0.001, // BTC
    htlcTimeout: 144
});

Infrastructure Components

Sparkle Protocol Stack:

  • Sparkle Swap: Taproot hashlock atomic swaps for trustless ordinal trading
  • Sparkle Coordinator: Non-custodial trade facilitation with WebSocket updates
  • Sparkle Indexer: Protocol-aware inscription indexer with trait composition
  • Lightning Integration: LND or Core Lightning node for HTLC settlement

All components working and tested on regtest. Ready for mainnet deployment.