Bananode

From Banano wiki


Docker[edit | edit source | hide | hide all]

Building the Bananode Docker image[edit | edit source | hide]

Install Docker[edit | edit source | hide]

The docker-ce distribution is recommended. Test with your install with docker run hello-world.

Obtain Image[edit | edit source | hide]

Either:

a) Pull the built image from the Docker Hub Registry

docker run -d -p 7072:7072 -v ~:/root bananocoin/banano.

or

b) Building the image from source.

The following commands should build a banano docker image from source:

git clone https://github.com/BananoCoin/banano
cd banano/docker
node/build.sh live   # choose a network - live, beta or test
Run the image[edit | edit source | hide]

Banano uses distinct ports from Nano, and RPC is enabled by default.

docker run -d -p 7072:7072 -v ~:/root bananocoin/banano

where:

a) -p is proxying localhost tcp/7072 to tcp/7072 on the container.

b) -v is mounting your home directory as /root/ on the container.

After a few seconds, test the node with the following two commands:

curl -d '{"action": "version"}' localhost:7072

curl -d '{"action": "block_count"}' localhost:7072

And check if peer count has went up on the official monitor.

4) Logs[edit | edit source | hide]

The bananode process rolls logs, and they are not piped to the containers stdout. This means they are not available to view via docker log. To examine the nodes logs e.g.

$ docker ps
CONTAINER ID        IMAGE                   COMMAND                 CREATED             STATUS              PORTS                    NAMES
5368f4c7fe63        bananocoin/banano:v18   "/bin/bash /entry.sh"   44 minutes ago      Up 44 minutes       0.0.0.0:7072->7072/tcp   elated_jennings
$ docker exec -it 5368f4c7fe63 bash
root@5368f4c7fe63:/# cd /root/BananoData/log/
root@5368f4c7fe63:~/BananoData/log# ll
total 56
drwx------ 2 root root  4096 Mar 22 20:33 ./
drwx------ 3 root root  4096 Mar 22 20:20 ../
-rw------- 1 root root  9715 Mar 22 20:32 log_2019-03-22_20-20-29.0.log
-rw------- 1 root root 31711 Mar 22 21:18 log_2019-03-22_20-33-50.1.log
root@5368f4c7fe63:~/BananoData/log#


Running a Docker Bananode[edit | edit source | hide]

Install docker[edit | edit source | hide]

The easiest way to run a node is by using docker images. First install docker-ce.

Running the Bananode image.[edit | edit source | hide]

Once docker is installed for your platform (check via docker run hello-world), to run a bananode, simply run:

docker run --restart=unless-stopped -d \
  -p 7071:7071 \
  -p [::1]:7072:7072 \
  -p [::1]:7074:7074 \
  -v ~:/root \
  bananocoin/banano
7071 -> TCP port
7072 -> RPC port
7074 -> Websocket port

You can then check your node as would normally, e.g. using curl.

Stopping the bananode[edit | edit source | hide]

Run docker ps to list running containers. Use the CONTAINER_ID to shut down the bananode, e.g.

sudo docker stop 19d845535dc1

Example[edit | edit source | hide]
$ docker run --restart=unless-stopped -d -p 7071:7071 -p [::1]:7072:7072 -p [::1]:7074:7074 -v ~:/root bananocoin/banano
Unable to find image 'bananocoin/banano:latest' locally
latest: Pulling from bananocoin/banano
22dc81ace0ea: Pull complete
1a8b3c87dba3: Pull complete
91390a1c435a: Pull complete
07844b14977e: Pull complete
b78396653dae: Pull complete
9a359b47c2fa: Pull complete
082ef437d263: Pull complete
b808a9115179: Pull complete
34e529540e96: Pull complete
Digest: sha256:d713883a740222d6a5e5c473f34b474c985670768c5a7004c99573e6659d9475
Status: Downloaded newer image for bananocoin/banano:latest
19d845535dc1c3e9b4af0e69d46691e9c95340ed7afc86bb3d6531b102dca474
$


Building a Bananode from sources[edit | edit source | hide]

Ubuntu 16.04, 18.04, and 20.04, Debian 8, 9, 10, and 11[edit | edit source | hide]

