Getting Started
Use the Block Explorer for manual lookup or the XNDR Network REST API for server-side integrations. An operator-issued API key is optional.
Use the Block Explorer
The Block Explorer looks up complete hashes, not keywords. Start with a blockHash or contentHash from an ALX Block you created or received.
- Open the Block Explorer.
- Search using the complete
blockHashorcontentHash. - Review the matching Block's fields, source observations, declared parents, and indexed children.
- Copy the result's
blockHashif you want to query the same Block through the API.
Understanding Search Results
blockHash identifies one ALX Block. contentHash identifies content that several Blocks may share. The selected scope identifies the configured sources included in the query. A matching result reports a Block indexed in that scope; an empty result means the scope has no matching record.
| ALX Protocol defines | The selected scope observes | |
|---|---|---|
| Block fields | Canonical Block fields. Identity, content, and optional protocol version are independent of the index. blockHash · contentHash · content · protocolVersion | Source observations. Which sources reported the Block and when the scope observed the Block. observedSources · firstObservedAt · lastObservedAt |
| Block relationships | Declared parents. Exactly what the Block declares, whether or not the scope holds each record. parentHashes | Indexed children. Blocks in the scope that declare this Block as a parent. An absent child is unobserved, never disproven. indexedChildren · indexedChildCount |
Build with the API
The REST API returns structured JSON over HTTP GET for scripts and services.
1. Choose a Base URL and Optional Key
The production API is https://xndr.network/api/v1; a local index serves http://127.0.0.1:4173/api/v1. Set XNDR_API_BASE_URL for another deployment.
Send X-XNDR-API-Key only when an operator has issued a key. See the API Overview for authentication, rate tiers, and key errors.
2. Make a REST Request
Check the available scopes, then request the copied blockHash.
: "${XNDR_API_BASE_URL:=https://xndr.network/api/v1}"
curl --request GET \
--url "${XNDR_API_BASE_URL}/scopes" \
--header "Accept: application/json"
# Replace 0x... with a complete blockHash from the Block Explorer.
BLOCK_HASH="0x..."
curl --request GET \
--url "${XNDR_API_BASE_URL}/blocks/${BLOCK_HASH}" \
--header "Accept: application/json" \
${XNDR_API_KEY:+--header "X-XNDR-API-Key: ${XNDR_API_KEY}"}
GET /scopes returns the configured scopes. The response returns data, scope, and page; a Block missing from the selected scope returns 404 block_not_found.
3. Query a Block from Code
Set XNDR_BLOCK_HASH to the same complete hash before running either example. Use a server process. A browser on another origin cannot call the REST API directly, because the REST API sends no CORS headers.
- JavaScript / TypeScript
- Python
const baseUrl = process.env.XNDR_API_BASE_URL ?? 'https://xndr.network/api/v1';
const blockHash = process.env.XNDR_BLOCK_HASH; // a complete 0x-prefixed Block hash
const headers = { Accept: 'application/json' };
if (process.env.XNDR_API_KEY) {
headers['X-XNDR-API-Key'] = process.env.XNDR_API_KEY;
}
const response = await fetch(
`${baseUrl}/blocks/${blockHash}?scope=default`,
{ headers }
);
const envelope = await response.json();
if (!response.ok) {
throw new Error(`${envelope.error.code}: ${envelope.error.message}`);
}
const { block } = envelope.data;
console.log(block.blockHash, block.contentHash, block.parentHashes.length);
console.log(envelope.scope.id, envelope.scope.indexRevision, envelope.scope.completeness);
import json
import os
import urllib.request
base_url = os.environ.get("XNDR_API_BASE_URL", "https://xndr.network/api/v1")
block_hash = os.environ["XNDR_BLOCK_HASH"] # a complete 0x-prefixed Block hash
request = urllib.request.Request(f"{base_url}/blocks/{block_hash}?scope=default")
request.add_header("Accept", "application/json")
if os.environ.get("XNDR_API_KEY"):
request.add_header("X-XNDR-API-Key", os.environ["XNDR_API_KEY"])
with urllib.request.urlopen(request, timeout=20) as response:
envelope = json.load(response)
block = envelope["data"]["block"]
print(block["blockHash"], block["contentHash"], len(block["parentHashes"]))
print(envelope["scope"]["id"], envelope["scope"]["indexRevision"], envelope["scope"]["completeness"])
For Python integrations, urllib raises HTTPError for 4xx and 5xx responses. Read the response body to access the structured { "error": { "code", "message" } } object.
Security
Interpret Results
Use the scope ID, index revision, and completeness value when displaying or processing results. Keep canonical Block fields separate from scope-specific observations.