Nebulas 101 - 01 Compile and Install Nebulas

The current version of Nebulas Mainnet is 2.0, which is called Nebulas Nova.

Nebulas Nova aims to discover the value of blockchain data, and it also means the future of collaboration.

Check our Youtube Introduction for more details.

You can download the Nebulas source code to compile the private chain locally.

To learn about Nebulas, please read the Nebulas Non-Technical White Paper.

To learn about the technology, please read the Nebulas Technical White Paper and the Nebulas github code.

At present, Nebulas can only run on Mac and Linux at this stage. The Windows version will be coming later.

Golang Environment

Nebulas is implemented in Golang and C++.

| Components | Description | | — | — | | Golang | The Go Programming Language, version >= 1.11 | | C++ | The C++ programming language, based on c++14 standard |


Homebrew is recommended for installing golang on Mac.

# install
brew install go

# environment variables
export GOPATH=/path/to/workspace
Note: GOPATH is a local golang working directory which could be decided by youself. After GOPATH is configured, your go projects need to be placed in GOPATH directory.


# download

# extract
tar -C /usr/local -xzf go1.11.linux-amd64.tar.gz

# environment variables
export PATH=$PATH:/usr/local/go/bin
export GOPATH=/path/to/workspace

Compile Nebulas


Clone source code with the following commands.

# enter workspace
mkdir -p $GOPATH/src/
cd $GOPATH/src/

# download
git clone

# enter repository
cd go-nebulas

# master branch is most stable
git checkout master

Build NBRE

NBRE is short for Nebulas Blockchain Runtime Environment, which is the platform that runs the core protocols and algorithms.

To build NBRE:

cd $GOPATH/src/

# build dependencies
# switch your shell to bash before running the script

# set up environment variables

# build NBRE
mkdir build
cd build & cmake -DRelease=1 ..

The preparation steps listed above may take some time to complete.

Install Go Dependencies

Go dependencies in Go-Nebulas are managed by Dep.

| Components | Version | Description | | — | — | — |

Dep | >= 0.3.1 | Dep is a dependency management tool for Go. |

Install Dep

  • Mac OSX

  • Install Dep via Homebrew

    brew install dep
    brew upgrade dep
  • Linux

  • Install dep

    cd /usr/local/bin/
    ln -s dep-linux-amd64 dep

Download Dependencies

Switch to the root directory of the project to download dependencies for Go-Nebulas:

cd $GOPATH/src/
make dep

make dep downloads lots of dependencies. It might take a long time to download for the first time. Some dependencies may fail to download. If you can not download, you can directly download the zipped dependency files generated by dep vendor.tar.gz and extract it to the nebulas root directory.

MD5: fd9bba20b5b8d8e347329bc32feb9d34

Build NEB

  • Set up runtime environment
cd $GOPATH/src/
  • Build NEB You can now build the executable for Nebulas:
cd $GOPATH/src/
make build

Once the building is complete,there will be an executable file neb generated under the root directory. ../../_images/101-01-make-build.pngmake build

Start NEB

Genesis Block

Before launching a new Nebulas chain, we have to define the configuration of genesis block.

Genesis Block Configuration

# Neb genesis text file. Scheme is defined in core/pb/genesis.proto.

meta {
    # Chain identity
  chain_id: 100

consensus {
    dpos {
    # Initial dynasty, including all initial miners
        dynasty: [
            [ miner address ],

# Pre-allocation of initial tokens
token_distribution [
        address: [ allocation address ]
        value: [ amount of allocation tokens ]

An example genesis.conf is located in conf/default/genesis.conf.


Before getting a neb node started, we have to define the configuration of this node.

Neb Node Configuration

# Neb configuration text file. Scheme is defined in neblet/pb/config.proto:Config.

# Network Configuration
network {
    # For the first node in a new Nebulas chain, `seed` is not need.
    # Otherwise, every node need some seed nodes to introduce it into the Nebulas chain.
    # seed: ["/ip4/"]

    # P2p network service host. support mutiple ip and ports.
    listen: [""]

    # The private key is used to generate a node ID. If you don't use the private key, the node will generate a new node ID.
    # private_key: "conf/network/id_ed25519"

# Chain Configuration
chain {
    # Network chain ID
    chain_id: 100

    # Database storage location
    datadir: "data.db"

    # Accounts' keystore files location
    keydir: "keydir"

    # The genesis block configuration
    genesis: "conf/default/genesis.conf"

    # Signature algorithm
    signature_ciphers: ["ECC_SECP256K1"]

    # Miner address
    miner: "n1SAQy3ix1pZj8MPzNeVqpAmu1nCVqb5w8c"

    # Coinbase address, all mining reward received by the above miner will be send to this address
    coinbase: "n1FF1nz6tarkDVwWQkMnnwFPuPKUaQTdptE"

    # The passphrase to miner's keystore file
    passphrase: "passphrase"

# API Configuration
rpc {
    # GRPC API port
    rpc_listen: [""]

    # HTTP API port
    http_listen: [""]

    # The module opened
    http_module: ["api", "admin"]

# Log Configuration
app {
    # Log level: [debug, info, warn, error, fatal]
    log_level: "info"

    # Log location
    log_file: "logs"

    # Open crash log
    enable_crash_report: false

# NBRE configurations
nbre {
    # The root directory of NBRE, where the NBRE libraries located
    root_dir: "nbre"

    # NBRE log folder path
    log_dir: "conf/nbre/logs"

    # NBRE db location
    data_dir: "conf/nbre/nbre.db"

    # NBRE binary location
    nbre_path: "nbre/bin/nbre"

    # Administrator address used to submit tx and authorize specific account
    # with the right of IR submission. For more details, please check the NBRE 
    # related documents.
    admin_address: "n1S9RrRPC46T9byYBS868YuZgzqGuiPCY1m"

    # Height when the DIP takes effect
    start_height: 2307000

    # NEB and NBRE inter-process communication socket
    ipc_listen: ""
    ipc_port: 8688

# Metrics Configuration
stats {
    # Open node metrics
    enable_metrics: false

    # Influxdb configuration
    influxdb: {
        host: "http://localhost:8086"
        db: "nebulas"
        user: "admin"
        password: "admin"

A lot of examples can be found in $GOPATH/src/

Run Nodes

The Nebulas chain you are running at this point is private and is different with official Testnet and Mainnet.

Start your first Nebulas node with the following commands.

cd $GOPATH/src/
./neb -c conf/default/config.conf

After starting, the following should be visible in the terminal: ../../_images/101-01-seed-node-start.pngseed node start

By default, the node using conf/default/config.conf won‘t mine new blocks. Start your first Nebulas mining node with another commands.

cd $GOPATH/src/
./neb -c conf/example/miner.conf

After the node starts, if the connection with the seed node is successful, you can see the following log (detailed log can be found in: logs/miner.1/neb.log): ../../_images/101-01-node-start.pngnode start

Note: You can start many nodes locally. Please make sure the ports in your node configurations won‘t conflict with each other.

Next step: Tutorial 2

Sending Transactions on Nebulas