Blocklog records agent activity in an append-only, per-tenant SHA-256 hash chain. Sealed batches commit to their logs with an RFC 6962 Merkle root and are signed with Ed25519. Authoritative execution receipts are a separate artifact: they are signed snapshots of a terminal execution and do not create Merkle or transparency proofs in the v1.0 contract.
In this guide you will ingest an event, seal a batch, and verify the batch and an individual log through the API.
1. Authenticate the Request
Create a key in the dashboard under Settings → API Keys. Generated keys use the prefix bl_ and are shown only once. Send the key in X-API-Key. Authorization: Bearer <key> is also accepted for SDK and legacy clients.
bash
X-API-Key: bl_YOUR_KEY
2. Ingest an Agent Execution Event
Send a structured event to POST /api/v1/logs. Event-specific fields belong inside data. The optional idempotency_key is deduplicated per company and must be 8–128 characters.
Unsealed logs are sealed by the background worker or on demand. The seal response includes both the RFC 6962 merkle_root and the cumulative batch_hash, which commits the root to the previous batch seal.
bash
curl -X POST "https://api.blocklogsecurity.com/api/v1/batches/seal?interval_minutes=5" \
-H "X-API-Key: bl_YOUR_KEY"
Verification rechecks the canonical leaves, the Merkle root, the previous-batch link, and the Ed25519 signature:
bash
# Verify the batch signature and cumulative seal
curl https://api.blocklogsecurity.com/api/v1/verify/batch/d04a6b12-92ec-49f2-8921-b847a1029cde \
-H "X-API-Key: bl_YOUR_KEY"
# Verify one log's inclusion in the sealed batch
curl https://api.blocklogsecurity.com/api/v1/verify/log/8f71d9c4-a3e2-4891-b7c3-d05a2b6e8f10 \
-H "X-API-Key: bl_YOUR_KEY"
Current /verify/* code recomputes roots with legacy odd-node duplication, while sealing stores an RFC 6962 root. For batch sizes that are not powers of two, the two roots can differ and verification can fail. Validate against your deployment before relying on this path in production; this is a known implementation limitation, not a property of the receipt or Merkle design.
Blocklog uses tenant-scoped API keys for machine clients, short-lived JWT sessions for dashboard operators, and WebAuthn assertions for HITL approvals:
MethodPathDescription
POST/api/v1/auth/api_keysGenerate a scoped API key (user session required)
GET/api/v1/auth/api_keysList active company API keys
DELETE/api/v1/auth/api_keys/{key_id}Revoke an API key immediately
POST/api/v1/auth/logoutClear the operator session cookie
GET/.well-known/blocklog-keys.jsonPublic RFC 8037 Ed25519 JSON Web Key Set (JWKS)
Machine API Keys
Generated keys use the prefix bl_ and are returned in plaintext exactly once. Only a salted SHA-256 hash and the first 12 characters are stored. Keys can carry one of four roles:
serviceadminauditorread-only
Send X-API-Key: bl_... for machine-to-machine calls. The backend also accepts Authorization: Bearer bl_... and a dashboard cookie. Invalid, revoked, or expired keys return 401.
API-key management itself requires a logged-in user session. An API key cannot mint another API key. Agent CRUD routes under /api/v1/agents also require a user session or company-admin authorization, not API-key auth alone.
Human Operator Session (Dashboard & HITL)
Browser sessions use a JWT in the blocklog_auth cookie. The cookie isHttpOnly, Secure in production, and SameSite=Lax. HITL approval endpoints require an authenticated human user plus a valid WebAuthn assertion; an API key alone is not sufficient for /hitl/approve.
Public Verification Keys
The public Ed25519 verification keys are published as a JWK Set at /.well-known/blocklog-keys.json. Key records include a key ID and status. Pin a known key ID or trust root in offline verification rather than trusting an unauthenticated download at verification time.
Blocklog separates event integrity, batch inclusion, and execution receipts. The diagram shows how those artifacts are produced:
text
[Agent Operation] ──► POST /api/v1/logs (canonical payload + SHA-256)
│
▼
[Tenant Sequential Hash Chain]
chain_hash = SHA256(prev_hash:payload_hash:event_type:source)
│
▼
[RFC 6962 Merkle Tree Batching]
Leaves: H(0x00 || canonical_leaf)
Nodes: H(0x01 || left || right)
│
▼
[Cumulative Batch Seal & Ed25519 Signature]
seal = SHA256(merkle_root || prev_batch_hash)
│
▼
[Authoritative Execution Receipt v1.0 (separate artifact)]
├─ 5 SHA-256 commitments ├─ Canonical serialization hash
├─ Execution/policy snapshots └─ Ed25519 signature
└─ No Merkle or transparency proof in v1
Canonical Payload JSONThe backend uses Python json.dumps(payload, sort_keys=True, separators=(',', ':'), ensure_ascii=False), then UTF-8 encoding and SHA-256. This is deterministic sorted-key JSON, not full RFC 8785/JCS: numbers, Unicode normalization, and language-specific edge cases are not normalized. Cross-language producers must reproduce the exact bytes.
Payload HashSHA-256 digest of the canonical event payload. It is a commitment to the stored payload; it is not returned by POST /logs.
Sequential Hash ChainEach event computes chain_hash = SHA256(previous_hash:payload_hash:event_type:source). The tenant row and latest log row are locked during append. Changing a historical row breaks later chain hashes unless the attacker can rewrite and re-sign the entire chain.
RFC 6962 Merkle TreeBatch roots use RFC 6962 leaf and node domain separation (0x00 and 0x01). Current proof-bundle generation and API verification also contain a legacy odd-node duplication path, so non-power-of-two batch proofs need explicit validation.
Cumulative Batch SealBinds a batch Merkle root to the prior batch seal: SHA256(merkle_root || prev_batch_hash). The seal is signed with the deployment Ed25519 batch key. The colon-free concatenation is intentional and part of the current format.
Execution Receipt (v1.0)A signed snapshot of a terminal execution. It contains five SHA-256 commitments, policy/execution/outcome snapshots, a canonical serialization hash, and an Ed25519 signature. It deliberately makes no Merkle or transparency-log claim in v1.
WebAuthn HITL AssertionA FIDO2 assertion bound to a server-issued challenge for a specific approval request. It proves possession of the enrolled credential at approval time; it does not by itself prove legal authority or that the downstream action occurred.
A Blocklog signature is evidence about a Blocklog artifact. It is not, by itself, evidence that the underlying real-world action occurred. Keep these boundaries explicit when designing controls and audit procedures.
Artifact-by-artifact guarantees
Batch signature. Proves that the batch root and cumulative seal were signed by the deployment's batch Ed25519 key. It does not prove that the events are true, complete, or authorized.
Authoritative execution receipt. Binds an execution ID, policy snapshot, execution snapshot, outcome, and five SHA-256 commitments to an Ed25519 signature. In v1 it does not contain a Merkle proof, checkpoint, or witness quorum.
Client signature. Optional client_signature plus client_key_id attestation. A failed client-signature check is logged but does not reject ingestion. It is weaker than the server batch signature and must not be presented as server-attested.
HITL approval. Binds a WebAuthn assertion to a server-issued challenge for one approval request. It proves control of the enrolled credential at that moment, not legal authority, intent, or downstream execution.
Transparency checkpoint. Read endpoints and a checkpoint format exist, but automatic checkpoint creation and witness quorum are not established in the current backend. The standalone verifier reports quorum_established: false unless independently configured evidence is supplied.
Gateway enforcement. The execution gateway returns a policy decision and single-use token. Enforcement is advisory unless the downstream processor actually requires and validates that token.
Trust roots and key separation
Batch seals and authoritative receipts use separate signing-key settings; configure distinct keys for production. Pin the expected key ID or public key in your verifier; do not trust a key fetched from the same server at verification time. Key rotation and revocation are represented in the key registry, and old signatures remain verifiable only while the corresponding public key is trusted.
Threat model boundary
Hash chains and signatures detect database-level tampering and unauthorized edits when the attacker does not control the signing keys. A fully compromised application server that holds the signing keys can produce new valid signatures. Blocklog is not a blockchain, does not prove physical delivery, and is not a safety-rated control system.
⚠
Use precise language in audit reports: "signed by Blocklog" means the artifact was signed by a Blocklog-controlled key. It does not mean "verified true in the physical world." Outcome confidence depends on the recorded source, adapter evidence, and any counterparty attestations.
The ingestion engine records agent actions, tool calls, model interactions, and decision events. Append operations lock the tenant quota row and latest log row so chain assignment remains ordered under concurrency.
MethodPathDescription
POST/api/v1/logsIngest one structured log event
POST/api/v1/logs/batchIngest up to 1,000 events; returns ingested count and log IDs
GET/api/v1/logsCursor-paginated log queries with time and identity filters
GET/api/v1/logs/{log_id}Fetch the stored payload, hashes, and correlation IDs
GET/api/v1/logs/{log_id}/verifyVerify chain continuity and the server signature, when present
GET/api/v1/logs/export-proofExport canonical leaves, payload/chain hashes, and a recomputed root for a time window
Request Payload Schema
json
{
"event_type": "tool.invocation", // Required: min 1 char
"data": { // Optional object; "payload" is accepted as an alias
"tool": "sql_query_executor",
"query": "SELECT balance FROM accounts WHERE user_id = 'u_8912'",
"rows_affected": 1
},
"timestamp": "2026-10-24T07:15:00Z", // Optional event time; stored in the hashed payload
"source": "database-agent-v1", // Default: "api"
"idempotency_key": "exec_step_89102", // Optional: 8-128 chars, deduplicated per company
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"session_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"workflow_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"agent_id": "agent_financial_analyst",
"agent_type": "autonomous",
"client_signature": null, // Optional client attestation
"client_key_id": null // Optional registered client key ID
}
Batch ingestion accepts { "logs": [...] } and returns { "ingested": 2, "log_ids": ["...", "..."] }. It processes events in order; it is not a single all-or-nothing database transaction. Reusing an idempotency key with a different payload or event type returns 409.
Log Chain Verification Response
Calling GET /api/v1/logs/{log_id}/verify recomputes the chain hash. signature_valid is null when the log has no server signature, for example on plans where event signing is disabled.
batch_proof is batch metadata, not a per-log inclusion proof. Use GET /api/v1/verify/log/{log_id} or the batch proof bundle when you need an explicit Merkle path.
Logs are grouped into time-windowed batches. The batch root commits to canonical log leaves, and the cumulative seal binds that root to the prior batch seal:
POST/api/v1/batches/sealSeal events in the last N minutes (1–1440)
GET/api/v1/batchesList batches (limit up to 200)
GET/api/v1/batches/{batch_id}Get batch metadata, Merkle root, and Ed25519 signature
GET/api/v1/batches/{batch_id}/statusInspect sealed, signed, and finalized states
POST/api/v1/batches/{batch_id}/finalizeFinalize a sealed batch that has a signed root
GET/api/v1/batches/{batch_id}/proof-bundleExport recomputed root and inclusion paths for all logs
⚠
The current proof-bundle and verification code build a level-paired tree that duplicates the last node at odd widths. RFC 6962 roots use subtree splitting. For batch sizes that are not powers of two, the recomputed root and inclusion paths can disagree with the stored merkle_root. Treat non-power-of-two proofs as unverified until this implementation is corrected or independently checked.
Proof Bundle Structure
GET /api/v1/batches/{batch_id}/proof-bundle returns the stored seal and a recomputed root plus per-log paths. The hash field is the log's payload_hash, not the leaf hash:
An Execution represents a bounded lifecycle of an agent operation, from creation through authorization, optional human approval, and a terminal outcome.
MethodPathDescription
POST/api/v1/executions/Create an execution record (requires execution_id)
GET/api/v1/executions/{execution_id}Fetch execution details; supports include_steps and include_approvals
POST/api/v1/executions/{execution_id}/statusAttempt an allowed state-machine transition
POST/api/v1/executions/{execution_id}/stepsRecord a step with input/output hashes and metadata
GET/api/v1/executions/{execution_id}/stepsList recorded steps for an execution
GET/api/v1/executions/{execution_id}/timelineFetch the chronological step and approval timeline
ℹ
The lifecycle router is under active hardening in this release. Validate tenant-scoped behavior against your deployment before using it as a production control. The execution gateway and authoritative receipt APIs are the primary enforcement and evidence surfaces.
State Machine
The transition endpoint enforces the graph below. BLOCKED, COMPLETED, FAILED, CANCELLED, and EXPIRED are terminal. Enum values such as SUCCEEDED and OUTCOME_UNKNOWN exist for imported or receipt-backed records but are not reachable through this transition API.
The Execution Gateway evaluates an action against active policies and, when authorized, returns a short-lived, single-use token plus a signed gateway receipt. Enforcement is advisory unless the downstream processor requires and validates the token.
# 1. Authorize: request a policy decision and single-use token
curl -X POST https://api.blocklogsecurity.com/api/v1/execution/authorize \
-H "X-API-Key: bl_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"processor": "stripe",
"action_type": "payments.transfer",
"amount_minor": 100000,
"currency": "USD",
"idempotency_key": "transfer_20261024_001",
"subject_reference": "acct_892b1a",
"context": { "destination": "acct_99182" }
}'
# 2. Verify the token before dispatching the downstream action
curl -X POST https://api.blocklogsecurity.com/api/v1/execution/verify \
-H "X-API-Key: bl_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"token": "exec_tok_9f81a7d2...",
"processor": "stripe",
"action_type": "payments.transfer",
"amount_minor": 100000,
"currency": "USD",
"idempotency_key": "transfer_20261024_001",
"subject_reference": "acct_892b1a"
}'
# 3. Consume the token after the processor accepts the action
curl -X POST https://api.blocklogsecurity.com/api/v1/execution/consume \
-H "X-API-Key: bl_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"token": "exec_tok_9f81a7d2...",
"processor": "stripe",
"action_type": "payments.transfer",
"execution_reference": "tr_3Nx1289",
"transaction_reference": "ch_3N123456789"
}'
The authorize response includes token, token_expires_at, receipt_id, receipt_signature, and an outcome object with the decision, reasons, policy hash, and risk fields. Consume returns consumed_at, token_consumed, and status; it does not accept arbitrary outcome or output objects.
An authoritative execution receipt is a signed, immutable snapshot of a terminal execution. It binds five SHA-256 commitments, the policy/execution/outcome snapshots, and a canonical serialization hash to an Ed25519 signature:
Arbitrary client receipt creation via POST /api/v1/receipts/ is disabled and returns 403. A receipt can only be issued by the server from a persisted execution with an authoritative action type and adapter ID.
Issuance Rules
Eligible states: COMPLETED, SUCCEEDED, FAILED, CANCELLED, INTERRUPTED, and OUTCOME_UNKNOWN. EXPIRED is not currently issuable.
The execution must have action_type and adapter_id. Missing authoritative action identity returns 409.
Issuance is idempotent per internal execution. Retries return the same receipt; they do not mint a new snapshot.
Export returns the stored artifact, not a fresh projection of mutable execution rows.
Canonical Receipt Schema (v1.0)
receipt_id is a UUID. Optional timestamps use UTC RFC 3339 with a Z suffix; absent optional values are null. The canonical hash is computed with integrity initially empty, and the signature is computed over the artifact before the signature member is added.
A v1 receipt is a signed execution snapshot. It is not a Merkle proof, a transparency checkpoint, or a guarantee that the physical action occurred. The outcome.source and any separately supplied adapter or counterparty evidence determine outcome confidence.
The integrity subsystem scans the tenant hash chain for broken links and reports batch continuity. The quick status check is bounded; read verification_scope and logs_scanned before treating a result as a full-history audit.
MethodPathDescription
GET/api/v1/integrity/statusQuick integrity scan and log/batch verification counts
GET/api/v1/integrity/reportComprehensive integrity report with batch timeline and missing hash analysis
A valid status means the scanned segment is internally consistent. It is not a proof that every historical event exists, that batch signatures are valid, or that the underlying actions occurred. Use the batch verification and standalone receipt verifier for those claims.
Online verification endpoints recheck a signed batch or one log's inclusion. They return 404 with a failure object when verification does not succeed, so clients must inspect the body rather than relying on HTTP status alone.
MethodPathDescription
GET/api/v1/verify/batch/{batch_id}Verify batch root, cumulative seal, and Ed25519 signature
GET/api/v1/verify/log/{log_id}Verify log inclusion and the batch signature
bash
# Verify a batch
curl https://api.blocklogsecurity.com/api/v1/verify/batch/d04a6b12-92ec-49f2-8921-b847a1029cde \
-H "X-API-Key: bl_YOUR_KEY"
Because of the odd-width root recomputation described under Batches, these endpoints can reject a valid non-power-of-two batch. Verify against a deployment with known batch sizes, or independently check the exported RFC 6962 root and proof, before making availability or compliance claims.
The standalone verifier is an offline Python tool for receipt artifacts. It checks schema, commitments, canonical hashing, and Ed25519 signatures without calling the Blocklog API. It can also validate Merkle, checkpoint, witness, and counterparty material when those optional artifacts are present.
Installation
bash
pip install blocklog-verifier
# Or from the repository:
pip install -e ./verifier
CLI Verification
bash
# 1. Verify with a pinned Ed25519 public key (hex or base64)
blocklog-verify receipt.json -k "3a82910cde4819..."
# 2. Resolve the signing key through a pinned trust-root file
blocklog-verify receipt.json --trust-root-file trust_roots.json
# 3. Machine-readable output for CI gates
blocklog-verify receipt.json -k "3a8291..." --json-output
# 4. Structural validation only (NO cryptographic authenticity)
blocklog-verify receipt.json --no-signature
A trust-root file is a JSON array of objects with key_id, public_key, status, and algorithm. Revoked keys fail verification. Use --require-merkle only for receipts that actually contain a Merkle proof; v1 authoritative receipts report merkle_inclusion: unavailable and will fail that flag.
CLI Verification Output
text
============================================================
BLOCKLOG INDEPENDENT RECEIPT VERIFICATION
============================================================
VERIFICATION PASSED: Cryptographic integrity and signature confirmed
Receipt ID: 0e7a3d9c-5c84-4a31-9f3c-4f0f0f7a2b11
Verified At: 2026-10-24T07:22:15.012Z
Claimed Status: completed (Source: adapter_verified)
Real-World Verified: True (Confidence: HIGH)
Verification Checks:
[schema_version] Receipt version '1.0' recognized
[required_fields] All required envelope fields present
[execution_commitment_syntax] Execution commitment format valid
[outcome_commitment_syntax] Outcome commitment format valid
[canonical_hash] Canonical serialization hash matches payload
[signature] Ed25519 signature valid using key 'blocklog:execution:3a82910cde4819ab'
Warnings:
- No Merkle inclusion proof present to verify
- No transparency checkpoint evidence supplied
============================================================
Programmatic Python Verification
python
from verifier.core import verify_receipt_file
result = verify_receipt_file(
"receipt.json",
public_key="3a82910cde4819...",
)
if result.cryptographically_verified:
print(f"Receipt {result.receipt_id} signature verified")
print(result.outcome_assessment)
else:
print("Verification failed:", result.errors)
# Full machine-readable result
print(result.to_dict())
ℹ
Outcome confidence is MAXIMAL for a verified counterparty attestation, HIGH for an adapter-verified outcome, and LOW otherwise (including agent self-report). These are evidence-source tiers, not a guarantee of physical-world truth. The verifier validates individual witness assertions but does not establish BFT quorum; quorum_established is false.
Evidence policies declare required payload fields, retention, seal latency, and expected event frequency. Reads accept any valid authentication; create, update, and archive require a company admin user session. Policy evaluation matches event_type exactly; wildcard matching is not implemented.
MethodPathDescription
GET/api/v1/policy/retentionList active evidence policies for the company
GET/api/v1/policyList all non-archived policies
POST/api/v1/policyCreate an evidence policy (company admin required)
GET/api/v1/policy/{policy_id}Fetch policy specification by integer ID
PUT/api/v1/policy/{policy_id}Update a policy (company admin required)
policy_id in this API is an integer database ID, not the string policy identifier used by the execution gateway. retention_days is also limited by the company plan.
Agents represent autonomous software actors. Agent CRUD uses the dashboard user session: reads require an authenticated user, while create, update, and delete require a company admin. The identity subroutes are separate and currently declare API-key authentication.
MethodPathDescription
POST/api/v1/agentsRegister a new agent (company admin required)
GET/api/v1/agentsList company agents
GET/api/v1/agents/{agent_id}Get agent metadata
PATCH/api/v1/agents/{agent_id}Update name, slug, description, or active state
DELETE/api/v1/agents/{agent_id}Delete an agent (company admin required)
GET/api/v1/agents/{agent_id}/identityGet the active cryptographic identity
GET/api/v1/agents/{agent_id}/identitiesList identities with optional status filter
POST/api/v1/agents/{agent_id}/identityCreate an Ed25519 identity for the agent
POST/api/v1/agents/{agent_id}/identity/rotateRotate the agent identity key
POST/api/v1/agents/{agent_id}/identity/revokeRevoke the active identity
⚠
Agent identity endpoints are experimental. They declare API-key auth and pass the resulting AuthContext into parameters annotated as str, which may fail at runtime. Validate tenant scoping, authentication, and key lifecycle behavior against your deployment before relying on them as a production trust anchor.
When an execution enters WAITING_FOR_APPROVAL, an API client can request a human review. The server returns a five-minute challenge. Approval requires a logged-in company member and a valid WebAuthn assertion bound to that challenge; the API key used to request review cannot approve its own request.
MethodPathDescription
POST/api/v1/hitl/requestRequest approval for an execution awaiting HITL
POST/api/v1/hitl/approveSubmit a WebAuthn assertion (user session required)
POST/api/v1/hitl/rejectReject an approval request and append an audit record
POST/api/v1/hitl/escalateEscalate to another reviewer
GET/api/v1/hitl/overridesList historical human overrides and approvals
GET/api/v1/hitl/overrides/{override_id}Fetch one override record
GET/api/v1/hitl/audit-trailFetch the append-only HITL audit trail
The execution_id in the HITL request is the database UUID of the execution, not the external execution_id correlation string. The response contains the approval ID, current status, the challenge to pass to navigator.credentials.get(), and the expiry:
Approval changes the execution to RUNNING and stores the HITL proof hash. Expired challenges return 403; already-decided requests return 409. HITL proves possession of the enrolled credential, not the legal authority of the signer.
Decisions are structured records of an AI model's inputs, outputs, tools, policies, confidence, evidence links, and optional signatures. They are separate from logs and execution receipts.
Provenance records form a directed acyclic graph of inputs, documents, model invocations, tool calls, decisions, and external actions. Node and edge creation use query parameters rather than a JSON body.
MethodPathDescription
POST/api/v1/provenance/nodesCreate a node via query parameters (execution_id, node_type, ...)
POST/api/v1/provenance/edgesCreate a directed edge via query parameters
GET/api/v1/provenance/executions/{execution_id}Fetch the complete provenance DAG
GET/api/v1/provenance/executions/{execution_id}/summaryFetch node/edge counts and graph summary
GET/api/v1/provenance/executions/{execution_id}/traceTrace a chain from an optional start node
GET/api/v1/provenance/executions/{execution_id}/freshnessCheck provenance freshness against max_age_minutes
⚠
Provenance routes are experimental in this release and currently pass the API-key dependency result where a tenant string is expected. Validate tenant scoping before relying on them in production.
The AI provenance endpoint records an action log and a companion provenance row. It hashes the supplied prompt and optional context summary with SHA-256 server-side; the raw prompt is not stored in the provenance row. The action log itself contains only the fields you place in action.data.
MethodPathDescription
POST/api/v1/ai/actionsIngest an action plus model ID, prompt hash source, and human-confirmation flag
Hashing a prompt does not make it confidential by itself. Avoid placing secrets in prompts, and treat the prompt hash as a correlation commitment rather than encryption.
Forensics reconstructs the recorded decision and execution context and evaluates counterfactual policy scenarios. It analyzes stored evidence; it does not re-execute external side effects or prove what would have happened in the real world.
MethodPathDescription
GET/api/v1/forensics/replaysList replay sessions
POST/api/v1/forensics/replaysCreate a replay session from recorded evidence
GET/api/v1/forensics/replays/{replay_id}Get replay session status and summary
Dispatchable events are batch.sealed, log.ingested, and integrity.violation. Target URLs must be HTTPS and pass outbound URL validation. If a signing secret is configured, the payload is sent as sorted compact JSON and signed with HMAC-SHA256.
batch.signed is accepted by the registration schema for compatibility but is not in the dispatch set. Subscribe to batch.sealed for sealed-batch notifications.
MethodPathDescription
GET/api/v1/webhooks/eventsList dispatchable events and a sample payload
POST/api/v1/webhooksRegister an HTTPS webhook and optional signing secret
GET/api/v1/webhooksList registered webhooks (secret never returned)
DELETE/api/v1/webhooks/{webhook_id}Deregister a webhook
Verifying Webhook Signatures
Verify the exact raw request body, not a re-serialized object. The header is X-Blocklog-Signature: sha256=<hex>.
The Python SDK provides execution tracking, contextvars-based context propagation, exponential-backoff retries, batched ingestion, and decorators for agents, tools, and decisions. Package version in this repository: 0.2.6.
Installation
bash
pip install blocklog
# Or with framework integrations:
pip install "blocklog[langchain]"
pip install "blocklog[openai]"
pip install "blocklog[all]"
Initialization
Initialize once at application startup. If omitted, the SDK reads BLOCKLOG_API_KEY and BLOCKLOG_BASE_URL. The default base URL is https://blocklogsecurity.com/api/v1.
Use @blocklog.agent to trace agent lifecycles and @blocklog.tool to capture inputs and outputs automatically:
python
import blocklog
@blocklog.tool(name="fetch-market-price")
def fetch_price(ticker: str) -> float:
# Tool inputs, outputs, and execution duration are automatically recorded
return 185.50
@blocklog.agent(name="algorithmic-trader", version="2.0", tags=["production", "treasury"])
def run_trading_cycle():
price = fetch_price("NVDA")
# Record structured decision with context manager
with blocklog.decision(type="BUY", asset="NVDA", confidence=0.89) as d:
d.record_input(market_price=price, signal="momentum_crossover")
# Execute action
order_id = "ord_nvda_8912"
d.record_output(order_id=order_id, filled_shares=100)
d.tag("high-conviction", "automated")
# Request human approval if threshold exceeded
if price * 100 > 15000:
d.request_approval(reason="Trade value exceeds $15,000 threshold", reviewer="risk@acme.com")
print(f"Decision committed with ID: {d.id}")
ℹ
@blocklog.agent works with or without arguments. Decorating a class emits only AGENT_START; decorate the method that owns the lifecycle for full tracing. request_approval() records a request and does not block the decision context.
⚠
The SDK's signing_key option uses HMAC-SHA256 and adds a log_signature field. The backend ingestion schema expects client_signature plus client_key_id and ignores log_signature. Do not describe Python SDK client signing as an Ed25519 server attestation.
The TypeScript SDK supports Node.js 18+, Bun, Next.js, and serverless runtimes. It provides Zod-validated configuration, queued batch ingestion, decorators, and typed API clients. Package version in this repository: 1.0.1.
Installation
bash
npm install @blocklog/sdk
Idiomatic Usage
blocklog.agent is the traceAgent decorator; it returns a decorator rather than executing a callback. Use executeAgent for an imperative call, or apply @traceAgent(...) to a class method.
TypeScript signing helpers exist for HMAC-SHA256 and Ed25519, but the backend ingestion schema does not define log_signature; it expects client_signature and client_key_id. The TypeScript receipt trust client also does not implement Ed25519 verification. Treat client signing as a local integration feature, not a server-attested signature.
The Go SDK provides concurrent event ingestion, buffering, retries, and typed API clients for Go 1.22+ services. The default endpoint is https://blocklogsecurity.com/api/v1.
IngestResponse has Ingested and LogIDs fields; it does not return LogID or PayloadHash. Signing configuration exists in the Go SDK, but no signing implementation was found outside config/tests. Do not claim Go client signatures or receipt verification until verified in your build.
Connect Blocklog into your existing production observability, cloud storage, and identity systems:
OpenTelemetryObservability
Export Blocklog's own traces and metrics to your OpenTelemetry collector over gRPC or HTTP/protobuf. This is backend telemetry egress, not an ingestion path for agent spans.
Store append-only ledger records in S3. Object Lock COMPLIANCE retention is attempted best-effort; enable Object Lock on the bucket, otherwise writes fall back without retention.
Treat Blocklog as a stateful service: the API, PostgreSQL, Redis, Celery workers, and the signing keys all participate in the evidence path. A production deployment needs more than a reachable API process.
⚠
Production mode is validated at startup. Missing secrets, insecure defaults, wildcard CORS, non-TLS remote database/Redis URLs, disabled HTTPS enforcement, or AUTO_CREATE_TABLES=true will prevent the app from starting. Do not disable these checks to get a deployment running.
Minimum production configuration
bash
ENV=production
# Data stores (remote hosts must use TLS)
DATABASE_URL=postgresql://blocklog:password@db.internal:5432/blocklog?sslmode=require
REDIS_URL=rediss://default:password@redis.internal:6379/0
# Secrets: at least 32 characters, never the documented defaults
JWT_SECRET_KEY=<32+ random characters>
API_KEY_SALT=<32+ random characters>
BLOCKLOG_ENCRYPTION_KEY=<32+ random characters>
# Batch signing keypair (Ed25519, hex)
BLOCKLOG_SIGNING_KEY=<ed25519 private key hex>
BLOCKLOG_SIGNING_PUBLIC_KEY=<ed25519 public key hex>
# Required for authoritative receipt issuance (Ed25519, hex)
EXECUTION_SIGNING_PRIVATE_KEY_HEX=<ed25519 private key hex>
# Network and proxy controls
ENFORCE_HTTPS=true
TRUST_PROXY=true
RATE_LIMIT_FAIL_CLOSED=true
ALLOWED_HOSTS=api.blocklogsecurity.com
CORS_ORIGINS=https://app.blocklogsecurity.com
# Schema management and email (email is required in production)
AUTO_CREATE_TABLES=false
SMTP_HOST=smtp.internal
SMTP_PORT=587
SMTP_USERNAME=blocklog
SMTP_PASSWORD=<smtp password>
Process topology
API: run the FastAPI app under Gunicorn/Uvicorn workers behind a TLS proxy. Keep TRUST_PROXY=true only when the proxy is actually trusted.
Worker: run at least one Celery worker for exports, alerts, integrity checks, retention, and scheduled sealing work.
Beat: run exactly one Celery Beat scheduler per environment to avoid duplicate scheduled jobs.
PostgreSQL: use managed backups, point-in-time recovery, and TLS. The chain is only as durable as the database that stores it.
Redis: use TLS and persistence appropriate for rate-limit and execution-token state. Redis loss can invalidate in-flight execution tokens.
Migrations and probes
bash
# Apply reviewed migrations before starting new API/worker processes
alembic upgrade head
# Liveness: process is up
curl -f https://api.blocklogsecurity.com/api/v1/health/live
# Readiness: PostgreSQL and Redis are reachable
curl -f https://api.blocklogsecurity.com/api/v1/health/ready
/health/ready returns 503 with per-dependency checks when PostgreSQL or Redis is unavailable. Use liveness for restart decisions and readiness for load-balancer admission.
Key and data operations
Back up signing keys separately from the database. Losing a receipt signing key prevents new receipts from being verifiable against the expected key; it does not make old receipts unreadable.
Plan key rotation before revoking. Publish the new public key, keep the old key available for verification, then retire the old key after the verification window.
Test restore, not just backup. Restore a database snapshot into an isolated environment and verify a known batch and receipt against the restored data.
Monitor the evidence path. Alert on readiness failures, worker backlog, failed webhook deliveries, unsealed batches, and verifier failures.
ℹ
Production readiness does not remove the limitations described in Trust Model & Guarantees. Signatures prove artifact integrity, not real-world truth, and gateway enforcement remains advisory unless the downstream processor validates the execution token.
Start with the HTTP status and the response body. Blocklog uses standard status codes, but several verification endpoints return 404 for a failed verification and put the real reason in detail.
HTTP status map
400 — malformed request or invalid state transition.
401 — missing, malformed, revoked, or expired API key/token. Check the bl_ prefix and send X-API-Key.
403 — valid identity but insufficient role or company membership, or an expired HITL challenge.
404 — resource not found in your company, or a verification endpoint reporting a failed check in detail.
422 — schema validation failure, such as a missing amount_minor, currency, or subject_reference.
429 — rate limit exceeded. Back off; do not retry in a tight loop.
500 — unexpected server error. Capture the request ID and server logs.
503 — readiness failure or dependency unavailable.
Common failures
Ingestion returns 409: the idempotency_key was already used for a different payload or event. Reuse the same key only for an identical retry.
Receipt issuance returns 409: the execution lacks an authoritative action_type or adapter_id, or its status is EXPIRED. Only completed/terminal outcomes are receipt-issuable.
Gateway authorize returns 422: include processor, action_type, amount_minor, currency, an 8+ character idempotency_key, and subject_reference.
HITL approval returns 403: the challenge expired (default TTL 300 seconds) or the authenticated user is not a company member.
Webhook signature mismatch: verify the exact raw body, not a re-serialized JSON object. The signature covers sorted compact JSON.
Verification failures
text
BATCH_NOT_FOUND batch ID does not exist in your company
NO_SIGNATURE batch has no Ed25519 signature
NO_LOGS_IN_BATCH batch contains no log rows
BATCH_SEAL_MISMATCH recomputed Merkle root or previous-batch link differs
NO_PUBLIC_KEY verifier has no batch public key configured
SIGNATURE_INVALID Ed25519 signature does not match the signed payload
LOG_NOT_BATCHED log is not assigned to a sealed batch
BATCH_NOT_FOUND_FOR_LOG log references a batch that cannot be loaded
CUMULATIVE_HASH_MISMATCH recomputed root does not match the stored batch seal
LOG_NOT_FOUND_IN_BATCH log row is missing from the reconstructed batch
A failed GET /verify/log/{log_id} or GET /verify/batch/{batch_id} can surface as 404 with the verifier result in detail. Do not treat every 404 as “not found” without reading the body.
⚠
If batch proofs fail only for non-power-of-two batches, check the known odd-width inconsistency between RFC 6962 roots and the duplicated-last-node proof builder. Treat the sealed root as authoritative and verify inclusion with the standalone verifier before assuming data corruption.
Need custom trust architecture or integration assistance?
Connect directly with the Blocklog cryptographic engineering team.