Skip to content
Prividium

Service Integration

This document explains how external services (such as indexers) can integrate with Prividium to access chain data and verify user permissions.

Overview

Services can integrate with Prividium in two ways:

  1. Service RPC Endpoint - Access chain data for indexing (blocks, logs, transactions)
  2. Check Read Access Endpoint - Verify if a user has read permissions before serving data

Service Authentication

Services authenticate using a service token in the Authorization header. The Prividium™ api validates that the caller is a registered service entity before processing requests.

Service RPC Access

Available Methods

The following JSON-RPC methods are available for services (typically used for chain indexing):

MethodDescription
eth_blockNumberGet the current block number
eth_getLogsQuery event logs with filters
eth_getTransactionByHashGet transaction details by hash
eth_getTransactionReceiptGet transaction receipt by hash
eth_getBlockByNumberGet a block by block number

Example Request

curl -X POST http://localhost:8000/rpc \
  -H "Authorization: Bearer <service_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
  }'

Example Response

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

Verifying User Read Access

When a service needs to serve indexed data to a user, it should verify that the user has read permissions.

Endpoint

POST http://localhost:8000/api/service-actions/check-read-access

Request Body

FieldTypeRequiredDescription
userIdstringYesThe user ID to check access for

Response

FieldTypeDescription
authorizedbooleantrue if user has read access, false otherwise

Permission Logic

A user has fullReadAccess if any of the following conditions are met:

  • User has the admin role
  • User has the full_read_access system permission

Example Request

curl -X POST http://localhost:8000/api/service-actions/check-read-access \
  -H "Authorization: Bearer <service_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_123456"
  }'

Example Response

{
  "authorized": true
}

Integration Flow

A typical integration flow for a webhook service:

Loading diagram...
  1. Configure Webhook: User sends webhook configuration along with their session token
  2. Identify User: Service calls GET /api/profiles/me with the user's session token to retrieve the user profile and ID
  3. Check Access: Service calls POST /check-read-access with the user ID to verify read permissions
  4. Store Configuration: If access is granted, store the webhook configuration; otherwise, return an error
  5. Periodic Re-check: Service periodically re-validates user permissions and disables webhooks for users who no longer have access