Joining Testnet Galactica - Galactica-corp/galactica GitHub Wiki
Joining testnet Galactica
Getting Started
Make sure the following prerequisites are completed:
- Choose the proper hardware/server configuration. See the hardware guide.
- Ensure
gala
is properly installed. See the installation guide for a walk-through.
Hardware Recommended Specifications:
Recommended Hardware requirements for starting Galactica node
Type of instance | CPU | RAM | Disk* |
---|---|---|---|
Validator | 4 cpu | 16 GB | 400 GB |
Relay | 4 cpu | 16 GB | 400 GB |
* Requirements for disk space may increase during network growth
Preparing keys
Prepare dir & variables
Before any execution, you need to create a folder that will keep configurations and keys to the wallet
mkdir galactica-validator
cd $_
and export some variables to reuse them later
# set dir for data & configs
export MAIN_PATH_HOME=./
# set dir for configs, by default ~/.galactica
export MAIN_PATH_CONFIG=$MAIN_PATH_HOME/config
# set chain_id which we will join
export CHAIN_ID=galaandr_41238-41238
# that's how keys will be kept - in that case in a file and encrypted with a password
export KEYRING_BACKEND=file
Alias
For easy use, you can create a temporary alias to galacticad
with preconfigured params:
alias gala="galacticad --home $MAIN_PATH_HOME --keyring-backend $KEYRING_BACKEND"
Additionaly you can add this alias to your environment by default:
echo alias gala="galacticad --home $(realpath $MAIN_PATH_HOME) --keyring-backend $KEYRING_BACKEND" >> ~/.bashrc
Get keys for your validator
You need to get your private key to validator instance dir. If you don't have a wallet at that moment see how to create them or if you need to move already created keys how to export and import them.
Configure galacticad instance for joining testnet
Initialize configuration for validator
# Configure your client to connect with your node
gala config chain-id $CHAIN_ID
gala config keyring-backend file
gala config node tcp://0.0.0.0:26657
# Set name of your node/validator
export VALIDATOR_MONIKER=name_of_validator
sed -i.backup "s?moniker = \".*\"?moniker = \"$VALIDATOR_MONIKER\"?" $MAIN_PATH_CONFIG/config.toml
Change network parameters in config.toml and app.toml
sed -i 's?laddr = "tcp://127.0.0.1:26657"?laddr = "tcp://0.0.0.0:26657"?g' $MAIN_PATH_CONFIG/config.toml
sed -i 's?proxy_app = "tcp://127.0.0.1:26658"?proxy_app = "tcp://0.0.0.0:26658"?g' $MAIN_PATH_CONFIG/config.toml
sed -i 's?cors_allowed_origins = \[\]?cors_allowed_origins = \["*"\]?g' $MAIN_PATH_CONFIG/config.toml
sed -i.backup '/\[api\]/,+3 s?enable = false?enable = true?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?address = "tcp://localhost:1317"?address = "tcp://0.0.0.0:1317"?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?enabled-unsafe-cors = false?enabled-unsafe-cors = true?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?address = "localhost:9090"?address = "0.0.0.0:9090"?' $MAIN_PATH_CONFIG/app.toml
sed -i '/\[grpc-web\]/,+7 s?address = "localhost:9091"?address = "0.0.0.0:9091"?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?pruning = "default"?pruning = "nothing"?g' $MAIN_PATH_CONFIG/app.toml
sed -i 's?minimum-gas-prices = ".*"?minimum-gas-prices = "10ugnet"?g' $MAIN_PATH_CONFIG/app.toml
genesis.json
file
Get Genesis file will be published later.
This file need to be placed in config
dir of your instance
mv genesis.json $MAIN_PATH_CONFIG/
Get list of seeds
List of seeds in seeds.txt
file will be published later.
You need at least one endpoint from it to use galacticad to manage your funds later.
For now you can place that file in config
dir of your instance
mv seeds.txt $MAIN_PATH_CONFIG/
After that copy lines from that file to config/config.toml
p2p.seeds
section like below:
[p2p]
# ...
# Comma separated list of seed nodes to connect to
seeds = "tcp://[email protected]:26656,tcp://[email protected]:26656,tcp://[email protected]:26656"
Start validator node
Try to start node wit command below:
galacticad start --home=$(realpath $MAIN_PATH_HOME) --chain-id=$CHAIN_ID --keyring-backend=file --pruning=nothing --metrics --rpc.unsafe --log_level=info --json-rpc.enable=true --json-rpc.enable-indexer=true --json-rpc.api=eth,txpool,personal,net,debug,web3 --api.enable
To check that your node is syncing right now see catching_up
attribute in gala status
respose
Also in Linux, you can create systemd unit file galactica.service
echo > galactica.service <<EOF
[Unit]
Description=galactica validator service
[Service]
WorkingDirectory=$(realpath $MAIN_PATH_HOME)
ExecStart=$(which galacticad) start --home=$(realpath $MAIN_PATH_HOME) --chain-id=$CHAIN_ID --keyring-backend=file --pruning=nothing --metrics --rpc.unsafe --log_leve=info --json-rpc.enable=true --json-rpc.enable-indexer=true --json-rpc.api=eth,txpool,personal,net,debug,web3 --api.enable
Type=simple
## uncomment if you create a separate user on the server for galactica purpose
# User=galactica
# Group=galactica
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo mv galactica.service /etc/systemd/system/galactica.service
sudo chown root:root /etc/systemd/system/galactica.service
sudo systemctl daemon-reload
sudo systemctl enable --now galactica.service
Delegate token to validator node
After your node is synced to the network and you have funds in your account, you can create a validator from your node. Here's how to do it:
- Prepare for staking: The minimal amount for self-delegation on
galaandr_41238-41238
is 100 gnet. This is the minimum amount you need to stake to become a validator. - Check the active set: The network has an active set of 100 validators. To produce blocks, you need to be in this active set. You can check the current active set and staking amounts at Galactica Explorer. To enter the active set, you'll need to have enough total stake. This can be achieved through a combination of self-delegation and delegations from other users. You don't necessarily have to stake all the tokens yourself.
- Create your validator: Use the following command to create your validator:
gala tx staking create-validator \
--amount=5000gnet \
--chain-id=$CHAIN_ID \
--fees `awk 'BEGIN {print 20e6}'`agnet \
--moniker=$VALIDATOR_MONIKER \
--commission-rate="0.05" \
--commission-max-rate="0.10" \
--commission-max-change-rate="0.01" \
--from=$KEY_NAME \
--pubkey=`gala tendermint show-validator` \
--min-self-delegation=`bc <<< 'scale=50; 5000*10^18'`
Check delegations to validator
After that you can check your validator`s delegations:
gala query staking delegations-to `gala keys show $KEY_NAME --bech val -a`
And check that your validator takes part in block validation:
gala query staking historical-info `gala status | jq -r '.SyncInfo.latest_block_height'`
Add stake to validator
If you want delegate more to validator you can with command:
gala tx staking delegate `gala keys show $KEY_NAME -a --bech val` `$AMOUNT`ugnet --from=$KEY_NAME --fees 2000000ugnet --chain-id $CHAIN_ID
Unbond some tokens from validator
export VALIDATOR_ADDR=`gala keys show $KEY_NAME -a --bech val`
echo "Unbond 9 GNET tokens from validator ($VALIDATOR_ADDR)..."
gala tx staking unbond $VALIDATOR_ADDR 9000000ugnet --from $KEY_NAME --fees 2000000ugnet
TLDR
To run galactica node:
mkdir -p gala-validator
cd $_
Place a script validator-init.sh
below
#!/bin/bash
alias gala="gallacticad --home $MAIN_PATH_HOME --keyring-backend $KEYRING_BACKEND --keyring-dir $MAIN_PATH_HOME"
echo Create keys for the wallet
galacticad keys add $KEY_NAME --algo secp256k1 --home $MAIN_PATH_HOME --keyring-backend $KEYRING_BACKEND --keyring-dir $MAIN_PATH_HOME <<EOF
$KEYS_PASSWORD
$KEYS_PASSWORD
EOF
echo 'Your public main address:'
galacticad keys show $KEY_NAME -a --home $MAIN_PATH_HOME --keyring-backend $KEYRING_BACKEND --keyring-dir $MAIN_PATH_HOME <<EOF
$KEYS_PASSWORD
EOF
echo 'Your validator address to delegate stake tokens:'
galacticad keys show $KEY_NAME --bech val -a --home $MAIN_PATH_HOME --keyring-backend $KEYRING_BACKEND --keyring-dir $MAIN_PATH_HOME <<EOF
$KEYS_PASSWORD
EOF
echo Initialize config
galacticad --home $MAIN_PATH_HOME config chain-id $CHAIN_ID
galacticad --home $MAIN_PATH_HOME config keyring-backend file
galacticad --home $MAIN_PATH_HOME config node tcp://0.0.0.0:26657
echo Changing some parameters in config.yaml and app.yaml
sed -i.backup 's?laddr = "tcp://127.0.0.1:26657"?laddr = "tcp://0.0.0.0:26657"?g' $MAIN_PATH_CONFIG/config.toml
sed -i 's?proxy_app = "tcp://127.0.0.1:26658"?proxy_app = "tcp://0.0.0.0:26658"?g' $MAIN_PATH_CONFIG/config.toml
sed -i 's?cors_allowed_origins = \[\]?cors_allowed_origins = \["*"\]?g' $MAIN_PATH_CONFIG/config.toml
sed -i "s?moniker = \".*\"?moniker = \"$VALIDATOR_MONIKER\"?" $MAIN_PATH_CONFIG/config.toml
sed -i.backup '/\[api\]/,+3 s?enable = false?enable = true?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?address = "tcp://localhost:1317"?address = "tcp://0.0.0.0:1317"?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?enabled-unsafe-cors = false?enabled-unsafe-cors = true?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?address = "localhost:9090"?address = "0.0.0.0:9090"?' $MAIN_PATH_CONFIG/app.toml
sed -i '/\[grpc-web\]/,+7 s?address = "localhost:9091"?address = "0.0.0.0:9091"?' $MAIN_PATH_CONFIG/app.toml
sed -i 's?pruning = "default"?pruning = "nothing"?g' $MAIN_PATH_CONFIG/app.toml
sed -i 's?minimum-gas-prices = ".*"?minimum-gas-prices = "10ugnet"?g' $MAIN_PATH_CONFIG/app.toml
Run the script with password additional variable
export MAIN_PATH_HOME=.
export MAIN_PATH_CONFIG=$MAIN_PATH_HOME/config
export CHAIN_ID=galaandr_41238-41238
export KEYRING_BACKEND=file
KEYS_PASSWORD=CHANGEME1 KEY_NAME=gala_wallet VALIDATOR_MONIKER=gala_val1 bash validator-init.sh
After that get genesis.json
and seeds.txt
and locate them accordingly their instructions
Try to start galactica node with command
galacticad start --home=$(realpath $MAIN_PATH_HOME) --chain-id=$CHAIN_ID --keyring-backend=file --pruning=nothing --metrics --rpc.unsafe --log_level=info --json-rpc.enable=true --json-rpc.enable-indexer=true --json-rpc.api=eth,txpool,personal,net,debug,web3 --api.enable
To add galacticad
validator to linux systemd-units to autostart service with command below:
echo > /etc/systemd/system/galactica.service <<EOF
[Unit]
Description=galactica validator service
[Service]
WorkingDirectory=$(realpath $MAIN_PATH_HOME)
ExecStart=$(which galacticad) start --home $(realpath $MAIN_PATH_HOME) --chain-id $CHAIN_ID --pruning=nothing --metrics --rpc.unsafe --log_level info --json-rpc.enable true --json-rpc.enable-indexer true --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable
Type=simple
## uncomment if you create a separate user on the server for galactica purpose
# User=galactica
# Group=galactica
Restart=always
[Install]
WantedBy=network.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now galactica.service
After your node is synced and you get funds on your account - create validator node