Skip to main content

API reference

BlockDB exposes a set of gRPC services. All services are pure gRPC (no REST gateway), and gRPC server reflection is enabled, so you can inspect and call every method with grpcurl without preparing proto files yourself. The default service address is localhost:19002.

JSON mapping conventions

Before writing requests, it helps to know how proto3 messages map to JSON:
  • Value is a oneof: in JSON only the set field appears, using its camelCase name — "stringValue", "intValue", "doubleValue", "boolValue". NULL is represented by omitting kind (an empty {}).
  • int64 fields are encoded as JSON strings (per proto3). For example height, limit, and affected_rows appear as strings.
  • Field names: proto3 JSON emits lowerCamelCase (tableId, not table_id), but accepts both camelCase and the original snake_case on input.
  • Read responses use a schema + positional array shape: ResultSet { columns: ColumnMeta[], rows: Row[] }, where each Row.values is a positional Value[] aligned with columns.
  • Write requests use a self-describing map: WriteRow.fields is a map<string, Value>.
The canonical definitions live in proto/blockdb/v1/ (common.proto, table.proto, block.proto, time.proto, batch.proto).

Regular table services

TableReadService

GetRow

Read a single row. Proto
Call
Response

BatchGetRows

Read several primary keys in one call. Proto
Call

FilterRows

Filter by a condition string, with sorting and pagination. Proto
Call

TableWriteService

UpsertRows

The request uses self-describing WriteRow maps, so only the columns present are updated (partial update). The optional condition supports UPDATE_IF_SMALLER / UPDATE_IF_LARGER. Proto
Call
Response

DeleteRows

Call

TableScanService

Scan (server-streaming)

Proto
Call

Block table services

BlockReadService

GetState

Read a state snapshot at a block. current_block injects height ≤ target height; if omitted it reads the latest. Proto
Call

BlockWriteService

UpsertBlock

Proto
Call

BlockSubscribeService

Subscribe (server-streaming)

Proto
Call

Time table services

TimeReadService — GetValue

Proto
Call

TimeWriteService — UpsertTimeRows

Proto
Call
The time bucket alignment (rounding 17:04:35 up to the 17:05:00 bucket) is done on the SDK side, so a raw gRPC call receives whatever time_at you pass.

Batch write service — BatchWriteService

InitWriteJob

Putting it together

A minimal “read a row” call end to end: