Corpus Core Docs

REST API

The Colibri Stateless server provides a comprehensive REST API for generating and verifying cryptographic proofs for blockchain data. This API enables lightweight, stateless verification of Ethereum and Layer-2 blockchain operations.

Overview

The API consists of the following main categories:

  • Proof Generation - Create cryptographic proofs for blockchain data
  • Proof Verification - Verify proofs and execute JSON-RPC requests
  • Beacon Chain API - Light client sync endpoints for Ethereum consensus layer
  • Health & Monitoring - Server health checks and Prometheus metrics
  • Configuration - Server configuration management (requires WEB_UI_ENABLED)

OpenAPI Specification

The complete API is documented using OpenAPI 3.1.0 specification. You can access the specification in the following ways:

Live Server Endpoint

If you have a running Colibri server instance, the OpenAPI specification is available at:

http://localhost:8090/openapi.yaml

Replace localhost:8090 with your server's host and port.

Static Specification

The specification is also available in the source repository at:

src/server/openapi.yaml

Interactive API Documentation

The OpenAPI specification below provides interactive documentation for all available endpoints.

Note: First, add the OpenAPI specification to GitBook via the OpenAPI panel or CLI, then replace colibri-api below with your spec name.

Endpoints

POST/rpc
Verify and Execute JSON-RPC Request

Processes a JSON-RPC request by generating (locally) or fetching (remotely) a proof, verifying it, and returning the verified JSON-RPC response.

This endpoint combines proof generation and verification in one call, providing a transparent interface for verified blockchain data access.

Supported Methods: Same as /proof endpoint

Server: http://127.0.0.1:8090

Request Body application/json

  • jsonrpcstringrequired

    JSON-RPC version

    Values: 2.0
  • methodstringrequired

    RPC method name

    Example: "eth_call"
  • paramsobject[]required

    Method parameters

  • idstring | number | nullrequired

    Request identifier

Examples
eth_call example
{
  "jsonrpc": "2.0",
  "method": "eth_call",
  "params": [
    {
      "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "data": "0x06fdde03"
    },
    "latest"
  ],
  "id": 1
}
eth_getBalance example
{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": [
    "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "latest"
  ],
  "id": 1
}

Responses

200 Request verified and executed successfully
application/json
500 Internal server error
application/json
  • errorstringrequired

    Error message

POST/proof
Generate Proof

Generates a cryptographic proof for a JSON-RPC request.

This endpoint accepts standard JSON-RPC requests with additional optional properties:

  • c4: Hex-encoded state of the requested client for proof decisions
  • include_code: Include bytecode in eth_call proofs

The response is an SSZ-encoded C4Request container defined in the Ethereum Main Proof Request specification.

Supported Methods:

  • eth_call - Execute contract call with proof
  • eth_getBalance - Get account balance with proof
  • eth_getStorageAt - Get storage value with proof
  • eth_getTransactionByHash - Get transaction with proof
  • eth_getTransactionReceipt - Get receipt with proof
  • eth_getLogs - Get logs with proof
  • eth_getBlockByNumber - Get block data with proof
  • eth_getBlockByHash - Get block data with proof
  • eth_getCode - Get contract code with proof
  • And more...
Server: http://127.0.0.1:8090

Request Body application/json

Examples
eth_call example
{
  "jsonrpc": "2.0",
  "method": "eth_call",
  "params": [
    {
      "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "data": "0x06fdde03"
    },
    "latest"
  ],
  "id": 1,
  "include_code": true
}
eth_getBalance example
{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": [
    "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "latest"
  ],
  "id": 1
}
eth_getStorageAt example
{
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": [
    "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "0x0",
    "latest"
  ],
  "id": 1
}

Responses

200 Proof generated successfully
application/octet-stream

SSZ-encoded C4Request container. See the C4Request specification for detailed structure.

The container includes:

  • version: 4-byte version (domain, major, minor, patch)
  • data: Union of different proof data types
  • proof: Union of different proof types
  • sync_data: Optional light client updates
500 Internal server error
application/json
  • errorstringrequired

    Error message

GET/proof/{method}/{block}/{version}/{zk}/{c4}

Open OpenAPI specification

GET/config.html
Get Configuration Web UI

Serves the web-based configuration interface for managing server settings.

Security Note: This endpoint is disabled by default. Enable it with WEB_UI_ENABLED=1 environment variable or the -u command-line flag. Only enable on trusted networks.

Server: http://127.0.0.1:8090

