Protocol Buffers

Complete reference for NCN Network v2 Protocol Buffer definitions.


Overview

NCN Network uses Protocol Buffers (protobuf) for all gRPC communication. The definitions are in proto/common_types.proto.


Services

GatewayClientService

Client-facing service exposed by Gateway nodes.

service GatewayClientService {
  // Submit an inference task
  rpc SubmitInferenceTask(InferenceRequest) returns (InferenceTaskStatus);
  
  // Subscribe to task updates (streaming)
  rpc SubscribeToTaskUpdates(TaskID) returns (stream InferenceResponse);
  
  // Get current task status
  rpc GetTaskStatus(TaskID) returns (InferenceTaskStatus);
  
  // Cancel a task
  rpc CancelTask(TaskID) returns (Ack);
  
  // Confirm payment was made
  rpc ConfirmPayment(TransactionConfirmation) returns (Ack);
  
  // Get supported models
  rpc GetSupportedModels(Empty) returns (stream ModelInfo);
}

GatewayComputeService

Compute node-facing service exposed by Gateway nodes.

P2PRegistryService

Registry service for node discovery and validation.


Core Messages

InferenceRequest

Request for model inference.

InferenceResponse

Response from model inference.

NodeInfo

Information about a network node.


Payment Messages

PaymentTree

Payment distribution specification.

PreprocessingValidation

Validator approval for payment initiation.

TransactionConfirmation

Blockchain transaction confirmation.

ComputeCompletion

Compute node's result attestation.

CompletionValidation

Validator approval for payment distribution.

ValidatorSignature

Individual validator signature.


Subnet Messages

SubnetMetadata

Subnet configuration and status.

ModelDescriptor

Model specification in subnet.

CreateSubnetRequest

Request to create a new subnet.


Status Messages

InferenceTaskStatus

Current status of an inference task.

PaymentStatus

Status of payment flow.


Utility Messages

TaskID

Ack

Empty

WalletAddress


Error Handling

gRPC Status Codes

Code
Meaning
When Used

OK (0)

Success

Request completed

CANCELLED (1)

Cancelled

Task cancelled

INVALID_ARGUMENT (3)

Bad input

Invalid request format

NOT_FOUND (5)

Not found

Unknown task/model

ALREADY_EXISTS (6)

Duplicate

Request ID exists

RESOURCE_EXHAUSTED (8)

Rate limited

Too many requests

INTERNAL (13)

Server error

Processing error

UNAVAILABLE (14)

Service down

Node unavailable


Code Generation

Rust (tonic)

Python

Go

JavaScript


Last updated