Fiber: A Payment Channel Network on CKB

CryptapeCryptape
9 min read

This post was originally a talk delivered at Common Knowledge Conference (CKCON) 2024 in Chiang Mai, Thailand. Ian is a developer of the Fiber Network team in Cryptape. He is also an active contributor to the CKB development.

The video recording of this talk is available on Youtube.

Hello, everyone. I'm glad to be here today to introduce Fiber, a payment channel network on CKB. I will spend about 15 minutes introducing what Fiber is, what Fiber can do, what our vision is, and how to get involved in Fiber's development. Now, let's get started.

What is Fiber

Before introducing Fiber, I need to explain what a Payment Channel Network is.

Indeed, the name tells us all. Payment tells us what it does. It's designed for peer-to-peer transactions where the payer sends on-chain assets to the payee.

Channel and Network tell us how it works. Channels are established by two parties who lock funds in a smart contract on CKB to create an initial balance state. Subsequent balance updates are exchanged off-chain, with each update representing a new balance allocation. These transactions are instant and free due to the need for consensus only between the involved parties, rather than a global consensus on CKB. Security is ensured through cryptographic signatures, while the CKB blockchain serves as the final arbiter. The varying consensus sizes contribute to the speed and safety of payment channels. Opt for the minimum consensus size for speed and choose the broadest for enhanced security.

When parties rarely interact through a channel, the communication degrades to regular on-chain transfers since opening a channel requires interaction with the CKB blockchain. This issue is resolved by a network of channels, which allows users to send payments without direct connections between the sender and receiver. Payments route through intermediate channels, similar to how the internet routes data packets.

The Need for Speed: Why Payment Channel Network Matters

Blockchains struggle to achieve scalability, security, and decentralization simultaneously, which is what the blockchain trilemma refers to. CKB prioritizes security and decentralization. This creates natural limitations on transaction throughput. Currently, CKB caps the capacity at 200 TPS, while real-world payment networks need thousands of TPS.

Cost is another impact to consider. Each on-chain transaction requires network fees. During network congestion, fees can spike significantly. Imagine trying to pay for your coffee every morning using blockchain—each transaction would take minutes and cost several dollars in fees. Payment Channel Network solves this by creating efficient "highways" for transactions.

In a Payment Channel Network, transactions are instant because only two parties need to exchange states directly to reach consensus. The cost is nearly zero thanks to a channel that requires only two on-chain transactions but can serve thousands of off-chain transactions.

What Fiber Can Do

Payment Channel Network is not new, and there are already running networks such as Lightning on Bitcoin. So, what differentiates Fiber from other existing networks?

Fiber's Competitive Edge

There are at least two technical advantages.

The first advantage is the advanced VM capabilities. Fiber can incorporate Bitcoin Lightning Network technologies because both Bitcoin and CKB are UTXO-based. Moreover, CKB offers an additional advantage with its full-featured virtual machine, CKB-VM, making it easier for Fiber to implement more advanced protocols. Here are two examples implemented or planned:

  • First, we have implemented the Daric protocol to simplify the implementation of watchtowers and reduce storage requirements. Daric allows a channel party to revoke all old payments by using a payment with a higher version number, reducing the storage complexity from O(n) to O(1), or in simple words, the storage requirement is constant and does not increase over time (Learn more about Daric in this paper). We can implement Daric because CKB supports Covenants. Covenant is a scripting capability that you can get in CKB-VM since launch but is not available yet in Bitcoin.

  • Second, we have planned PTLC (Point Time Lock Contract) and will implement the protocol based on PTLC to allow users to receive payments while they are offline. In addition, we will delve into the advanced applications of Schnorr signatures, as the CKB virtual machine goes beyond solely verifying signatures. We hope these technologies can empower dApp developers to create compelling applications with exceptional user experiences.

The second advantage is that CKB has a significantly shorter block interval of approximately 10 seconds, in contrast to Bitcoin's 10-minute block interval (Thanks to NC-Max. Learn more in this paper). A shorter block interval offers the advantage of increased responsiveness, but it also presents certain challenges. The CKB consensus protocol tackles these challenges by eliminating bottlenecks in block propagation, leveraging the reduced latency for higher throughput, and mitigating selfish mining attacks.

Fiber in Action: Real-World Applications

The Payment Channel Network has various real-world applications, including:

  • Instant payments with zero confirmation

  • Near-zero fees for international transfers

  • Pay-per-second video streaming

Furthermore, there are two distinct applications exclusive to Fiber worth noting:

  • CKB and xUDT Channels. Fiber will support transfers of CKB and xUDT from its launch. This allows Fiber to handle various user-defined tokens like stablecoins and RGB++ assets.

  • Connect Fiber and Lightning Network. Since we can fully support the hash lock contract used by Bitcoin, payments can be routed between Fiber and Bitcoin Lightning. The two networks are connected into one to leverage each other's network effects. This also enables swift and cost-effective transfers of RGB++ assets between Fiber and Lightning.

