Skip to content

Instantly share code, notes, and snippets.

@anilcse
Last active May 16, 2020 09:14
Show Gist options
  • Save anilcse/17f12d55be53d46ca21d567a4185de91 to your computer and use it in GitHub Desktop.
Save anilcse/17f12d55be53d46ca21d567a4185de91 to your computer and use it in GitHub Desktop.
export DENOM=akt
export CHAINID=testchain
export VP=600000000000
export DAEMON=akashd
export CLI=akashctl

## This script assumes following keys to be created before hand. Create keys if not present.
$CLI keys add validator
$CLI keys add faucet

rm -rf ~/.$DAEMON
$DAEMON init --chain-id $CHAINID $CHAINID
sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:26657#g' ~/.$DAEMON/config/config.toml
sed -i "s/172800000000000/$VP/g" ~/.$DAEMON/config/genesis.json # 10 minutes
sed -i "s/stake/$DENOM/g" ~/.$DAEMON/config/genesis.json
sed -i 's/"signed_blocks_window": "100"/"signed_blocks_window": "10000"/g' ~/.$DAEMON/config/genesis.json
sed -i 's/pruning = "syncable"/pruning = "nothing"/g' ~/.$DAEMON/config/app.toml

# Now its time to construct the genesis file
$DAEMON add-genesis-account $($CLI keys show validator -a) 100000000000$DENOM,10000000samoleans
$DAEMON add-genesis-account $($CLI keys show faucet -a) 10000000000000$DENOM,10000000samoleans
$DAEMON gentx --name validator --amount 90000000000$DENOM
$DAEMON collect-gentxs
$DAEMON start --pruning nothing
export DENOM=akt
export CHAINID=testchain
export VP=600000000000
export NODE=http://localhost:26657
export DAEMON=akashd
export CLI=akashctl
export CURRENT_BLOCK_HEIGHT=10
export UPGRADE_TITLE=sirius-upgrade

echo "Submit upgrade proposal"
$CLI tx gov submit-proposal software-upgrade "$UPGRADE_TITLE" --upgrade-height $((CURRENT_BLOCK_HEIGHT + 100)) --title "UPGRADE_TITLE" --description "UPGRADE_TITLE" --from faucet --chain-id $CHAINID --node $NODE -y
sleep 7
echo
echo "Query proposal"
$CLI query gov proposal 1 --chain-id testchain -o json --node $NODE --trust-node
echo
echo "Deposit for proposal"
$CLI tx gov deposit 1 10000000$DENOM --from validator --chain-id $CHAINID --node $NODE
sleep 7
echo
echo "Query proposal"
$CLI query gov proposal 1 --chain-id testchain -o json --node $NODE --trust-node
echo
echo "Vote for proposal"
$CLI tx gov vote 1 yes --from validator --chain-id $CHAINID --node $NODE -y
$CLI tx gov vote 1 yes --from faucet --chain-id $CHAINID --node $NODE -y
echo "Query proposal votes"
$CLI query gov votes 1 --chain-id testchain -o json --node $NODE --trust-node
echo
echo "Query proposal"
$CLI query gov proposal 1 --chain-id testchain -o json --node $NODE --trust-node
echo "Your proposal submitted successfully. The chain will halt for upgrade at height: $((CURRENT_BLOCK_HEIGHT + 100))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment