payloads

Every protocol interaction produces structured payloads that are validated against Zod schemas and persisted to 0G Storage. This page documents the key payload types and their lifecycle.


Job Definition

The complete job specification is uploaded to 0G Storage during preparation, producing the jobHash that anchors the entire lifecycle.

ts
PreparedJobSchema = z.object({
  prepareId: z.string(),
  quoteId: z.string(),
  assignmentSeed: z.string(),
  trustLevel: z.string().default("standard"),
  jobHash: z.string(),
  serviceId: z.string(),
  providerId: z.string(),
  requesterAddress: z.string(),
  paymentNetwork: z.string(),
  paymentToken: z.string(),
  threshold: z.number(),
  selectedVerifierIds: z.array(z.string()).min(1),
  assignedVerifiers: z.array(z.object({
    verifierId: z.string(),
    ownerAddress: z.string(),
    signingPublicKey: z.string(),
    payoutAddress: z.string(),
  })).min(1),
  createdAt: z.string(),
})

Result Payload

When a provider submits results, the output is uploaded to 0G Storage, producing an immutable resultHash.

ts
JobResultSchema = z.object({
  resultHash: z.string(),     // 0G Storage content hash
  output: z.any(),            // Provider's compute output
  submittedAt: z.string(),    // ISO timestamp
})

Attestation Payload

Each attestation is also uploaded to 0G Storage, producing an attestationHash.

ts
AttestationSchema = z.object({
  attestationId: z.string(),
  attestationHash: z.string(),
  jobHash: z.string(),
  resultHash: z.string(),
  verifierId: z.string(),
  verifierAddress: z.string(),
  decision: z.enum(["approve", "reject", "uncertain"]),
  confidence: z.number().min(0).max(1),
  reason: z.string(),
  failedCriteria: z.array(z.string()),
  teeVerified: z.boolean(),
  teeProof: TeeProofSchema,
  verifierSignature: z.string(),
  createdAt: z.string(),
})

ID Conventions

All protocol IDs are generated with specific prefixes to identify their entity type during routing and logging.

PrefixEntityDescription
prep_Prepared JobUnfunded, pending payment
job_Confirmed JobFunded, assigned to nodes
qt_QuotePricing requirement
prov_ProviderCompute agent identity
ver_VerifierConsensus node identity
svc_ServiceCompute capability
att_AttestationSigned TEE evaluation