Responses

200 Configuration UI HTML page
text/html

HTML page with interactive configuration editor

403 Web UI is disabled
text/html

HTML error page explaining how to enable the Web UI

GET/config
Get Server Configuration

Returns the current server configuration as JSON.

Security Note: This endpoint is disabled by default. Enable it with WEB_UI_ENABLED=1.

Server: http://127.0.0.1:8090

Responses

200 Current server configuration
application/json
  • parametersobject[]required
    Fields
    • namestringrequired

      Parameter name

      Example: "port"
    • envstringrequired

      Environment variable name

      Example: "PORT"
    • descriptionstringrequired

      Human-readable parameter description

      Example: "Port to listen on"
    • typestringrequired

      Parameter type

      Values: int string key
    • valueobject

      Current parameter value (not included for 'key' type)

    • mininteger

      Minimum value (for 'int' type)

    • maxinteger

      Maximum value (for 'int' type)

403 Web UI is disabled
text/html
GET/health
Health Check

Returns the server health status and operational statistics.

Use this endpoint for monitoring and health checks in production deployments.

Server: http://127.0.0.1:8090

Responses

200 Server is healthy
application/json
  • statusstringrequired

    Overall health status

    Values: ok error
  • statsobjectrequired
    Fields
    • total_requestsintegerrequired

      Total number of requests processed since server start

      Example: 1523
    • total_errorsintegerrequired

      Total number of errors encountered

      Example: 12
    • last_sync_eventintegerrequired

      Timestamp of last sync committee event

      Example: 125705
    • last_request_timeintegerrequired

      Unix timestamp of last request

      Example: 1698234567
    • open_requestsintegerrequired

      Number of currently active requests

      Example: 3
500 Server is unhealthy
application/json
  • errorstringrequired

    Error message

GET/metrics
Prometheus Metrics

Returns Prometheus-compatible metrics for monitoring server performance and operations.

Configure your Prometheus instance to scrape this endpoint for comprehensive monitoring of proof generation, verification, and RPC operations.

Server: http://127.0.0.1:8090

Responses

200 Prometheus metrics
text/plain

Prometheus text-based exposition format

500 Internal server error
application/json
  • errorstringrequired

    Error message

GET/eth/v1/beacon/headers/{block_id}
Get Beacon Block Header

Retrieves the beacon block header for a given block identifier.

This endpoint is part of the Ethereum Beacon Chain API and is used for light client sync operations. Requests are proxied to configured beacon nodes.

Server: http://127.0.0.1:8090

Parameter

  • block_idstringpathrequired

    Block identifier. Can be one of:

    • head - Canonical head in node's view
    • genesis - Genesis block
    • finalized - Latest finalized block
    • <slot> - Specific slot number
    • <hex_root> - Hex-encoded block root with 0x prefix

Responses

200 Block header retrieved successfully
application/json
  • execution_optimisticbooleanrequired

    True if the response references an unverified execution payload

  • finalizedbooleanrequired

    True if the response references the finalized history

  • dataobjectrequired
    Fields
    • rootstring (hex)required
    • canonicalbooleanrequired
    • headerobjectrequired

      SignedBeaconBlockHeader object

400 Bad request - invalid input
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

404 Resource not found
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

500 Internal server error
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

GET/eth/v1/beacon/light_client/bootstrap/{block_root}
Get Light Client Bootstrap

Requests the LightClientBootstrap structure for a given post-Altair beacon block root.

This is used to initialize light clients with the current sync committee. See the Ethereum Consensus Specs for details.

Server: http://127.0.0.1:8090

Parameter

  • block_rootstring (hex)pathrequired

    Hex-encoded block root with 0x prefix

Responses

200 Light client bootstrap data
application/json
  • versionstringrequired
    Values: phase0 altair bellatrix capella deneb electra fulu
  • dataobjectrequired

    LightClientBootstrap structure

400 Bad request - invalid input
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

404 Resource not found
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

500 Internal server error
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

GET/eth/v1/beacon/light_client/updates
Get Light Client Updates

Requests LightClientUpdate instances in the sync committee period range [start_period, start_period + count), leading up to the current head.

Used for light client sync to track sync committee changes across periods. See the Ethereum Consensus Specs for details.

Server: http://127.0.0.1:8090

Parameter

  • start_periodstringqueryrequired

    Starting sync committee period

  • countstringqueryrequired

    Number of periods to request

Responses

200 Array of light client updates
application/json
  • versionstringrequired
    Values: phase0 altair bellatrix capella deneb electra fulu
  • dataobjectrequired

    LightClientUpdate structure

400 Bad request - invalid input
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

500 Internal server error
application/json
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

GET/openapi.yaml
Get OpenAPI Specification

Returns this OpenAPI specification document in YAML format

Server: http://127.0.0.1:8090

Responses

200 OpenAPI specification
text/yaml

Schemas

ProofRequest object
JsonRpcRequest object
  • jsonrpcstringrequired

    JSON-RPC version

    Values: 2.0
  • methodstringrequired

    RPC method name

    Example: "eth_call"
  • paramsobject[]required

    Method parameters

  • idstring | number | nullrequired

    Request identifier

JsonRpcResponse object
  • jsonrpcstringrequired
    Values: 2.0
  • resultobjectrequired

    Method result (type varies by method)

  • idstring | number | nullrequired
JsonRpcErrorResponse object
  • jsonrpcstringrequired
    Values: 2.0
  • errorobjectrequired
    Fields
    • codeintegerrequired

      JSON-RPC error code

      Example: -32000
    • messagestringrequired

      Error message

      Example: "execution reverted"
    • dataobject

      Additional error data (optional)

  • idstring | number | nullrequired
ErrorResponse object
  • errorstringrequired

    Error message

HealthResponse object
  • statusstringrequired

    Overall health status

    Values: ok error
  • statsobjectrequired
    Fields
    • total_requestsintegerrequired

      Total number of requests processed since server start

      Example: 1523
    • total_errorsintegerrequired

      Total number of errors encountered

      Example: 12
    • last_sync_eventintegerrequired

      Timestamp of last sync committee event

      Example: 125705
    • last_request_timeintegerrequired

      Unix timestamp of last request

      Example: 1698234567
    • open_requestsintegerrequired

      Number of currently active requests

      Example: 3
ConfigResponse object
  • parametersobject[]required
    Fields
    • namestringrequired

      Parameter name

      Example: "port"
    • envstringrequired

      Environment variable name

      Example: "PORT"
    • descriptionstringrequired

      Human-readable parameter description

      Example: "Port to listen on"
    • typestringrequired

      Parameter type

      Values: int string key
    • valueobject

      Current parameter value (not included for 'key' type)

    • mininteger

      Minimum value (for 'int' type)

    • maxinteger

      Maximum value (for 'int' type)

ConfigParameter object
  • namestringrequired

    Parameter name

    Example: "port"
  • envstringrequired

    Environment variable name

    Example: "PORT"
  • descriptionstringrequired

    Human-readable parameter description

    Example: "Port to listen on"
  • typestringrequired

    Parameter type

    Values: int string key
  • valueobject

    Current parameter value (not included for 'key' type)

  • mininteger

    Minimum value (for 'int' type)

  • maxinteger

    Maximum value (for 'int' type)

BeaconErrorResponse object
  • codeintegerrequired

    Error code or HTTP status code

  • messagestringrequired

    Error message

  • stacktracesstring[]

    Optional stack traces (debug mode only)

Quick Start Examples

Generate a Proof

Generate a cryptographic proof for an eth_getBalance request:

curl -X POST http://localhost:8090/proof \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", "latest"],
    "id": 1
  }' \
  --output proof.ssz

The response is an SSZ-encoded C4Request container. For details on the proof format, see the Ethereum Main Proof Request specification.

Verify and Execute a Request

Execute a JSON-RPC request with automatic proof verification:

curl -X POST http://localhost:8090/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", "latest"],
    "id": 1
  }'

Response:

{
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000",
  "id": 1
}

Execute a Smart Contract Call with Proof

Generate a proof for an eth_call request with bytecode included:

curl -X POST http://localhost:8090/proof \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{
      "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "data": "0x06fdde03"
    }, "latest"],
    "id": 1,
    "include_code": true
  }' \
  --output call_proof.ssz

The include_code property ensures that the contract bytecode is included in the proof, enabling fully stateless verification.

Update Configuration

Update server configuration programmatically (requires WEB_UI_ENABLED=1 and a config file):

curl -X POST http://localhost:8090/config \
  -H "Content-Type: application/json" \
  -d '{
    "parameters": [
      {"env": "PORT", "value": 8091},
      {"env": "RPC_NODES", "value": "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY"}
    ]
  }'

Response:

{
  "success": true,
  "restart_required": true,
  "message": "Configuration saved. Restart server to apply changes.",
  "updated_count": 2
}

Note: After a successful configuration update, the server automatically restarts (via exit(0)), relying on the service manager (systemd/launchd/docker-compose) to restart it with the new settings. This is automatically configured by the installer packages.

Health Check

Check the server's operational status:

curl http://localhost:8090/health

Response:

{
  "status": "ok",
  "stats": {
    "total_requests": 1523,
    "total_errors": 12,
    "last_sync_event": 125705,
    "last_request_time": 1698234567,
    "open_requests": 3
  }
}

Prometheus Metrics

Retrieve metrics for monitoring:

curl http://localhost:8090/metrics

Advanced Features

Client State Parameter

For historic block proofs, you can provide the client's state to optimize proof generation:

{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", "0x100000"],
  "id": 1,
  "c4": "0x1234567890abcdef..."
}

The c4 parameter is a hex-encoded representation of the client's current sync committee state, allowing the prover to determine which header proofs are necessary.

Supported JSON-RPC Methods

The following Ethereum JSON-RPC methods are supported with proof generation:

Account & Storage:

  • eth_getBalance
  • eth_getCode
  • eth_getStorageAt
  • eth_getProof

Transactions:

  • eth_getTransactionByHash
  • eth_getTransactionReceipt
  • eth_getTransactionCount

Blocks:

  • eth_getBlockByNumber
  • eth_getBlockByHash
  • eth_blockNumber

Contract Calls:

  • eth_call

Events & Logs:

  • eth_getLogs

Colibri-Specific:

  • colibri_simulateTransaction - Simulate transaction execution with proof

For a complete list of supported methods, see the Supported RPC Methods documentation.

Beacon Chain API

The server also provides light client endpoints from the Ethereum Beacon Chain API for sync committee updates:

  • GET /eth/v1/beacon/headers/{block_id} - Retrieve beacon block headers
  • GET /eth/v1/beacon/light_client/bootstrap/{block_root} - Initialize light client
  • GET /eth/v1/beacon/light_client/updates - Sync committee period updates

These endpoints are used internally by the verifier to maintain the current sync committee state and are also available for external light client implementations.

Error Handling

HTTP Status Codes

  • 200 OK - Request successful
  • 400 Bad Request - Invalid request format or parameters
  • 403 Forbidden - Web UI disabled (for /config and /config.html)
  • 404 Not Found - Endpoint or resource not found
  • 500 Internal Server Error - Server error during processing

Error Response Format

Error responses use the following JSON format:

{
  "error": "Error message describing what went wrong"
}

For JSON-RPC errors, the standard JSON-RPC error format is used:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32000,
    "message": "execution reverted"
  },
  "id": 1
}

Rate Limiting & Performance

The server is designed for high-performance proof generation and verification. Key performance characteristics:

  • Concurrent Requests: Multiple requests can be processed in parallel
  • Proof Generation: Typically 100-500ms depending on proof complexity
  • Proof Verification: Typically 50-200ms depending on proof size
  • Light Client Sync: Sync committee updates every ~27 hours

For production deployments, consider:

  • Using memcached for caching frequently requested proofs (configure via MEMCACHED_HOST and MEMCACHED_PORT)
  • Monitoring via Prometheus metrics at /metrics
  • Load balancing across multiple RPC nodes (configure via RPC_NODES)

Security Considerations

Web UI Access

The configuration endpoints (/config, /config.html, /api/restart) are disabled by default. WEB_UI_ENABLED=1 (or -u) turns them on with no authentication, no CSRF protection, and no origin check.

This UI is currently unused in typical deployments. Enable it only on trusted localhost, or behind an authenticating reverse proxy, and only if you accept the residual risk:

  • Any client that can reach the bind address can read and rewrite configuration (RPC/beacon URLs, TLS settings) and force exit(0) via POST /api/restart.
  • String parameter values are written into the config file as KEY=value lines. A value containing a newline can inject extra config keys, including ones the UI otherwise refuses to update (e.g. WITNESS_KEY).
  • There is no CONFIG_API_KEY (or similar) in the server; do not assume one exists.
# Environment variable
export WEB_UI_ENABLED=1

# Command line flag
./colibri-server -u

Network Binding

By default, the server binds to 127.0.0.1 (localhost only). To expose the server to other machines:

export HOST=0.0.0.0
export PORT=8090

Warning: Only expose the server to untrusted networks if you have proper security measures in place (firewall, authentication proxy, etc.).

Additional Resources