sherlock.
AUDIT / MODULE REFERENCE

Ledger

Keep verifiable, tamper-evident cryptographic audit chains of decisions and executions.

Direct API: POST /api/v1/modules/ledgerManage API keys ↗View code boilerplate ↗

When to use it

Validate exported audit trails and verify compliance integrity independently of live services.

Supported Operations & Data Contracts

Call this module with a key scoped to 'ledger'. Provide the operation name and matching input dictionary.

verify · Verify Cryptographic Audit ChainPOST /api/v1/modules/ledger

Validates parent-child SHA-256 hashes, timestamps, and sequence indices across an audit log snapshot.

Input Parameters

FieldTypeRequirementDescription
epochstring (1-128 chars)RequiredEpoch identifier matching the entries.
entriesarrayRequiredSequential array of audit entries starting at index 0.

Output Fields

FieldTypeDescription
validbooleanWhether the chain is unbroken and cryptographically sound.
countnumberNumber of verified entries.
headHashstringTerminal entry SHA-256 hash.
errorIndexnumber (optional)Index of entry that failed verification, if invalid.
reasonstring (optional)Explanation of failure (e.g. prevHash mismatch).

Example Request Payload

JSON Request BodyContent-Type: application/json
{
  "operation": "verify",
  "input": {
    "epoch": "2026-10-q4",
    "entries": []
  }
}

Example Response

JSON Response (HTTP 200)Cache-Control: no-store
{
  "module": "ledger",
  "output": {
    "valid": true,
    "count": 0,
    "headHash": ""
  }
}

Configuration in Graph Builder

When adding Ledger into a visual component or graph workflow, configure its node runtime settings in the builder inspector:

Position Ledger at the end of a transaction workflow to record immutable checkpoint proofs of permitted actions.

Direct API Code Examples

Invoke this module directly from your backend services without passing through the visual builder:

TypeScript / Node.js (Fetch)index.ts
const response = await fetch("https://api.sherlock.dev/api/v1/modules/ledger", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.SHERLOCK_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    operation: "verify",
    input: { epoch: "export-epoch", entries: myLedgerExport }
  }),
});
const { output } = await response.json();
console.log("Audit Chain Valid:", output.valid, "Head Hash:", output.headHash);
cURL / Bashterminal
curl -X POST "$SHERLOCK_BASE_URL/api/v1/modules/ledger" \
  -H "Authorization: Bearer $SHERLOCK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operation":"verify","input":{"epoch":"demo","entries":[]}}'

Current Boundaries & Guarantees

Standalone verification checks an exported snapshot against hash-chain rules; it does not append arbitrary events. Raw voice audio never enters the ledger.

Related Trust Modules