Using the Block Explorer API
The Prividium Block Explorer provides a REST API for querying blockchain data such as transactions, accounts, blocks, and contracts. Like other Prividium services, the API requires authentication.
Authentication
The Block Explorer API uses the same authentication mechanism as other Prividium services. You must obtain an access token using the SIWE authentication flow and include it as a Bearer token in your requests.
Request Headers
| Header | Value |
|---|---|
Authorization | Bearer <access-token> |
API Documentation
The full API documentation is available at your Block Explorer API service:
https://<your-block-explorer-api>/docs
This Swagger UI provides interactive documentation for all available endpoints.
Example Request
# First, obtain a token using the SIWE flow (see programmatic token management guide)
TOKEN="your-access-token"
# Query the API with the Bearer token
curl -X GET "https://block-explorer-api.prividium.dev/api/stats" \
-H "Authorization: Bearer $TOKEN"Example with JavaScript
explorer.ts
const BLOCK_EXPLORER_API = 'http://localhost:3002';
async function queryBlockExplorer(token: string, endpoint: string) {
const response = await fetch(`${BLOCK_EXPLORER_API}${endpoint}`, {
headers: {
Authorization: `Bearer ${token}`
}
});
return response.json();
}
// Usage
export async function getExplorerData() {
const session = await prividium.authorize();
const token = session.rawToken;
const stats = await queryBlockExplorer(token, '/api/stats/ethprice');
const txlist = await queryBlockExplorer(token, `/api?module=account&action=txlist&address=${ACCOUNT_ADDRESS}`);
return { stats, txlist };
}Next Steps
- Programmatic Token Management - Learn how to obtain and refresh access tokens
- Contract Deployment and Scripting - Deploy contracts and interact with the RPC