Get the FREE Ultimate OpenClaw Setup Guide →

check-crypto-address-balance

Scanned
npx machina-cli add skill besoeasy/open-skills/check-crypto-address-balance --openclaw
Files (1)
SKILL.md
7.4 KB

Check Crypto Address Balance Skill

Query cryptocurrency address balances across multiple blockchains using free public APIs. Supports Bitcoin, Ethereum, BSC, Solana, Litecoin, and other major chains without requiring API keys for basic queries.

Supported chains & best free APIs

ChainAPIBase URLRate limitNotes
Bitcoin (BTC)Blockchain.infohttps://blockchain.info~1 req/10sMost reliable, no key needed
Bitcoin (BTC)Blockstreamhttps://blockstream.info/apiGenerousEsplora API, open-source
Ethereum (ETH)Etherscanhttps://api.etherscan.io/api5 req/sec (free)Optional key for higher limits
Ethereum (ETH)Blockchairhttps://api.blockchair.com30 req/minMulti-chain support
BSC (BNB)BscScanhttps://api.bscscan.com/api5 req/sec (free)Same API as Etherscan
Solana (SOL)Public RPChttps://api.mainnet-beta.solana.comVaries by nodeFree public nodes
Solana (SOL)Solscan APIhttps://public-api.solscan.io10 req/secNo key for basic queries
Litecoin (LTC)BlockCypherhttps://api.blockcypher.com/v1/ltc/main200 req/hrMulti-chain API
Litecoin (LTC)Chain.sohttps://chain.so/api/v2GenerousSimple JSON responses
Multi-chainBlockchairhttps://api.blockchair.com30 req/minBTC, ETH, LTC, DOGE, BCH

Skills

Bitcoin (BTC) balance

# Using Blockchain.info (satoshis, convert to BTC by dividing by 100000000)
curl -s "https://blockchain.info/q/addressbalance/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"

# Using Blockstream (satoshis)
curl -s "https://blockstream.info/api/address/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa" | jq '.chain_stats.funded_txo_sum - .chain_stats.spent_txo_sum'

Node.js:

async function getBTCBalance(address) {
  const res = await fetch(`https://blockchain.info/q/addressbalance/${address}`);
  const satoshis = await res.text();
  return parseFloat(satoshis) / 1e8; // convert satoshis to BTC
}

Ethereum (ETH) balance

# Using Etherscan (no API key required for single queries, returns wei)
curl -s "https://api.etherscan.io/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest" | jq -r '.result'

# Using Blockchair (returns balance in wei with additional metadata)
curl -s "https://api.blockchair.com/ethereum/dashboards/address/0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae" | jq '.data[].address.balance'

Node.js:

async function getETHBalance(address) {
  const url = `https://api.etherscan.io/api?module=account&action=balance&address=${address}&tag=latest`;
  const res = await fetch(url);
  const data = await res.json();
  return parseFloat(data.result) / 1e18; // convert wei to ETH
}

BSC (BNB Smart Chain) balance

# Using BscScan (same API as Etherscan)
curl -s "https://api.bscscan.com/api?module=account&action=balance&address=0x8894E0a0c962CB723c1976a4421c95949bE2D4E3&tag=latest" | jq -r '.result'

Node.js:

async function getBSCBalance(address) {
  const url = `https://api.bscscan.com/api?module=account&action=balance&address=${address}&tag=latest`;
  const res = await fetch(url);
  const data = await res.json();
  return parseFloat(data.result) / 1e18; // convert wei to BNB
}

Solana (SOL) balance

# Using public RPC (balance in lamports, 1 SOL = 1e9 lamports)
curl -s https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBalance",
  "params": ["vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"]
}' | jq '.result.value'

# Using Solscan API (returns SOL directly)
curl -s "https://public-api.solscan.io/account/vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg" | jq '.lamports'

Node.js:

async function getSOLBalance(address) {
  const res = await fetch('https://api.mainnet-beta.solana.com', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 1,
      method: 'getBalance',
      params: [address]
    })
  });
  const data = await res.json();
  return data.result.value / 1e9; // convert lamports to SOL
}

Litecoin (LTC) balance

# Using Chain.so (returns LTC directly)
curl -s "https://chain.so/api/v2/get_address_balance/LTC/LTC_ADDRESS/6" | jq -r '.data.confirmed_balance'

# Using BlockCypher (returns satoshis)
curl -s "https://api.blockcypher.com/v1/ltc/main/addrs/LTC_ADDRESS/balance" | jq '.balance'

Node.js:

async function getLTCBalance(address) {
  const res = await fetch(`https://chain.so/api/v2/get_address_balance/LTC/${address}/6`);
  const data = await res.json();
  return parseFloat(data.data.confirmed_balance);
}

