Nervos CKB in a Nutshell

Matt Quinn
Nervos Network
Published in
5 min readApr 17, 2019

The Nervos Common Knowledge Base (CKB) is a preservation focused, “Store of Assets” public permissionless blockchain and the base layer of the Nervos network.

In a blockchain context, “common knowledge” refers to states verified by global consensus and CKB is designed to be a state verification system. This post aims to help readers understand how it is different from existing public permissionless blockchains such as Bitcoin and Ethereum.

Nervos CKB generalizes Bitcoin’s UTXO model to support user-defined tokens and smart contracts. It is designed to be adaptable, sustainable, and flexible.

CKB adapts to network conditions with a PoW algorithm that adjusts based on the bandwidth of participating nodes.

It achieves sustainability through its novel token economics model, focused on providing a long-term store-of-value. An adaptable PoW algorithm also improves the sustainability of CKB, automatically scaling up with bandwidth improvements.

The combination of CKB’s generalized cell model and RISC-V instruction set introduces maximum flexibility: cells can store executable code and reference other cells as dependencies, allowing new algorithms to be easily deployed and integrated into CKB without hard forks.

CKB cells store primitives that have previously been built into custom VMs. By keeping the VM as simple as possible and offloading program storage to cells, updating key algorithms (e.g., Secp256k1) is as simple as loading the algorithm into a new cell and updating references.

Programming Model: Generalized UTXO + RISC-V based VM
Nervos is a smart contract platform like Ethereum, however, Nervos CKB has been designed to be a state verification and storage system instead of a computation platform. The Layer 1 blockchain verifies and stores states, while the computation-intensive state generation happens on Layer 2.

Nervos programming is based on the Cell model, inspired by Bitcoin’s UTXO model. Cells contain arbitrary data, which could be state, (such as user-defined token ownership) or business logic (such as code that verifies the integrity of a token transfer). Cells are also immutable: once they have been created, they cannot be changed.

In CKB, Cells are first class citizens. Cells serve as both the inputs and outputs of transactions and are the elements that comprise the global state of CKB.

Since cells can both reference data in other cells and store data of their own, the state and business logic of an asset are separated. For example, the creator of a new token would deploy the business logic of the token (e.g., how many tokens exist, whether new ones can be created, etc.) within one cell, and then users would control cells containing ownership and amount data. The users’ cells would reference the business logic cell, which would contain a script that verifies new cell validity.

The owners of user defined tokens (UDT) are truly owners: only they can utilize the cells that store their token data. In CKB, stateful programs do not aggregate state in a central place (such as seen in Ethereum smart contracts). Users own their cells, allowing straightforward state rent and mitigating the tragedy of the commons.

Clear dependencies allow nodes to process transactions in parallel.

Blockchain Evolution: The Common Knowledge Base
Looking at previous public blockchains, we have observed one fundamental challenge: once they are built, they are more or less fixed.

While they will be upgraded over time, their structure will generally remain the same. To see the challenge this brings, we can look at how difficult it has been to bring Segwit to Bitcoin or Wasm to Ethereum.

CKB takes a step back. Scripts are far more primitive than smart contracts in Ethereum, but carry a significant benefit: flexibility. Almost all algorithms and data structures are implemented in CKB scripts stored within cells.

On CKB, if you are not satisfied with fundamental functionality, such as a signature algorithm or hash function, just roll up your sleeves and build what you need.

‘Nervos’ is derived from the word ‘nerve’, and ‘cells’ are specialized units that work together. Just as we see in the biological world, CKB cells can be specialized to process information, convey messages or simply store knowledge.

Nervos CKB is an organic construction, rather than a work of traditional engineering. It allows the network to evolve at its lowest level, taking advantage of properties Charles Darwin observed over a century ago:

“the species that survives is the one that is able to adapt to and to adjust best to the changing environment”


Virtual Machine
CKB VM is a RISC-V based virtual machine for executing smart contracts on Nervos CKB, written in Rust. Utilizing the RISC-V instruction set allows for scripts to be written in a wide variety of programming languages. Check out the CKB VM paper for more details.

Consensus
Nervos uses a proof of work-based, adaptive Nakamoto Consensus. Check out the post on Nervos Consensus for more details.

Token-economics
The native token CKB is designed to represent rights to occupy state storage over time. The protocol constrains state storage growth through monetary policy and collects state rent through a “targeted inflation” scheme from state users. Check out the token-economic paper for more details.

Project
The co-founders of Nervos are Jan Xie, Terry Tai, Kevin Wang, Daniel Lv and Cipher Wang with a team of core developers and researchers. Past projects by the team include Ethereum clients (ruby-ethereum and pyethereum), Spark Pool (2nd largest Ethereum mining pool), imToken (an Ethereum wallet with 7 million users) and CITA (a permissioned blockchain used by a number of high profile financial institutions in China).

The team began engineering Nervos in January 2018 and raised 28 million USD in pre-sale from investors including Sequoia and Polychain. Currently the team is preparing a testnet launch in Q2 2019 and mainnet launch in Q4 2019.

Resources:
Whitepaper

Keeping up with Nervos:
Blog
Forum
Twitter
Github
Reddit
Youtube

👏Thanks to Xuejie Xiao, Wilfred Tannr Allard, Jane Wu and Toya B for suggestions and review of the article. 👏

--

--