# CKB Fiber Introduction for CKCon 2024 ## Metadata **Status**:: #x **Zettel**:: #zettel/fleeting **Created**:: [[2024-10-31]] **Topic**:: [[♯ CKB Fiber]] **URL**:: [docs.google.com](https://docs.google.com/presentation/d/1IogBFIuoPXSlM3Sju5n_aVHuSpjRA7oWHsXCxwhiOx8/edit?usp=sharing) ## Requirements 从今年下半年开始,Fiber就是整个ckb生态关注的重点,所以想请你们来做一下分享:什么是Fiber?CKB上的闪电网络和比特币的闪电网络有什么区别?有什么可以合作的地方?Fiber的开发进度如何?未来大家可以基于Fiber做哪些开发? --- ## Fiber: A Payment Channel Network on CKB [email protected] Hello, everyone. I'm glad to be here today to introduce Fiber, a payment channel network on CKB. I'm Ian, a developer at Cryptape on the Fiber team. I'm also an active contributor to the CKB development. I will spend about 15 minutes to introduce what is Fiber, what Fiber can do, what's our vision, and how to get involved in the Fiber development. ## Understanding Payment Channel Network: The Foundation So, what is Payment Channel Network? Indeed, the name says it 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" tells us how it does. 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 has to touch 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. CKB, like Bitcoin, prioritizes security and decentralization. This creates natural limitations on transaction throughput. Currently CKB caps the capacity to 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. **Speed Comparison** - Traditional CKB transaction: 1-2 minutes - Payment Channel Network: Near-instant (<1 second) - Traditional payment networks (Visa): 2-3 seconds **Cost Efficiency** - Only two on-chain transactions needed: opening and closing - Thousands of off-chain transactions in between - Cost per transaction approaches zero - Enables micro-transactions and new business models ## Fiber's Competitive Edge Payment Channel Network is not new and there are already running networks such as Lighting on Bitcoin. So, what differentiates Fiber from other existing networks? There are at least two technical advantages. - CKB's Advanced VM Capabilities - Responsive Dispute Resolution First 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, making it easier for Fiber to implement more advanced protocols. Here are 2 examples implemented or planned: - We have implemented [daric](https://eprint.iacr.org/2022/1295) protocol to simplify the implementation of watchtower 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 along time. We can implement daric because CKB supports [Covenants](https://bitcoinops.org/en/topics/covenants/). Covenant is a scripting capability that you can get in CKB VM since launch but is not available yet in Bitcoin. - We have planned PTLC, the [Point Time Lock Contract](https://thebitcoinmanual.com/articles/point-time-lock-contract/) and will implement the protocol based on PTLC to allow users receiving 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. 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. Furthermore, there are two distinct applications exclusive to Fiber worth noting. - Instant payments with zero confirmation - Near-zero fees for international transfers - Pay-per-second video streaming First, Fiber will support transfers of CKB and xUDT from its launch. This allows Fiber to handle various user-defined tokens like stable coins and RGB++ assets moved into CKB. Second, 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. ## Beyond Payments: Fiber's Vision Let me share Fiber's ambitious vision: - We're creating an open financial infrastructure that goes beyond simple payments. This isn't just about transactions - it's about creating a foundation for financial freedom - Our goal is to foster innovation in decentralized applications, enabling developers to build the next generation of financial services - We aim to bridge different payment solutions on CKB and connect blockchain ecosystems Fiber is built on six fundamental values: **Open Source** - Community-driven development - Transparent codebase - Collaborative innovation **Interoperability** - Cross-chain compatibility - Bridge between different projects - Seamless integration with existing solutions **Programmability** - Full smart contract capabilities - Advanced VM features - Flexible protocol design **Security** - Robust dispute resolution - Strong cryptographic foundations **Privacy** - Confidential transactions - Route obfuscation capabilities **Accessibility** - Low barriers to entry - User-friendly interfaces - Comprehensive documentation This vision translates into real-world impact: - Enabling new business models - Reducing financial barriers - Connecting global payment networks - Empowering developers and users alike ``` Open Source /\ / \ Privacy / \ Interoperability / \ / \ / \ / \ / Security \ / ⚡️ \ / \ Access- Program- ibility ability FIBER CORE VALUES ``` ``` Values → Implementation → Impact [Open] → [GitHub Repos] → [Community Growth] [Interoperability] → [Cross-Chain] → [Network Effect] [Programmability] → [Smart Contracts] → [Innovation] [Security] → [Dispute Resolution] → [Trust] [Privacy] → [Confidential Tx] → [User Protection] [Accessbility] → [Easy APIs] → [Mass Adoption] ``` ## Breaking Barriers: Interoperability Interoperability 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 highways to connect users, to connect applications, and to connect chains. ## From Vision to Reality: Fiber's 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 channels 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. There are three features planed in the next version after launch: - Implement Payment Offers to allow generating invoices on demand via the P2P network. - Replaces HTLCs with more private and feature-rich PTLCs. - 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 receiving payments while offline. ``` 2023 2024 Q1 Q2 Q3 Q4 Q1 Q2 │ │ │ │ │ │ ├───┼───┼───┼───┼───┤ ↓ ↓ ↓ ↓ ↓ │ │ │ │ └─ MPP │ │ │ └───── PTLC │ │ └───────── BOLT12 │ └───────────── Demo └───────────────── Core Protocol Current Position: ▼ ``` ``` ┌─────────────────────────────────────┐ │ Current vs Upcoming Features │ ├─────────────────┬─────────────────┤ │ Basic Invoices │ Payment Offers │ │ HTLC │ PTLC │ │ Single Path │ Multipath │ └─────────────────┴─────────────────┘ ``` ## 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 the 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, 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 is the node uptime requirements. It presents a challenge in developing a product that requires users online to receive payment. We have planed Payments Offers and PTLC, the Point Time Lock Contract. Based on these two features, we will implement the protocol to allow users receiving 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. ## Join the Revolution: Fiber Community Fiber operates on a community-driven basis with all code openly available on GitHub under nervosnetwork/fiber. This transparency extends to the development process, also hosted on GitHub, where anyone can contribute and review code. Besides code contributions to Fiber, there are multiple paths to participation: - Run Liquidity Service Providers - Build wallets and applications - Issue assets such as wrapped BTC and stablecoins The Fiber team will provide technical support and update Fiber to incorporate different requirements based on the community feedback. - Technical Support - Community Driven Priority ## Wrapping Up - Introduction to Fiber - Fiber's Vision - Get Involved - Contact Information: nervosnetwork/fiber, email