惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
MyScale Blog
MyScale Blog
博客园 - Franky
The Cloudflare Blog
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
The Blog of Author Tim Ferriss
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
腾讯CDC
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
云风的 BLOG
云风的 BLOG

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Check Wallet Balances Across 4 Chains with Zero Dependenc...
neuralmint · 2026-05-27 · via DEV Community

neuralmint

TL;DR: A single-file Python CLI tool that checks native and token balances across Solana, Ethereum, BSC, and Polygon using public RPC endpoints. No pip install required. Just Python 3 and a wallet address.

GitHub: https://github.com/neuralmint/multichain-balance-cli


Why Another Balance Checker?

Most multi-chain balance checkers fall into two categories:

  1. Web dashboards — nice UI but no CLI, no scripting, no automation
  2. Heavy SDKs — ethers.js, web3.py, solana-py — each requires its own install, its own API keys, its own learning curve

I wanted something I could run on any server with Python 3, pipe into jq, drop into a cron job, and never worry about dependency rot. The result is a single 278-line Python file that works out of the box.

What It Does

# Check all 4 chains at once
python3 chain_balance.py --address 0x742d35Cc6634C0532925a3b844Bc1dC3E92bBbb7

# Just Solana
python3 chain_balance.py --address 4TGyiYBjaYhFFPNYyCoJjf16ctUsWVBiMR1FXQxEfhWi --chains solana

# JSON mode for jq/shell pipelines
python3 chain_balance.py --address 0x... --chains eth,polygon --json | jq '.results[].native'

# Silent mode for cron jobs
python3 chain_balance.py --address 0x... --quiet --json > report.json

Enter fullscreen mode Exit fullscreen mode

Supported Chains

Chain Native Token RPC Endpoint
Solana SOL api.mainnet-beta.solana.com
Ethereum ETH ethereum-rpc.publicnode.com
BSC BNB bsc-dataseed1.binance.org
Polygon MATIC polygon-rpc.com

Token Coverage

For each EVM chain, it checks the top 5 tokens by market cap:

  • Ethereum: USDT, USDC, LINK, UNI, DAI
  • BSC: USDT, USDC, BUSD, WBNB, CAKE
  • Polygon: USDT, USDC, WMATIC, LINK, WETH
  • Solana: All SPL tokens via getTokenAccountsByOwner (auto-discovers any token you hold)

How It Works

Pure JSON-RPC 2.0 calls over HTTPS using Python's stdlib urllib. No HTTP library, no Web3 SDK, no Solana SDK:

def rpc_call(url, method, params):
    payload = json.dumps({
        "jsonrpc": "2.0", "id": 1,
        "method": method, "params": params,
    }).encode()
    req = urllib.request.Request(url, data=payload, headers={"Content-Type": "application/json"})
    with urllib.request.urlopen(req, timeout=15) as resp:
        return json.loads(resp.read().decode()).get("result")

Enter fullscreen mode Exit fullscreen mode

For Solana, it uses getTokenAccountsByOwner with the Token program ID to discover all SPL tokens in the wallet — not just a hardcoded list.

Example Output

════════════════════════════════════════════════════════
  Multi-Chain Balance Report
  Address: 0x742d35Cc6634C0532925a3b844Bc1dC3E92bBbb7
════════════════════════════════════════════════════════

  ┌── SOLANA ────────────────────────────────
  │ Native: 0.000000 SOL
  │ (no token balances found)
  └─────────────────────────────────────────────

  ┌── ETH ────────────────────────────────────
  │ Native: 0.000000 ETH
  └─────────────────────────────────────────────

Enter fullscreen mode Exit fullscreen mode

Use Cases

  • Cron job monitoring: Check your wallet daily, email if balance drops below threshold
  • Portfolio dashboard: Pipe --json into a shell script that builds a dashboard
  • Swap pre-flight: Check you have enough gas tokens before sending a transaction
  • CI/CD health check: Verify a faucet wallet still has funds

Tips

If this tool saves you time or money, tips are appreciated:

  • SOL: 4TGyiYBjaYhFFPNYyCoJjf16ctUsWVBiMR1FXQxEfhWi
  • ETH/ERC-20: 0xe07f177E0725c11EEc8BeA34C5b5193CaF2a1A6a

What's Next

This is part of the neuralmint CLI Tools series. Previous tools in the series:

  • wallet_tracker.py — transaction history tracker
  • token_info.py — token metadata lookup
  • crypto_sentiment.py — sentiment analysis from social feeds
  • crypto_news.py — crypto news aggregator

All tools are single-file, MIT-licensed, and zero-dependency.


Built with Python 3 stdlib. No npm, no pip, no bloat.