DEV Community

Samuel Akoji
Samuel Akoji

Posted on

I Built a Terminal Account Explorer (Mini Solscan)

Day 23 of #100DaysOfSolana

Today I stopped staring at raw terminal output and built something actually useful: a CLI tool that takes any Solana address and prints a clean summary of the account balance, owner, data size, and whether it's executable.

Think of it as your own mini Solscan, no browser required.


What I built

A Node.js script (explorer.mjs) that:

  • Accepts any Solana address as a CLI argument
  • Fetches balance via getBalance and account metadata via getAccountInfo
  • Converts lamports to SOL (divide by 1,000,000,000)
  • Maps owner addresses to friendly names (System Program, Token Program, etc.)
  • Truncates large data fields so your terminal doesn't explode

Stack: @solana/kit, ES Modules, devnet RPC


The core insight

Every single account on Solana — wallets, token accounts, deployed programs — is described by the same 5 fields:

Field What it tells you
balance How much SOL (in lamports)
owner Which program controls this account
data Custom bytes stored in the account
executable Is this account a runnable program?
rent_epoch When rent was last collected

The difference between a wallet and a smart contract is literally one boolean: executable.


What surprised me

Block explorers like Solscan and SolanaFM aren't doing anything special. They call the same getBalance and getAccountInfo RPC methods I used today — they just wrap the output in a web UI.

Building the raw version yourself gives you a mental model that no tutorial skips to.


Try it yourself

node explorer.mjs TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
Enter fullscreen mode Exit fullscreen mode

Run it against the Token Program address. You'll see executable: true and the System Program listed as owner.

Then try your own devnet wallet — executable: false, zero data, System Program owner.


Day 23 down. Still shipping daily

solana #web3 #blockchain #100daysofcode #javascript

Top comments (0)