Skip to main content

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.

  1. Open the Block Explorer.
  2. Search using the complete blockHash or contentHash.
  3. Review the matching Block's fields, source observations, declared parents, and indexed children.
  4. Copy the result's blockHash if 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 definesThe selected scope observes
Block fieldsCanonical 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 relationshipsDeclared 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.

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);

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.