Skip to content

Commit

Permalink
feat: register validator WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
obasilakis committed Jun 24, 2024
1 parent 2fdf363 commit ef62817
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion scripts/create_validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,52 @@ echo -e "$HOTKEY_PASSWORD\n$HOTKEY_PASSWORD" | btcli wallet new_hotkey --wallet.
# Use the faucet for the validator wallet
run_faucet validator || { echo "Faucet failed for validator wallet"; exit 1; }

echo "Wallets for miner and validator created, and faucet used successfully."
echo "Wallets for validator created, and faucet used successfully."

# Expect script to handle the interactive prompts
expect << EOF
log_user 1
set timeout -1
# Loop until the correct netuid prompt is seen
while {1} {
spawn btcli subnet register --wallet.name validator --wallet.hotkey validator_hotkey --subtensor.chain_endpoint ws://subtensor_machine:9946
expect {
"Enter netuid \\[0/3\\] (0):" {
puts "Waiting for subnet creation..."
sleep 5
exp_continue
}
"Enter netuid \\[0/1/3\\] (0):" {
puts "Correct netuid prompt received."
send "1\r"
exp_continue
}
"Do you want to continue? \\[y/n\\] (n)" {
puts "Confirming continuation..."
send "y\r"
exp_continue
}
"Enter password to unlock key:" {
puts "Entering password..."
send "$COLDKEY_PASSWORD\r"
exp_continue
}
"Recycle τ" {
puts "Recycling τ..."
send "y\r"
exp_continue
}
"✅ Registered" {
puts "Successfully registered."
exit
}
eof {
puts "Retrying registration..."
sleep 1
}
}
}
EOF

tail -f /dev/null

0 comments on commit ef62817

Please sign in to comment.