Recommended Hardware[edit | edit source | hide]
  • Run the node in a datacenter. Most SSD VPS packages will work. (DigitalOcean, Vultr, Hetzner, OVH, etc.)
  • 1 modern CPU core minimum. 2 or more is recommended especially for voting nodes and principal nodes.
  • 10GB Free disk space (Blockchain database is ~5.2GB in size at the moment)
  • 2 GB system RAM or more. 4 GB or more is recommended especially for voting nodes and principal nodes
Installing dependencies[edit | edit source | hide]
sudo apt-get update && sudo apt-get upgrade   
sudo apt-get install -y git cmake make g++ curl wget python-dev
Cloning the Bananode's git repository[edit | edit source | hide]
git clone --recursive https://github.com/BananoCoin/banano.git banano_build   
Installing precompiled Boost (Ubuntu 20.04, Debian 10, Debian 11)[edit | edit source | hide]

If your distribution includes boost 1.67 or newer (e.g. Ubuntu 20.04) you can skip the next section and simply run:

sudo apt install -y libboost-all-dev
Building static Boost (Ubuntu 16.04, Ubuntu 18.04, Debian 8, Debian 9)[edit | edit source | hide]

To automate this step, you can use sudo banano_build/util/build_prep/bootstrap_boost.sh --m (the optional m 'minimum' flag reduces compilation time but may break Boost for other use cases than building the bananode) which does essentially this:

wget https://netix.dl.sourceforge.net/project/boost/boost/1.69.0/boost_1_69_0.tar.gz   
tar xzvf boost_1_69_0.tar.gz   
cd boost_1_69_0   
./bootstrap.sh --with-libraries=filesystem,iostreams,log,program_options,thread   
./b2 --prefix=/usr/local/boost link=static install   
cd ..
Building bananode[edit | edit source | hide]
cd banano_build   

git submodule update --init --force --recursive

cmake -DBOOST_ROOT=/usr/local/boost/ -G "Unix Makefiles"   
make bananode   

Optional: You can also add custom cmake flags like -DACTIVE_NETWORK=nano_test_network if you want to run a private testnet.

To copy the binaries into the parent folder and see if they are working, you can use cp bananode ../bananode && cd .. && ./bananode --diagnostics This will also create the /root/BananoData folder that will contain all specific data. If you want to use a different folder, you can add a custom --data_path /root/BananoData parameter each time you run bananode.

To start the node daemon in the background, use nohup ./bananode --daemon &, but beforehand you might want to edit the config.json in BananoData/config.json to "rpc_enable": "true", in order to accept RPC calls. You can also change the default RPC port, and enable critical commands with "enable_control": "true", if you want to use the node's wallets. If you do this, make sure that you specify the host that is allowed to access the RPC interface in the "address" field. Use IPv6 notation for this (e.g. ::1 for localhost, or ::ffff:115.35.63.22 for a remote host), to avoid problems.

RPC commands are explained in NANO's wiki. Only use the 'raw' unit when sending commands to the Bananode. Detailed implementation guides will be released shortly.

If a build fails, delete these temporary files before you try again

rm -rf CmakeCache.txt
rm -rf CMakeFiles
CentOS 7[edit | edit source | hide]

You need to install a custom repository or this will fail with c++: error: unrecognized command line option ‘-std=c++14’

sudo yum -y check-update   
sudo yum -y install git curl wget bzip2 python-devel cmake

sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-7
scl enable devtoolset-7 bash

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y cryptopp cryptopp-devel

Tools that are included in the above package: gcc gcc-c++ libstdc++-static make

Compiling on low-end VPS[edit | edit source | hide]

You'll need either 2GB Ram for a successful compile, or a generous swap file:

sudo fallocate -l 2G /swapfile

sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile
Check block count[edit | edit source | hide]

./bananode --debug_block_count

OSX[edit | edit source | hide]
git clone https://github.com/BananoCoin/banano.git
cd banano
sh ci/bootstrap_boost.sh
git submodule update --init --recursive
cmake -DBOOST_ROOT=/usr/local/boost/ -G "Unix Makefiles"
make
./bananode --daemon

To shorten boost build time, you can add --m after bootstrap_boost.sh, but you may break boost for other use cases then.

Data will be stored in ~/Library/Banano

External links[edit | edit source | hide]

Source

Ledger snapshot for bootrstapping nodes

Cookies help us deliver our services. By using our services, you agree to our use of cookies.