vcp-explorer-api

VCP Explorer API

Status correction — 25 October 2026

Package version License

Express / TypeScript HTTP API for exploring sample VeritasChain Protocol (VCP) events. This repository contains the API server, in-memory fixtures, API documentation, and client integration types.

Default implementation status: the existing /v1/events, system and entity routes return mock data. Event hashes, signatures, Merkle paths, anchors, certification statuses, and system statistics are demonstration values, not verified evidence or a live certification registry. These routes retrieve proof fixtures and assemble JSON certificates; they do not perform cryptographic verification, contact an external anchor, or persist events.

Optional SDK evidence demonstration: /v1/evidence-demo can be enabled with an explicitly configured local VCP SDK build, its generated signed event bundle, and a separate trust configuration. The API recomputes hash, signature, batch, chain and inclusion checks for intact, tampered and missing-key cases. The intact case passes the local checks while its overall result stays INDETERMINATE because no external anchor is verified. See SDK → API → GUI evidence demonstration for setup, the response contract and the public test-key scope. Ordinary installation and the existing fixture routes do not require the SDK.

Quick Start

Requires Node.js 24.22.1 or a later 24.x patch and npm 11+, as declared in package.json. Development and CI use 24.22.1 from .nvmrc. .npmrc enforces the declared engine requirements.

This baseline includes the October 2026 Node.js security fixes. Node.js 18.x and 20.x are end-of-life and are not supported.

git clone https://github.com/veritaschain/vcp-explorer-api.git
cd vcp-explorer-api
nvm install
nvm use
npm ci
npm run dev

If you do not use nvm, install Node.js 24.22.1 (or a later 24.x patch) through your runtime manager before running npm. For an existing deployment, update the host or container runtime, restart the API process, and verify node --version in that running environment; changing this repository does not update a server.

The development command runs tsx watch src/index.ts. The API listens on port 3001 by default, with versioned routes under http://localhost:3001/v1.

In a second terminal:

curl --fail http://localhost:3001/health
curl --fail "http://localhost:3001/v1/events?symbol=XAUUSD&limit=5"
curl --fail http://localhost:3001/v1/events/01934e3a-7b2c-7f93-8f2a-1234567890ab
curl --fail http://localhost:3001/v1/events/01934e3a-7b2c-7f93-8f2a-1234567890ab/proof
curl --fail http://localhost:3001/v1/events/01934e3a-7b2c-7f93-8f2a-1234567890ab/certificate

These requests demonstrate the JSON interface using bundled fixtures. There is no GUI, browser-launch step, React application, or Vite build in this repository.

Compile and run

npm run type-check
npm run build
npm start

build invokes TypeScript with tsconfig.json, compiling src/ into dist/ (JavaScript, declarations, and source maps). start runs node dist/index.js; dist/ is server output, not a static website.

CI requires lint, strict type-checking, compilation, and HTTP regression tests to pass on Node.js 24.22.1. Run npm run lint && npm run type-check && npm run build && npm test before deploying. The tests run the compiled server and exercise successful and error responses, CORS error handling, and the rate limit.

Configuration

Setting Current behavior
PORT Read from the process environment; defaults to 3001
Environment files No dotenv loader; .env / .env.local are not loaded automatically
CORS Allowlist in src/index.ts: https://veritaschain.org, https://explorer.veritaschain.org, http://localhost:3000, http://localhost:5173; requests without an Origin header are also allowed
Rate limit 60 requests per minute per IP on /v1/; standard rate-limit headers enabled, legacy X-RateLimit-* headers disabled
Authentication No authentication middleware is implemented
Storage In-memory mock data in src/data/; no database configuration
Optional evidence demo Explicit local VCP_EVIDENCE_BUNDLE, VCP_EVIDENCE_TRUST, and VCP_EVIDENCE_SDK_MODULE; see configuration

For example, in a POSIX shell:

PORT=3002 npm run dev

Helmet provides response security headers and Morgan logs requests. CORS and rate limiting are configured in code, not through VITE_* environment variables.

API

All routes below are implemented as GET endpoints. Paths include the /v1 prefix where applicable.

Endpoint Response / behavior
/ Service metadata and a partial endpoint listing
/health Health status, timestamp, and service metadata
/v1/system/status Mock event totals, node count, tier, and last-anchor metadata
/v1/events Filtered event summaries as { events, query, total }
/v1/events/recent Recent sample summaries as { events }; default limit 10, capped at 100
/v1/events/:id Event detail with header, payload, and security
/v1/events/:id/proof Stored Merkle-proof fixture and anchor metadata
/v1/events/:id/certificate JSON assembled from event details and a proof fixture
/v1/certified/entities Mock organization entries as { entities }

Event detail payloads contain trade_data and optional vcp_risk / vcp_gov modules. Integer timestamps and financial quantities are represented as strings in the fixtures. The detail, proof, and certificate routes validate UUID v7 syntax and return 400 for invalid IDs or 404 for missing data. Only the sample event ending in 7890ab has a bundled proof and certificate.

Search behavior

