1. Overview
- CKB stablecoin payment is a decentralized stablecoin payment solution based on the CKB network, allowing users to generate and manage the USD-pegged stablecoin RUSD through a joint network of CKB and Bitcoin, utilizing Layer 2 extensions such as RGB++ and Fiber Network, achieving fast, low-cost, and secure cross-chain stablecoin payments.
2. Introduction to Core Components
2.1 CKB (Common Knowledge Base)
2.1.1 What is CKB
CKB is the Layer 1 blockchain of the Nervos Network, whose main functions can be summarized as Consensus & Execution and Data Availability, enhancing scalability through payment channels and RGB++ built on top of it.
It is based on a PoW consensus mechanism, similar to BTC, and employs an upgraded BTC algorithm called NC-MAX. This algorithm improves network efficiency and responsiveness by accelerating transaction confirmation times and reducing orphan block rates. Unlike BTC's fixed interval of one block every 10 minutes, CKB dynamically adjusts block intervals based on network activity (approximately every four hours), optimizing performance.
CKB uses the Eaglesong hash function, a hash function specifically customized for the Nervos Network, providing the same level of security as SHA-256.
CKB adopts the Cell model as the core of its data structure, which is an improved version of BTC's UTXO accounting model.
Through a dual-script system, it allows for more flexible data storage and verification, supporting asset issuance and smart contract execution.
It provides data storage and state management functions, ensuring the long-term availability of all on-chain assets and data.
2.1.2 Cell Model
Cell Model & Features:
The Cell model is similar to BTC's UTXO model but achieves on-chain data storage and verification of smart contract scripts through the introduction of dual scripts.
Store any type of data or asset: In BTC's UTXO model, each transaction output can only contain simple amount information and ownership; whereas each Cell in CKB can store smart contract code and trigger these scripts to execute in transactions through external calls. This means each Cell can independently execute the smart contract logic associated with it, providing programmability.
Separation of state and computation: Since Cells store the code and state of smart contracts, each Cell can independently execute contract logic. Complex computation tasks can be executed on Layer 2 or off-chain, with the results synchronized back to Layer 1 through transactions, ensuring network security and data consistency.
Parallel execution & transaction packaging: Through the Cell model, smart contracts in different Cells can achieve parallel execution, while the transaction results of different Cells can be packaged and updated on-chain. This method is more efficient for computation and reduces transaction fees.
- How the Cell model works:
Cells consist of inputs and outputs: Similar to BTC's UTXO model, Cells execute transactions and state updates through inputs and outputs. Each Cell can be spent as an input in a transaction, generating new outputs and creating new Cells.
Elements of a Cell: Each Cell contains Capacity, Updated Data, Lock Script, and Type Script.
Capacity: Capacity records the size of the storage space of the Cell and represents the storage value of CKByte tokens. Users need to allocate a certain amount of Capacity for the Cells they create based on the data volume, ensuring effective utilization of on-chain storage.
Data: This is one of the core features of the Cell model, allowing for the storage of diverse data, from simple numbers to complex smart contract states, enabling the storage of varied data on the blockchain.
Dual-script system:
Lock Script: Used for authentication, similar to BTC's signature mechanism, preventing unauthorized users from accessing or modifying data in the Cell. Users must provide the correct signature or multi-signature to unlock and use the Cell.
Type Script: Defines the data validation logic of the Cell, setting the rules for how the Cell can be used or changed in future transactions. It determines the legality of transactions or states through the execution of smart contracts or rule validation.
Live Cell & Dead Cell:
A Live Cell refers to a Cell that has not yet been spent and can still be used as input for the next transaction or state update.
Once a Cell is spent, it becomes a Dead Cell and can no longer be used, but its historical record remains on-chain to ensure traceability.
State leasing mechanism: Users need to pay CKByte tokens to lease storage space on the chain, ensuring long-term data storage while preventing state bloat.
Sources:
https://medium.com/nervosnetwork/https-medium-com-nervosnetwork-cell-model-7323fca57571
https://docs.nervos.org/docs/tech-explanation/cell-model#first-class-assets
2.1.3 Programmability & CKB-VM
The Cell model is the foundation of CKB's programmability: It supports storing the state and execution scripts of smart contracts in each Cell, tightly integrating contract execution and asset management.
Through the Turing-complete RISC-V virtual machine (CKB-VM), developers can execute custom smart contracts on-chain. The flexibility of the RISC-V instruction set gives developers more freedom to write contracts, enabling CKB to support complex contract logic.
CKB-VM supports multiple languages: including popular languages like C and Rust. This broad compatibility distinguishes CKB-VM from other blockchain virtual machines that are typically limited to specific languages, opening it up to a wider developer community. The CKB network also supports SDKs for mainstream languages such as JavaScript, Rust, Go, and Java, making it easier for developers to use familiar tools for development.
Compatibility and scalability: The design of CKB-VM ensures compatibility with BTC's UTXO model and other blockchains while supporting highly scalable smart contracts and complex applications.
Sources:
https://medium.com/nervosnetwork/an-introduction-to-ckb-vm-9d95678a7757
2.1.4 PoW Consensus Mechanism
CKB adopts a PoW consensus mechanism similar to BTC, ensuring the security and decentralization of the network. Like BTC, miners compete to compute hash values to package blocks, ensuring the immutability and censorship resistance of the network.
NC-MAX Algorithm: Compared to BTC, CKB introduces the improved NC-MAX algorithm. This improvement allows for higher throughput and optimizes block packaging efficiency, reducing orphan block rates and enhancing transaction confirmation speeds, making it suitable for large-scale application scenarios such as asset storage and payment settlement.
Eaglesong Hash Function: The custom design of the Eaglesong hash function provides performance and security advantages for the Nervos CKB network through ASIC neutrality, efficiency, security, and network fairness, ensuring decentralization while enhancing mining efficiency and network scalability.
Sources:
https://docs.nervos.org/docs/tech-explanation/consensus#nc-max-consensus-algorithm
2.1.5 Multi-layer Security Architecture
- CKB employs a multi-layer security architecture: Layer 1 focuses on the final settlement of data and the secure storage of states, while Layer 2 is used to expand transaction processing capabilities.
- The separated architecture ensures the security of the main chain (Layer 1): Reducing the load during transaction processing improves the overall stability of the network.
2.1.6 Connection and Authenticity with BTC
Cross-chain interoperability of the UTXO model:
The CKB Cell model is an extension of the BTC UTXO model, and this similarity allows assets on the BTC UTXO model to be cross-chain operated on CKB through cross-chain bridging tools like Force Bridge. BTC users can map their assets to the CKB network, utilizing the flexibility of the CKB network for storage, smart contract operations, and decentralized finance (DeFi) applications.
Since Cells are structurally similar to BTC UTXOs, and CKB is compatible with BTC's signature algorithm, users can manipulate CKB on-chain assets using BTC wallets, which is also true for other UTXO public chains.
Authenticity: CKB maintains ideological consistency with BTC by adopting NC-Max (Nakamoto Consensus Max). NC-Max is an improved version of the Nakamoto consensus, providing better security and performance.
Community Support: The Nervos community consists of numerous blockchain technology enthusiasts, developers, and miners, and has received support from parts of the BTC community. Its authenticity lies in inheriting BTC's decentralization philosophy and meeting broader needs through extended functionalities.
Sources:
https://medium.com/@NervosCN/%E7%A7%91%E6%99%AE-%E4%BB%80%E4%B9%88%E6%98%AF%E4%B8%AD%E6%9C%AC%E8%81%AA%E5%85%B1%E8%AF%86-92ffe0886104
2.1.7 The Role of CKB in Stablecoin Payments
- Storage and Management of Stablecoin Balances: The Cell model of CKB serves as the foundation for stablecoin storage, with users' stablecoin balances like RUSD stored in Cells on-chain. Each Cell contains complete balance information, ensuring the security and traceability of assets.
- Recording Transaction States: CKB supports recording every state change of transactions on-chain, allowing all payment processes to be transparently recorded and tracked through the Cell model. This mechanism is crucial in stablecoin payments, ensuring the security and verifiability of transactions.
- Execution of Smart Contracts: Complex operations such as conditional payments and locks during the stablecoin payment process can be implemented through smart contracts supported by CKB-VM.
2.2 RGB++
2.2.1 What is RGB++
A decentralized asset issuance and smart contract protocol suitable for the Bitcoin UTXO model and other UTXO public chains.
The RGB++ protocol is developed from the RGB protocol, inheriting the idea of creating and binding transactions on-chain and off-chain separately. The difference is that RGB moves more data and smart contracts that cannot be stored on the BTC network off-chain using client-side validation, creating corresponding transactions bound to the chain, while RGB++ moves these unstoreable data and unimplementable smart contracts to CKB, making CKB the smart contract settlement layer for BTC.
Sources:
https://hackernoon.com/utxo-stack-the-complete-edition-of-the-rgb-protocol-charting-bitcoins-course
https://www.nervos.org/knowledge-base/UnderstandingBitcoinlayer2_%28explainCKBot%29
https://medium.com/@utxostack/the-magic-of-rgb-bridgeless-cross-chain-leap-70ed82bed3ab
2.2.2 Basic Functions
Using RGB++, CKB acts as the Shadow Chain for BTC: As a supplementary chain to BTC, it handles complex logic and smart contract operations that BTC natively cannot process.
Interaction with the BTC Network
Transaction Occurrence: In the BTC network, users complete transactions through the conventional UTXO model, while parts involving smart contract execution are bound to CKB through RGB++.
Verification Logic: Transaction records conducted on the BTC network will synchronize with the contract states stored on CKB through RGB++, ensuring the legality of transactions through specific verification logic. Whenever a transaction occurs on the network, RGB++ triggers the execution of contracts on CKB, checking whether the transaction meets predetermined rules, such as whether the balance is sufficient, the signature is valid, and the contract conditions are satisfied.
RGB++ uses a Client-Side Validation model to ensure the privacy and integrity of off-chain data, submitting data to CKB for final settlement only after off-chain validation passes.
Asset Issuance and Management: RGB++ allows users to issue assets (such as stablecoins, tokens, etc.) through off-chain protocols and manage the lifecycle of these assets using CKB (including not only asset issuance and circulation but also more complex operations like time locks and conditional payments).
RGB++ combines the high security of BTC with the programmability of CKB.
2.2.3 Isomorphic Binding
Cross-chain Synchronization of Assets & States: Isomorphic binding refers to maintaining synchronization of assets and states between BTC and CKB (or other UTXO public chains, such as Cardano) through a binding mechanism. Whenever an asset transaction occurs on the BTC chain, RGB++ maps the corresponding contract state or asset change on CKB.
Extended UTXO: In isomorphic binding, each UTXO on the BTC chain will have a corresponding Cell (UTXO container) on CKB, recording the corresponding asset state and smart contract conditions.
Asset Binding: When a user holds a certain RGB++ asset on the BTC chain, the Cell on CKB will store the corresponding asset state, ensuring the consistency of this asset information between the two chains through isomorphic binding.
Transaction Synchronization: When RGB++ token transactions occur, the isomorphic binding mechanism generates a Commitment on the BTC network, consuming the corresponding Cell on the CKB chain, while new Cells are generated to allocate assets.
Advantages of Isomorphic Binding - Empowering BTCFi
Smart Contract Support: BTC cannot natively support Turing-complete smart contracts, but through isomorphic binding, CKB can serve as the execution layer for smart contracts, managing complex transaction conditions for BTC assets, such as time locks and conditional payments.
Flexibility in Asset Management: Isomorphic binding allows for the management of assets circulating in the BTC network on CKB, enabling users to execute complex financial operations through CKB's flexible programming capabilities without altering the underlying BTC protocol.
2.2.4 Leap
RGB++ Layer Upgrade Proposal: Expands the binding relationship between CKB and BTC to all UTXO chains, achieving cross-chain asset transfer through "re-binding."
Bridge-less Cross-chain Between BTC and Other UTXO Chains: Its core purpose is to allow RGB++ assets on the BTC chain to be seamlessly transferred to other UTXO chains. It supports managing and transferring assets across multiple blockchains by switching the UTXO of asset bindings.
Bridge-less Technology: Leap achieves cross-chain asset transfer through Isomorphic Binding technology and switching UTXOs across different chains, without relying on traditional Lock-Mint cross-chain bridges.
Operational Process: For example, users can control RGB++ assets originally on the BTC chain through the Cardano chain and perform asset splitting and transfers on the Cardano chain.
Publishing Commitment: First, the user needs to publish a Commitment on the BTC chain, declaring the intention to unbind the assets bound to the BTC UTXO.
Cardano Chain Binding: Next, publish a new Commitment on the Cardano chain to bind the RGB++ asset to Cardano's eUTXO.
Modifying Lock Script: Then, modify the lock script of the RGB++ asset on the CKB chain, switching the unlock conditions from the BTC UTXO to the eUTXO on the Cardano chain. This step allows the asset holder to control the assets originally on the BTC chain through the Cardano chain.
The Role of CKB in Leap:
CKB acts as a sort of indexer and data availability (DA) layer. All RGB++ asset data is still stored on the CKB chain, with CKB serving as a third-party witness to handle Leap requests and ensure the security of cross-chain assets.
CKB provides security and credibility: Compared to the multi-signature or MPC (multi-party computation) mechanisms commonly found in traditional cross-chain bridges, CKB's security and decentralization attributes are more reliable.
2.2.5 The Role of RGB++ in Stablecoin Payments
- Issuance and Circulation of Stablecoins: Stablecoins are issued on the BTC chain through RGB++, utilizing CKB for smart asset management.
- Cross-chain Asset Management: The combination of the RGB++ Layer and CKB ensures seamless stablecoin payments across different UTXO chains.
- Smart Contract Support: Provides complex payment conditions, time locks, and other functionalities for stablecoin payments, enhancing flexibility and security.
- Bridge Role: The RGB++ Layer acts as a bridge between BTC (and other UTXO chains) and CKB, expanding BTC's programmability and asset management capabilities, making BTC's stablecoin payment functions more diverse and flexible.
2.3 Fiber Network
2.3.1 Introduction to Fiber Network
Fiber Network is a Layer 2 extension solution on CKB similar to the BTC Lightning Network: It is specifically designed to enhance CKB's off-chain payment capabilities, allowing users to make fast, low-cost payments off-chain. Off-chain transactions are achieved through payment channels, reducing the pressure on the main chain and increasing transaction speed.
Characteristics of Off-chain Payments: Fiber Network enables rapid off-chain transfers through payment channels, reducing reliance on the CKB main chain and increasing transaction throughput.
Current Status: As of September 2024, according to mempool data, over $300 million is currently allocated in the BTC Lightning Network, with approximately 12,000 nodes and nearly 50,000 payment channels built between them.
Sources:
https://hackernoon.com/fiber-network-a-lightning-network-based-on-ckb
2.3.2 Technical Points
Off-chain Payment Channels (Fiber Channels): Fiber Network allows users to directly exchange assets off-chain by creating payment channels, submitting the final state to the CKB main chain for settlement only when the channel is closed.
On-chain Contracts (HTLC):
Similar to the BTC Lightning Network, Fiber Network now also uses Hash Time-Locked Contracts (HTLC) to ensure the security of off-chain transactions; if an off-chain transaction is not confirmed within the agreed time, assets can be automatically returned through HTLC.
PTLC: Fiber Network improves upon HTLC to avoid using the same cryptographic value for the entire payment path, employing PTLC to prevent privacy leakage regarding transaction associations.
Multi-Hop Routing:
Like the BTC Lightning Network, Fiber Network supports payment path jumps through multiple nodes, using the Dijkstra algorithm to search for payment paths, thereby reducing routing costs and increasing the success rate of multi-hop payments.
Monitoring Service - Watchtower Service:
Users can utilize a 24/7 monitoring service to keep track of the status of payment channels, preventing malicious nodes from attempting double spending or cheating (preventing transaction participants from submitting expired Commitments on-chain). This service can automatically track transactions and issue alerts.
2.3.3 Differences Between Fiber Network and BTC Lightning Network
Multi-Asset Support:
The BTC Lightning Network only supports off-chain payments for BTC, and may support other assets in the future through Taproot Asset upgrades, but currently only natively supports BTC;
Fiber Network supports multiple assets, including CKB, BTC, RGB++ stablecoins, and more.
Transaction Fees and Speed:
The BTC Lightning Network incurs higher BTC transaction fees when opening and closing channels due to operating on the BTC chain, especially when BTC transaction fees rise, significantly increasing the cost of channel operations;
Fiber Network, relying on CKB, has higher TPS and lower transaction fees, making the costs of opening and closing channels lower, providing a better user experience.
Cross-chain Interoperability:
The BTC Lightning Network is primarily used for payments within the BTC network and does not yet support cross-chain payments with other UTXO chains.
Fiber Network supports the circulation of various assets, including native BTC assets (such as inscriptions, runes, etc.), CKB, and native RGB++ assets (including RUSD, etc.).
Cross-chain Asset Off-chain Payments: With the help of the RGB++ Layer, all UTXO chain assets can enter the Lightning Network.
Fiber Network and the BTC Lightning Network can interconnect: enabling cross-chain payments (only initiated by Fiber Network and received by the BTC Lightning Network), allowing users to use CKB or RGB++ assets to purchase assets on the BTC Lightning Network while ensuring the atomicity of cross-chain transactions (preventing partial success/failure of asset transfers across chains).
2.3.4 The Role of Fiber Network in Stablecoin Payments
- Fiber Network is used to support off-chain stablecoin transfers, ensuring the immediacy and low cost of payments.
- Fiber Network allows users to conduct high-frequency trading off-chain by creating off-chain payment channels, reducing pressure on the main chain.
- Fiber Network supports cross-chain atomic payments, enabling stablecoin payments to safely traverse multiple chains.
2.4 Stable++
2.4.1 Introduction to Stable++
A decentralized over-collateralized stablecoin protocol in the CKB ecosystem, allowing users to mint RUSD pegged to the US dollar by collateralizing BTC or CKB.
RUSD is theoretically the first stablecoin issued directly on the Bitcoin network based on the RGB++ protocol, leveraging CKB's capabilities to provide a more localized and efficient solution (with questions).
Transaction Fees: Users are charged fees for minting RUSD by collateralizing BTC/CKB and for redeeming BTC/CKB when returning RUSD.
RUSD Staking: Users can earn governance tokens STB by staking borrowed RUSD.
Governance Token STB
Users can participate in collateral liquidation to earn rewards by staking STB.
Users can participate in fee sharing by staking STB.
Cross-chain Interoperability: RUSD can achieve transfers between UTXO chain accounts through isomorphic binding and Leap functionality of RGB++.
Lower Minimum Collateralization Ratio (MCR): Thanks to efficient liquidation, the risk of potential losses faced by the protocol and stability providers is reduced, thereby lowering the demand for collateral value.
Decentralization: Stable++ is a completely decentralized, independently operating protocol that requires no control or permission from any entity, allowing users to interact with the system freely and securely.
Sources:
https://jackylhh.notion.site/Stable-RGB-Layer-9b2c3a385d5d4ce89f176d2b9c1701e4
https://medium.com/@NervosCN/stable-%E6%8E%A0%E5%BD%B1-%E6%89%AD%E8%BD%AC%E6%BD%AE%E6%B5%81%E7%9A%84%E5%8D%8F%E8%AE%AE-de7eadee5036
2.4.2 Liquidation Mechanism - Double Insurance
Overview: The liquidation mechanism is a protective measure triggered when the value of collateral falls below a certain critical point (Minimum Collateralization Ratio * borrowed RUSD), ensuring that the generated RUSD stablecoin is always sufficiently backed by collateral. The system automatically liquidates users with insufficient collateral to maintain overall system stability.
Stability Pool:
To address the inefficiencies that occur during large-scale liquidations, Stable++ uses a stability pool to replace the auction method commonly used in most lending protocols for liquidation, eliminating the need to find liquidators in the market.
Automatic Liquidation: The stability pool requires LPs (users) to pre-deposit RUSD as reserves. When liquidation occurs, RUSD equivalent to the bad debt in the stability pool will be directly destroyed, while the collateral will be directly allocated to the LPs.
By automatically liquidating through the stability pool and directly distributing excess collateral instead of traditional auctions, the operational efficiency and stability of the stablecoin during large-scale liquidations are improved.
Reallocation
Overview: When the stability pool does not have enough reserves to complete the liquidation of bad debts, the bad debts and collateral will be distributed among borrowers through a sufficiency allocation mechanism.
Debt Reallocation: When the liquidation pool cannot cover all bad debts, the remaining debt will be proportionally redistributed among all borrowers.
Collateral Distribution: While all borrowers collectively absorb the bad debts, they will also receive a proportional allocation of excess collateral as a reward.
By having all borrowers share the burden of bad debts, this mechanism ensures that there are no uncovered debts in the system, preventing the accumulation of systemic risk.
2.4.3 The Role of Stable++ in Stablecoin Payments
- The Stable++ protocol generates the stablecoin RUSD, which serves as the primary stablecoin used in payments.
- Stable++ improves the traditional over-collateralization method through its innovative liquidation mechanism, ensuring the stability of the RUSD price.
- With the help of RGB++'s isomorphic binding and Leap capabilities, RUSD becomes the first truly freely circulating stablecoin on any UTXO-supporting chain, further expanding the liquidity of stablecoins.
2.5 JoyID
2.5.1 What is JoyID
The JoyID Passkey wallet is a cryptocurrency wallet that combines Passkey key management.
In the Nervos ecosystem, JoyID is designed as a cross-chain, decentralized identity authentication and management tool, allowing users to securely store and use cryptocurrencies and other decentralized applications.
Sources:
https://nervina.notion.site/JoyID-8645e910ef104962b01bd4835a8ea7dc
https://x.com/joy_protocol/status/1836299130345525533
2.5.2 Key Features
No Passwords or Mnemonics Required: Access the wallet through biometrics, enabling keyless login.
Supports BTC and Fiber Network: Users can trade faster and more efficiently, helping to expand the application scenarios of CKB.
Multi-chain Support: JoyID supports not only BTC and Nervos CKB but also ETH and a range of EVM chains.
Additional Security through Passkey: Passkey generates the secp256k1 signatures required for blockchain transactions through secp256r1 signatures associated with hardware devices. Since secp256r1 signatures are not exposed in transactions and are generated only through biometric information, this adds an extra layer of security to the wallet.
Combination of Security and Usability
Security: Hardware Wallet > Passkey Wallet > Software Non-Custodial Wallet > Custodial Wallet
Usability: Passkey Wallet > Custodial Wallet > Software Non-Custodial Wallet > Hardware Wallet
2.5.3 The Role of JoyID in Stablecoin Payments
- JoyID serves as the user interface, allowing users to make stablecoin payments on the CKB network, managing their RUSD assets and payment channels.
- With its excellent combination of capabilities (security, usability, multi-chain support), JoyID can further empower stablecoin payments and other transactions based on CKB.
3. Payment Link
- Payment Initiation and Acceptance: Users can open payment channels through the JoyID wallet to make stablecoin payments.
- Stablecoin Issuance: RGB++ and Stable++ work together, with Stable++ generating RUSD through over-collateralization of BTC or CKB, and then issuing it on-chain through RGB++.
- Cross-chain Transactions & Circulation: RGB++ seamlessly connects the BTC chain (and other UTXO chains) with the CKB chain through isomorphic binding and Leap, allowing RUSD and other assets to operate across multiple UTXO chains, expanding the range of asset circulation and ensuring data synchronization.
- Transaction Records and Settlement: The combination of Fiber Network and CKB supports rapid processing of off-chain payments, with CKB serving as the L1 chain to ensure the final settlement of transactions, safeguarding the security of all transaction states and assets.
- Foundation for Complex Transactions: CKB's virtual machine and Cell model provide an execution environment for smart contracts, supporting complex payment conditions and custom contract logic, while also ensuring the decentralization of the Stable++ protocol.
免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。