# PRYSM

### Welcome to PRYSM

PRYSM is a blockchain that strives to challenge the limits of decentralized networks by integrating a combination of the finest features of existing blockchain technologies with new innovative ideas. A thriving diverse community is crucial for the success of any project, and PRYSM aims to achieve this by building a user-friendly ecosystem that is accessible to all. To this end, PRYSM will provide clear documentation that simplifies participation in the network for anyone who wants to take part.

Website       : http://Prysm.Network http://prysm.network/\
Twitter         : https://twitter.com/PrysmNetwork \
Telegram     : https://t.me/PrysmNetwork \
Youtube       : https://www.youtube.com/@PrysmNetwork \
Medium       : https://medium.com/@prysmnetwork

### Services

Explorer : https://www.explorer.winnode.xyz/prysm/&#x20;

Rpc         : https://rpc-prysm.winnode.xyz/&#x20;

Api           : https://api-prysm.winnode.xyz/

### Manual Installation

[Official Documentation](broken-reference) \
Recommended Hardware: 4 Cores, 8GB RAM, 200GB of storage (NVME)

```bash
# install dependencies, if needed
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y

```

Node Name Wallet Port

```bash
# install go, if needed
cd $HOME
VER="1.22.6"
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 vars
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="test"" >> $HOME/.bash_profile
echo "export PRYSM_CHAIN_ID="prysm-devnet-1"" >> $HOME/.bash_profile
echo "export PRYSM_PORT="25"" >> $HOME/.bash_profile
source $HOME/.bash_profile

# download binary
cd $HOME
rm -rf prysm
git clone https://github.com/kleomedes/prysm prysm
cd prysm
git checkout v0.1.0-devnet
make install

# config and init app
prysmd config node tcp://localhost:${PRYSM_PORT}657
prysmd config keyring-backend os
prysmd config chain-id prysm-devnet-1
prysmd init "test" --chain-id prysm-devnet-1

# download genesis and addrbookwget 
wget -O $HOME/.prysm/config/genesis.json https://filex.winnode.xyz/snapshot/prysm/genesis.json
wget -O $HOME/.prysm/config/addrbook.json  https://filex.winnode.xyz/snapshot/prysm/addrbook.json

# set seeds and peers
SEEDS="1b5b6a532e24c91d1bc4491a6b989581f5314ea5@prysm-testnet-seed.itrocket.net:25656"
PEERS="ff15df83487e4aa8d2819452063f336269958d09@prysm-testnet-peer.itrocket.net:25657,ea436c798572aef13813b5f9eeda24abb196569f@62.169.23.220:29656,01e40fe961c9522936a8bb7ede533198614abf9f@[2a0e:dc0:2:2f71::1]:14256,e0daf1e5649feba5ba3787288e66e1c9921b2c4c@149.50.96.153:19756,50dcf516699f45351037d08c0074629a0748d446@[2a03:cfc0:8000:13::b910:277f]:14256,69509925a520c5c7c5f505ec4cedab95073388e5@136.243.13.36:29856,2334e9eb772d5aaf9c48a2885c41d5c33e911912@65.109.92.163:3020,66ea180127711b96e35683be6e6f1cffc2b04e0a@184.107.169.193:25656,170bf5fa23b18d19148ca9a52dbdde485ad59f7b@65.109.79.185:15656,844f4b8382f6abf86ad13fcd2d384214605b094e@144.76.155.11:26656,f9758cec18d2af1cca6431a42ec5b68230ae12c8@149.102.142.113:40656"
sed -i -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*seeds *=.*/seeds = \"$SEEDS\"/}" \
       -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*persistent_peers *=.*/persistent_peers = \"$PEERS\"/}" $HOME/.prysm/config/config.toml


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

# set minimum gas price, enable prometheus and disable indexingsed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.0uprysm"|g'$HOME/.prysm/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/"$HOME/.prysm/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/"$HOME/.prysm/config/config.toml

# create service filesudotee /etc/systemd/system/prysmd.service > /dev/null <<EOF
[Unit]
Description=Prysm node
After=network-online.target
[Service]
User=$USERWorkingDirectory=$HOME/.prysm
ExecStart=$(which prysmd) start --home $HOME/.prysm
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
# reset and download snapshotprysmd tendermint unsafe-reset-all --home $HOME/.prysm
curl https://filex.winnode.xyz/snapshot/prysm/prysm-latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.prysm
    else
els eecho"no snapshot founded"fi

# enable and start service
sudo systemctl daemon-reload
sudo systemctl enable prysmd
sudo systemctl restart prysmd &&sudo journalctl -u prysmd -f
```

### Create wallet

```bash
# to create a new wallet, use the following command. don’t forget to save the mnemonic
prysmd keys add $WALLET

# to restore exexuting wallet, use the following command
prysmd keys add $WALLET --recover

# save wallet and validator address
WALLET_ADDRESS=$(prysmd keys show $WALLET -a)
VALOPER_ADDRESS=$(prysmd 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

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

# before creating a validator, you need to fund your wallet and check balance
prysmd query bank balances $WALLET_ADDRESS 
```

### Node Sync Status Checker

```bash
#!/bin/bash
rpc_port=$(grep -m 1 -oP '^laddr = "\K[^"]+' "$HOME/.prysm/config/config.toml" | cut -d ':' -f 3)

while true; do
  local_height=$(curl -s localhost:$rpc_port/status | jq -r '.result.sync_info.latest_block_height')
  network_height=$(curl -s https://rpc-prysm.winnode.xyz/status | jq -r '.result.sync_info.latest_block_height')

  if ! [[ "$local_height" =~ ^[0-9]+$ ]] || ! [[ "$network_height" =~ ^[0-9]+$ ]]; then
    echo -e "\033[31mError: Invalid data. Retrying...\033[0m"
    sleep 5
    continue
  fi

  blocks_left=$((network_height - local_height))
  [ "$blocks_left" -lt 0 ] && blocks_left=0

  echo -e "\033[33mNode:\033[34m $local_height\033[0m \033[33m| Network:\033[36m $network_height\033[0m \033[33m| Left:\033[31m $blocks_left\033[0m"

  sleep 5
done

```

### Create validator

```bash
cd $HOME
# Create validator.json file
echo "{\"pubkey\":{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"$(prysmd comet show-validator | grep -Po '\"key\":\s*\"\K[^"]*')\"},
    \"amount\": \"1000000uprysm\",
    \"moniker\": \"test\",
    \"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 a validator using the JSON configuration
prysmd tx staking create-validator validator.json \
    --from $WALLET \
    --chain-id prysm-devnet-1 \
	--gas auto --gas-adjustment 1.5 \
	
```

#### Firewall security

```bash
sudo ufw default allow outgoing
sudo ufw default deny incoming
sudo ufw allow ssh/tcp
sudo ufw allow 25656/tcp
sudo ufw enable
```

### Delete node

```bash
sudo systemctl stop prysmd
sudo systemctl disable prysmd
sudorm -rf /etc/systemd/system/prysmd.service
sudorm$(which prysmd)sudorm -rf $HOME/.prysm
sed -i "/PRYSM_/d"$HOME/.bash_profile
```
