Check Stellar Wallet Balance With Bash

Stellar / XLM developments
Post Reply
Styler
Posts: 5
Joined: Sun Feb 02, 2025 1:53 am

Check Stellar Wallet Balance With Bash

Post 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"
Post Reply