Page 1 of 1

Check Stellar Wallet Balance With Bash

Posted: Sat Feb 08, 2025 3:10 am
by Styler
Make sure you have curl ;)

Code: Select all

#!/bin/bash

# Set your Stellar wallet address (public key)
STELLAR_ADDRESS="Your Wallet"

# API endpoint for Stellar public network
STELLAR_API="https://horizon.stellar.org/accounts/$STELLAR_ADDRESS"

# Function to fetch balance
get_balance() {
    curl -s "$STELLAR_API" | jq -r '.balances[] | select(.asset_type == "native>
}

# Get initial balance
LAST_BALANCE=$(get_balance)

echo "Checking Stellar wallet: $STELLAR_ADDRESS"
echo "Current Balance: $LAST_BALANCE XLM"