Nervos CKB - The Common Knowledge Base
Nervos CKB is the layer 1 of Nervos Network, a public blockchain with PoW and cell model.
Nervos project defines a suite of scalable and interoperable blockchain protocols. Nervos CKB uses those protocols to create a self-evolving distributed network with a novel economic model, data model and more.
Notice: The ckb process will send stack trace to sentry on Rust panics.
This is enabled by default before mainnet, which can be opted out by setting
the option dsn to empty in the config file.
Nervos CKB is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.
This project is still in development, and it's NOT in production-ready status. The board also lists some known issues that we are currently working on.
The master branch is regularly built and tested, however, it is not guaranteed to be completely stable; The develop branch is the work branch to merge new features, and it's not stable. The CHANGELOG is available in Releases and CHANGELOG.md in the master branch.
The contribution workflow is described in CONTRIBUTING.md, and security policy is described in SECURITY.md. To propose new protocol or standard for Nervos, see Nervos RFC.
CKB is currently tested mainly with stable-1.33.0 on Linux and Mac OSX.
We recommend installing Rust through rustup
# Get rustup from rustup.rs, then in your `ckb` folder:
rustup override set 1.33.0
rustup component add rustfmt
rustup component add clippyReport new breakage is welcome.
You also need to get the following packages:
- Ubuntu and Debian:
sudo apt-get install git gcc libc6-dev pkg-config libssl-dev libclang-dev clang- Arch Linux
sudo pacman -Sy git gcc pkgconf clang- macOS:
brew install autoconf libtool# get ckb source code
git clone https://github.com/nervosnetwork/ckb.git
cd ckb
# build in release mode
make buildYou can run the full test suite, or just run a specific package test:
# Run the full suite
cargo test --all
# Run a specific package test
cargo test -p ckb-chainCreate the default runtime directory:
cp -r nodes_template/ nodesUse the config file to start the node
target/release/ckb runIt searches config file ckb.toml, nodes/default.toml in the shell
working directory in that order. Alternatively, the argument -c can specify
the config file used to start the node.
The default config file saves data in nodes/default/.
Find RPC port in the log output, the following command assumes 8114 is used:
curl -d '{"id": 1, "jsonrpc": "2.0", "method":"get_tip_header","params": []}' \
-H 'content-type:application/json' 'http://localhost:8114'Run miner, gets a block template to mine.
target/release/ckb minerRun multiple nodes in different data directories.
Create the config file for new nodes, for example:
cp nodes/default.toml nodes/node2.tomlUpdate data_dir configuration in config file to a different directory.
data_dir = "node2"
Then start the new node using the new config file
target/release/ckb run -c nodes/node2.tomlThe option ckb.chain configures the chain spec. It accepts a path to the spec toml file. The directory nodes_template/spec has all the pre-defined specs. Please note that nodes with different chain specs may fail to connect with each other.
The chain spec can switch between different PoW engines. Wiki has the instructions about how to configure it.