Skip to content

Compile and install Contentbox

gtygo edited this page Jun 4, 2019 · 1 revision

Golang environmental construction

Components Version Description
Golang >=1.11 The Go Programming Language
RocksDB >=5.0.1 A high performance embedded database for key-value data.

We will introduce the construction of the golang environment under Mac OSX and Linux respectively.

Mac OSX

In mac, we recommend using homebrew to install the program.

# Go
brew install go

export GOPATH=/path/to/workspace

go get -u github.com/kardianos/govendor

# RocksDB
brew install rocksdb

GOPATH has developed our workspace, all source code should be placed under the GOPATH.

Linux

# Go
wget https://dl.google.com/go/go1.9.3.linux-amd64.tar.gz

tar -C /usr/local -xzf go1.9.3.linux-amd64.tar.gz

export PATH=$PATH:/usr/local/go/bin

export GOPATH=/path/to/workspace

# RocksDB
apt-get -y install build-essential libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
 
git clone https://github.com/facebook/rocksdb.git

cd rocksdb && make shared_lib && make install-shared

Compile contentbox

Download source

You can use the following instructions to directly download the latest version of the contentbox source code.

go get github.com/BOXFoundation/boxd

go mod vender

Compile

make

Running contentbox

Now you can start the private chain locally.We need to configure the settings of the node before starting. The location of the node configuration file is in boxd/.devconfig/.box-1.yaml

network: mainnet
workspace: .devconfig/ws1
database:
    name: rocksdb
log:
    out:
        name: stderr # stdout|stderr|null
    level: debug # debug|info|warning|error|fatal
    formatter:
        name: text # json|text
    hooks:
        - name: filewithformatter
          options:
              filename: box.log
              maxlines: 100000
              # daily: true
              # maxsize: 10240000
              rotate: true
              level:  4 # 0:panic, 1:fatal, 2:error, 3:warning, 4:info, 5:debug
p2p:
    key_path: peer.key
    port: 19199
    bucket_size: 16
    latency: 10
    conn_max_capacity: 200
    conn_load_factor: 0.8
    relay_size: 32
rpc:
    # Set the port number of rpc
    port: 19191
    http:
        port: 19190
    faucet_keyfile: ./keyfile/key1.keystore
dpos:
    keypath: key.keystore
    # Set whether it is a miner node
    enable_mint: true
    passphrase: 1
pprof: "0.0.0.0:8888"
metrics:
    enable: false
    host: http://localhost:8086
    db: box
    user: 
    password:
    tags: [region:us-west, host:box-1]
wallet:
    enable: true
    cache_size: 512
    utxo_cache_time: 10

After the configuration is complete, start this node.

./box start --config=./.devconfig/.box-1.yaml

At this point, the private chain is started, and it has nothing to do with the contentbox main network and the test network.

The following log output indicates that the startup was successful. avator

If we start the miner node, we will see the log output continuous outbound information. avator

Clone this wiki locally