Skip to content

Commit

Permalink
refactor: change multi node setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
fiamma-builder committed Nov 6, 2024
1 parent 29f892c commit 6c5e54f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
14 changes: 4 additions & 10 deletions scripts/multi_node_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ set -e
: "${CHAIN_ID:=fiamma-testnet-1}"
: "${PASSWORD:=password}"
token="ufia"
initial_balance=10000000000000
initial_faucet_balance=10000000000
initial_stake=10000000
minimum_gas_price=0
initial_balance=250000000000000
initial_stake=50000000000000
minimum_gas_price=0.002
committee_address=""
staker_addresses=()

Expand Down Expand Up @@ -76,12 +75,7 @@ for (( i=1; i <= "$#"; i++ )); do
staker_addresses+=($val_operator)

echo "Giving val_${!i} some tokens..."
if [ $i -eq 1 ]; then
faucet_initial_balance=$((initial_faucet_balance + initial_stake))
docker run --rm -it -v $(pwd)/testnet-nodes/${!i}:/root/.fiamma ghcr.io/fiamma-chain/fiamma genesis add-genesis-account $val_address $faucet_initial_balance$token
else
docker run --rm -it -v $(pwd)/testnet-nodes/${!i}:/root/.fiamma ghcr.io/fiamma-chain/fiamma genesis add-genesis-account $val_address $initial_balance$token
fi
docker run --rm -it -v $(pwd)/testnet-nodes/${!i}:/root/.fiamma ghcr.io/fiamma-chain/fiamma genesis add-genesis-account $val_address $initial_balance$token

if [ $((i+1)) -le "$#" ]; then
j=$((i+1))
Expand Down
17 changes: 4 additions & 13 deletions scripts/run_localnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@ set -e

# Basic settings
CHAIN_ID="fiamma-testnet-1"
PASSWORD="password"
token="ufia"
initial_balance="10000000000000"
initial_faucet_balance="10000000000"
initial_stake="10000000"
minimum_gas_price="0"
initial_balance="1000000000000000"
initial_stake="50000000000000"
minimum_gas_price="0.002"
committee_address=""
staker_addresses=()

babylonContractAddr=fiamma14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sgx3jav
btcStakingContractAddr=fiamma1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrqyn5sl2

# RPC and Auth Key settings
rpc="http://127.0.0.1:26658"
authkey=""

# Ensure that node name is provided
if [ $# -lt 1 ]; then
echo "Usage: $0 <node_name>"
Expand Down Expand Up @@ -66,8 +60,6 @@ sed -i '' 's/"btc_staking_contract_address": ""/"btc_staking_contract_address":

fiammad config set app minimum-gas-prices "$minimum_gas_price$token"
fiammad config set app pruning "nothing"
fiammad config set app da-config.rpc "$rpc"
fiammad config set app da-config.authkey "$authkey"

# Key generation and setup
echo "Creating key for $node..."
Expand All @@ -94,8 +86,7 @@ jq --argjson staker_addresses "$(printf '%s\n' "${staker_addresses[@]}" | jq -R
mv ~/.fiamma/config/genesis.json.tmp ~/.fiamma/config/genesis.json

# Setup genesis
faucet_initial_balance=$((initial_faucet_balance + initial_stake))
fiammad genesis add-genesis-account $val_address $faucet_initial_balance$token
fiammad genesis add-genesis-account $val_address $initial_balance$token

# Configure staking and genesis
fiammad genesis gentx $node $initial_stake$token --keyring-backend test --chain-id $CHAIN_ID --gas 1000000 --gas-prices $minimum_gas_price$token
Expand Down

0 comments on commit 6c5e54f

Please sign in to comment.