Installation
Automatic Installation
source <(curl -s https://raw.githubusercontent.com/NodersUA/Scripts/main/babylon)
Manual Installation
Setting up a Bitcoin node
Install node
# Update the repositories
apt update && apt upgrade -y
# Download Bitcoin Core binary
mkdir bitcoin && cd bitcoin
wget https://bitcoincore.org/bin/bitcoin-core-26.0/bitcoin-26.0-x86_64-linux-gnu.tar.gz
# Extract the downloaded archive
tar -xvf bitcoin-26.0-x86_64-linux-gnu.tar.gz
cd bitcoin-26.0/bin
# Provide execution permissions to binaries
chmod +x bitcoind bitcoin-cli
sudo cp bitcoind bitcoin-cli /usr/local/bin/ && cd ~/
# Set the variables
# Come up with the name of your node and replace it instead <your_moniker>
MONIKER=<your_moniker>
BTC_STAKER_RPC_USER=<your_rpc_username>
BTC_STAKER_RPC_PASSWORD=<your_rpc_password>
echo 'export MONIKER='$MONIKER >> $HOME/.bash_profile
echo "export BTC_STAKER_RPC_USER=$BTC_STAKER_RPC_USER" >> $HOME/.bash_profile
echo "export BTC_STAKER_RPC_PASSWORD=$BTC_STAKER_RPC_PASSWORD" >> $HOME/.bash_profile
source $HOME/.bash_profile
# check whether the last command was executed
# Create the service file
sudo tee /etc/systemd/system/bitcoind.service >/dev/null <<EOF
[Unit]
Description=bitcoin signet node
After=network.target
[Service]
User=$USER
Type=simple
ExecStart=/usr/local/bin/bitcoind \
-deprecatedrpc=create_bdb \
-signet \
-server \
-txindex \
-rpcport=38332 \
-rpcuser=$BTC_STAKER_RPC_USER \
-rpcpassword=$BTC_STAKER_RPC_PASSWORD
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
# Start the service
sudo systemctl daemon-reload
sudo systemctl enable bitcoind
sudo systemctl start bitcoind
journalctl -u bitcoind -f -o cat
Create legacy wallet and generate address
~/bitcoin-26.0/bin/bitcoin-cli -signet \
-rpcuser=$BTC_STAKER_RPC_USER \
-rpcpassword=$BTC_STAKER_RPC_PASSWORD \
-rpcport=38332 \
-named createwallet \
wallet_name=btcstaker \
passphrase="<passphrase>" \
load_on_startup=true \
descriptors=false
bitcoin-cli -signet \
-rpcuser=$BTC_STAKER_RPC_USER \
-rpcpassword=$BTC_STAKER_RPC_PASSWORD \
-rpcport=38332 \
getnewaddress
# Check balance
bitcoin-cli -signet \
-rpcuser=$BTC_STAKER_RPC_USER \
-rpcpassword=$BTC_STAKER_RPC_PASSWORD \
-rpcport=38332 \
getwalletinfo
Setting up a Babilon node
# Install developer packages
apt install curl iptables build-essential git wget jq make gcc nano tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y
# Install Go
source <(curl -s https://raw.githubusercontent.com/NodersUA/Scripts/main/system/go)
# Set the variables
# Come up with the name of your node and replace it instead <your_moniker>
MONIKER=<your_moniker>
echo 'export MONIKER='$MONIKER >> $HOME/.bash_profile
echo "export BABYLON_CHAIN_ID=bbn-test-3" >> $HOME/.bash_profile
echo "export BABYLON_PORT=45" >> $HOME/.bash_profile
source $HOME/.bash_profile
# check whether the last command was executed
# Download binary files
cd $HOME
git clone https://github.com/babylonchain/babylon && cd babylon
git checkout v0.8.4
make install
sudo cp $(which babylond) /usr/local/bin/ && cd $HOME
babylond version --long | grep -e version -e commit
# v0.8.4
# Initialize the node
babylond init $MONIKER --chain-id $BABYLON_CHAIN_ID
# Download Genesis
wget https://github.com/babylonchain/networks/raw/main/bbn-test-3/genesis.tar.bz2
tar -xjf genesis.tar.bz2 && rm genesis.tar.bz2
mv genesis.json ~/.babylond/config/genesis.json
# Check Genesis
sha256sum $HOME/.babylond/config/genesis.json
# 0ac83f9ae547643635c592da44b5a6b09a35e1ef5f515267cf0141f1560e127d
# Set the ports
# config.toml
sed -i.bak -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:${BABYLON_PORT}658\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:${BABYLON_PORT}657\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:${BABYLON_PORT}061\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:${BABYLON_PORT}656\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":${BABYLON_PORT}660\"%" $HOME/.babylond/config/config.toml
# app.toml
sed -i.bak -e "s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:${BABYLON_PORT}90\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:${BABYLON_PORT}91\"%; s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:1${BABYLON_PORT}7\"%" $HOME/.babylond/config/app.toml
# client.toml
sed -i.bak -e "s%^node = \"tcp://localhost:26657\"%node = \"tcp://localhost:${BABYLON_PORT}657\"%" $HOME/.babylond/config/client.toml
external_address=$(curl -s https://checkip.amazonaws.com)
sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:${BABYLON_PORT}656\"/" $HOME/.babylond/config/config.toml
Setup config
# correct config (so we can no longer use the chain-id flag for every CLI command in client.toml)
# babylond config chain-id $BABYLON_CHAIN_ID
# adjust if necessary keyring-backend в client.toml
#babylond config keyring-backend test
# Set the minimum price for gas
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.00001ubbn\"/" ~/.babylond/config/app.toml
# Add seeds/peers в config.toml
peers=""
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$peers\"|" $HOME/.babylond/config/config.toml
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.babylond/config/config.toml
seeds="49b4685f16670e784a0fe78f37cd37d56c7aff0e@3.14.89.82:26656,9cb1974618ddd541c9a4f4562b842b96ffaf1446@3.16.63.237:26656"
sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.babylond/config/config.toml
# Set up filter for "bad" peers
sed -i -e "s/^filter_peers *=.*/filter_peers = \"true\"/" $HOME/.babylond/config/config.toml
# Set up pruning
#pruning="custom"
#pruning_keep_recent="1000"
#pruning_interval="50"
#sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.babylond/config/app.toml
#sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.babylond/config/app.toml
#sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.babylond/config/app.toml
sed -i -e "s/^network *=.*/network = \"signet\"/" $HOME/.babylond/config/app.toml
sed -i -e "s/^key-name *=.*/key-name = \"wallet\"/" ~/.babylond/config/app.toml
sed -i -e "s/^timeout_commit *=.*/timeout_commit = \"30s\"/" ~/.babylond/config/config.toml
(OPTIONAL) Turn off indexing in config.toml
#indexer="null" && \
#sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.babylond/config/config.toml
# Create service file (One command)
sudo tee /etc/systemd/system/babylond.service > /dev/null <<EOF
[Unit]
Description=Babylond Node
After=network.target
[Service]
Type=simple
User=$USER
WorkingDirectory=$HOME/go/bin
ExecStart=/usr/local/bin/babylond start
Restart=on-failure
StartLimitInterval=0
RestartSec=3
LimitNOFILE=65535
LimitMEMLOCK=209715200
[Install]
WantedBy=multi-user.target
EOF
# Start the node
systemctl daemon-reload
systemctl enable babylond
systemctl restart babylond && journalctl -u babylond -f -o cat
# Escape from logs ctrl+c
# Check the logs again
journalctl -u babylond -f -o cat
# Escape from logs ctrl+c
Now all ok, check the status
# Check status
curl localhost:${BABYLON_PORT}657/status
# "catching_up": false means that the node is synchronized, we are waiting for complete synchronization
Wallet
# Create wallet
babylond keys add wallet --keyring-backend test
The wallet has been created. In the last line there will be a phrase that must be written down
# If the wallet was already there, restore it
babylond keys add wallet --recover --keyring-backend test
# Insert the seed phrase from your wallet
# If everything is correct, you will see your wallet data
# Save the wallet address
BABYLON_ADDRESS=$(babylond keys show wallet -a --keyring-backend test)
BABYLON_VALOPER=$(babylond keys show wallet --bech val -a --keyring-backend test)
echo "export BABYLON_ADDRESS="${BABYLON_ADDRESS} >> $HOME/.bash_profile
echo "export BABYLON_VALOPER="${BABYLON_VALOPER} >> $HOME/.bash_profile
source $HOME/.bash_profile
babylond create-bls-key $BABYLON_ADDRESS
systemctl restart babylond && journalctl -u babylond -f -o cat
# Check the ballance
babylond query bank balances $BABYLON_ADDRESS
Validator
# Change <identity> to your key from keybase
babylond tx staking create-validator \
--amount 10000000ubbn \
--from=wallet \
--commission-rate "0.1" \
--commission-max-rate "0.20" \
--commission-max-change-rate "0.1" \
--min-self-delegation "1" \
--pubkey=$(babylond tendermint show-validator) \
--moniker=$MONIKER \
--chain-id=$BABYLON_CHAIN_ID \
--identity=<identity> \
--details="" \
--website="" \
--gas="auto" \
--gas-adjustment=1.2 \
--gas-prices="0.0025ubbn" \
-y
Or by command
babylond query staking validators --limit 1000000 -o json | jq '.validators[] | select(.description.moniker=="$MONIKER")' | jq
# Edit the validator
babylond tx staking edit-validator \
--new-moniker=$MONIKER \
--website="" \
--identity=<identity> \
--details="" \
--chain-id=$BABYLON_CHAIN_ID \
--gas="auto" \
--gas-adjustment=1.2 \
--gas-prices="0.0025ubbn" \
--from=wallet \
-y
!!! Save priv_validator_key.json which is located in /root/.babylond/config
Last updated
Was this helpful?