Multi-chain helper (Node.js)

const APIS = {
  BTC: (addr) => `https://blockchain.info/q/addressbalance/${addr}`,
  ETH: (addr) => `https://api.etherscan.io/api?module=account&action=balance&address=${addr}&tag=latest`,
  BSC: (addr) => `https://api.bscscan.com/api?module=account&action=balance&address=${addr}&tag=latest`,
  LTC: (addr) => `https://chain.so/api/v2/get_address_balance/LTC/${addr}/6`
};

const DIVISORS = { BTC: 1e8, ETH: 1e18, BSC: 1e18, LTC: 1 };

async function getBalance(chain, address) {
  if (chain === 'SOL') {
    const res = await fetch('https://api.mainnet-beta.solana.com', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        jsonrpc: '2.0', id: 1, method: 'getBalance', params: [address]
      })
    });
    const data = await res.json();
    return data.result.value / 1e9;
  }
  
  const url = APIS[chain](address);
  const res = await fetch(url);
  
  if (chain === 'BTC') {
    const satoshis = await res.text();
    return parseFloat(satoshis) / DIVISORS[chain];
  } else if (chain === 'LTC') {
    const data = await res.json();
    return parseFloat(data.data.confirmed_balance);
  } else {
    const data = await res.json();
    return parseFloat(data.result) / DIVISORS[chain];
  }
}

// usage: getBalance('ETH', '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae').then(console.log);

Agent prompt

You have a cryptocurrency balance-checking skill. When a user provides a crypto address, detect the chain (BTC/ETH/BSC/SOL/LTC) from the address format:
- BTC: starts with 1, 3, or bc1
- ETH: starts with 0x (42 chars)
- BSC: starts with 0x (42 chars, context-dependent)
- SOL: base58 string (32-44 chars, no 0x)
- LTC: starts with L or M

Use the appropriate free public API from the table above, respecting rate limits. Return the balance in the native currency (BTC, ETH, BNB, SOL, LTC) with proper decimal conversion.

Rate-limiting best practices

  • Implement 1-2 second delays between requests to the same API.
  • Cache results for at least 30 seconds to avoid redundant queries.
  • Use exponential backoff on rate-limit errors (HTTP 429).
  • For production, consider getting free API keys (Etherscan, BscScan) for higher limits.

Additional chains (via Blockchair)

Blockchair supports: BTC, ETH, LTC, DOGE, BCH, Dash, Ripple, Groestlcoin, Stellar, Monero (view-key required), Cardano, and Zcash (t-addresses).

See also

Source

git clone https://github.com/besoeasy/open-skills/blob/main/skills/check-crypto-address-balance/SKILL.mdView on GitHub

Overview

Query wallet balances on multiple blockchains using free public APIs. This skill supports BTC, ETH, BSC, SOL, LTC, and more without requiring API keys for basic queries, making it ideal for quick multi-chain checks or portfolio reviews.

How This Skill Works

The skill queries free public APIs for each supported chain (e.g., Blockchain.info and Blockstream for BTC, Etherscan or Blockchair for ETH, BscScan for BSC, Solana RPC and Solscan for SOL, BlockCypher or Chain.so for LTC, and Blockchair for multi-chain). It returns numeric balances and handles unit conversions (satoshis/wei/lamports to standard units) so you can read amounts directly.

When to Use It

  • Audit a hot wallet by checking BTC, ETH, and LTC balances across public endpoints without keys
  • Verify a recipient address balance before sending funds on BTC, ETH, or BSC
  • Quickly check balances across multiple chains for a crypto portfolio
  • Research API rate limits and reliability when selecting free public APIs
  • Diagnose discrepancies by comparing outputs from different free APIs

Quick Start

  1. Step 1: Choose a chain and copy the target address (BTC, ETH, BSC, SOL, LTC).
  2. Step 2: Call the public API endpoint for that chain to fetch the balance (read the example endpoints in the skill).
  3. Step 3: Convert the returned value to the proper unit (BTC, ETH, BNB, SOL, LTC) and review the balance.

Best Practices

  • Respect per-API rate limits and implement gentle retry logic
  • Prefer consistent chain endpoints for reliable comparisons and consider API keys if higher limits are needed
  • Validate addresses per chain before querying to avoid invalid results
  • Normalize and convert units (satoshis/wei/lamports) to user-friendly amounts
  • Cache results when possible to reduce unnecessary calls and protect privacy

Example Use Cases

  • BTC balance using Blockchain.info for address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
  • ETH balance via Etherscan for address 0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
  • BSC balance via BscScan for address 0x8894E0a0c962CB723c1976a4421c95949bE2D4E3
  • SOL balance via Solana RPC for address vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg
  • LTC balance via BlockCypher for a sample LTC address

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers