-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdeploy-subnets.sh
More file actions
executable file
·85 lines (74 loc) · 2.42 KB
/
deploy-subnets.sh
File metadata and controls
executable file
·85 lines (74 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
# Deploy all 4 subnet chains (Zoo, Hanzo, SPC, Pars) to mainnet + testnet
# Usage: ./deploy-subnets.sh [mainnet|testnet|devnet|both]
#
# Prerequisites:
# - macOS keychain must have mainnet-key-02 key (will prompt for approval)
# - Nodes must be running on the target network
# - Genesis files must exist in ~/work/lux/state/chains/
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
DEPLOY_BIN="$SCRIPT_DIR/deploy-chains"
STATE_DIR="$HOME/work/lux/state/chains"
# Build if needed
if [ ! -f "$DEPLOY_BIN" ]; then
echo "Building deploy-chains..."
cd "$SCRIPT_DIR"
go build -o "$DEPLOY_BIN" ./wallet/network/primary/examples/deploy-chains/
fi
# Use mainnet-key-02 (NOT 01!) because 01's funds are all staked by initialStakers
# mainnet-key-02 has 70M LUX unlocked on P-chain, sufficient for subnet creation
KEY_NAME="mainnet-key-02"
echo "Extracting $KEY_NAME from keychain..."
echo "(Approve the macOS keychain dialog that appears)"
KEY=$(security find-generic-password -s "io.lux.cli" -a "lux-key-$KEY_NAME" -w 2>/dev/null)
if [ -z "$KEY" ]; then
echo "ERROR: Could not extract key from keychain."
echo "Make sure $KEY_NAME exists: security find-generic-password -s io.lux.cli -a lux-key-$KEY_NAME"
exit 1
fi
echo "Key loaded successfully ($KEY_NAME)."
TARGET="${1:-both}"
deploy_network() {
local network=$1
echo ""
echo "=============================="
echo "Deploying subnets to $network"
echo "=============================="
LUX_PRIVATE_KEY="$KEY" "$DEPLOY_BIN" \
--network="$network" \
--state-dir="$STATE_DIR" 2>&1
echo ""
echo "$network deployment complete!"
}
case "$TARGET" in
mainnet)
deploy_network mainnet
;;
testnet)
deploy_network testnet
;;
devnet)
deploy_network devnet
;;
both|all)
deploy_network mainnet
deploy_network testnet
;;
*)
echo "Usage: $0 [mainnet|testnet|devnet|both]"
exit 1
;;
esac
# Clear the key from memory
unset KEY
echo ""
echo "All deployments complete!"
echo ""
echo "Next steps:"
echo " 1. Copy the Subnet IDs and Blockchain IDs from output above"
echo " 2. Update Helm values files:"
echo " ~/work/lux/devops/charts/lux/values-mainnet.yaml"
echo " ~/work/lux/devops/charts/lux/values-testnet.yaml"
echo " 3. Helm upgrade to apply new chain tracking config"
echo " 4. Import RLP blocks for Zoo/SPC if available"