Nervos CKB Development Update #13

Ian Yang
Nervos Network
Published in
4 min readJun 26, 2019

Covering Jun 3 to Jun 23

This post is co-authored by Ian Yang, Xuejie Xiao, Qian Linfeng and James Chen. Because of development schedule change, we have deferred the report one week. Thus it reviews our work in the previous three weeks.

TL;DR

  • New RFC: RFC#0020, the consensus protocol.

CKB Highlights:

CKB VM Highlights:

  • New AOT execution mode!
  • Full RISC-V test suite integration.

Changes in RFC

@nirenzang has published the Consensus Protocol as RFC#0020.

Bitcoin’s Nakamoto Consensus (NC) is well-received due to its simplicity and low communication overhead. However, NC suffers from two kinds of drawback: first, its transaction processing throughput is far from satisfactory; second, it is vulnerable to a selfish mining attack, where attackers can gain more block rewards by deviating from the protocol’s prescribed behavior.

The CKB consensus protocol is a variant of NC that raises its performance limit and selfish mining resistance while keeping its merits. By identifying and eliminating the bottleneck in NC’s block propagation latency, our protocol supports very short block interval without sacrificing security. The shortened block interval not only raises the throughput, but also lowers the transaction confirmation latency. By incorporating all valid blocks in the difficulty adjustment, selfish mining is no longer profitable in our protocol.

Changes in CKB

CKB v0.14.0 has released, and v0.15.0 is ready.

Feature highlights in v0.15.0

Earliest transaction proposer get 40% of the transaction fee as a reward.

Block reward is deferred until the proposal window is closed.

We upgraded the default secp256k1 to use recoverable signature. See details in nervosnetwork/ckb-system-scripts#15

  • #910: Implement the alert system in CKB for urgent situation (@jjyr)
  • #1000: Allow miner add an arbitrary message into the cellbase (@driftluo)
  • #905: Add indexer related rpc (@quake)

See the release page for the full change list.

Changes in VM

This is a heavy week in CKB VM. First, we have Brian Anderson reviewing and helping enhancing CKB VM! Brian is kind enough to help us with 2 fixes:

  • #67 Replace custom power_of_2 function with std
  • #68 Replace uses of rounddown / roundup with round_page_down / round_page_up

There’re also 2 big announcements in CKB VM:

  • First, we have implemented the new AOT execution mode! This significantly bump the runtime performance of CKB VM on top of our already fast assembly interpreter. Our benchmark shows that a secp256k1 operation can finish in the new AOT mode in under 1 ms, while the current assembly interpreter needs 5 ms at best. This brings us to the same order of magnitude of native code.
  • We have integrated full RISC-V test suite into CKB VM, now each change we made is validated against the comprehensive test suites thanks to the awesome RISC-V community. We are very serious on ensuring the correctness of CKB VM.

The exact changes for this PR include:

  • #64 refactor: windows support adjustments
  • #69 feat: add flag denoting if PC should be updated when loading ELF
  • #70 Add coverage CI job containing full CKB VM test suite
  • #71 Eliminate as much usize as making sense from CKB VM
  • #72 feat: Add new AOT mode to replace experimental JIT mode
  • #74 feat: Do not trigger coverage jobs in PRs
  • #75 test: avoid make-cov run test two times @u2
  • #76 feat: Set codecov coverage target

Changes in P2P

  • #162: Refactor identify protocol
  • #163: Fix bug on protocol open command send by control
  • #164: Add open protocols interface (DialProtocol will deprecated on 0.3)
  • #168: Allow dns resolver on current thread runtime

Changes in Toolchains

SDKs

  • Released SDK v0.14.0
  • Added support for indexer RPC module
  • Implemented Secp256k1 recoverable sign

CKB testnet faucet

  • Removed lock-generation-tool
  • Updated to use SDK v0.14.0

CKB Explorer

  • Separated to two projects: front-end and server (back-end)
  • Applied many bug fixes and UI tweaks
  • Applied performance tweaks for both front end and back end
  • Enhanced block data syncing

Neuron Wallet

  • Implemented BIP39
  • Set up CI with Azure Pipelines
  • Moved transaction and chain data syncing module off main process to renderer (background) process
  • Added BIP32 public key derivation
  • Refactored keys module
  • Implemented basic layout as per design mockups
  • Implemented multiple inputs signing

Please connect with us on Github, CKB Dev telegram or the Nervos Forumif you have any questions, run into any issues or can help improve the documentation.

Keeping up with Nervos:
Forum
Twitter
Github
Reddit
Youtube

--

--