Documentation Index
Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt
Use this file to discover all available pages before exploring further.
ZKML SDK
Zero-knowledge ML — prove inference, verify proofs, register models on-chain
Operations
| Method | Description |
|---|
lucidGenerateZkmlProof | Generate zkML proof |
lucidVerifyZkmlProof | Verify zkML proof |
lucidRegisterZkmlModel | Register model circuit |
lucidListZkmlModels | List registered model circuits |
Generated Reference
Overview
Zero-knowledge ML — prove inference, verify proofs, register models on-chain
Available Operations
lucidGenerateZkmlProof
Generate a zero-knowledge proof for a model inference run. The proof attests that a specific model produced a specific output without revealing the model weights or full input.
Example Usage
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const raijinLabsLucidAi = new RaijinLabsLucidAi();
async function run() {
const result = await raijinLabsLucidAi.zkML.lucidGenerateZkmlProof({
modelId: "<id>",
inputHash: "<value>",
outputHash: "<value>",
policyHash: "<value>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { zkMLLucidGenerateZkmlProof } from "raijin-labs-lucid-ai/funcs/zkMLLucidGenerateZkmlProof.js";
// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();
async function run() {
const res = await zkMLLucidGenerateZkmlProof(raijinLabsLucidAi, {
modelId: "<id>",
inputHash: "<value>",
outputHash: "<value>",
policyHash: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("zkMLLucidGenerateZkmlProof failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|
request | models.GenerateZkMLProofRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.LucidGenerateZkmlProofResponse>
Errors
| Error Type | Status Code | Content Type |
|---|
| errors.ErrorResponse | 400 | application/json |
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |
lucidVerifyZkmlProof
Verify a zkML Groth16 proof. Performs off-chain verification first, then optionally submits for on-chain verification via the ecPairing precompile on EVM chains.
Example Usage
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const raijinLabsLucidAi = new RaijinLabsLucidAi();
async function run() {
const result = await raijinLabsLucidAi.zkML.lucidVerifyZkmlProof({
chainId: "<id>",
proof: {},
receiptHash: "<value>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { zkMLLucidVerifyZkmlProof } from "raijin-labs-lucid-ai/funcs/zkMLLucidVerifyZkmlProof.js";
// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();
async function run() {
const res = await zkMLLucidVerifyZkmlProof(raijinLabsLucidAi, {
chainId: "<id>",
proof: {},
receiptHash: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("zkMLLucidVerifyZkmlProof failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|
request | models.VerifyZkMLProofRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ZkMLVerifyResponse>
Errors
| Error Type | Status Code | Content Type |
|---|
| errors.ErrorResponse | 400 | application/json |
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |
lucidRegisterZkmlModel
Register a model’s Groth16 verifying key on-chain, enabling future proofs for this model to be verified by the ZkMLVerifier smart contract.
Example Usage
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const raijinLabsLucidAi = new RaijinLabsLucidAi();
async function run() {
const result = await raijinLabsLucidAi.zkML.lucidRegisterZkmlModel({
chainId: "<id>",
modelHash: "<value>",
verifyingKey: "<value>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { zkMLLucidRegisterZkmlModel } from "raijin-labs-lucid-ai/funcs/zkMLLucidRegisterZkmlModel.js";
// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();
async function run() {
const res = await zkMLLucidRegisterZkmlModel(raijinLabsLucidAi, {
chainId: "<id>",
modelHash: "<value>",
verifyingKey: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("zkMLLucidRegisterZkmlModel failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|
request | models.RegisterZkMLModelRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.SuccessResponse>
Errors
| Error Type | Status Code | Content Type |
|---|
| errors.ErrorResponse | 400 | application/json |
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |
lucidListZkmlModels
List all registered zkML model circuits on a specific chain, including model IDs, verifying key hashes, and registration timestamps.
Example Usage
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";
const raijinLabsLucidAi = new RaijinLabsLucidAi();
async function run() {
const result = await raijinLabsLucidAi.zkML.lucidListZkmlModels({
chainId: "<id>",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { zkMLLucidListZkmlModels } from "raijin-labs-lucid-ai/funcs/zkMLLucidListZkmlModels.js";
// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();
async function run() {
const res = await zkMLLucidListZkmlModels(raijinLabsLucidAi, {
chainId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("zkMLLucidListZkmlModels failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|
request | operations.LucidListZkmlModelsRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<models.ListZkMLModelsResponse>
Errors
| Error Type | Status Code | Content Type |
|---|
| errors.ErrorResponse | 500 | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX | */* |