@obelyzk/sdk 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +481 -0
- package/bin/bitsage-demo.ts +12 -0
- package/dist/chunk-3D3DPNVV.mjs +700 -0
- package/dist/chunk-CGPFHXUF.mjs +701 -0
- package/dist/chunk-F3E66KH7.mjs +683 -0
- package/dist/chunk-KRCKY3II.mjs +5857 -0
- package/dist/chunk-LXJT3QK6.mjs +5950 -0
- package/dist/chunk-O2PF7VJA.mjs +700 -0
- package/dist/index.d.mts +868 -0
- package/dist/index.d.ts +868 -0
- package/dist/index.js +7445 -0
- package/dist/index.mjs +853 -0
- package/dist/obelysk/index.d.mts +567 -0
- package/dist/obelysk/index.d.ts +567 -0
- package/dist/obelysk/index.js +1760 -0
- package/dist/obelysk/index.mjs +1449 -0
- package/dist/privacy/index.d.mts +408 -0
- package/dist/privacy/index.d.ts +408 -0
- package/dist/privacy/index.js +735 -0
- package/dist/privacy/index.mjs +44 -0
- package/dist/react/index.d.mts +1367 -0
- package/dist/react/index.d.ts +1367 -0
- package/dist/react/index.js +8442 -0
- package/dist/react/index.mjs +2600 -0
- package/dist/tee-BKXj7gQs.d.mts +4749 -0
- package/dist/tee-BKXj7gQs.d.ts +4749 -0
- package/dist/tee-BslKx4iU.d.mts +4749 -0
- package/dist/tee-BslKx4iU.d.ts +4749 -0
- package/dist/tee-CiR0hpfm.d.mts +4794 -0
- package/dist/tee-CiR0hpfm.d.ts +4794 -0
- package/package.json +101 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BatchClient,
|
|
3
|
+
BitSageClient,
|
|
4
|
+
CAPABILITY_FLAGS,
|
|
5
|
+
ContractClient,
|
|
6
|
+
DAILY_CAPS,
|
|
7
|
+
DEFAULT_CONFIG,
|
|
8
|
+
DEFAULT_CONTRACT_CONFIG,
|
|
9
|
+
DEFAULT_HTTP_CONFIG,
|
|
10
|
+
DEFAULT_WS_CONFIG,
|
|
11
|
+
DashboardClient,
|
|
12
|
+
EncryptionHelper,
|
|
13
|
+
GOVERNANCE_CONFIG,
|
|
14
|
+
GPU_MULTIPLIERS,
|
|
15
|
+
GovernanceClient,
|
|
16
|
+
HALVENING_SCHEDULE,
|
|
17
|
+
HttpClient,
|
|
18
|
+
LOCAL_CONTRACTS,
|
|
19
|
+
MAINNET_CONTRACTS,
|
|
20
|
+
MAINNET_TOKENS,
|
|
21
|
+
MAX_BATCH_SIZE,
|
|
22
|
+
MIN_STAKE,
|
|
23
|
+
MiningClient,
|
|
24
|
+
PRAGMA_ORACLE,
|
|
25
|
+
PaymentsClient,
|
|
26
|
+
PrivacyClient,
|
|
27
|
+
PrivacyKeyManager,
|
|
28
|
+
SEPOLIA_CONTRACTS,
|
|
29
|
+
SEPOLIA_TOKENS,
|
|
30
|
+
SLASH_PERCENTAGES,
|
|
31
|
+
STAKE_TIER_THRESHOLDS,
|
|
32
|
+
SdkError,
|
|
33
|
+
StakingClient,
|
|
34
|
+
StwoClient,
|
|
35
|
+
TeeClient,
|
|
36
|
+
UNSTAKE_LOCKUP_SECS,
|
|
37
|
+
VERIFICATION_CONFIG,
|
|
38
|
+
WebSocketClient,
|
|
39
|
+
WorkersClient,
|
|
40
|
+
createBatchClient,
|
|
41
|
+
createDashboardClient,
|
|
42
|
+
createGovernanceClient,
|
|
43
|
+
createMiningClient,
|
|
44
|
+
createPaymentsClient,
|
|
45
|
+
createPrivacyClient,
|
|
46
|
+
createStakingClient,
|
|
47
|
+
createStwoClient,
|
|
48
|
+
createTeeClient,
|
|
49
|
+
createTransferProof,
|
|
50
|
+
createWebSocketClient,
|
|
51
|
+
createWorkersClient,
|
|
52
|
+
fromFelt,
|
|
53
|
+
getContractsForNetwork,
|
|
54
|
+
getDailyCapForTier,
|
|
55
|
+
getGpuMultiplier,
|
|
56
|
+
getMinStakeForTier,
|
|
57
|
+
getPrivacyDerivationMessage,
|
|
58
|
+
getStakeTierFromAmount,
|
|
59
|
+
getTokensForNetwork,
|
|
60
|
+
isContractConfigured,
|
|
61
|
+
isValidPublicKey,
|
|
62
|
+
isWorkerEligible,
|
|
63
|
+
joinU256,
|
|
64
|
+
splitU256,
|
|
65
|
+
toFelt,
|
|
66
|
+
verifyTransferProof
|
|
67
|
+
} from "./chunk-LXJT3QK6.mjs";
|
|
68
|
+
import {
|
|
69
|
+
AssetId,
|
|
70
|
+
CURVE_ORDER,
|
|
71
|
+
ConfidentialSwapClient,
|
|
72
|
+
FIELD_PRIME,
|
|
73
|
+
GENERATOR_G,
|
|
74
|
+
GENERATOR_H,
|
|
75
|
+
ObelyskPrivacy,
|
|
76
|
+
addMod,
|
|
77
|
+
ecAdd,
|
|
78
|
+
ecDouble,
|
|
79
|
+
ecMul,
|
|
80
|
+
invMod,
|
|
81
|
+
isIdentity,
|
|
82
|
+
mulMod,
|
|
83
|
+
poseidonHash,
|
|
84
|
+
powMod,
|
|
85
|
+
randomScalar,
|
|
86
|
+
subMod
|
|
87
|
+
} from "./chunk-O2PF7VJA.mjs";
|
|
88
|
+
|
|
89
|
+
// src/types.ts
|
|
90
|
+
function getMinStake(tier) {
|
|
91
|
+
switch (tier) {
|
|
92
|
+
case "consumer":
|
|
93
|
+
return 1000n;
|
|
94
|
+
case "workstation":
|
|
95
|
+
return 2500n;
|
|
96
|
+
case "data_center":
|
|
97
|
+
return 5000n;
|
|
98
|
+
case "enterprise":
|
|
99
|
+
return 10000n;
|
|
100
|
+
case "frontier":
|
|
101
|
+
return 25000n;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function getGpuTier(model) {
|
|
105
|
+
const lower = model.toLowerCase();
|
|
106
|
+
if (lower.includes("b200")) return "frontier";
|
|
107
|
+
if (lower.includes("h100") || lower.includes("h200")) return "enterprise";
|
|
108
|
+
if (lower.includes("a100")) return "data_center";
|
|
109
|
+
if (lower.includes("a6000") || lower.includes("l40")) return "workstation";
|
|
110
|
+
return "consumer";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/types/generated/payments.ts
|
|
114
|
+
var DEFAULT_DISCOUNT_TIERS = {
|
|
115
|
+
stablecoin_discount_bps: 0,
|
|
116
|
+
strk_discount_bps: 0,
|
|
117
|
+
wbtc_discount_bps: 0,
|
|
118
|
+
sage_discount_bps: 500,
|
|
119
|
+
// 5%
|
|
120
|
+
staked_sage_discount_bps: 1e3,
|
|
121
|
+
// 10%
|
|
122
|
+
privacy_credit_discount_bps: 200
|
|
123
|
+
// 2%
|
|
124
|
+
};
|
|
125
|
+
var DEFAULT_FEE_DISTRIBUTION = {
|
|
126
|
+
worker_bps: 8e3,
|
|
127
|
+
// 80%
|
|
128
|
+
protocol_fee_bps: 2e3,
|
|
129
|
+
// 20%
|
|
130
|
+
burn_share_bps: 7e3,
|
|
131
|
+
// 70% of protocol fee
|
|
132
|
+
treasury_share_bps: 2e3,
|
|
133
|
+
// 20% of protocol fee
|
|
134
|
+
staker_share_bps: 1e3
|
|
135
|
+
// 10% of protocol fee
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// src/modules/stwo-prover.ts
|
|
139
|
+
var DEFAULT_PROVER_CONFIG = {
|
|
140
|
+
baseUrl: "https://prover.bitsage.network",
|
|
141
|
+
defaultGpuTier: "auto",
|
|
142
|
+
defaultPriority: "standard",
|
|
143
|
+
timeout: 3e4,
|
|
144
|
+
requireTee: false
|
|
145
|
+
};
|
|
146
|
+
var StwoProverClient = class {
|
|
147
|
+
config;
|
|
148
|
+
constructor(config) {
|
|
149
|
+
this.config = { ...DEFAULT_PROVER_CONFIG, ...config };
|
|
150
|
+
}
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
// Core API Methods
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
/**
|
|
155
|
+
* Load an ONNX model on the prover server.
|
|
156
|
+
* Must be called before submitting proving jobs for that model.
|
|
157
|
+
*/
|
|
158
|
+
async loadModel(request) {
|
|
159
|
+
const response = await this.fetch("/api/v1/models", {
|
|
160
|
+
method: "POST",
|
|
161
|
+
body: JSON.stringify({
|
|
162
|
+
model_path: request.modelPath,
|
|
163
|
+
description: request.description
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
return {
|
|
167
|
+
modelId: response.model_id,
|
|
168
|
+
weightCommitment: response.weight_commitment,
|
|
169
|
+
numLayers: response.num_layers,
|
|
170
|
+
inputShape: response.input_shape
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Submit a proof generation job to the GPU network
|
|
175
|
+
*/
|
|
176
|
+
async submitProofJob(request) {
|
|
177
|
+
const body = {
|
|
178
|
+
proof_type: request.proofType,
|
|
179
|
+
public_inputs: request.publicInputs.map((i) => i.toString()),
|
|
180
|
+
private_inputs: request.privateInputs?.map((i) => i.toString()),
|
|
181
|
+
circuit_id: request.circuitId,
|
|
182
|
+
priority: request.priority ?? this.config.defaultPriority,
|
|
183
|
+
gpu_tier: request.gpuTier ?? this.config.defaultGpuTier,
|
|
184
|
+
deadline: request.deadline,
|
|
185
|
+
require_tee: request.requireTee ?? this.config.requireTee,
|
|
186
|
+
max_cost_usdc: request.maxCostUsdc,
|
|
187
|
+
callback_url: request.callbackUrl,
|
|
188
|
+
metadata: request.metadata
|
|
189
|
+
};
|
|
190
|
+
const response = await this.fetch("/api/v1/prove", {
|
|
191
|
+
method: "POST",
|
|
192
|
+
body: JSON.stringify(body)
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
jobId: response.job_id,
|
|
196
|
+
status: response.status,
|
|
197
|
+
estimatedCostUsdc: response.estimated_cost_usdc,
|
|
198
|
+
estimatedTimeSecs: response.estimated_time_secs,
|
|
199
|
+
queuePosition: response.queue_position,
|
|
200
|
+
assignedGpu: response.assigned_gpu ? {
|
|
201
|
+
tier: response.assigned_gpu.tier,
|
|
202
|
+
workerId: response.assigned_gpu.worker_id,
|
|
203
|
+
teeEnabled: response.assigned_gpu.tee_enabled
|
|
204
|
+
} : void 0,
|
|
205
|
+
createdAt: response.created_at
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Get the current status of a proof generation job
|
|
210
|
+
*/
|
|
211
|
+
async getJobStatus(jobId) {
|
|
212
|
+
const response = await this.fetch(`/api/v1/prove/${jobId}`);
|
|
213
|
+
return {
|
|
214
|
+
jobId: response.job_id,
|
|
215
|
+
status: response.status,
|
|
216
|
+
progressBps: response.progress_bps,
|
|
217
|
+
estimatedTimeRemainingSecs: response.estimated_time_remaining_secs,
|
|
218
|
+
currentPhase: response.current_phase,
|
|
219
|
+
gpuUtilization: response.gpu_utilization,
|
|
220
|
+
memoryUsedMb: response.memory_used_mb,
|
|
221
|
+
errorMessage: response.error_message,
|
|
222
|
+
retryCount: response.retry_count
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get the completed proof result
|
|
227
|
+
*/
|
|
228
|
+
async getProofResult(jobId) {
|
|
229
|
+
const response = await this.fetch(`/api/v1/prove/${jobId}/result`);
|
|
230
|
+
return {
|
|
231
|
+
jobId: response.job_id,
|
|
232
|
+
proofHash: response.proof_hash,
|
|
233
|
+
proofData: response.proof_data,
|
|
234
|
+
publicInputHash: response.public_input_hash,
|
|
235
|
+
proofSizeBytes: response.proof_size_bytes,
|
|
236
|
+
generationTimeMs: response.generation_time_ms,
|
|
237
|
+
costUsdc: response.cost_usdc,
|
|
238
|
+
gpuTier: response.gpu_tier,
|
|
239
|
+
teeAttestation: response.tee_attestation ? {
|
|
240
|
+
teeType: response.tee_attestation.tee_type,
|
|
241
|
+
enclaveMeasurement: response.tee_attestation.enclave_measurement,
|
|
242
|
+
quoteHash: response.tee_attestation.quote_hash
|
|
243
|
+
} : void 0,
|
|
244
|
+
verificationStatus: response.verification_status,
|
|
245
|
+
txHash: response.tx_hash
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Cancel a pending proof job.
|
|
250
|
+
*
|
|
251
|
+
* @experimental prove-server does not currently implement a cancel endpoint.
|
|
252
|
+
* This method is provided for forward-compatibility with the coordinator API.
|
|
253
|
+
*/
|
|
254
|
+
async cancelJob(jobId) {
|
|
255
|
+
try {
|
|
256
|
+
const response = await this.fetch(`/api/v1/prove/${jobId}/cancel`, {
|
|
257
|
+
method: "POST"
|
|
258
|
+
});
|
|
259
|
+
return response.cancelled === true;
|
|
260
|
+
} catch {
|
|
261
|
+
throw new Error(
|
|
262
|
+
"Cancel is not supported by the current prove-server. This method will work with a future coordinator API."
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Wait for a proof to complete (polling)
|
|
268
|
+
*/
|
|
269
|
+
async waitForProof(jobId, options) {
|
|
270
|
+
const pollInterval = options?.pollIntervalMs ?? 2e3;
|
|
271
|
+
const timeout = options?.timeoutMs ?? 3e5;
|
|
272
|
+
const startTime = Date.now();
|
|
273
|
+
while (Date.now() - startTime < timeout) {
|
|
274
|
+
const status = await this.getJobStatus(jobId);
|
|
275
|
+
if (options?.onProgress) {
|
|
276
|
+
options.onProgress(status);
|
|
277
|
+
}
|
|
278
|
+
if (status.status === "completed") {
|
|
279
|
+
return this.getProofResult(jobId);
|
|
280
|
+
}
|
|
281
|
+
if (status.status === "failed" || status.status === "cancelled") {
|
|
282
|
+
throw new Error(
|
|
283
|
+
`Proof generation ${status.status}: ${status.errorMessage ?? "Unknown error"}`
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
await this.sleep(pollInterval);
|
|
287
|
+
}
|
|
288
|
+
throw new Error(`Proof generation timed out after ${timeout}ms`);
|
|
289
|
+
}
|
|
290
|
+
// ---------------------------------------------------------------------------
|
|
291
|
+
// Batch Operations
|
|
292
|
+
// ---------------------------------------------------------------------------
|
|
293
|
+
/**
|
|
294
|
+
* Submit multiple proofs as a batch (with optional aggregation).
|
|
295
|
+
*
|
|
296
|
+
* @experimental Not supported by prove-server. Requires coordinator API.
|
|
297
|
+
*/
|
|
298
|
+
async submitBatch(request) {
|
|
299
|
+
const body = {
|
|
300
|
+
proofs: request.proofs.map((p) => ({
|
|
301
|
+
proof_type: p.proofType,
|
|
302
|
+
public_inputs: p.publicInputs.map((i) => i.toString()),
|
|
303
|
+
private_inputs: p.privateInputs?.map((i) => i.toString()),
|
|
304
|
+
circuit_id: p.circuitId,
|
|
305
|
+
require_tee: p.requireTee
|
|
306
|
+
})),
|
|
307
|
+
aggregate: request.aggregate ?? false,
|
|
308
|
+
priority: request.priority ?? this.config.defaultPriority,
|
|
309
|
+
max_total_cost_usdc: request.maxTotalCostUsdc
|
|
310
|
+
};
|
|
311
|
+
const response = await this.fetch("/api/v1/proofs/batch", {
|
|
312
|
+
method: "POST",
|
|
313
|
+
body: JSON.stringify(body)
|
|
314
|
+
});
|
|
315
|
+
return {
|
|
316
|
+
batchId: response.batch_id,
|
|
317
|
+
jobIds: response.job_ids,
|
|
318
|
+
estimatedTotalCostUsdc: response.estimated_total_cost_usdc,
|
|
319
|
+
estimatedTimeSecs: response.estimated_time_secs,
|
|
320
|
+
status: response.status
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get batch status
|
|
325
|
+
*/
|
|
326
|
+
async getBatchStatus(batchId) {
|
|
327
|
+
const response = await this.fetch(`/api/v1/proofs/batch/${batchId}/status`);
|
|
328
|
+
return {
|
|
329
|
+
batchId: response.batch_id,
|
|
330
|
+
jobIds: response.job_ids,
|
|
331
|
+
estimatedTotalCostUsdc: response.estimated_total_cost_usdc,
|
|
332
|
+
estimatedTimeSecs: response.estimated_time_secs,
|
|
333
|
+
status: response.status
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Wait for entire batch to complete
|
|
338
|
+
*/
|
|
339
|
+
async waitForBatch(batchId, options) {
|
|
340
|
+
const pollInterval = options?.pollIntervalMs ?? 5e3;
|
|
341
|
+
const timeout = options?.timeoutMs ?? 6e5;
|
|
342
|
+
const startTime = Date.now();
|
|
343
|
+
while (Date.now() - startTime < timeout) {
|
|
344
|
+
const status = await this.getBatchStatus(batchId);
|
|
345
|
+
if (options?.onProgress) {
|
|
346
|
+
let completed = 0;
|
|
347
|
+
for (const jobId of status.jobIds) {
|
|
348
|
+
const jobStatus = await this.getJobStatus(jobId);
|
|
349
|
+
if (jobStatus.status === "completed") completed++;
|
|
350
|
+
}
|
|
351
|
+
options.onProgress(completed, status.jobIds.length);
|
|
352
|
+
}
|
|
353
|
+
if (status.status === "completed") {
|
|
354
|
+
const results = [];
|
|
355
|
+
for (const jobId of status.jobIds) {
|
|
356
|
+
results.push(await this.getProofResult(jobId));
|
|
357
|
+
}
|
|
358
|
+
return results;
|
|
359
|
+
}
|
|
360
|
+
if (status.status === "failed") {
|
|
361
|
+
throw new Error("Batch proof generation failed");
|
|
362
|
+
}
|
|
363
|
+
await this.sleep(pollInterval);
|
|
364
|
+
}
|
|
365
|
+
throw new Error(`Batch proof generation timed out after ${timeout}ms`);
|
|
366
|
+
}
|
|
367
|
+
// ---------------------------------------------------------------------------
|
|
368
|
+
// Cost Estimation
|
|
369
|
+
// ---------------------------------------------------------------------------
|
|
370
|
+
/**
|
|
371
|
+
* Estimate cost before submitting a job.
|
|
372
|
+
*
|
|
373
|
+
* @experimental Not supported by prove-server. Requires coordinator API.
|
|
374
|
+
*/
|
|
375
|
+
async estimateCost(request) {
|
|
376
|
+
const body = {
|
|
377
|
+
proof_type: request.proofType,
|
|
378
|
+
public_inputs_count: request.publicInputs.length,
|
|
379
|
+
private_inputs_count: request.privateInputs?.length ?? 0,
|
|
380
|
+
circuit_id: request.circuitId,
|
|
381
|
+
priority: request.priority ?? this.config.defaultPriority,
|
|
382
|
+
gpu_tier: request.gpuTier ?? this.config.defaultGpuTier,
|
|
383
|
+
require_tee: request.requireTee ?? this.config.requireTee
|
|
384
|
+
};
|
|
385
|
+
const response = await this.fetch("/api/v1/proofs/estimate", {
|
|
386
|
+
method: "POST",
|
|
387
|
+
body: JSON.stringify(body)
|
|
388
|
+
});
|
|
389
|
+
return {
|
|
390
|
+
costUsdc: response.cost_usdc,
|
|
391
|
+
timeSecs: response.time_secs,
|
|
392
|
+
recommendedGpuTier: response.recommended_gpu_tier,
|
|
393
|
+
breakdown: {
|
|
394
|
+
baseCost: response.breakdown.base_cost,
|
|
395
|
+
constraintCost: response.breakdown.constraint_cost,
|
|
396
|
+
prioritySurcharge: response.breakdown.priority_surcharge,
|
|
397
|
+
teeSurcharge: response.breakdown.tee_surcharge
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Estimate batch cost
|
|
403
|
+
*/
|
|
404
|
+
async estimateBatchCost(request) {
|
|
405
|
+
const body = {
|
|
406
|
+
proofs: request.proofs.map((p) => ({
|
|
407
|
+
proof_type: p.proofType,
|
|
408
|
+
public_inputs_count: p.publicInputs.length,
|
|
409
|
+
private_inputs_count: p.privateInputs?.length ?? 0
|
|
410
|
+
})),
|
|
411
|
+
aggregate: request.aggregate ?? false,
|
|
412
|
+
priority: request.priority ?? this.config.defaultPriority
|
|
413
|
+
};
|
|
414
|
+
const response = await this.fetch("/api/v1/proofs/batch/estimate", {
|
|
415
|
+
method: "POST",
|
|
416
|
+
body: JSON.stringify(body)
|
|
417
|
+
});
|
|
418
|
+
return {
|
|
419
|
+
totalCostUsdc: response.total_cost_usdc,
|
|
420
|
+
individualCosts: response.individual_costs.map((c) => ({
|
|
421
|
+
costUsdc: c.cost_usdc,
|
|
422
|
+
timeSecs: c.time_secs,
|
|
423
|
+
recommendedGpuTier: c.recommended_gpu_tier,
|
|
424
|
+
breakdown: c.breakdown
|
|
425
|
+
})),
|
|
426
|
+
aggregationSavings: response.aggregation_savings
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
// ---------------------------------------------------------------------------
|
|
430
|
+
// Network Metrics
|
|
431
|
+
// ---------------------------------------------------------------------------
|
|
432
|
+
/**
|
|
433
|
+
* Get current network metrics and pricing.
|
|
434
|
+
*
|
|
435
|
+
* @experimental Not supported by prove-server. Requires coordinator API.
|
|
436
|
+
*/
|
|
437
|
+
async getMetrics() {
|
|
438
|
+
const response = await this.fetch("/api/v1/proofs/metrics");
|
|
439
|
+
return {
|
|
440
|
+
availableGpus: response.available_gpus.map((g) => ({
|
|
441
|
+
tier: g.tier,
|
|
442
|
+
count: g.count,
|
|
443
|
+
teeEnabled: g.tee_enabled
|
|
444
|
+
})),
|
|
445
|
+
queueDepth: response.queue_depth,
|
|
446
|
+
avgWaitTimeSecs: response.avg_wait_time_secs,
|
|
447
|
+
proofsLastHour: response.proofs_last_hour,
|
|
448
|
+
networkUtilization: response.network_utilization,
|
|
449
|
+
pricing: response.pricing.map((p) => ({
|
|
450
|
+
proofType: p.proof_type,
|
|
451
|
+
baseCostUsdc: p.base_cost_usdc,
|
|
452
|
+
perConstraintUsdc: p.per_constraint_usdc
|
|
453
|
+
}))
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Get queue depth for planning.
|
|
458
|
+
*
|
|
459
|
+
* @experimental Not supported by prove-server. Requires coordinator API.
|
|
460
|
+
*/
|
|
461
|
+
async getQueueDepth() {
|
|
462
|
+
const response = await this.fetch("/api/v1/proofs/queue");
|
|
463
|
+
return {
|
|
464
|
+
total: response.total,
|
|
465
|
+
byPriority: response.by_priority,
|
|
466
|
+
estimatedClearTimeSecs: response.estimated_clear_time_secs
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
// ---------------------------------------------------------------------------
|
|
470
|
+
// Specialized Proof Helpers
|
|
471
|
+
// ---------------------------------------------------------------------------
|
|
472
|
+
/**
|
|
473
|
+
* Generate proof for batch payments (optimized)
|
|
474
|
+
*/
|
|
475
|
+
async proveBatchPayments(payments, options) {
|
|
476
|
+
const publicInputs = [];
|
|
477
|
+
for (const p of payments) {
|
|
478
|
+
publicInputs.push(BigInt(p.sender));
|
|
479
|
+
publicInputs.push(BigInt(p.recipient));
|
|
480
|
+
publicInputs.push(p.amount);
|
|
481
|
+
publicInputs.push(BigInt(p.asset));
|
|
482
|
+
}
|
|
483
|
+
const job = await this.submitProofJob({
|
|
484
|
+
proofType: "batch_payments",
|
|
485
|
+
publicInputs,
|
|
486
|
+
priority: options?.priority ?? "high",
|
|
487
|
+
requireTee: options?.requireTee,
|
|
488
|
+
metadata: {
|
|
489
|
+
payment_count: payments.length.toString()
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
return this.waitForProof(job.jobId);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Generate proof for AI/ML inference
|
|
496
|
+
*/
|
|
497
|
+
async proveInference(modelId, inputs, outputs, options) {
|
|
498
|
+
const job = await this.submitProofJob({
|
|
499
|
+
proofType: "ai_inference",
|
|
500
|
+
publicInputs: [...inputs, ...outputs],
|
|
501
|
+
circuitId: modelId,
|
|
502
|
+
priority: options?.priority ?? "standard",
|
|
503
|
+
requireTee: options?.requireTee ?? true,
|
|
504
|
+
// TEE recommended for ML
|
|
505
|
+
metadata: {
|
|
506
|
+
model_id: modelId,
|
|
507
|
+
input_count: inputs.length.toString(),
|
|
508
|
+
output_count: outputs.length.toString()
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
return this.waitForProof(job.jobId);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Generate VRF randomness proof
|
|
515
|
+
*/
|
|
516
|
+
async proveRandomness(seed, count, options) {
|
|
517
|
+
const job = await this.submitProofJob({
|
|
518
|
+
proofType: "vrf_randomness",
|
|
519
|
+
publicInputs: [seed, BigInt(count)],
|
|
520
|
+
priority: options?.priority ?? "high",
|
|
521
|
+
metadata: {
|
|
522
|
+
random_count: count.toString()
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
const proof = await this.waitForProof(job.jobId);
|
|
526
|
+
const randomValues = [];
|
|
527
|
+
return { proof, randomValues };
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Generate cross-chain bridge proof
|
|
531
|
+
*/
|
|
532
|
+
async proveBridge(sourceChain, txHash, blockHeaders, options) {
|
|
533
|
+
const publicInputs = [
|
|
534
|
+
BigInt(sourceChain),
|
|
535
|
+
BigInt(txHash),
|
|
536
|
+
...blockHeaders.map((h) => BigInt(h))
|
|
537
|
+
];
|
|
538
|
+
const job = await this.submitProofJob({
|
|
539
|
+
proofType: "cross_chain_bridge",
|
|
540
|
+
publicInputs,
|
|
541
|
+
priority: options?.priority ?? "critical",
|
|
542
|
+
metadata: {
|
|
543
|
+
source_chain: sourceChain,
|
|
544
|
+
tx_hash: txHash
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
return this.waitForProof(job.jobId);
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Aggregate multiple proofs into one (recursive proving)
|
|
551
|
+
*/
|
|
552
|
+
async aggregateProofs(proofHashes, options) {
|
|
553
|
+
const publicInputs = proofHashes.map((h) => BigInt(h));
|
|
554
|
+
const job = await this.submitProofJob({
|
|
555
|
+
proofType: "recursive_aggregation",
|
|
556
|
+
publicInputs,
|
|
557
|
+
priority: options?.priority ?? "high",
|
|
558
|
+
metadata: {
|
|
559
|
+
proof_count: proofHashes.length.toString()
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
return this.waitForProof(job.jobId);
|
|
563
|
+
}
|
|
564
|
+
// ---------------------------------------------------------------------------
|
|
565
|
+
// Internal Helpers
|
|
566
|
+
// ---------------------------------------------------------------------------
|
|
567
|
+
async fetch(path, init) {
|
|
568
|
+
const url = `${this.config.baseUrl}${path}`;
|
|
569
|
+
const headers = {
|
|
570
|
+
"Content-Type": "application/json"
|
|
571
|
+
};
|
|
572
|
+
if (this.config.apiKey) {
|
|
573
|
+
headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
574
|
+
}
|
|
575
|
+
const response = await fetch(url, {
|
|
576
|
+
...init,
|
|
577
|
+
headers: { ...headers, ...init?.headers },
|
|
578
|
+
signal: AbortSignal.timeout(this.config.timeout ?? 3e4)
|
|
579
|
+
});
|
|
580
|
+
if (!response.ok) {
|
|
581
|
+
const error = await response.json().catch(() => ({}));
|
|
582
|
+
throw new Error(
|
|
583
|
+
error.message ?? `HTTP ${response.status}: ${response.statusText}`
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
return response.json();
|
|
587
|
+
}
|
|
588
|
+
sleep(ms) {
|
|
589
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
function createStwoProverClient(config) {
|
|
593
|
+
return new StwoProverClient(config);
|
|
594
|
+
}
|
|
595
|
+
StwoProverClient.prototype.loadZkmlModel = async function(req) {
|
|
596
|
+
const response = await this.fetch("/api/v1/models", {
|
|
597
|
+
method: "POST",
|
|
598
|
+
body: JSON.stringify({
|
|
599
|
+
model_path: req.modelPath,
|
|
600
|
+
description: req.description
|
|
601
|
+
})
|
|
602
|
+
});
|
|
603
|
+
return {
|
|
604
|
+
modelId: response.model_id,
|
|
605
|
+
weightCommitment: response.weight_commitment,
|
|
606
|
+
numLayers: response.num_layers,
|
|
607
|
+
inputShape: response.input_shape
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
StwoProverClient.prototype.submitZkmlProve = async function(req) {
|
|
611
|
+
const response = await this.fetch("/api/v1/prove", {
|
|
612
|
+
method: "POST",
|
|
613
|
+
body: JSON.stringify({
|
|
614
|
+
model_id: req.modelId,
|
|
615
|
+
input: req.input,
|
|
616
|
+
gpu: req.gpu ?? false,
|
|
617
|
+
security: req.security ?? "auto"
|
|
618
|
+
})
|
|
619
|
+
});
|
|
620
|
+
return { jobId: response.job_id, status: response.status };
|
|
621
|
+
};
|
|
622
|
+
StwoProverClient.prototype.getZkmlProveStatus = async function(jobId) {
|
|
623
|
+
const response = await this.fetch(`/api/v1/prove/${jobId}`);
|
|
624
|
+
return {
|
|
625
|
+
jobId: response.job_id,
|
|
626
|
+
status: response.status,
|
|
627
|
+
progressBps: response.progress_bps,
|
|
628
|
+
elapsedSecs: response.elapsed_secs
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
StwoProverClient.prototype.getZkmlProveResult = async function(jobId) {
|
|
632
|
+
const response = await this.fetch(`/api/v1/prove/${jobId}/result`);
|
|
633
|
+
return {
|
|
634
|
+
calldata: response.calldata,
|
|
635
|
+
ioCommitment: response.io_commitment,
|
|
636
|
+
weightCommitment: response.weight_commitment,
|
|
637
|
+
layerChainCommitment: response.layer_chain_commitment,
|
|
638
|
+
estimatedGas: response.estimated_gas,
|
|
639
|
+
numMatmulProofs: response.num_matmul_proofs,
|
|
640
|
+
numLayers: response.num_layers,
|
|
641
|
+
proveTimeMs: response.prove_time_ms,
|
|
642
|
+
teeAttestationHash: response.tee_attestation_hash ?? null
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
StwoProverClient.prototype.proveZkml = async function(req, opts) {
|
|
646
|
+
const { jobId } = await this.submitZkmlProve(req);
|
|
647
|
+
const pollInterval = opts?.pollIntervalMs ?? 2e3;
|
|
648
|
+
const timeout = opts?.timeoutMs ?? 6e5;
|
|
649
|
+
const startTime = Date.now();
|
|
650
|
+
while (Date.now() - startTime < timeout) {
|
|
651
|
+
const status = await this.getZkmlProveStatus(jobId);
|
|
652
|
+
if (opts?.onProgress) opts.onProgress(status);
|
|
653
|
+
if (status.status === "completed") {
|
|
654
|
+
return this.getZkmlProveResult(jobId);
|
|
655
|
+
}
|
|
656
|
+
if (status.status === "failed") {
|
|
657
|
+
throw new Error(`ZKML proving failed for job ${jobId}`);
|
|
658
|
+
}
|
|
659
|
+
await this.sleep(pollInterval);
|
|
660
|
+
}
|
|
661
|
+
throw new Error(`ZKML proving timed out after ${timeout}ms`);
|
|
662
|
+
};
|
|
663
|
+
var PROOF_TYPES = {
|
|
664
|
+
BATCH_PAYMENTS: "batch_payments",
|
|
665
|
+
AI_INFERENCE: "ai_inference",
|
|
666
|
+
CROSS_CHAIN_BRIDGE: "cross_chain_bridge",
|
|
667
|
+
DEFI_CALCULATION: "defi_calculation",
|
|
668
|
+
GAME_STATE: "game_state",
|
|
669
|
+
VRF_RANDOMNESS: "vrf_randomness",
|
|
670
|
+
KYC_VERIFICATION: "kyc_verification",
|
|
671
|
+
SUPPLY_CHAIN: "supply_chain",
|
|
672
|
+
RECURSIVE_AGGREGATION: "recursive_aggregation",
|
|
673
|
+
CUSTOM: "custom"
|
|
674
|
+
};
|
|
675
|
+
var GPU_TIERS = {
|
|
676
|
+
H100: "H100",
|
|
677
|
+
H200: "H200",
|
|
678
|
+
B200: "B200",
|
|
679
|
+
A100: "A100",
|
|
680
|
+
RTX_4090: "4090",
|
|
681
|
+
AUTO: "auto"
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
// src/branding.ts
|
|
685
|
+
var BITSAGE_LOGO = `
|
|
686
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
687
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D
|
|
688
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557
|
|
689
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D
|
|
690
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
691
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
692
|
+
`;
|
|
693
|
+
var BITSAGE_TAGLINE = "The Economic Heart of Decentralized Compute";
|
|
694
|
+
var BITSAGE_BANNER = `
|
|
695
|
+
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
696
|
+
\u2551 \u2551
|
|
697
|
+
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
698
|
+
\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2551
|
|
699
|
+
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
700
|
+
\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551
|
|
701
|
+
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
702
|
+
\u2551 \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
|
|
703
|
+
\u2551 \u2551
|
|
704
|
+
\u2551 The Economic Heart of Decentralized Compute \u2551
|
|
705
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
706
|
+
`;
|
|
707
|
+
var OBELYSK_LOGO = `
|
|
708
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557
|
|
709
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D
|
|
710
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
711
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u255A\u2588\u2588\u2554\u255D \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557
|
|
712
|
+
\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2557
|
|
713
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
|
|
714
|
+
`;
|
|
715
|
+
var OBELYSK_TAGLINE = "Verifiable GPU Compute \u2022 ZK Proofs \u2022 TEE Attestation";
|
|
716
|
+
var OBELYSK_BANNER = `
|
|
717
|
+
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
718
|
+
\u2551 \u2551
|
|
719
|
+
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2551
|
|
720
|
+
\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D \u2551
|
|
721
|
+
\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2551
|
|
722
|
+
\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u255A\u2588\u2588\u2554\u255D \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557 \u2551
|
|
723
|
+
\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2557 \u2551
|
|
724
|
+
\u2551 \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u2551
|
|
725
|
+
\u2551 \u2551
|
|
726
|
+
\u2551 Verifiable GPU Compute \u2022 ZK Proofs \u2022 TEE Attestation \u2551
|
|
727
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
728
|
+
`;
|
|
729
|
+
function printBitsageBanner() {
|
|
730
|
+
console.log(BITSAGE_BANNER);
|
|
731
|
+
}
|
|
732
|
+
function printObelyskanBanner() {
|
|
733
|
+
console.log(OBELYSK_BANNER);
|
|
734
|
+
}
|
|
735
|
+
function getVersionBanner(version) {
|
|
736
|
+
return `
|
|
737
|
+
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
738
|
+
\u2551 \u2551
|
|
739
|
+
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
740
|
+
\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2551
|
|
741
|
+
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
742
|
+
\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551
|
|
743
|
+
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
744
|
+
\u2551 \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
|
|
745
|
+
\u2551 \u2551
|
|
746
|
+
\u2551 The Economic Heart of Decentralized Compute \u2551
|
|
747
|
+
\u2551 SDK v${version.padEnd(10)} \u2551
|
|
748
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
749
|
+
`;
|
|
750
|
+
}
|
|
751
|
+
export {
|
|
752
|
+
AssetId,
|
|
753
|
+
BITSAGE_BANNER,
|
|
754
|
+
BITSAGE_LOGO,
|
|
755
|
+
BITSAGE_TAGLINE,
|
|
756
|
+
BatchClient,
|
|
757
|
+
BitSageClient,
|
|
758
|
+
CAPABILITY_FLAGS,
|
|
759
|
+
CURVE_ORDER,
|
|
760
|
+
ConfidentialSwapClient,
|
|
761
|
+
ContractClient,
|
|
762
|
+
DAILY_CAPS,
|
|
763
|
+
DEFAULT_CONFIG,
|
|
764
|
+
DEFAULT_CONTRACT_CONFIG,
|
|
765
|
+
DEFAULT_DISCOUNT_TIERS,
|
|
766
|
+
DEFAULT_FEE_DISTRIBUTION,
|
|
767
|
+
DEFAULT_HTTP_CONFIG,
|
|
768
|
+
DEFAULT_PROVER_CONFIG,
|
|
769
|
+
DEFAULT_WS_CONFIG,
|
|
770
|
+
DashboardClient,
|
|
771
|
+
EncryptionHelper,
|
|
772
|
+
FIELD_PRIME,
|
|
773
|
+
GENERATOR_G,
|
|
774
|
+
GENERATOR_H,
|
|
775
|
+
GOVERNANCE_CONFIG,
|
|
776
|
+
GPU_MULTIPLIERS,
|
|
777
|
+
GPU_TIERS,
|
|
778
|
+
GovernanceClient,
|
|
779
|
+
HALVENING_SCHEDULE,
|
|
780
|
+
HttpClient,
|
|
781
|
+
LOCAL_CONTRACTS,
|
|
782
|
+
MAINNET_CONTRACTS,
|
|
783
|
+
MAINNET_TOKENS,
|
|
784
|
+
MAX_BATCH_SIZE,
|
|
785
|
+
MIN_STAKE,
|
|
786
|
+
MiningClient,
|
|
787
|
+
OBELYSK_BANNER,
|
|
788
|
+
OBELYSK_LOGO,
|
|
789
|
+
OBELYSK_TAGLINE,
|
|
790
|
+
ObelyskPrivacy,
|
|
791
|
+
PRAGMA_ORACLE,
|
|
792
|
+
PROOF_TYPES,
|
|
793
|
+
PaymentsClient,
|
|
794
|
+
PrivacyClient,
|
|
795
|
+
PrivacyKeyManager,
|
|
796
|
+
SEPOLIA_CONTRACTS,
|
|
797
|
+
SEPOLIA_TOKENS,
|
|
798
|
+
SLASH_PERCENTAGES,
|
|
799
|
+
STAKE_TIER_THRESHOLDS,
|
|
800
|
+
SdkError,
|
|
801
|
+
StakingClient,
|
|
802
|
+
StwoClient,
|
|
803
|
+
StwoProverClient,
|
|
804
|
+
TeeClient,
|
|
805
|
+
UNSTAKE_LOCKUP_SECS,
|
|
806
|
+
VERIFICATION_CONFIG,
|
|
807
|
+
WebSocketClient,
|
|
808
|
+
WorkersClient,
|
|
809
|
+
addMod,
|
|
810
|
+
createBatchClient,
|
|
811
|
+
createDashboardClient,
|
|
812
|
+
createGovernanceClient,
|
|
813
|
+
createMiningClient,
|
|
814
|
+
createPaymentsClient,
|
|
815
|
+
createPrivacyClient,
|
|
816
|
+
createStakingClient,
|
|
817
|
+
createStwoClient,
|
|
818
|
+
createStwoProverClient,
|
|
819
|
+
createTeeClient,
|
|
820
|
+
createTransferProof,
|
|
821
|
+
createWebSocketClient,
|
|
822
|
+
createWorkersClient,
|
|
823
|
+
ecAdd,
|
|
824
|
+
ecDouble,
|
|
825
|
+
ecMul,
|
|
826
|
+
fromFelt,
|
|
827
|
+
getContractsForNetwork,
|
|
828
|
+
getDailyCapForTier,
|
|
829
|
+
getGpuMultiplier,
|
|
830
|
+
getGpuTier,
|
|
831
|
+
getMinStake,
|
|
832
|
+
getMinStakeForTier,
|
|
833
|
+
getPrivacyDerivationMessage,
|
|
834
|
+
getStakeTierFromAmount,
|
|
835
|
+
getTokensForNetwork,
|
|
836
|
+
getVersionBanner,
|
|
837
|
+
invMod,
|
|
838
|
+
isContractConfigured,
|
|
839
|
+
isIdentity,
|
|
840
|
+
isValidPublicKey,
|
|
841
|
+
isWorkerEligible,
|
|
842
|
+
joinU256,
|
|
843
|
+
mulMod,
|
|
844
|
+
poseidonHash,
|
|
845
|
+
powMod,
|
|
846
|
+
printBitsageBanner,
|
|
847
|
+
printObelyskanBanner,
|
|
848
|
+
randomScalar,
|
|
849
|
+
splitU256,
|
|
850
|
+
subMod,
|
|
851
|
+
toFelt,
|
|
852
|
+
verifyTransferProof
|
|
853
|
+
};
|