Fiber's Vision: Beyond Payments

We're creating an open financial infrastructure that represents more than just moving assets from point A to point B. Our mission has three core pillars:

  • Building an open financial infrastructure that anyone can use, modify, and improve.

  • Fostering innovation in decentralized applications by providing developers with powerful tools and capabilities.

  • Creating bridges between different payment solutions on CKB and connecting various blockchain ecosystems.

Fiber’s Values & Impact

To achieve the vision, we've built Fiber on six fundamental values that guide every aspect of our development and community.

  • We are open source. Every line of code is public, our development process is transparent, and we actively encourage community participation. This isn't just about sharing code — it's about building trust and fostering collaboration.

  • Interoperability is in our DNA. Fiber isn't designed to be an isolated system. We're building bridges between different blockchain ecosystems, starting with Bitcoin's Lightning Network. This connectivity multiplies the value for all users.

  • We leverage the full power of programmability of CKB's virtual machine. This isn't just a payment network — it's a platform for financial innovation, allowing developers to build complex financial applications and custom solutions.

  • Security is non-negotiable. We've implemented robust dispute resolution mechanisms and use battle-tested cryptographic foundations. Your assets' safety is our top priority.

  • We believe privacy is a fundamental right. That's why we've built in confidential transactions and route obfuscation capabilities. Users should have control over their financial information.

  • Accessibility is crucial. We're removing barriers to entry through user-friendly interfaces and comprehensive documentation. Whether you're a developer or end-user, Fiber should be easy to understand and use.

These values aren't just words on a slide—they're the principles that guide every decision we make in building Fiber.

This vision translates into real-world impact, including:

  • Enabling new business models

  • Reducing financial barriers

  • Connecting global payment networks

  • Empowering developers and users alike

Breaking Barriers: Interoperability

Among all the values, I want to highlight Interoperability. It is crucial due to network effects. A growing network results in more users and potential routes, enhancing payment reliability. We have shipped a cross-chain hub service in the first Fiber demo to forward payments between Fiber and Bitcoin Lightning Network.

Bitcoin users can send BTC to Fiber, and Fiber users will receive wrapped BTC in CKB. CKB users can send wrapped BTC to Bitcoin, and Bitcoin users will receive BTC. This is not the end but just a start—Fiber can act as the highway to connect users, applications, and chains.

How to Get Involved

From Vision to Reality: Fiber's Current Progress

First, I want to share the current progress. We began developing a channel-based payment network for CKB in March of this year. The first Proof of Concept (PoC) has been delivered, featuring channel management, on-chain contracts, and cross-chain service for Lightning. The upcoming second PoC will introduce network features such as path finding and payment routing. We are working toward the mainnet launch by this year's end.

Upcoming Features

There are three features planned in the next version after launch:

  • Implement Payment Offers to allow generating invoices on demand via the P2P network.

  • Replace HTLCs with more private and feature-rich PTLCs.

  • Implement Multipath Payments (MPP) to split a payment into smaller parts and route each part separately.

Payment Offers and PTLCs also enable us to implement features that allow users to receive payments while offline.

Building the Future: Challenges & Solutions

Despite the progress, there are still several key challenges. In my view, there are two main challenges.

The first is liquidity. Users need to actively manage payment channels and ensure sufficient liquidity, which can be complex. The network is only usable when there are enough nodes in the network, enough channels between these nodes, and enough funds locked in these channels.

Currently, there is no silver bullet to solve the liquidity challenges technically. The network relies on operators to provide liquidity services, but Fiber members lack expertise in operations. To enhance liquidity in Fiber, community participation is vital. By collaborating with the community, we aim to develop more effective incentivization protocols and liquidity tools to support service providers more efficiently.

The second challenge is the node uptime requirements. It presents a difficulty in developing a product that requires users to be online to receive payments.

As I mentioned, we have planned Payment Offers and PTLC. These features enable us to implement protocols that allow users to receive payments while they are offline. Additionally, PTLC also brings us Schnorr signatures. We will explore whether we can leverage this powerful cryptographic tool to empower dApp developers, enabling them to create compelling applications with exceptional user experiences.

Join the Revolution: Fiber Community

Fiber operates on a community-driven basis with all code openly available on GitHub. This transparency extends to the development process, also hosted on GitHub, where anyone can contribute and review code.

Contribute

Besides code contributions to Fiber, there are multiple paths to participation, including:

  • Code, documents, discussions

  • Liquidity service providers

  • Wallet and application builders

  • Asset issuance such as wrapped BTC and stablecoins

What We Provide

The Fiber team will provide technical support and update Fiber to incorporate different requirements based on community feedback.

This is the end of my presentation today. If you have further questions, you can take a photo of this slide. You can visit our GitHub repo (nervosnetwork/fiber) or drop me an email (ian@cryptape.com). Thank you!

0
Subscribe to my newsletter

Read articles from Cryptape directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Cryptape
Cryptape