-
Notifications
You must be signed in to change notification settings - Fork 51
Building a Bananode from sources
NOTE: UBUNTU 20.10 currently does not have a version of boost that works with bananode. Please use UBUNTU 20.04 until UBUNTU 20.10 is patched.
- 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.
- 20GB Free disk space (Blockchain database is ~9GB in size at the moment)
- 2 GB system RAM or more. 4 GB or more is recommended especially for voting nodes and principal nodes
you can bootstrap off the rocksdb or leveldb files here: http://ledgerfiles.banano.cc/
sudo apt update;
sudo apt upgrade -y;
sudo apt-get install -y git cmake make g++ curl wget python-dev;
sudo apt install python3-pip;
sudo pip install cmake-format;
https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/
sudo fallocate -l 4G /swapfile;
sudo chmod 600 /swapfile;
sudo mkswap /swapfile;
sudo swapon /swapfile;
sudo nano /etc/fstab;
# add the below line to /etc/fstab
/swapfile swap swap defaults 0 0
If your distribution includes boost 1.67 or newer (e.g. Ubuntu 20.04) but not "1.74.0.3ubuntu6" (Ubuntu 21.10) you can skip the section "Building static Boost" and simply run:
sudo apt install -y libboost-all-dev
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.70.0/boost_1_70_0.tar.gz
tar xzvf boost_1_70_0.tar.gz
cd boost_1_70_0
./bootstrap.sh --with-libraries=system,thread,log,filesystem,program_options,coroutine,context
./b2 --prefix=/usr/local/boost link=static install
cd ..
git clone --recursive https://github.com/BananoCoin/banano.git banano_build
git clone --branch v25.1 --recursive https://github.com/BananoCoin/banano.git banano_build
git clone --branch v26.1 --recursive https://github.com/BananoCoin/banano.git banano_build
cd banano_build
git submodule update --init --force --recursive
cmake -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.
# in debug mode
cd banano_build
git submodule update --init --force --recursive
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -DNANO_STACKTRACE_BACKTRACE=ON -DNANO_TEST=ON -G "Unix Makefiles"
make bananode core_test rpc_test load_test slow_test
# cycle core tests
reset;git pull;make bananode core_test;./core_test
##run in debug mode
apt install gdb
gdb
(gdb) file ./bananode
(gdb) run --daemon
instructions based on nanocurrency's instructions: https://docs.nano.org/integration-guides/build-options/#node_1
## copy the node executable into the parent directory
cp bananode ../bananode;
cd ..;
## check if the freshly compiled executable executes
./bananode --diagnostics;
## generate default config files with all available options. You can then customize the config files, for example to activate RPC or activate voting.
mkdir BananoData;
./bananode --generate_config node > /root/BananoData/config-node.toml
./bananode --generate_config rpc > /root/BananoData/config-rpc.toml
cp ./banano_build/docker/node/config/config-* BananoData;
## you can delete the banano_build directory now, if you want
vi BananoData/config-node.toml
[node]
# throttle bandwidth (recommended unless on a large vps)
# bandwidth_limit = 1
# only allow one person to bootstrap from you at a time (recommended unless on a large vps or a principle rep)
# bootstrap_connections_max = 1
# don't allow burst mode (recommended unless on a large vps or a principle rep)
# bandwidth_limit_burst_ratio = 1.0
[node.rocksdb]
enable = true
[node.websocket]
# WebSocket server bind address.
# type:string,ip
address = "::ffff:0.0.0.0"
# Enable or disable WebSocket server. disable unless you need it.
# type:bool
enable = false
[rpc]
# Enable or disable RPC.
# enable to allow debugging of bootstrapping. disable if not needed after bootstrapping.
# type:bool
enable = true
# start the node in the background
screen -dmSL bananode ./bananode --daemon;
# check that it has peers (firewall may prevent peers)
curl -g -d '{"action": "peers"}' 'localhost:7072';
# check local block count (RPC)
curl -g -d '{"action": "block_count"}' 'localhost:7072';
# check local block count (CLI)
./bananode --debug_block_count;
# check kalium block count (RPC)
curl -g -d '{"action": "block_count"}' 'https://kaliumapi.appditto.com/api';
# check how many accounts are still being processed.
cat BananoData/log/* | grep -e 'accounts in pull queue' | tail -n 2
if you want to enable rocksdb follow these instructions: https://docs.nano.org/running-a-node/ledger-management/#enable-rocksdb
The default bandwidth limit is 10 MB/s.
if this is too high, try a few things:
vi BananoData/config-node.toml
[node.websocket]
enable = false
[rpc]
enable = false
Default bandwidth limit is 10 MB/s, which is 10.
To set it to 1 MB/s, use 1
[node]
bandwidth_limit = 1
bootstrap_connections_max = 1
bandwidth_limit_burst_ratio = 1.0
RPC commands are explained in NANO's wiki. Only use the 'raw' unit when sending commands to the Bananode.
If a build fails, delete these temporary files before you try again
rm -rf CmakeCache.txt
rm -rf CMakeFiles
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
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
./bananode --debug_block_count
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
- If you plan to use your node as a representative in Banano network voting consensus, you must create a wallet within your node so that you can share it with your friends / family / community so that they can delegate their voting weight to your node and thus contribute with network decentralization. In order to this, you need to follow the next steps:
- If
./bananode --debug_block_count
command output is fine you will receive the current block state and it will be ready to go; - Do a RPC call with
curl -d '{ "action" : "wallet_create" }' [::1]:7072
to generate your wallet's seed. Take on consideration about ipv6 usage. If your node is running over ipv4 usecurl -d '{ "action" : "wallet_create" }' 127.0.0.1:7072
instead.7072
is Banano node port and you need to keep it free for sharing information with another pairs; - After done, you must have your seed and it will look like this
82E20E9E4FC8957A223E05E8325FD39BB6EA81A2D8DB40B3E79227BB6557BC1
, make sure you copy it in a safe place (use a pen or an offline environment for this). Generate a new account for your seed sending this RPC commandcurl -d '{ "action": "account_create", "wallet": "82E20E9E4FC8957A223E05E8325FD39BB6EA81A2D8DB40B3E79227BB6557BC1" }' 127.0.0.1:7072
and voilá! The output will be a ban_address that you will use to set your representative in all your seeds, friend or family ones.
https://github.com/NanoTools/nanoNodeMonitor
on ubuntu allow port 80
sudo ufw allow http
apt-get install ca-certificates apt-transport-https software-properties-common gnupg2 -y;
add-apt-repository ppa:ondrej/php;
apt-get install php8.0 -y;
apt-get install php8.0-common php8.0-curl php8.0-gd php8.0-mysql php8.0-xml php8.0-imagick php8.0-cli php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip php8.0-dev php8.0-imap -y;
apt-get install libapache2-mod-php8.0 -y;
apt autoremove -y;
systemctl restart apache2;
cd /var/www/html;
rm index.html;
git clone https://github.com/NanoTools/nanoNodeMonitor .;
cd modules/;
cp config.sample.php config.php;
nano config.php;
https://github.com/BananoCoin/banano/wiki/set-up-monit-for-monitoring