Blog

Developer Guide

Building a Blockchain Explorer for Stellar: Core Data You Need

A blockchain explorer is one of the most useful tools you can build for a network. For Stellar, the core data comes from five entity types: accounts, ledgers, transactions, assets, and operations. Here is how to query and display each one.

The Five Pillars

1. Accounts

Every Stellar account has a public key, balances, signers, and configuration:

GET /accounts/{accountId}

Key fields to display:

  • Account ID (public key)
  • XLM balance and all asset balances
  • Number of signers and threshold configuration
  • Home domain (if set)
  • Subentry count (trustlines, offers, data entries)
  • Last modified ledger
  • 2. Ledgers

    Ledgers are Stellar's equivalent of blocks — they close every 5-6 seconds:

    GET /ledgers?limit=10&order=desc
    GET /ledgers/{sequence}

    Key fields to display:

  • Sequence number
  • Close time
  • Transaction count (successful + failed)
  • Operation count
  • Base fee
  • Protocol version
  • Hash
  • 3. Transactions

    Each ledger contains transactions submitted by accounts:

    GET /transactions?limit=20&order=desc
    GET /transactions/{hash}
    GET /transactions/{hash}/operations

    Key fields to display:

  • Hash
  • Source account
  • Ledger number
  • Fee charged
  • Operation count
  • Success/failure status
  • Memo (if present)
  • Envelope XDR (for advanced users)
  • 4. Operations

    Operations are the atomic units of work within transactions:

    GET /operations?limit=20&order=desc
    GET /accounts/{id}/operations

    Stellar has 25+ operation types. The most common:

  • payment — XLM or asset transfer
  • create_account — Fund a new account
  • change_trust — Add or remove an asset trustline
  • manage_sell_offer / manage_buy_offer — DEX trading
  • invoke_host_function — Soroban smart contract calls
  • 5. Assets

    Every non-XLM token on Stellar is an asset with a code and issuer:

    GET /assets?limit=20&order=desc
    GET /assets?asset_code=USDC

    Key fields to display:

  • Asset code
  • Issuer account
  • Number of accounts holding it
  • Total amount issued
  • Flags (authorization required, revocable, clawback, immutable)
  • Connecting the Data

    An explorer lets users navigate between these entities:

  • Ledger → Transactions: Click a ledger to see its transactions
  • Transaction → Operations: Click a transaction to see its operations
  • Operation → Accounts: Click source/destination to see the account
  • Account → Assets: See all assets an account holds
  • Asset → Holders: See accounts holding a specific asset
  • Each Horizon response includes _links with HAL links to related resources, making navigation easy.

    Pagination

    All list endpoints use cursor-based pagination:

    // First page
    GET /transactions?limit=20&order=desc
    
    // Next page (use _links.next.href from response)
    GET /transactions?cursor=abc123&limit=20&order=desc

    Search

    An explorer needs search. Common patterns:

  • Account search: Validate as Stellar public key (starts with G, 56 chars)
  • Transaction search: Validate as hex hash (64 chars)
  • Ledger search: Validate as integer
  • Asset search: Query /assets?asset_code={code}
  • LumenQuery as Your Data Layer

    Building an explorer from scratch means managing Horizon infrastructure. LumenQuery provides:

  • [Horizon API](/docs): All endpoints for accounts, ledgers, transactions, assets, operations
  • [Smart Contract Explorer](/contracts): Decoded Soroban data (calls, storage, events)
  • [Live Transactions](/dashboard/transactions): Real-time decoded transaction stream

  • *Power your Stellar explorer with LumenQuery. Managed Horizon API with all the data you need — start free.*