Selendra

Documentation

EVM Explorer API

Selendra's blockchain explorer provides a comprehensive REST API for querying on-chain data, transaction history, account information, and network statistics.

Overview

The Selendra Explorer API is your gateway to accessing blockchain data programmatically. Built on BlockScout, it provides both real-time and indexed data from the Selendra network, enabling developers to build wallets, analytics tools, dApps, and more without running a full node.

Key Concepts

Real-Time vs. Indexed Data

  • Real-Time RPC: Direct blockchain queries via https://rpc.selendra.org for latest block height and validator info (~1s latency)
  • Indexed Data: Historical data via Explorer API at https://explorer.selendra.org/api/v2 for transactions, addresses, and aggregated statistics (~30s latency)

Hybrid Approach
This website combines both sources - RPC for block height (real-time) and Explorer API for transaction counts (indexed) to provide the best user experience.

Common Use Cases

Build a Wallet

  • Query account balances and transaction history
  • Monitor pending transactions
  • Track token balances and transfers
  • Estimate gas fees for transactions

Analytics Dashboard

  • Fetch network statistics (total transactions, active addresses)
  • Analyze token distribution and holder counts
  • Track validator performance
  • Monitor network health metrics

dApp Integration

  • Verify smart contract deployment
  • Query contract state and events
  • Display user transaction history
  • Show real-time balance updates

Block Explorer

  • Search transactions by hash or address
  • Display block details and contents
  • Show internal transactions and traces
  • Decode contract interactions

Base URL

https://explorer.selendra.org/api

Authentication

The Explorer API is public and doesn't require authentication for read operations. Rate limits apply to prevent abuse.

Common Endpoints

Network Statistics

Get network-wide statistics including block height, transaction count, and active validators.

GET /api?module=stats&action=coinprice
GET /api?module=stats&action=totalsupply  
GET /api?module=stats&action=totalfees

Block Information

# Get latest block number
GET /api?module=block&action=eth_block_number

# Get block by number
GET /api?module=block&action=getblockreward&blockno=BLOCK_NUMBER

# Get block by timestamp
GET /api?module=block&action=getblocknobytime&timestamp=UNIX_TIMESTAMP&closest=before

Account Queries

# Get account balance
GET /api?module=account&action=balance&address=0x...

# Get multiple account balances
GET /api?module=account&action=balancemulti&address=0x...,0x...

# Get account transactions
GET /api?module=account&action=txlist&address=0x...&startblock=0&endblock=99999999&sort=desc

# Get account internal transactions  
GET /api?module=account&action=txlistinternal&address=0x...

# Get token transfers for account
GET /api?module=account&action=tokentx&address=0x...

# Get list of tokens owned by address
GET /api?module=account&action=tokenlist&address=0x...

Token Information

# Get token info by contract address
GET /api?module=token&action=getToken&contractaddress=0x...

# Get token holders
GET /api?module=token&action=getTokenHolders&contractaddress=0x...&page=1&offset=10

# Get token total supply
GET /api?module=stats&action=tokensupply&contractaddress=0x...

Transaction Data

# Get transaction info
GET /api?module=transaction&action=gettxinfo&txhash=0x...

# Get transaction receipt status
GET /api?module=transaction&action=gettxreceiptstatus&txhash=0x...

# Get transaction error status
GET /api?module=transaction&action=getstatus&txhash=0x...

Smart Contract Verification

# Get contract source code
GET /api?module=contract&action=getsourcecode&address=0x...

# Get contract ABI
GET /api?module=contract&action=getabi&address=0x...

# List verified contracts
GET /api?module=contract&action=listcontracts&page=1&offset=10

Response Format

All API responses follow this structure:

{
  "status": "1",
  "message": "OK",
  "result": {
    // Response data
  }
}

Status Codes:

  • 1 - Success
  • 0 - Error

Real-World Example

This website uses the Explorer API to display live network statistics. Here's how:

Fetching Network Stats

// Fetch block height and validator count
const RPC_ENDPOINT = 'https://rpc.selendra.org'
const EXPLORER_API = 'https://explorer.selendra.org/api'

// Get latest block from RPC
const blockResponse = await fetch(RPC_ENDPOINT, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_blockNumber',
    params: []
  })
})

const { result: blockHex } = await blockResponse.json()
const blockHeight = parseInt(blockHex, 16)

// Get transaction count from Explorer API
const txResponse = await fetch(
  `${EXPLORER_API}?module=stats&action=txcount`
)
const { result } = await txResponse.json()

Displaying Live Data

import { useEffect, useState } from 'react'

export function NetworkStats() {
  const [stats, setStats] = useState(null)

  useEffect(() => {
    async function fetchStats() {
      const res = await fetch(
        'https://explorer.selendra.org/api?module=stats&action=coinprice'
      )
      const data = await res.json()
      setStats(data.result)
    }

    fetchStats()
    const interval = setInterval(fetchStats, 10000) // Update every 10s
    return () => clearInterval(interval)
  }, [])

  return (
    <div>
      <div>Block: {stats?.blockHeight}</div>
      <div>Validators: {stats?.validatorCount}</div>
    </div>
  )
}

Pagination

Most list endpoints support pagination:

GET /api?module=account&action=txlist&address=0x...&page=1&offset=20

Parameters:

  • page - Page number (default: 1)
  • offset - Number of results per page (max: 10,000)
  • sort - Sort order: asc | desc

Rate Limits

  • Rate limit: 5 requests/second per IP
  • Daily limit: 100,000 requests/day
  • Burst: 10 requests

For higher limits, consider running your own BlockScout explorer instance or archive node.

Error Handling

async function fetchWithRetry(url: string, retries = 3) {
  for (let i = 0; i < retries; i++) {
    try {
      const response = await fetch(url)
      const data = await response.json()
      
      if (data.status === '0') {
        throw new Error(data.message || 'API Error')
      }
      
      return data.result
    } catch (error) {
      if (i === retries - 1) throw error
      await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)))
    }
  }
}

Best Practices

  1. Cache responses - The blockchain doesn't change retroactively, cache historical data
  2. Use batch endpoints - balancemulti is more efficient than multiple balance calls
  3. Implement exponential backoff - Retry failed requests with increasing delays
  4. Monitor rate limits - Track your requests to avoid hitting limits
  5. Use pagination - Don't fetch all data at once, paginate large result sets

Additional Resources

Support

For API issues or questions:

Contribute

Found an issue or want to contribute?

Help us improve this documentation by editing this page on GitHub.

Edit this page on GitHub