Loading...

Install dependencies

Update system and install build tools
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
Install Go
cd $HOME
sudo rm -rf /usr/local/go
wget https://go.dev/dl/go1.23.6.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.23.6.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source ~/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
go version
which go
rm -rf go1.23.6.linux-amd64.tar.gz

Download and build binary

Clone project repository
cd $HOME
rm -rf beacon-kit
git clone https://github.com/berachain/beacon-kit
cd beacon-kit
git checkout v1.1.3
make install
beacond version
which beacond
Or download directly binary
wget -O beacond https://snapshots.tienthuattoan.com/mainnet/berachain/beacond && mv beacond $HOME/go/bin

Initialize the node

Set node configuration
beacond config chain-id mainnet-beacon-80094
Initialize the node
beacond init you-node-name --chain-id mainnet-beacon-80094
Download genesis and addrbook
curl -Ls https://snapshots.tienthuattoan.com/mainnet/berachain/genesis.json > $HOME/.beacond/config/genesis.json
curl -Ls https://snapshots.tienthuattoan.com/mainnet/berachain/addrbook.json > $HOME/.beacond/config/addrbook.json
Add seed
sed -i -e "s|^seeds *=.*|seeds = \"a2cb1a3d1c0a5d86dbcbcff8186c0bc4d9bfecfa@berachain-rpc.tienthuattoan.com:26656\"|" $HOME/.beacond/config/config.toml
Set minimum gas price
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0bera\"|" $HOME/.beacond/config/app.toml
Update pruning and disable indexer to save disk space
sed -i \
  -e 's|^pruning *=.*|pruning = "custom"|' \
  -e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
  -e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
  -e 's|^pruning-interval *=.*|pruning-interval = "10"|' \
  $HOME/.beacond/config/app.toml

sed -i 's/indexer = "kv"/indexer = "null"/g' $HOME/.beacond/config/config.toml

Download Snapshot

wget -O berachain_latest.tar.lz4 https://snapshots.tienthuattoan.com/mainnet/berachain/berachain_latest.tar.lz4 && lz4 -c -d berachain_latest.tar.lz4 | tar -x -C $HOME/.beacond

Create service

sudo tee /etc/systemd/system/beacond.service > /dev/null << EOF
[Unit]
Description=Berachain node service
After=network-online.target
[Service]
User=$USER
ExecStart=$(which beacond) start
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Start the service and check the logs
sudo systemctl daemon-reload
sudo systemctl enable beacond
sudo systemctl restart beacond
sudo journalctl -u beacond -f