Implemented filters are trace_id, symbol, event_type, venue_id, algo_id, start_time, and end_time. The algo_id filter matches payload.vcp_gov.algo_id in the available detailed fixtures; a summary without matching detail is excluded rather than assigned an inferred algorithm.

Each supplied filter must be one non-empty string. Arrays, nested objects, duplicate query values and empty strings return 400 invalid_parameter before the data source is queried. An unsupported event_type returns 400 invalid_event_type. The search accepts the 27 names in the fixed VCP v1.2 structured schema and retains six legacy fixture names (PRT, REJ, ALG, AUD, REC, SNC), for 33 accepted names in total. New registered names without bundled data return an empty page. This changes filtering vocabulary only: fixture payloads, signatures, legacy numeric codes and verification outcomes are unchanged. The client/OpenAPI EventSearchType is distinct from the legacy fixture response EventType.

Time filters accept the parser’s RFC3339 form: uppercase T, Z or a numeric UTC offset, and zero to nine fractional digits. Invalid calendar dates, unsupported timestamp forms and a start later than the end return 400 invalid_parameter. Boundaries are inclusive. JavaScript Date is used only to convert whole seconds; fractional seconds and comparisons use bigint nanoseconds, preserving one-nanosecond differences. This is search filtering, not verification of timestamp provenance or clock accuracy.

Pagination uses offset (default 0) and limit (default 50, capped at 500). Supplied values must be single unsigned decimal strings within JavaScript’s safe-integer range: offset may be zero, and limit must be positive. Invalid values return 400 invalid_parameter; valid limits above 500 are capped. Search rejects unknown query parameter names with 400 invalid_parameter before querying data. In particular, event_id and hash are not search filters; use /v1/events/:id for an event ID. /v1/events/recent accepts only limit and rejects other query names. Supported requests and requests with no query parameters retain their existing behavior.

The response total is the number of events in the returned page, not a count before pagination. Search returns summaries; fetch /v1/events/:id for payloads.

The existing JSON/form body parsers return 400 invalid_body for malformed input or excessive form nesting, 413 payload_too_large for a body or form parameter count over their limits, and 415 unsupported_media_type for an unsupported charset or content encoding. Responses contain generic messages, without the supplied body or parser diagnostics. These errors occur before route selection and do not add POST endpoints. Other runtime errors retain the existing 500 internal_error behavior.

Differences from the integration documents

API_REFERENCE.md, DEVELOPER_GUIDE.md, openapi.yaml, and types.ts describe the v1.1 API and client integration examples. Some descriptions are ahead of the server:

For actual behavior, consult src/routes/ and src/data/. Use the canonical specification when implementing verification; the bundled examples are not a conformance test suite.

Project Structure

Path Purpose
src/index.ts Express entry point, middleware, route mounting, health endpoint
src/routes/system.ts System-status route
src/routes/events.ts Search, recent events, details, proofs, and certificates
src/routes/entities.ts Mock organization-list route
src/data/ Mock fixtures and data-source classes
src/middleware/rateLimiter.ts Rate-limit definitions
src/types/index.ts Types imported by the server
types.ts Separate client integration types and helpers; outside the server build
API_REFERENCE.md Detailed API descriptions and response examples
DEVELOPER_GUIDE.md Client integration and SDK-generation examples
openapi.yaml OpenAPI 3.1 integration description
package.json / tsconfig.json Dependencies, scripts, and compiler settings
.github/workflows/ci.yml Existing CI workflow
dist/ Generated server build output

The runtime dependencies are Express, CORS, Helmet, Morgan, and express-rate-limit. Development uses TypeScript and tsx.

Development

Command Purpose
npm run dev Watch and run the TypeScript server
npm run type-check TypeScript checking without emitting files
npm run build Compile the server
npm start Run compiled server output
npm run lint Check source with ESLint
npm run format Format src/**/*.ts with Prettier

npm test exercises the compiled API; run npm run build first. To contribute, create a branch, describe the change and its validation, and open a pull request.

VCP Specification and Versioning

API package versions, URL versions, and protocol versions are separate:

Item Current reference
This API package 1.1.0 in package.json
HTTP route namespace /v1
Bundled certificate metadata system.vcp_version: "1.0" (mock data)
Canonical VCP specification veritaschain/vcp-spec, authoritative files under spec/

Canonical status checked on 2026-10-25 (JST): VCP v1.2 is Released. The v1.2.0 tag now exists in veritaschain/vcp-spec and points to commit b23acb2. (When this section was first written on 2026-10-08, the tag was not yet present.)

See the canonical v1.2 documents and status for updates. A specification status does not establish this API’s conformance; this repository has not demonstrated v1.2 conformance. Historical v1.0 fixture values are not automatically upgraded by changing a documentation link.

License

Repository license source of truth: LICENSE, which identifies Apache License 2.0. Package, OpenAPI, and documentation license metadata use Apache-2.0 to match it.

Copyright © 2025 VeritasChain Standards Organization (VSO).

The separately maintained VCP specification is licensed under CC BY 4.0 in its own repository; that specification license is distinct from this API’s license.

Support