Spark Program | Fiber RGB++ Swap

Fiber RGB++ Swap

The first working cross-chain swap between RGB++ Bitcoin assets and CKB, over Fiber

Applicant: Carl (solo developer) Track: Fiber Network, RGB++ Innovations Requested funding: $1,000 Timeline: 6 weeks, delivered in 3 milestones


Executive Summary

Fiber’s Cross-Chain Hub (CCH) already proves atomic cross-chain swaps work: a hub operator runs both a Fiber node and a Lightning node, and lets users swap BTC on Lightning for wrapped BTC on Fiber using a shared HTLC payment hash, with no custodian and no bridge delay. It’s real, shipped infrastructure.

It also does exactly one thing. It supports exactly one asset pair, at a fixed 1:1 ratio, with no way to add a second. Meanwhile, RGB++ assets issued on Bitcoin are already named in Fiber’s own protocol design as a supported channel asset class. Two working pieces of the same protocol have never been connected to each other.

This project connects them. Fiber RGB++ Swap delivers a working, demoable swap: a user sends an RGB++ asset issued on Bitcoin and receives the corresponding asset on CKB, atomically, entirely through a Fiber channel — no bridge, no custodian, no separate confirmation windows on each side. The underlying mechanism needed to make that possible — letting a hub advertise a second asset pair and its rate, since CCH currently has no way to do that at all — is built as the foundation, not the headline.

The Problem

