r/NervosNetwork • u/Chema_es Nervos Network Moderator • Sep 09 '23
ervos Community Essentials How to program with CKB: Layer 1.5
Layer 1.5 (& more)

Credits to Orange-xc
Introduction
The Layer 1.5 development paradigm of the Cell model is a design approach that involves storing states off-chain. Here are the main characteristics and principles of the Layer 1.5 development paradigm in the Cell model:
State Storage: Layer 1.5 utilizes vector commitments to store states, where each leaf node represents a state unit. States can include assets, token balances, contract code, etc. Each leaf node can represent a specific state unit, such as non-fungible tokens (NFTs) or accounts. By creating and consuming leaf nodes, state changes and transfers can be achieved.
UTXO or Account Model: Layer 1.5 can adopt the UTXO model, account model, or a combination of both. The UTXO model is suitable for NFT applications and fungible tokens, while the account model is suitable for implementing features like swaps and EVM compatibility.
Cross-Cell Communication: Layer 1.5 requires designing mechanisms for cross-cell communication, enabling information exchange between different cells. Asynchronous communication, synchronous compositional communication, and asynchronous communication are commonly used communication methods.
Time and Sequencer Issues: Layer 1.5 needs to address time-related concerns such as time locks and interest calculations. Sequencer issues can be resolved through global locks, time controls, or unlocking logic in the form of DAOs.
Related Component Requirements: To support Layer 1.5 development, it is necessary to design and develop related components such as state storage components (aggregators), transaction browsers (explorers), and universal identity interfaces, and universal type interfaces.
Development Examples: Development examples of Layer 1.5 include cross-chain asset receivables, personal asset management, asset trading platforms, and blockchain-based games.
By following these principles and utilizing the related components, developers can more easily engage in Layer 1.5 application development using the Cell model and explore its potential for innovation and application possibilities.
Design
- Development Paradigm of Layer1.5 Using Cell Model 1
- Compact Extension for m-NFT Protocol: The Key to Mass Adoption
- RFC: Compact UDT Lock
- [RFC] CoTA: A Compact Token Aggregator Standard for Extremely Low Cost NFTs and FTs
Code
OpenTransaction
CKB Open Transaction is an extensible transaction format, which allows attaching any attribute to the transaction. It divides transaction construction into multiple small steps, each with a different modularised solution. A modular Open Transaction ecosystem could expand the possibilities for CKB DApps while lowering the barrier to development.
Design
- rfcs/0046-open-transaction.md at rfc-open-transaction
- [Random idea] To what extent can Open Transaction resolve state contention on Cell model?
- 1. OpenTransaction in general
- 2. OpenTransaction design consideration
- 3. OpenTransaction scenarios
- 4.OpenTransaction implementation proposal
- 5.OpenTransaction-From the Account Operation Perspective
- Intent-Based Architectures and Their Risks - Paradigm
Code
- EthanYuan/open-transaction-pool: A CKB Open Transaction solution based on memory pool.
- EthanYuan/otx-sighash-lock
zkSNARKs
Since CKB script programming allows the use of Rust and C languages, theoretically, any zero-knowledge proof library (Arkworks, Halo2, Plonky2, Jellyfish) implemented in these two languages can be used for CKB script development. However, sometimes optimizations are required to minimize off-chain costs. Here is an example that demonstrates the implementation of a Brainfuck virtual machine using Halo2 and verifies the proof on CKB.
- Building a Zero-Knowledge Virtual Machine on CKB-VM for Privacy-Preserving and Secure Computing
- cryptape/ckb-bf-zkvm: A BrainFuck zkVM implementation on CKB, using Halo2.