Skip to main content

API

Workflow

Img

Participants: Customer | ZEROBASE Hub | Prover Nodes

1. Request Node List

  • Customer submits a proof‐generation request to the ZEROBASE Hub, including the circuit ID, inputs and payment credentials.
  • Hub records the task, issues a unique UUID, and returns it to the Customer.

2. Respond Node List

  • Hub and Prover Nodes exchange periodic heartbeat messages to confirm node health.
  • Hub selects a pseudo-random subset (e.g. 4) of available nodes.
  • Hub returns the chosen nodes’ gRPC endpoints to the Customer.

3. Send Proof Generation Tasks

  • Customer invokes GenerateProof(taskID, inputs) in parallel on each selected node.
  • Each Prover:
    1. (If in payment-verified mode) validates on-chain payment status.
    2. Executes the circuit to derive the zero-knowledge proof and witness.

4. Respond Proofs

  • Prover Nodes transmit the computed proof and witness back to the Customer via gRPC.

Role Description

ZEROBASE Hub

The ZEROBASE Hub is the core module of the network, responsible for task broadcasting, Prover node scheduling, user request handling, and node communication management. Before submitting a zero-knowledge proof request, users must first register their task. Once registration is successful, the Hub broadcasts the task across the network and randomly selects Prover nodes to generate the proof. The Hub also manages the node list, processes heartbeat packets, and handles payment workflows.

Prover Node

Prover nodes are responsible for generating ZK-SNARK proofs by receiving input data and performing the necessary computations. They periodically send heartbeat packets to update their status. Prover nodes support both a basic mode and a payment-verified mode. In basic mode, they generate proofs directly; in payment-verified mode, they must first confirm the payment status before proceeding. By transmitting heartbeat packets, the nodes help maintain system stability. This architecture enables high-performance scheduling of ZK computation tasks.

Pre-request

Install gRPC Tools

Install grpcio-tools to generate gRPC code:

pip install grpcio-tools

Get Prover Node

Example Request:

curl -X GET "https://prove-api.zerobase.pro/api/v1/hub/node"

Example Response:

{"code":0,"msg":"Successfully","results":[{"grpc_info":{"address":"","timestamp":1750351910},"http_info":{"address":"","timestamp":1750351910},"poh":"622b40c2431bd60508f46e232c17de82bf8b083c85cf6bc638a643c80942e099"}],"proof_hash":"0x683a8622e80caaf9bbcc58b45ebe803bdc82a381216188ff620fc023c04f2b54"}

Generate gRPC Code

Use protoc to generate Python service and message handling code.

python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. prove.proto
// File: prove_service_v2.proto
// Description: ProveService gRPC definitions for zero-knowledge proof generation,

syntax = "proto3";

package prove_service.v2;

import "google/protobuf/empty.proto";

message GenerateProofRequest {
string prover = 1;
string circuit_template_id = 2;
string payload = 3;
int32 length = 4;
bool is_encrypted = 5;
string auth_token = 6;
int32 task_type = 7;
string oauth_provider = 8;
string proof_hash = 9;
}

message GenerateProofResponse {
int32 code = 1;
string msg = 2;
string proof = 3;
string proof_solidity = 4;
bytes proof_bytes = 5;
string public_witness = 6;
bytes public_witness_bytes = 7;
}

message GetPublicKeyResponse {
int32 code = 1;
string msg = 2;
string public_key = 3;
}

service ProveService {
rpc Prove(GenerateProofRequest) returns (GenerateProofResponse);
rpc GetPublicKey(google.protobuf.Empty) returns (GetPublicKeyResponse);
rpc Ping(google.protobuf.Empty) returns (google.protobuf.Empty);
}

Params

GenerateProofRequest
FieldTypeRequiredDescription
proverstringYesProver identifier
circuit_template_idstringYesCircuit template ID
payloadstringYesInput data
lengthint32YesFor nosha256
is_encryptedboolNoWhether the payload is encrypted (default: false)
auth_tokenstringYesAuthentication token (see Authentication section)
task_typestringNoBusiness-defined task type
oauth_providerstringNoOAuth provider name (default: google)
proof_hashstringYesFetch this parameter from the Hub API
GenerateProofResponse
FieldTypeRequiredDescription
codeint32YesResponse code (0 = success; see Status Code section)
msgstringYesHuman-readable message
proofstringYesString proof
proof_soliditystringYesProof for smart contract verification
proof_bytesbytesYesRaw proof bytes
public witnessstringYesString Public witness
public_witness_bytebytesYesRaw public witness bytes

Status Code

STATUS_CODEVALUE
STATUS_CODE_SUCCESSFULLY0
STATUS_CODE_ERROR-1
STATUS_CODE_TASK_NOT_FOUND1000
STATUS_CODE_TASK_INVALID1001
STATUS_CODE_UNSUPPORT_TASK_TYPE1002
STATUS_CODE_UNSUPPORT_PROVER1003
STATUS_CODE_UNSUPPORT_OAUTH_PROVIDER1004
STATUS_CODE_UNAUTHORIZED_PAYLOAD1005
STATUS_CODE_PROVER_NOT_RESPONSE1006
STATUS_CODE_PUBLIC_KEY_NOT_FOUND2000
STATUS_CODE_PUBLIC_KEY_INVALID2001
STATUS_CODE_PRIVATE_KEY_NOT_FOUND2002
STATUS_CODE_PRIVATE_KEY_INVALID2003
STATUS_CODE_UNSUPPORT_CIRCUIT100000
STATUS_CODE_GPU_DEVICE_ERROR100001
STATUS_CODE_SHA256_NOT_MATCH100002
STATUS_CODE_JSON_FROMAT_ERROR100003
STATUS_CODE_INVALID_INPUT100004
STATUS_CODE_TO_WITNESS_ERROR100005
STATUS_CODE_TO_SECRET_WITNESS_ERROR100006
STATUS_CODE_TO_PUBLIC_WITNESS_ERROR100007
STATUS_CODE_GENERATE_PROOF_ERROR100008

Pricing Table

We do not offer free proof generation for commercial circuits. The fee is intended to encourage you to approach circuit development with a focus on validity. However, we do offer free circuit generation for public goods. Please feel free to email me directly at: [email protected]

ServiceCost
Circuit Deployment & Distribution1000 USD/one-time
Network Resource Usage Base Fee50 USD/month
Proof Generation <10K proofs/month0.01 USD/proof
Proof Generation 10K-100K proofs/month0.008 USD/proof
Proof Generation 100K-1M proofs/month0.005 USD/proof
Proof Generation >1M proofs/monthContact Sales