> For the complete documentation index, see [llms.txt](https://cryptomolot.gitbook.io/cryptomolot-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cryptomolot.gitbook.io/cryptomolot-docs/testnets/alignedlayer.md).

# Alignedlayer

RPC: <https://aligned-test.rpc.cryptomolot.com/>

## Resources

<table><thead><tr><th></th><th data-type="content-ref"></th></tr></thead><tbody><tr><td>Github</td><td><a href="https://github.com/yetanotherco/aligned_layer">https://github.com/yetanotherco/aligned_layer</a></td></tr><tr><td>Docs</td><td><a href="https://docs.alignedlayer.com/">https://docs.alignedlayer.com/</a></td></tr><tr><td>Discord</td><td><a href="https://discord.com/invite/alignedlayer">https://discord.com/invite/alignedlayer</a></td></tr><tr><td>x.com</td><td><a href="https://x.com/alignedlayer">https://x.com/alignedlayer</a></td></tr><tr><td>Website</td><td><a href="https://alignedlayer.com/">https://alignedlayer.com/</a></td></tr></tbody></table>

## Hardware requirements

<table data-view="cards"><thead><tr><th>CPU</th><th>RAM</th><th>Storage</th><th>Network</th><th>OS</th></tr></thead><tbody><tr><td>4-Cores</td><td>16 GB</td><td>200 GB NVME</td><td>100mbps network bandwidth</td><td>Linux (Ubuntu 22.04 x64)</td></tr></tbody></table>

## Installation 💾

## Update repositories

```bash
apt update && apt upgrade -y
```

## Install dependencies

```bash
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
```

Install GO 1.22.2

```bash
sudo rm -rf /usr/local/go && \
curl -L https://go.dev/dl/go1.22.2.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local && \
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile && \
source .bash_profile && \
go version
```

Set variables

> change the \<wallet>, \<moniker>.\
> And Alignedlayer\_port # **if you needed**

```bash
echo "export WALLET="<WALLET>"" >> $HOME/.bash_profile
echo "export MONIKER="<MONIKER>"" >> $HOME/.bash_profile
echo "export ALIGNEDLAYER_CHAIN_ID="alignedlayer"" >> $HOME/.bash_profile
echo "export ALIGNEDLAYER_PORT="26"" >> $HOME/.bash_profile
source $HOME/.bash_profile
```

Get binaries

```bash
cd $HOME
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env

curl https://get.ignite.com/cli | bash
sudo mv ignite /usr/local/bin/

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

## Initialize

> change the \<moniker>

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

## Download genesis and addrbook

```bash
wget -O $HOME/.alignedlayer/config/genesis.json https://testnet-files.itrocket.net/alignedlayer/genesis.json
```

```bash
wget -O $HOME/.alignedlayer/config/addrbook.json https://testnet-files.itrocket.net/alignedlayer/addrbook.json
```

## Add seeds/bpeers/peers in config.toml

```bash
SEEDS="d1a8816c1c5800b352c2a1eb0e7a156bce34ae9f@alignedlayer-testnet-seed.itrocket.net:50656"
PEERS="144c2d4fbbaf54dda837bfbc88b688fb2f02c92f@alignedlayer-testnet-peer.itrocket.net:50656,2567ea5aed4bba4e3062a1072a8f1e7fb4e4497c@65.109.85.36:26656,51ca4087558ebe93a16e3f1e84a969d30e7a91f1@95.216.245.35:26656,5f0e7fbfef5865c15be8d564f4b11f56abecc501@164.68.108.76:26656,ee5a3e96c1eda6605bd2dfd9cef9eb67a67a9e6b@109.199.97.54:26656,7292de855372480ae23dbcaf94d36ead187cf6a8@194.163.143.206:50656,c2a2bb5cf9d126b623d5ef40151cad73b5d7f4e8@37.60.248.85:26656,a1d6d9569789a7a8765f0a4899439819f07755d4@213.133.103.213:26656,9a8aa5cebc5183c2cba97252c452eab4aba3a6be@213.199.57.46:26656,029808691d64f7f03ee9ff2736858fa34d753017@46.250.235.85:24256,38bcfb4d2026b1f34f5c61d48c1905cc46096c0b@94.130.35.35:12656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.alignedlayer/config/config.toml
```

## Set minimum gas-price

```bash
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.0001stake"|g' $HOME/.alignedlayer/config/app.toml
```

## Set custom ports (if needed)

```bash
# set custom ports in app.toml
sed -i.bak -e "s%:1317%:${ALIGNEDLAYER_PORT}317%g;
s%:8080%:${ALIGNEDLAYER_PORT}080%g;
s%:9090%:${ALIGNEDLAYER_PORT}090%g;
s%:9091%:${ALIGNEDLAYER_PORT}091%g;
s%:8545%:${ALIGNEDLAYER_PORT}545%g;
s%:8546%:${ALIGNEDLAYER_PORT}546%g;
s%:6065%:${ALIGNEDLAYER_PORT}065%g" $HOME/.alignedlayer/config/app.toml

# set custom ports in config.toml file
sed -i.bak -e "s%:26658%:${ALIGNEDLAYER_PORT}658%g;
s%:26657%:${ALIGNEDLAYER_PORT}657%g;
s%:6060%:${ALIGNEDLAYER_PORT}060%g;
s%:26656%:${ALIGNEDLAYER_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${ALIGNEDLAYER_PORT}656\"%;
s%:26660%:${ALIGNEDLAYER_PORT}660%g" $HOME/.alignedlayer/config/config.toml
```

## (Optional) Pruning

```bash
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
```

## (Optional) Disable indexer and enable prometheus

> default indexer="kv"\
> default prometheus = false

```bash
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.alignedlayer/config/config.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.alignedlayer/config/config.toml
```

## Create a service file

```bash
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=5
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF
```

```bash
sudo systemctl daemon-reload
sudo systemctl enable alignedlayerd
sudo systemctl restart alignedlayerd && sudo journalctl -u alignedlayerd -f
```

## Run from snapshot

```bash
```

## Wait fo full sync (output "false")

```bash
alignedlayerd status 2>&1 | jq
```

## Create or recover wallet

> !!! BACKUP YOUR SEED PHRASE !!!

```bash
alignedlayerd keys add $WALLET

OR

alignedlayerd keys add $WALLET --recover
```

### Get tokens from faucet 🆓

> faucet not yet

## Set var for wallet and valoper addresses

```bash
WALLET_ADDRESS=$(alignedlayerd keys show $WALLET -a)
VALOPER_ADDRESS=$(alignedlayerd keys show $WALLET --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
```

## Create Validator

> Create validator json file

```bash
echo "{\"pubkey\":{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"$(alignedlayerd comet show-validator | grep -Po '\"key\":\s*\"\K[^"]*')\"},
    \"amount\": \"1000000stake\",
    \"moniker\": \"<MONIKER>\",
    \"identity\": \"\",
    \"website\": \"\",
    \"security\": \"\",
    \"details\": \"\",
    \"commission-rate\": \"0.1\",
    \"commission-max-rate\": \"0.2\",
    \"commission-max-change-rate\": \"0.01\",
    \"min-self-delegation\": \"1\"
}" > validator.json
```

> Create validator from json

```bash
alignedlayerd tx staking create-validator validator.json \
    --from $WALLET \
    --chain-id alignedlayer \
    --fees 50stake
```

> !!! BACKUP YOUR priv\_validator\_key.json !!!

## Useful commands ⚙️

node info

```bash
alignedlayerd status 2>&1 | jq
```

logs

```bash
sudo journalctl -u alignedlayerd -f
```

start service

```bash
sudo systemctl start alignedlayerd
```

stop service

```bash
sudo systemctl stop alignedlayerd
```

restart service

```bash
sudo systemctl restart alignedlayerd
```

enable service

```bash
sudo systemctl enable alignedlayerd
```

disable service

```bash
sudo systemctl disable alignedlayerd
```

Check wallets list

```bash
alignedlayerd keys list
```

Delete wallet

```bash
alignedlayerd keys delete $WALLET
```

Check Balance

```bash
alignedlayerd q bank balances $WALLET_ADDRESS
```

Withdraw all rewards

```bash
alignedlayerd tx distribution withdraw-all-rewards --from $WALLET --chain-id alignedlayer --fees 50stake
```

Withdraw rewards and commission from your validator

```bash
alignedlayerd tx distribution withdraw-rewards $VALOPER_ADDRESS --from $WALLET --commission --chain-id alignedlayer --fees 50stake -y
```

Check your balance

```bash
alignedlayerd query bank balances $WALLET_ADDRESS
```

Delegate to Yourself

```bash
alignedlayerd tx staking delegate $(alignedlayerd keys show $WALLET --bech val -a) 1000000stake --from $WALLET --chain-id alignedlayer --fees 50stake -y
```

Delegate

```bash
alignedlayerd tx staking delegate <TO_VALOPER_ADDRESS> 1000000stake --from $WALLET --chain-id alignedlayer --fees 50stake -y
```

Redelegate Stake to Another Validator

```bash
alignedlayerd tx staking redelegate $VALOPER_ADDRESS <TO_VALOPER_ADDRESS> 1000000stake --from $WALLET --chain-id alignedlayer --fees 50stake -y
```

Unbond

```bash
alignedlayerd tx staking unbond $(alignedlayerd keys show $WALLET --bech val -a) 1000000stake --from $WALLET --chain-id alignedlayer --fees 50stake -y
```

Transfer Funds

```bash
alignedlayerd tx bank send $WALLET_ADDRESS <TO_WALLET_ADDRESS> 1000000stake --fees 50stake -y
```

Validator Details

```bash
alignedlayerd q staking validator $(alignedlayerd keys show $WALLET --bech val -a)
```

Jailing info

```bash
alignedlayerd q slashing signing-info $(alignedlayerd tendermint show-validator)
```

Slashing parameters

```bash
alignedlayerd q slashing params
```

Unjail validator

```bash
alignedlayerd tx slashing unjail --from $WALLET --chain-id alignedlayer --fees 50stake -y
```

## Delete node 🗑️

```bash
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
```
