Skip to content

Commit

Permalink
chore: create custom private network
Browse files Browse the repository at this point in the history
  • Loading branch information
PhearZero committed Oct 24, 2024
1 parent 62ee30c commit 7b63147
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 96 deletions.
10 changes: 0 additions & 10 deletions .docker/algod_config.json

This file was deleted.

52 changes: 0 additions & 52 deletions .docker/algod_network_template.json

This file was deleted.

8 changes: 0 additions & 8 deletions .docker/start_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ if [ "$ALGORAND_DATA" != "/algod/data" ]; then
echo "Do not override 'ALGORAND_DATA' environment variable."
exit 1
fi
# To allow mounting the data directory we need to change permissions
# to our algorand user. The script is initially run as the root user
# in order to change permissions, afterwards the script is re-launched
# as the algorand user.
if [ "$(id -u)" = '0' ]; then
chown -R algorand:algorand $ALGORAND_DATA
exec su -p -c "$(readlink -f $0) $@" algorand
fi

/node/run/start_empty.sh &
/node/run/start_fast_catchup.sh &
Expand Down
62 changes: 36 additions & 26 deletions .docker/start_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,47 @@
set -e

if [ "$DEBUG" = "1" ]; then
set -x
set -x
fi

if [ "$ALGORAND_DATA" != "/algod/data" ]; then
echo "Do not override 'ALGORAND_DATA' environment variable."
exit 1
echo "Do not override 'ALGORAND_DATA' environment variable."
exit 1
fi

# To allow mounting the data directory we need to change permissions
# to our algorand user. The script is initially run as the root user
# in order to change permissions, afterwards the script is re-launched
# as the algorand user.
if [ "$(id -u)" = '0' ]; then
chown -R algorand:algorand "$ALGORAND_DATA"
exec su -p -c "$(readlink -f $0) $@" algorand
fi


# Configure the participation node
if [ -d "$ALGORAND_DATA" ]; then
if [ "$TOKEN" != "" ]; then
echo "$TOKEN" > "$ALGORAND_DATA/algod.token"
fi
if [ "$ADMIN_TOKEN" != "" ]; then
echo "$ADMIN_TOKEN" > "$ALGORAND_DATA/algod.admin.token"
fi
cd "$ALGORAND_DATA"
cp "/node/run/genesis/testnet/genesis.json" genesis.json
algocfg profile set --yes -d "$ALGORAND_DATA" "participation"
algod -o -d $ALGORAND_DATA -l "0.0.0.0:8080"
if [ -f "$ALGORAND_DATA/genesis.json" ]; then
if [ "$TOKEN" != "" ]; then
echo "$TOKEN" >"$EMPTY_DATA/algod.token"
fi
if [ "$ADMIN_TOKEN" != "" ]; then
echo "$ADMIN_TOKEN" >"$EMPTY_DATA/algod.admin.token"
fi
algod -o -d "$ALGORAND_DATA" -l "0.0.0.0:8080"
else
sed -i "s/NUM_ROUNDS/${NUM_ROUNDS:-30000}/" "/node/run/template.json"
sed -i "s/\"NetworkName\": \"\"/\"NetworkName\": \"hack-tui\"/" "/node/run/template.json"
goal network create --noclean -n tuinet -r "${ALGORAND_DATA}/.." -t "/node/run/template.json"

# Cycle Network
goal network start -r "${ALGORAND_DATA}/.."
goal node stop

# Update Tokens
if [ "$TOKEN" != "" ]; then
echo "$TOKEN" >"$ALGORAND_DATA/algod.token"
fi
if [ "$ADMIN_TOKEN" != "" ]; then
echo "$ADMIN_TOKEN" >"$ALGORAND_DATA/algod.admin.token"
fi
# Import wallet
goal account import -m "artefact exist coil life turtle edge edge inside punch glance recycle teach melody diet method pause slam dumb race interest amused side learn able heavy"

algod -o -d "$ALGORAND_DATA" -l "0.0.0.0:8080"
fi

else
echo "$ALGORAND_DATA" does not exist
exit 1
fi
echo "$ALGORAND_DATA" does not exist
exit 1
fi

0 comments on commit 7b63147

Please sign in to comment.