<!-- Source: https://docs.paxeer.app/relay-archive/ -->

# Relay & Archive Nodes

Operate independent public history, retain canonical network bytes, and forward signed activities without taking sequencer authority.

## Independent access to network history

A Paxeer X relay/archive follows an existing LayerX network, stores complete canonical history and serves public reads. It forwards the user's original signed activities to explicitly configured submission endpoints. Its role is distribution and durable history: ordering, state execution and finality quorum participation belong to the sequencer and guarantors.

| Role | Responsibility | Authority |
| --- | --- | --- |
| Relay/archive | Verify and retain canonical history, answer queries, forward signed activities | Pinned network and sequencer identity; no sequencer signing key |
| Sequencer | Order activities and sign batch history | Authorized sequencer key and batch range |
| Guarantor | Replay transitions and attest matching results | Configured guarantor membership and bonds |
| Hosted gateway | Provide authenticated RPC and receipt subscriptions | API credentials, scopes and verified upstream evidence |

## Pin trust before synchronization

Configure `network_id`, the SHA-256 of the exact signed genesis manifest, the sequencer identifier and its Ed25519 public key. Optionally restrict the sequencer's first and last authorized batch. Obtain these values independently of synchronization servers.

`GET /v1/sync/network` provides discovery metadata. The archive checks every fetched manifest, snapshot and batch against its pins and native canonical codecs, refusing changed network identity, invalid signatures, batch gaps, predecessor mismatches and incorrect section roots.

## Install and run

The release bundle contains `layerxd`, `layerx-archive-codec`, the Python runtime modules, a service unit and `manifest.sha256`. Verify the release manifest through an independent channel. The installer creates an unprivileged service account and enables `layerx-relay-archive.service`; non-loopback listeners require TLS.

```
layerxd --relay-archive /etc/layerx/relay-archive.json
```

The daemon starts the installed standard-library Python runtime and uses `layerx-archive-codec` for signed bootstrap and batch verification. Configure durable storage through `data_dir`, read origins through `upstreams` and submission destinations through `submission_upstreams`.

| Setting | Purpose |
| --- | --- |
| `listen`, `public_url` | Listener and advertised origin |
| `poll_interval_seconds`, `request_timeout_seconds` | Synchronization cadence and bounded upstream waits |
| `max_activity_bytes`, `max_batch_bytes`, `max_response_bytes` | Bound incoming and fetched data |
| `history_page_limit`, `max_history_page_limit` | Default and maximum history page sizes |
| `peer_discovery` | Compatible, bounded and expiring read-peer advertisements |
| `source_lni_socket`, `source_submission_token_file` | Optional local native submission integration; never publicly advertised |

Use credential-free URLs without query strings or fragments. Explicit `allow_loopback_dev` and a literal loopback endpoint enable local HTTP development. Loopback peers remain excluded from public advertisements.

## Durable history and restart

The archive atomically stores raw genesis, snapshot, batches, activities, receipts and maintenance records before advancing its head. Restart resumes at the durable next-batch position. Conflicting bytes and gaps are refused rather than concealed by advancing the cursor.

This is durable history recovery. Execution replay is a separate operation performed by nodes and guarantors using authenticated batch data. An archive's inclusion label means native verification proved a record belongs to its committed batch.

## Synchronization endpoints

| GET route | Result |
| --- | --- |
| `/v1/sync/network` | Network, genesis, snapshot and sequencer discovery metadata |
| `/v1/sync/genesis` | Exact signed genesis-manifest bytes |
| `/v1/sync/snapshot` | Exact canonical genesis-snapshot bytes |
| `/v1/sync/head` | Head batch, its identifiers and the next batch |
| `/v1/sync/batches/N` | Verified, durably committed canonical batch bytes |
| `/v1/peers` | Bounded compatible-peer advertisements |
| `/healthz`, `/readyz` | Process liveness and pinned-bootstrap/durable-sync readiness |

Raw responses include `Content-Length`, a quoted SHA-256 `ETag` and `X-Content-SHA256`; batches also include `X-LayerX-Batch`. Synchronization clients refuse redirects.

## Query canonical history

```
# Replace this example origin with your archive's HTTPS origin.
curl -sS 'https://archive.example.net/v1/history/activities?limit=100'
curl -sS 'https://archive.example.net/v1/history/receipts?limit=100&batch=12'
curl -sS 'https://archive.example.net/v1/history/batches/12'
```

List routes return `{version:1, items:[...], next_cursor:string|null}`. Continue using the returned cursor until it is null. Activity and receipt details include `canonical_hex` for exact-byte verification.

| Collection | List filters | Detail selector |
| --- | --- | --- |
| `/v1/history/activities` | cursor, limit, actor, account, module, batch | Activity ID |
| `/v1/history/receipts` | cursor, limit, batch | Activity ID |
| `/v1/history/batches` | cursor, limit | Batch number |
| `/v1/history/maintenance` | cursor, limit, batch | Maintenance cursor |

Append the detail selector to the collection route. IDs and digests use 64 lowercase hexadecimal characters; batch numbers use canonical unsigned decimal.

## Forward original signed activities

`POST /v1/activities` accepts bounded original signed activity bytes and an optional `Idempotency-Key`. The relay preserves the exact bytes. Incoming `Authorization` or `LayerX-Key` credentials go only to configured submission endpoints.

Peer discovery extends read synchronization and never changes submission failover. A newly discovered archive cannot become a destination for private credentials or signed submissions.

### Archive JSON-RPC subset

`POST /rpc` serves `lx_getNodeInfo`, `lx_getArchiveNetwork`, `lx_getArchiveHead`, `lx_getActivityStatus`, `lx_getReceipt`, `lx_getBatchHeader`, `lx_listActivities` and `lx_listBatches`, and forwards `lx_sendActivity`.

## Receipt subscriptions and durable reconciliation

Receipt WebSocket subscriptions belong to the hosted gateway at `GET /rpc/ws`. Authenticate with `LayerX-Key` and `receipt:read`; checkpoint and account topics require `state:read`. Use the archive's history queries for durable reconciliation beyond the subscription resume window.

```
{"jsonrpc":"2.0","id":1,"method":"lx_subscribe","params":["receipts","41"]}
```

On the WebSocket, this resumes receipts after cursor `41`. Persist each delivered `params.cursor` with the event your application accepts. The resume window is 16 positions: a wider gap returns `-32005`, an ahead-of-head cursor returns `-32602`, and an unavailable feed returns `-32001`. Reconcile through reads and create a fresh subscription when resume is refused. Sending subscription methods to HTTPS `POST /rpc` returns `-32004`.

See [Receipts & Proofs](https://docs.paxeer.app/proofs), [Data Availability](https://docs.paxeer.app/data-availability) and [External Mirrors](https://docs.paxeer.app/mirrors) for independent verification and historical evidence.
