Talk is cheap. Show me the tools.

CKB Weekly #9

Lina

Hello, welcome to issue #9 of the CKB Weekly, a newsletter about the Nervos Common Knowledge Base blockchain and related technology. 

Someone once told me hey the project seems cool but it’s painful to develop on the half-baked CKB with premature toolings.

Today we are glad to see three new dev tools and new document site came out for rescue :)

Sparkling [Tools]

Boost your productivity in building CKB dApps as well as inspire new directions only possible with Nervos CKB.

Polyjuice

Nervos CKB is built on the cell model, which is a generalized version of the UTXO model. There seems to be a belief in the blockchain world that the UTXO model is hard to program on, while the account model is easier for developers. 

Polyjuice is an Ethereum compatible layer on top of Nervos CKB. Ethereum, up to this day, is probably the most used and flexible account model based blockchain. With Polyjuice, it is perfectly possible to use the account model on Nervos CKB. The flexibility here actually enables countless opportunities.

What’s more interesting, Polyjuice, as the name [Polyjuice Portion] indicates, is not an account layer that is tailored just to Ethereum; with the extracted core account layer , devs are free to integrate any account layer, e.g. Libra’s exact programming model might also be ported over to CKB, enabling a very fruitful ecosystem.

Lumos

Lumos is a full featured JavaScript/TypeScript based dapp framework aiming to simplify the process of building apps on CKB . The name [Lumos Maxima] explains what it is about: the wonderland of CKB, though vast and fertile, still remains dark in most of the parts, Lumos tries to shed light upon the land, guiding people into this beautiful new world.

As of now, Lumos contains the following components:

  • indexer: a CKB cell indexer that fulfills Index-Query-Assemble pattern. For now, this package only contains RocksDB backed indexer. A separate package contains SQL backed indexer using the same interface. Later, we might merge the 2 packages into one for consistency.

  • base: a base package containing common types and utilities that are used by most packages. If there is a CKB specific task you need to perform, you might want to look here first. Chances are they are already provided.

  • helpers: a helper package containing more utilities. The difference between helpers and base, is that base contains pure stateless functions, while helpers works in a more intrinsic way: it requires config-manager mentioned below to be setup.

  • common-scripts: integrations for known scripts on CKB. While we try our best to provide integrations for popular CKB scripts, people might be working on innovations everyday. As a result, we are also designing a set of APIs, so developers can freely integrate their own scripts into Lumos for everyone to use. Once integrated, common-scripts should be able to leverage those new scripts as well.

  • config-manager: a manager for dealing with differences between different chains, such as mainnet, testnet, or numerous dev chains. We abstract each chain into individual config file. Once loaded, config manager will be able to handle the chain specific logic, so you don't have to deal with this in your own code.

  • transaction-manager: a transaction manager for CKB. One problem with UTXO based blockchains, is that a certain amount of gap period exists between a transaction is accepted by a blockchain, and when it is actually committed on chain. During this gap, new cells created by the pending transaction will not be available. Transaction manager package takes care of this. It wraps an indexer instance, and makes sure cells created in pending transactions, are also exposed and available for assembling new transactions. This means you are no longer bounded to one transaction at a time, you can freely send series of transactions as you wish.

Capsule

Capsule is a development framework for creating smart contract scripts in Rust for CKB. Rust is a language designed to empower everyone to build reliable and efficient software. The battle-tested type system and ownership model, healthy community inventing new things every day, together with the wide usage across the blockchain industry, all make Rust a perfect general-purpose language for building scripts on CKB. Capsule wraps around Rust tooling and provides a seamless experience for building Rust based scripts for Nervos CKB.

Capsule aims to steward the full lifecycle of a CKB script. It helps you develop, build, test, debug, and also deploy the script. Just like what the name [Hoi-Poi Capsules] hints at, Capsule packs a very big universe in an extremely small form factor. We do envision a world where Capsule is all one needs to go from zero to a running and successful script on CKB mainnet.

Capsule provides the following functionality:

  • Scaffolding for new projects.

  • Building of RISC-V binaries for CKB-VM.

  • Local execution of smart contract scripts via Docker.

  • Automated testing of smart contract scripts.

  • Configurable deployment of scripts to CKB.

  • Generation of simulated transaction data for debugging.

For more details, check out Introducing Capsule, Lumos, and Polyjuice - 3 new tools to help developers maximize the power of Nervos.

Essays

Technical Updates

Core

  • CKB

    • (#2140) shrink state map, cause rust hash table capacity does not shrink automatically, we need explicit call shrink for predictable limit memory usage

    • (#2136) add RPC `clear_tx_pool`

    • (#2138) bump bytes from 0.5.4 to 0.5.5

If you are curious about why a design in CKB is what it is now, please post your questions in this repository.

  • Dev Tools

  • Neuron

    • (#1711) Indexer refactor

      • Refactored the indexing process using the lumos indexer with a caching mechanism

      • Made it capable of querying live cells on-demand without caching the live cells on-chain and deprecated the live cells table for storage

      • Fixed async error in tests originated from the leveldb related operations by mocking up XHR requests

      • Fixed a bug in the asset account feature in which the newly created UDT account might not be shown up.

      • Enable asset account feature for dev chain as well

    • (#1743) Add notification of rebuild cache

      • Neuron has adopted a brand new index mechanism, which demands a rebuilding of cache database (estimated 30 ~ 60 min)

  • CKB Explorer

    • Released version v0.9.8

      • (#645) dao contract transactions api can find normal tx

      • (#646) dao contract transaction bug

      • (#649) update udt accounts bug

      • (#665) fix lock script nil on null address

      • (#652) add more info to sudt

      • (#662) perf block index api

      • (#658) reduce RPC call on cellbase

Layer 2

  • Muta [layer2 framework on CKB]

    • (#321) upgrade rust toolchain version

    • (#316) indenpendent tx hook states commit

    • (#320) add authorization service for mempool

  • SECBIT Labs [Zero knowledge proof toolkit for CKB]

Ecosystem