Trustless Atomic Swaps for Bitcoin Ordinals via Lightning Network
TL;DR: Pay Lightning, get Ordinal. Trustlessly. No custody risk.
Sparkle Protocol enables trustless atomic swaps for trading Bitcoin Ordinals using Lightning Network payments.
The Problem:
The Solution - Sparkle Swap:
How It Works:
Sparkle Protocol provides a trustless mechanism for trading Bitcoin Ordinals with Lightning payments:
If you're building ordinal marketplace infrastructure and want Lightning payments without custody risk, Sparkle Swap provides the atomic swap mechanism.
For curious readers who want the big picture.
For protocol designers, security engineers, and researchers.
For developers considering a proof‑of‑concept.
Sparkle Protocol's security model is based on cryptographic guarantees, not trust:
Sparkle provides the first trustless atomic swap mechanism specifically designed for ordinal trading with Lightning settlement.
Sparkle Protocol provides working implementations for building ordinal trading infrastructure:
{"p": "sparkle"} inscriptions and composes traits.Technical Stack: Node.js, bitcoinjs-lib, better-sqlite3, @scure/btc-signer for Taproot script construction.
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.
Instead of inscribing redundant data N times for a collection of N Ordinals, Sparkle defines a pattern where:
All data remains on Bitcoin. No off-chain storage or centralized databases required.
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.
Sparkle Protocol does NOT:
Sparkle Protocol is suitable for:
// 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
| 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.
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.
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}
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.
| 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.
| 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 |
Schnorr signatures and Tapscript enable compact, private atomic swaps on Bitcoin.
BOLT-compatible payment hash links Lightning invoice to on-chain ordinal claim.
2x safety margin on refund timeout protects against race conditions and reorgs.
| 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 |
A trustless atomic swap mechanism for trading Bitcoin Ordinals via Lightning payments. Uses established hashlock cryptography (HTLC pattern) applied specifically to ordinal trading.
If you want to trade ordinals with Lightning payments and zero custody risk, Sparkle Swap provides the atomic swap mechanism. Open source, MIT licensed.
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
});
Sparkle Protocol Stack:
All components working and tested on regtest. Ready for mainnet deployment.