Skip to content

Commit

Permalink
fix: make recommended changes, refactor to stake/unstake
Browse files Browse the repository at this point in the history
  • Loading branch information
gluax committed Nov 3, 2023
1 parent d8d25d6 commit c629604
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ MNEMONIC=
# Required: The keyring password must be at least 8 characters.
KEYRING_PASSWORD=qwertyuiop
# Required: The id of the network you wish to join. i.e. ('devnet', 'testnet')
NETWORK=devnet
NETWORK=testnet
# Required: The address of external node to connect to for syncing.
NODE_ADDRESS=http://18.130.31.180:26657
NODE_ADDRESS=https://3.10.185.200:26657
49 changes: 36 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ docker run -d --name seda_node \
--env 'MONIKER=' \
--env 'MNEMONIC=' \
--env 'KEYRING_PASSWORD=' \
--env 'NETWORK_ID=' \
--env 'NETWORK=' \
--env 'NODE_ADDRESS=' \
--volume ~/.seda-chain:/root/.seda-chain \
--volume $(pwd)/seda.env:/seda-chain/.env \
Expand Down Expand Up @@ -194,29 +194,49 @@ Otherwise simply have that field filled out, and it will add the account automat

There are a few things you may like to check as an operator(these assume your container is running):

1. If your node is synced. This can be done with the following command:
1. The current height of the chain:
```bash
docker exec seda_node seda-chaind status | jq '.SyncInfo.catching_up'
```
In which it outputs:
- `true`: if the node is **not** synced.
- `false`: if the node is synced.

2. The current height of the chain:
```bash
docker exec seda_node seda-chaind query block | jq '.block.header.height'
docker exec seda_node /bin/bash -c "seda-chaind query block | jq '.block.header.height'"
```

Which outputs a number, the current chain height.
2. More commands coming soon.

#### Becoming a Validator
#### Staking

**NOTE**: This assumes you already have funds in your account. If you don't please add some funds to your account before trying.
To become a validator run the following command:
**NOTE**: The amount at the end is the amount of tokens in `aseda` to stake.
```bash
docker exec seda_node /bin/bash -c "./staking.sh 1000"
# Which should produce some output:
gas estimate: 181315
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 6C8A6C1925F3B373BBEA4DF609D8F1FAE6CDA094586763652557B527E88893A6
```
#### Unstaking
**NOTE**: This assumes you have already staked.
To become a validator run the following command:
**NOTE**: The amount at the end is the amount of tokens in `aseda` to stake.
```bash
docker exec seda_node /bin/bash -c "./become_validator.sh 1000"
docker exec seda_node /bin/bash -c "./unstaking.sh 1000"
# Which should produce some output:
gas estimate: 181315
Expand All @@ -235,7 +255,10 @@ tx: null
txhash: 6C8A6C1925F3B373BBEA4DF609D8F1FAE6CDA094586763652557B527E88893A6
```
#### Checking Validator Status
You can then monitor your validator status by running:
**NOTE**: To be a validator you must be one of the top 100 stakers.
```bash
docker exec seda_node /bin/bash -c "./check_validator.sh"
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions scripts/node_setup/unstaking.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Tell script to exit immediately if any cmd fails
set -e

BIN="seda-chaind"
KEY_NAME="${KEY_NAME:-default_key}"
STAKE_AMOUNT="$1aseda"

source common.sh

validator_pub_key=$($BIN tendermint show-validator --home=$HOME/.seda-chain)

chain_id=$(cat $HOME/.seda-chain/config/genesis.json | jq .chain_id | tr -d '"')
auth_seda_chaind_command tx undbound create-validator $validator_pub_key --amount=$STAKE_AMOUNT --pubkey=$validator_pub_key --moniker=$MONIKER --commission-rate=0.10 --commission-max-rate=0.20 --commission-max-change-rate=0.01 --gas=auto --gas-adjustment=1.2 --gas-prices=0.0025aseda --from=$KEY_NAME --min-self-delegation=1 --yes --home=$HOME/.seda-chain --chain-id=$chain_id

0 comments on commit c629604

Please sign in to comment.