In an April 2026 GitHub discussion titled “Fiber CCH Summary and Future Plan” (nervosnetwork/fiber #1243), the Fiber core team documented the current state of CCH plainly: swaps are hard-coded to BTC against one wrapped-BTC type script, at a fixed 1:1 ratio, with no negotiation mechanism and no way for a hub to offer a different asset or rate. They also named the fix themselves — hub operators broadcasting signed advertisements of supported assets and rates, discoverable by clients before a swap is initiated.

This isn’t a hypothetical gap. It’s a dated, public admission from the people who built the protocol, describing a feature that unlocks real value and doesn’t exist yet.

The strategic cost of that gap is bigger than it looks. CKB’s current flagship narrative is deepening its role as a Bitcoin Layer-2 and BTCFi hub, and RGB++ is the mechanism that lets Bitcoin-native assets move onto CKB in the first place. Fiber is the instant-settlement layer that’s supposed to make CKB usable at Lightning speed. Right now, those two efforts don’t talk to each other — an RGB++ asset holder has no fast, non-custodial way to move that asset through Fiber at all.

The Solution

Fiber RGB++ Swap has two layers, built in order:

The advertisement mechanism — a signed SwapAdvertisement message that a hub operator broadcasts over Fiber’s existing peer gossip layer (the same channel already used for node and channel announcements), declaring which asset pairs and rates they support. This removes CCH’s current hard-coded, single-pair limitation and is the minimum infrastructure needed for any second asset to exist on CCH at all.

The swap itself — a client that discovers an RGB+±supporting hub via that advertisement, and executes a full atomic swap: RGB++ asset in, CKB asset out, using the same HTLC commit-and-reveal pattern CCH already uses for BTC, generalized to a second asset class. This is the actual deliverable users and reviewers will see work.

The proof of concept runs on testnet: a hub advertising RGB+±to-CKB-asset swap support, and a client that discovers the offer, executes the swap, and shows both sides of the trade settled on-chain.

Technical Approach

The build extends nervosnetwork/fiber’s existing fiber-lib/src/cch/ module rather than introducing new infrastructure or forking the protocol. The SwapAdvertisement message carries the asset pair, rate, fee, operator pubkey, signature, and expiry, and reuses the existing gossip broadcast/refresh cycle already used for peer and channel announcements — no new transport layer.

On the swap-execution side, the existing HTLC lock-and-reveal logic CCH uses for the BTC/wrapped-BTC pair is generalized to accept a second asset type, with the RGB++ leg validated against Fiber’s existing RGB++ channel-asset support. A CLI (fiber-rgbpp-swap) drives the flow end to end: query advertisements, select a hub, initiate the swap, confirm settlement on both chains. A minimal JS client wraps the same calls so the flow can be triggered from a web dApp, not just a terminal.

Milestones

Milestone 1 — Advertisement mechanism (Weeks 1–2) — $300 Deliverables: SwapAdvertisement message type implemented and signed/verified; broadcast integration into Fiber’s existing gossip layer; a hub node on testnet successfully advertising a second (RGB++) asset pair, visible to a listening client. Also in this milestone: posting the project direction in Discussion #1243 to confirm with the core team that no parallel effort is underway, closing the biggest risk early rather than late.

Milestone 2 — Swap execution (Weeks 3–4) — $400 Deliverables: generalized HTLC swap logic supporting the RGB++/CKB-asset pair; CLI tool that can discover an advertised offer and execute a full swap; first successful end-to-end testnet swap, RGB++ asset in, CKB asset out, both sides confirmed on-chain. This is the milestone where the core value of the project becomes real and demoable, not theoretical.

Milestone 3 — Hardening, JS client, and delivery (Weeks 5–6) — $300 Deliverables: repeated testnet runs to catch and fix edge cases (cross-chain HTLC logic is exactly where subtle bugs hide, so this milestone is deliberately not compressed); minimal JS client wrapper so the swap can be triggered from a web dApp; recorded demo of a live swap; documentation for other builders to extend the pattern to additional asset pairs; public write-up posted back to Discussion #1243.

Budget

Milestone 1 — $300 Covers roughly two weeks of focused development time on the advertisement mechanism and gossip integration.

Milestone 2 — $400 Covers roughly two weeks of development on the swap execution logic — the most technically demanding part of the build, reflected in the larger allocation — plus testnet node hosting for the first live swap test.

Milestone 3 — $300 Covers testing and bug-fixing time, the JS client wrapper, and production of the demo recording and documentation.

Total — $1,000. No hardware, no marketing spend, no third-party paid services — the budget is almost entirely development time, split across milestones so funding tracks delivered progress rather than being paid upfront against a plan.

Success Metrics

A live testnet swap of a real RGB++ asset into a CKB asset, completed end to end and independently verifiable on both chains. A hub advertising at least one asset pair beyond the current hard-coded BTC pair, discoverable by an independent client. Open-source code and documentation sufficient for another builder to stand up their own advertising hub or extend the swap to a third asset pair without needing to ask me questions first.

Risks and Mitigations

Risk: someone else builds this first. Mitigated by posting in Discussion #1243 in week 1, before deep implementation work, specifically to surface any parallel effort early.

Risk: cross-chain HTLC logic has subtle bugs. Mitigated by not compressing testing into the final days — Milestone 3 exists specifically to give hardening its own dedicated time rather than treating it as a footnote.

Risk: scope creep toward a full production swap system. Mitigated by explicitly limiting this grant to proving the pattern works end to end on testnet, not shipping a mainnet-ready trading system — that’s a natural Community Fund DAO follow-on, not part of this ask.

Why This Is Worth Funding

This is grounded in a gap the Fiber core team named themselves, on a dated public record — not a gap I’m asserting exists. It connects two of CKB’s most strategically important efforts, RGB++ and Fiber, that currently don’t talk to each other, directly serving the ecosystem’s stated BTCFi narrative rather than sitting off to the side of it. It produces something immediately legible to anyone watching, not just other Fiber developers: a real asset crossing from Bitcoin to CKB, instantly, without a bridge. And because it’s scoped tightly — proving the pattern works, not building a production trading platform — it’s realistic to actually finish inside a $1,000, six-week Spark grant instead of stalling out on scope, while leaving an obvious, well-evidenced next step for a larger Community Fund DAO application.


2 Likes