Node Installation

Aligned Layer node installation

Install dependencies

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 if nedeed

cd $HOME
VER="1.21.3"
wget "https://golang.org/dl/go$VER.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz"
rm "go$VER.linux-amd64.tar.gz"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin

Set variables

You can change the variables here as you want.

echo "export WALLET_NAME="MyWallet"" >> $HOME/.bash_profile
echo "export MONIKER="MyNodes"" >> $HOME/.bash_profile
echo "export ALIGNEDLAYER_PORT="222"" >> $HOME/.bash_profile

source $HOME/.bash_profile

Download binary

cd $HOME
rm -rf aligned_layer_tendermint
git clone https://github.com/yetanotherco/aligned_layer_tendermint.git
cd aligned_layer_tendermint
git checkout v0.1.0
make build-linux

Configure AlinedLayer App

alignedlayerd init $MONIKER --chain-id alignedlayer
sed -i -e "s|^node *=.*|node = \"tcp://localhost:${ALIGNEDLAYER_PORT}657\"|" $HOME/.alignedlayerd/config/client.toml

Download genesis and addrbook

curl -Ls https://krews.xyz/snapshots/data/alignedlayer/genesis.json > $HOME/.alignedlayer/config/genesis.json
curl -Ls https://krews.xyz/snapshots/data/alignedlayer/addrbook.json > $HOME/.alignedlayer/config/addrbook.json

Set seeds and peers

SEEDS="25ed2cb891b05bd5a28725cd19df601360b7cfdb@alignedlayer-seed.krews.xyz:24256"
PEERS="2567ea5aed4bba4e3062a1072a8f1e7fb4e4497c@65.109.85.36:26656,51ca4087558ebe93a16e3f1e84a969d30e7a91f1@95.216.245.35:26656,df898a791ae0aa21c1e2029c90ff8275104860d8@37.60.248.171:26656,18e1adeadb8cc596375e4212288fcd00690df067@213.199.48.195:26656,c2a2bb5cf9d126b623d5ef40151cad73b5d7f4e8@37.60.248.85:26656,7292de855372480ae23dbcaf94d36ead187cf6a8@194.163.143.206:50656,2514706bb8a168d3e12e07c66e37a9b585abeeb4@37.60.232.236:24256,a1d6d9569789a7a8765f0a4899439819f07755d4@213.133.103.213:26656,afeea4cd47aa80504adbdaa8aa019864e291de55@[2a03:cfc0:8000:13::b910:277f]:13356,5cbed18b59353db1ed7f864d621f271cae549d68@207.180.219.100:26656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.alignedlayer/config/config.toml

Set custom ports

for app.toml
sed -i.bak -e "s%:1317%:${ALIGNEDLAYER_PORT}17%g;
s%:8080%:${ALIGNEDLAYER_PORT}80%g;
s%:9090%:${ALIGNEDLAYER_PORT}90%g;
s%:9091%:${ALIGNEDLAYER_PORT}91%g;
s%:8545%:${ALIGNEDLAYER_PORT}45%g;
s%:8546%:${ALIGNEDLAYER_PORT}46%g;
s%:6065%:${ALIGNEDLAYER_PORT}65%g" $HOME/.alignedlayer/config/app.toml
for config.toml
sed -i.bak -e "s%:26658%:${ALIGNEDLAYER_PORT}58%g;
s%:26657%:${ALIGNEDLAYER_PORT}57%g;
s%:6060%:${ALIGNEDLAYER_PORT}60%g;
s%:26656%:${ALIGNEDLAYER_PORT}56%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${ALIGNEDLAYER_PORT}56\"%;
s%:26660%:${ALIGNEDLAYER_PORT}60%g" $HOME/.alignedlayer/config/config.toml

Set minimum gas price

sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.0025uward"|g' $HOME/.alignedlayer/config/app.toml

Configure pruning

sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.alignedlayer/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.alignedlayer/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.alignedlayer/config/app.toml

Create service file

sudo tee /etc/systemd/system/alignedlayerd.service > /dev/null <<EOF
[Unit]
Description=AlignedLayer Node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.alignedlayer
ExecStart= $(which alignedlayerd) start --home $HOME/.alignedlayer
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Reset node and download snapshot

alignedlayerd tendermint unsafe-reset-all --home $HOME/.alignedlayer --keep-addr-book
if curl -s --head curl https://krews.xyz/snapshots/alignedlayer/latest.tar.lz4 | head -n 1 | grep "200" > /dev/null; then
  curl https://krews.xyz/snapshots/alignedlayer/latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.alignedlayer
    else
  echo snapshot not found
fi

Allow P2P port

sudo ufw allow ${ALIGNEDLAYER_PORT}56/tcp

Enable and start node service

sudo systemctl daemon-reload
sudo systemctl enable alignedlayerd
sudo systemctl restart alignedlayerd && sudo journalctl -fu alignedlayerd

Create wallet

alignedlayerd keys add ${WALLET_NAME}

WALLET_ADDRESS=$(alignedlayerd keys show $WALLET_NAME -a)
VALOPER_ADDRESS=$(alignedlayerd keys show $WALLET_NAME --bech val -a)
echo "export WALLET_ADDRESS="$WALLET_ADDRESS >> $HOME/.bash_profile
echo "export VALOPER_ADDRESS="$VALOPER_ADDRESS >> $HOME/.bash_profile
source $HOME/.bash_profile

Faucet your wallet and check sync

# faucet your wallet on this website
https://faucet.alignedlayer.com/
# and check your balance
alignedlayerd query bank balances $WALLET_ADDRESS 

Create validator

# check sync status, once your node is fully synced, the output from above will print "false"
# if output is false, go ahead
alignedlayerd status 2>&1 | jq 

cd $HOME
# Create validator.json file. You can set identity, website, details as you wish.
echo "{\"pubkey\":{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"$(alignedlayerd comet show-validator | grep -Po '\"key\":\s*\"\K[^"]*')\"},
    \"amount\": \"1000000stake\",
    \"moniker\": \"test\",
    \"identity\": \"\",
    \"website\": \"\",
    \"security\": \"\",
    \"details\": \"I love blockchain ❤️\",
    \"commission-rate\": \"0.1\",
    \"commission-max-rate\": \"0.2\",
    \"commission-max-change-rate\": \"0.01\",
    \"min-self-delegation\": \"1\"
}" > validator.json
# Create a validator using the JSON configuration
alignedlayerd tx staking create-validator validator.json \
    --from $WALLET_NAME \
    --chain-id alignedlayer \
	--fees 50stake \

Delete node

sudo systemctl stop alignedlayerd
sudo systemctl disable alignedlayerd
sudo rm -rf /etc/systemd/system/alignedlayerd.service
sudo rm $(which alignedlayerd)
sudo rm -rf $HOME/.alignedlayer
sed -i "/ALIGNEDLAYER_/d" $HOME/.bash_profile

Last updated