Skip to content

Instantly share code, notes, and snippets.

@josinaldobarbosa
Last active January 3, 2022 02:45
Show Gist options
  • Save josinaldobarbosa/bbe1437d1a9a273f13eda83c429c139d to your computer and use it in GitHub Desktop.
Save josinaldobarbosa/bbe1437d1a9a273f13eda83c429c139d to your computer and use it in GitHub Desktop.
Add chia connections from chia.keva.app
#!/bin/bash
### CONFIG ###
APP_LOCATION="/usr/lib/chia-blockchain/resources/app.asar.unpacked/daemon/chia"
##############
HTML=$(curl -sS https://chia.keva.app/)
ipRegex="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
IPS=($(echo ${HTML} | grep -Eo "${ipRegex}"))
echo "Total IPs found: ${#IPS[@]}"
for ip in "${IPS[@]}"
do
${APP_LOCATION} show --add-connection "${ip}:8444"
done
connections=($(${APP_LOCATION} show --connections | grep FULL_NODE | awk '{print $2}'))
echo "Total connections: ${#connections[@]}"
@josinaldobarbosa
Copy link
Author

APP_LOCATION change to you bin location, ex. env location = chia, the default is from experimental GUI

@josinaldobarbosa
Copy link
Author

to run at an interval of 1 hour: watch -n 3600 ./chia-add-connections.sh

@mjmj
Copy link

mjmj commented May 20, 2021

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment