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
/rpcProcesses 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
http://127.0.0.1:8090Request Body application/json
jsonrpcstringrequiredJSON-RPC version
Values:2.0methodstringrequiredRPC method name
Example:"eth_call"paramsobject[]requiredMethod parameters
idstring | number | nullrequiredRequest identifier
Examples
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"data": "0x06fdde03"
},
"latest"
],
"id": 1
}{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"latest"
],
"id": 1
}Responses
200 Request verified and executed successfully
500 Internal server error
errorstringrequiredError message
/proofGenerates 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 decisionsinclude_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 proofeth_getBalance- Get account balance with proofeth_getStorageAt- Get storage value with proofeth_getTransactionByHash- Get transaction with proofeth_getTransactionReceipt- Get receipt with proofeth_getLogs- Get logs with proofeth_getBlockByNumber- Get block data with proofeth_getBlockByHash- Get block data with proofeth_getCode- Get contract code with proof- And more...
http://127.0.0.1:8090Request Body application/json
Examples
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"data": "0x06fdde03"
},
"latest"
],
"id": 1,
"include_code": true
}{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": [
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"latest"
],
"id": 1
}{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": [
"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"0x0",
"latest"
],
"id": 1
}Responses
200 Proof generated successfully
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 typesproof: Union of different proof typessync_data: Optional light client updates
500 Internal server error
errorstringrequiredError message
/proof/{method}/{block}/{version}/{zk}/{c4}/config.htmlServes 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.
http://127.0.0.1:8090Responses
200 Configuration UI HTML page
HTML page with interactive configuration editor
403 Web UI is disabled
HTML error page explaining how to enable the Web UI
/configReturns the current server configuration as JSON.
Security Note: This endpoint is disabled by default. Enable it with WEB_UI_ENABLED=1.
http://127.0.0.1:8090Responses
200 Current server configuration
parametersobject[]requiredFields
namestringrequiredParameter name
Example:"port"envstringrequiredEnvironment variable name
Example:"PORT"descriptionstringrequiredHuman-readable parameter description
Example:"Port to listen on"typestringrequiredParameter type
Values:intstringkeyvalueobjectCurrent parameter value (not included for 'key' type)
minintegerMinimum value (for 'int' type)
maxintegerMaximum value (for 'int' type)
403 Web UI is disabled
/config/healthReturns the server health status and operational statistics.
Use this endpoint for monitoring and health checks in production deployments.
http://127.0.0.1:8090Responses
200 Server is healthy
statusstringrequiredOverall health status
Values:okerrorstatsobjectrequiredFields
total_requestsintegerrequiredTotal number of requests processed since server start
Example:1523total_errorsintegerrequiredTotal number of errors encountered
Example:12last_sync_eventintegerrequiredTimestamp of last sync committee event
Example:125705last_request_timeintegerrequiredUnix timestamp of last request
Example:1698234567open_requestsintegerrequiredNumber of currently active requests
Example:3
500 Server is unhealthy
errorstringrequiredError message
/metricsReturns 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.
http://127.0.0.1:8090Responses
200 Prometheus metrics
Prometheus text-based exposition format
500 Internal server error
errorstringrequiredError message
/eth/v1/beacon/headers/{block_id}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.
http://127.0.0.1:8090Parameter
block_idstringpathrequiredBlock identifier. Can be one of:
head- Canonical head in node's viewgenesis- Genesis blockfinalized- Latest finalized block<slot>- Specific slot number<hex_root>- Hex-encoded block root with 0x prefix
Responses
200 Block header retrieved successfully
execution_optimisticbooleanrequiredTrue if the response references an unverified execution payload
finalizedbooleanrequiredTrue if the response references the finalized history
dataobjectrequiredFields
rootstring (hex)requiredcanonicalbooleanrequiredheaderobjectrequiredSignedBeaconBlockHeader object
400 Bad request - invalid input
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
404 Resource not found
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
500 Internal server error
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
/eth/v1/beacon/light_client/bootstrap/{block_root}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.
http://127.0.0.1:8090Parameter
block_rootstring (hex)pathrequiredHex-encoded block root with 0x prefix
Responses
200 Light client bootstrap data
versionstringrequiredValues:phase0altairbellatrixcapelladenebelectrafuludataobjectrequiredLightClientBootstrap structure
400 Bad request - invalid input
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
404 Resource not found
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
500 Internal server error
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
/eth/v1/beacon/light_client/updatesRequests 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.
http://127.0.0.1:8090Parameter
start_periodstringqueryrequiredStarting sync committee period
countstringqueryrequiredNumber of periods to request
Responses
200 Array of light client updates
versionstringrequiredValues:phase0altairbellatrixcapelladenebelectrafuludataobjectrequiredLightClientUpdate structure
400 Bad request - invalid input
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
500 Internal server error
codeintegerrequiredError code or HTTP status code
messagestringrequiredError message
stacktracesstring[]Optional stack traces (debug mode only)
/openapi.yamlReturns this OpenAPI specification document in YAML format
http://127.0.0.1:8090Responses
200 OpenAPI specification
Schemas
ProofRequest object
JsonRpcRequest object
jsonrpcstringrequiredJSON-RPC version
Values:2.0methodstringrequiredRPC method name
Example:"eth_call"paramsobject[]requiredMethod parameters
idstring | number | nullrequiredRequest identifier
JsonRpcResponse object
jsonrpcstringrequiredValues:2.0resultobjectrequiredMethod result (type varies by method)
idstring | number | nullrequired
JsonRpcErrorResponse object
jsonrpcstringrequiredValues:2.0errorobjectrequiredFields
codeintegerrequiredJSON-RPC error code
Example:-32000messagestringrequiredError message
Example:"execution reverted"dataobjectAdditional error data (optional)
idstring | number | nullrequired
ErrorResponse object
errorstringrequiredError message
HealthResponse object
statusstringrequiredOverall health status
Values:okerrorstatsobjectrequiredFields
total_requestsintegerrequiredTotal number of requests processed since server start
Example:1523total_errorsintegerrequiredTotal number of errors encountered
Example:12last_sync_eventintegerrequiredTimestamp of last sync committee event
Example:125705last_request_timeintegerrequiredUnix timestamp of last request
Example:1698234567open_requestsintegerrequiredNumber of currently active requests
Example:3
ConfigResponse object
parametersobject[]requiredFields
namestringrequiredParameter name
Example:"port"envstringrequiredEnvironment variable name
Example:"PORT"descriptionstringrequiredHuman-readable parameter description
Example:"Port to listen on"typestringrequiredParameter type
Values:intstringkeyvalueobjectCurrent parameter value (not included for 'key' type)
minintegerMinimum value (for 'int' type)
maxintegerMaximum value (for 'int' type)
ConfigParameter object
namestringrequiredParameter name
Example:"port"envstringrequiredEnvironment variable name
Example:"PORT"descriptionstringrequiredHuman-readable parameter description
Example:"Port to listen on"typestringrequiredParameter type
Values:intstringkeyvalueobjectCurrent parameter value (not included for 'key' type)
minintegerMinimum value (for 'int' type)
maxintegerMaximum value (for 'int' type)
BeaconErrorResponse object
codeintegerrequiredError code or HTTP status code
messagestringrequiredError 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_getBalanceeth_getCodeeth_getStorageAteth_getProof
Transactions:
eth_getTransactionByHasheth_getTransactionReceipteth_getTransactionCount
Blocks:
eth_getBlockByNumbereth_getBlockByHasheth_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 headersGET /eth/v1/beacon/light_client/bootstrap/{block_root}- Initialize light clientGET /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
/configand/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_HOSTandMEMCACHED_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)viaPOST /api/restart. - String parameter values are written into the config file as
KEY=valuelines. 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.).