Hey everyone,
While adding a new script to the Project Builder section of my tools site, I noticed I had fallen behind on archiving the miscellaneous scripts I've shared here recently.
I took some time today to fully update the site. If you see a snippet or tool that sparks an idea, feel free to grab it and build something new.
To mark the update, I am sharing a new Bash script I wrote today: he_sync.sh.

Why use it?
Checking logs to see if a Hive Engine node is syncing correctly works, but it is slow. This script provides an instant, color-coded status check by comparing your node's lastParsedHiveBlockNumber against the Hive Head Block.
It uses jq and curl to fetch the data and does the math for you.
he_sync.sh
#!/bin/bash
# Hive Engine Sync Checker
# Checks correct sync status using lastParsedHiveBlockNumber vs Hive Head Block
# Configuration
# Can be overridden by environment variables: HE_NODE, HIVE_NODE, WARN_THRESHOLD, ERROR_THRESHOLD
HE_NODE="${HE_NODE:-https://engine.thecrazygm.com}"
HIVE_NODE="${HIVE_NODE:-https://api.hive.blog}"
WARN_THRESHOLD="${WARN_THRESHOLD:-5}"
ERROR_THRESHOLD="${ERROR_THRESHOLD:-20}"
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m' # No Color
# Check dependencies
if ! command -v jq &>/dev/null; then
echo -e "${RED}Error: jq is required but not installed.${NC}"
exit 1
fi
if ! command -v curl &>/dev/null; then
echo -e "${RED}Error: curl is required but not installed.${NC}"
exit 1
fi
# Helper for JSON RPC
call_rpc() {
local url=$1
local method=$2
local params=$3
curl -s -X POST -H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\", \"method\":\"$method\", \"params\":$params, \"id\":1}" \
"$url"
}
echo -e "${CYAN}Fetching blockchain status...${NC}"
# Fetch Hive Head Block
HIVE_RESP=$(call_rpc "$HIVE_NODE" "condenser_api.get_dynamic_global_properties" "[]")
# Check for curl error (empty response)
if [[ -z "$HIVE_RESP" ]]; then
echo -e "${RED}Error: No response from Hive Node ($HIVE_NODE)${NC}"
exit 1
fi
HIVE_HEAD=$(echo "$HIVE_RESP" | jq -r '.result.head_block_number')
if [[ "$HIVE_HEAD" == "null" || -z "$HIVE_HEAD" ]]; then
echo -e "${RED}Error: Could not fetch Hive head block from $HIVE_NODE${NC}"
echo -e "Response: $HIVE_RESP"
exit 1
fi
# Fetch HE Status
# Append /blockchain to the node URL as this is the standard endpoint for getStatus
HE_URL="$HE_NODE/blockchain"
HE_RESP=$(call_rpc "$HE_URL" "getStatus" "{}")
if [[ -z "$HE_RESP" ]]; then
echo -e "${RED}Error: No response from Hive Engine Node ($HE_URL)${NC}"
exit 1
fi
HE_BLOCK=$(echo "$HE_RESP" | jq -r '.result.lastParsedHiveBlockNumber')
if [[ "$HE_BLOCK" == "null" || -z "$HE_BLOCK" ]]; then
echo -e "${RED}Error: Could not fetch lastParsedHiveBlockNumber from $HE_URL${NC}"
echo -e "Response: $HE_RESP"
exit 1
fi
# Calculate Difference
DIFF=$((HIVE_HEAD - HE_BLOCK))
echo -e "Hive Head Block: ${BOLD}$HIVE_HEAD${NC}"
echo -e "HE Node Parsed Block: ${BOLD}$HE_BLOCK${NC}"
if ((DIFF < 0)); then
ABS_DIFF=$((-DIFF))
echo -e "Status: ${MAGENTA}Node is ahead by $ABS_DIFF blocks! (Possible Hive API lag)${NC}"
elif ((DIFF <= WARN_THRESHOLD)); then
echo -e "Difference: $DIFF blocks"
echo -e "Status: ${GREEN}SYNCED${NC}"
elif ((DIFF <= ERROR_THRESHOLD)); then
echo -e "Difference: $DIFF blocks"
echo -e "Status: ${YELLOW}DRIFTING${NC}"
else
echo -e "Difference: $DIFF blocks"
echo -e "Status: ${RED}WAY OFF${NC}"
fi
You can also grab the raw file from the Github Gist.
As always,
Michael Garcia a.k.a. TheCrazyGM
I love the project builder!
!PIMP
!PAKX
!PIZZA
View or trade
PAKXtokens.Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.
$PIZZA slices delivered:
@ecoinstant(1/20) tipped @thecrazygm
Please vote for pizza.witness!
Thank you for another nifty tool, my friend! I like the idea of script snippets that can be used as building blocks in various projects. 😁🙏💚✨🤙