REST API Reference

Complete reference for the OpenScan.AI REST API v2.

Base URL: https://xdcscan.io/api/v2 ยท Interactive docs: xdcscan.io/api-docs

The API follows the Blockscout v2 specification. All endpoints are read-only GETs unless noted. Authentication is optional โ€” see API Keys & Rate Limits.


Conventions

  • Addresses and hashes are 0x-prefixed hex strings.
  • Amounts are integers in the smallest unit (wei for the native coin, base units for tokens).
  • Pagination: list endpoints return items plus next_page_params. Append the params to the next request; null means the last page. Max 50 items per page.
  • Errors return a JSON body of { "message": "..." } with an appropriate HTTP status code.

Stats

Get network stats

GET /api/v2/stats
curl https://xdcscan.io/api/v2/stats

Response fields include total_blocks, total_transactions, total_addresses, average_block_time (ms), coin_price, gas_prices, and network_utilization_percentage.

Get transaction chart data

GET /api/v2/stats/charts/transactions
GET /api/v2/stats/charts/market

Returns time-series arrays of { date, value } points for charting.


Blocks

List recent blocks

GET /api/v2/blocks

Query parameters: type โ€” block (default), uncle, or reorg.

Terminal window
curl https://xdcscan.io/api/v2/blocks

Get a block

GET /api/v2/blocks/{number_or_hash}
Terminal window
curl https://xdcscan.io/api/v2/blocks/89000000

Returns height, hash, timestamp, miner, gas_used, gas_limit, tx_count, and reward details.


Transactions

List transactions

GET /api/v2/transactions

Query parameters: filter โ€” pending or error.

Get a transaction

GET /api/v2/transactions/{hash}
curl https://xdcscan.io/api/v2/transactions/0x9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b

Key fields: hash, block, timestamp, from, to, value, fee, gas_used, gas_price, status (ok or error), method, and decoded_input (when the target contract is verified).

Token transfers, internal transactions, and logs

GET /api/v2/transactions/{hash}/token-transfers
GET /api/v2/transactions/{hash}/internal-transactions
GET /api/v2/transactions/{hash}/logs
GET /api/v2/transactions/{hash}/state-changes

Logs include decoded topics and data for verified contracts; state changes show per-address balance and storage diffs.


Addresses

Get an address

GET /api/v2/addresses/{hash}
Terminal window
curl https://xdcscan.io/api/v2/addresses/0x1234567890abcdef1234567890abcdef12345678
{
"hash": "0x1234567890abcdef1234567890abcdef12345678",
"coin_balance": "1234567890000000000000",
"is_contract": false,
"name": null,
"token": null,
"has_token_transfers": true,
"has_logs": true
}

Address activity

GET /api/v2/addresses/{hash}/transactions
GET /api/v2/addresses/{hash}/token-transfers
GET /api/v2/addresses/{hash}/internal-transactions
GET /api/v2/addresses/{hash}/token-balances
GET /api/v2/addresses/{hash}/tokens?type=ERC-20
GET /api/v2/addresses/{hash}/counters
GET /api/v2/addresses/{hash}/nft?type=ERC-721,ERC-1155
  • /transactions accepts filter=to, filter=from, or filter=to%20%7C%20from.
  • /token-transfers accepts type, filter, and token (contract address) parameters.
  • /counters returns aggregate counts (transactions, transfers, gas used) without pagination.

Tokens

GET /api/v2/tokens?q={query}&type=ERC-20
GET /api/v2/tokens/{hash}
GET /api/v2/tokens/{hash}/transfers
GET /api/v2/tokens/{hash}/holders
GET /api/v2/tokens/{hash}/instances
GET /api/v2/tokens/{hash}/instances/{token_id}

Full field-by-field details are in the Tokens API Reference.


Smart contracts

List verified contracts

GET /api/v2/smart-contracts

Query parameters: q (name filter), filter (solidity, vyper, yul).

Get a contract

GET /api/v2/smart-contracts/{hash}
curl https://xdcscan.io/api/v2/smart-contracts/0xabcdefabcdefabcdefabcdefabcdefabcdefabcd

Returns name, compiler_version, optimization_enabled, source_code, abi, is_verified, is_partially_verified, and verified_at for verified contracts.

Read from a contract

GET /api/v2/smart-contracts/{hash}/methods-read
POST /api/v2/smart-contracts/{hash}/query-read-method

List read-only methods, then query one by posting { "args": [...], "method_id": "..." }. For read/write interaction from a wallet, use the explorer UIโ€™s contract tabs โ€” see Contract Verification.


GET /api/v2/search?q={query}
GET /api/v2/search/quick?q={query}
GET /api/v2/search/check-redirect?q={query}
  • /search โ€” full results across tokens, addresses, transactions, blocks, and contracts.
  • /search/quick โ€” compact matches for autocomplete widgets.
  • /search/check-redirect โ€” returns the canonical entity URL for a query (useful for โ€œIโ€™m feeling luckyโ€ search boxes).

See the Search & Filtering Guide for usage patterns.


Main-page helpers

Endpoints that power the explorer home page, useful for dashboards:

GET /api/v2/main-page/blocks
GET /api/v2/main-page/transactions
GET /api/v2/main-page/indexing-status

indexing-status reports how far the indexer has caught up โ€” check it before assuming recent data is complete on a self-hosted instance.


Next steps

  • Quick Start โ€” runnable first calls
  • Examples โ€” portfolio tracker, whale alerts, CSV exports
  • Account API โ€” keys, watchlists, and private tags