This is a barebones install. It does not lock down SSH for key access only or configure the firewall.
This is on ubuntu 18.04
This part is for KVM VPS using make-vps from my repo Using my make-vps repository, clone an existing VPS template, start it and log in
VPSNAME=nntestnet2019 make clone18
virsh start nntestnet2019
virsh net-dhcp-leases default
ssh ip
sudo apt-get -y update
sudo apt-get -y upgrade
change it's ip address if required
sudo vi /etc/netplan/50-cloud-init.yaml
sudo netplan apply
relogin with ssh to new ip install kmd dependencies from cakeshop's komodo-in-a-box turnkey blockchain installer
sudo apt-get install python3 python3-dev python3-pip \
netcat-openbsd wget curl git sudo coreutils bc \
haveged pollinate unzip software-properties-common \
unattended-upgrades cron ntp fail2ban rsyslog \
build-essential pkg-config git libc6-dev m4 \
g++-multilib autoconf libtool ncurses-dev unzip \
python zlib1g-dev wget bsdmainutils automake \
libssl-dev libprotobuf-dev protobuf-compiler \
libqrencode-dev ntp ntpdate jq \
software-properties-common curl \
libcurl4-openssl-dev cmake clang libevent-dev \
libboost-all-dev build-essential pkg-config \
libc6-dev m4 g++-multilib autoconf libtool \
ncurses-dev unzip git python python-zmq \
zlib1g-dev wget libcurl4-openssl-dev bsdmainutils \
automake curl python3 python3-requests libsodium-dev \
screen tmux dnsutils traceroute whois htop
The nanomsg is a pre-requisite for many bitcoin based blockchains
echo "Installing nanomsg..."
cd ~
git clone https://github.com/nanomsg/nanomsg
cd nanomsg
mkdir build
cd build
cmake .. -DNN_TESTS=OFF -DNN_ENABLE_DOC=OFF
cmake --build .
sudo cmake --build . --target install
sudo ldconfig
now's the time to check if you have enough memory, 4GB phys and 2G+ swap, better to have 4 to match your phys
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Install komodo
git clone https://github.com/komodoplatform/komodo.git
cd komodo
git checkout dev
./zcutil/fetch-params.sh
./zcutil/build.sh -j$(nproc)
the above command -j$(nproc) is equivalent to -jnproc
fyi.
if your system doesn't have enough memory it will fail to compile, load some more swap
make a config file for komodo
touch komodo.conf
rpcuser=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
rpcpassword=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
echo "rpcuser=$rpcuser" > komodo.conf
echo "rpcpassword=$rpcpassword" >> komodo.conf
echo "daemon=1" >> komodo.conf
echo "server=1" >> komodo.conf
echo "txindex=1" >> komodo.conf
echo "rpcbind=127.0.0.1" >>bitcoin.conf
chmod 0600 komodo.conf
start syncing komodo
cd ~/komodo/src
./komodod &
bitcoin is not necessary (totally optional) for testnet but install it anyway for practise syncing requires 200GB of space, save your $$ if your testnet server is not readily equipped
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin/
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c
git branch -r
git tags
git tag
git checkout v0.16.3
ls
tar -xvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
mkdir -p build
BDB_PREFIX=$(pwd)/build
../dist/configure --disable-shared --enable-cxx --with-pic --prefix=$BDB_PREFIX
make install
cd ../..
./autogen.sh
./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/"
make -j$(nproc)
make a config file for bitcoin
mkdir .bitcoin
cd .bitcoin
touch bitcoin.conf
rpcuser=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
rpcpassword=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)
echo "rpcuser=$rpcuser" > komodo.conf
echo "rpcpassword=$rpcpassword" >> komodo.conf
echo "server=1" >bitcoin.conf
echo "daemon=1" >>bitcoin.conf
echo "txindex=1" >>bitcoin.conf
echo "bind=127.0.0.1" >>bitcoin.conf
echo "rpcbind=127.0.0.1" >>bitcoin.conf
chmod 0600 bitcoin.conf
start bitcoin in regtest mode just for wallet creation
~/bitcoin/src/bitcoind -regtest
check it
~/bitcoin/src/bitcoin-cli -regtest getblockchaininfo
install iguana, the dPoW process
cd ~
git clone https://github.com/jl777/SuperNET
cd SuperNET/iguana
git checkout dev
# and start it for the first time
# you can do it without reading this hint
# or you can open a virtual sesion in
# tmux or screen.
./m_LP
in another terminal (ssh in again or use tmux/screen)
~/SuperNET/agents/iguana
add two coins to iguana
~/SuperNET/iguana/coins/basilisk.old
encrypt wallet with a passphrase
$ curl --silent --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"encryptwallet\",\"passphrase\":\"XXXXXXXXXXXXXXXXXXXX\"}" | jq '.'
{
"pubkey": "12a4ed867a26e1bb121XXXXXXXXXXXXXXXXXXXXeea359a75d5ce6e1c",
"RS": "NXT-XXXX-XXXX-APTZ-XXXXX",
"NXT": "XXXXXXXXXXXXXXXXXXXX",
"btcpubkey": "02XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX10e3b707ddd21c7b9",
"rmd160": "371XXXXXXXXXXXXXXXXXXXX3ffe24",
"BTCD": "REJXXXXXXXXXXXXXXXXXXXXZcPGZYw",
"BTC": "162TfXXXXXXXXXXXXXXXXXXXXuc3reK",
"result": "success",
"handle": "",
"persistent": "12a4eXXXXXXXXXXXXXXXXXXXX6c04ceea359a75d5ce6e1c",
"status": "unlocked",
"duration": 3600,
"privkey": "d04XXXXXXXXXXXXXXXXXXXX5cfXXXXXXXXXXXXXXXXXXXX7f7f752",
"BTCDwif": "UXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXauGJ9",
"BTCwif": "L4CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXozQ4K7f",
"tag": "3824919021912066313"
}
For this passphrase
- BTCDwif is the KMD wif. KMD's lead developer was a community developer on the BTCD chain
- BTCwif is the BTC wif
- btcpubkey is your pubkey
- BTCD is your KMD address
- BTC is your BTC address
create a wallet unlocking script
vi ~/SuperNET/iguana/wp
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"walletpassphrase\",\"params\":[\"XXXXXXXXXXXXXXXXXXXX\", 9999999]}"
#check it is the same values as before
chmod +x wp
./wp
copy it to wp_7776 and change the port number
cp ~/SuperNET/iguana/wp ~/SuperNET/iguana/wp_7776
vi ~/SuperNET/iguana/wp_7776
you can ctrl c ^c iguana now
^c
at this stage, you've got everything you need for the rest of the season. now it's time to setup the machine for the season
helper for iguana to know it's homedir
vi ~/SuperNET/iguana/userhome/txt
home/me
helper for iguana to get the node pubkey
vi ~/SuperNET/iguana/pubkey.txt
pubkey=02XXXXXXXXX
or
pubkey=03XXXXXXXXX
import wif to daemons, KMD uses BTCD wif
cd ~
cd komodo
./src/komodo-cli importprivkey BTCDwif
check to see it imported kmd (btcd) address correctly
./src/komodo-cli validateaddress kmdaddress/btcdaddress
become root
sudo su -
because there are lots of open files/sockets etc. for this program, increase ulimit on system permanently
ulimit -a # see all the kernel parameters
ulimit -n # see the number of open files
ulimit -n 1000000 # set the number open files to 1000000
vi /etc/security/limits.conf
soft nofile 1000000
hard nofile 1000000
vi /etc/pam.d/common-session
session required pam_limits.so
sudo apt-get install ufw
sudo ufw disable
sudo ufw default deny incoming
sudo ufw allow 22 # SSH port
sudo ufw allow 7770 # KMD port
sudo ufw allow 777X # Iguana port
...
sudo ufw allow assetchain p2p
...
sudo ufw enable
check the status again
sudo ufw status