VerdifaX

VerdifaxClient

The synchronous Python client. Wraps an httpx.Client with a connection pool, applies client-side validation before every call, and translates HTTP errors into a clean exception hierarchy.

Import

from verdifax import VerdifaxClient

Constructor

VerdifaxClient(
    base_url: str | None = None,
    api_key: str | None = None,
    timeout: float = 30.0,
    transport: httpx.BaseTransport | None = None,
)
ArgumentDefaultNotes
base_url$VERDIFAX_API_URL or http://localhost:9090Trailing slashes are stripped
api_key$VERDIFAX_API_KEYSent as X-Verdifax-Key header
timeout30.0 secondsApplied to every request
transportNoneInject a custom transport for tests (e.g. httpx.MockTransport)

Methods

client.health() -> dict
client.attest(payload, program_id, route_id, registry_record_hash) -> AttestationReceipt
client.verify(manifest_hash, payload, program_id, route_id, registry_record_hash) -> bool
client.execute(payload, program_id, route_id, registry_record_hash) -> ExecutionManifest
client.close() -> None

execute() is a lower-level alternative to attest() that returns just the ExecutionManifest without the receipt envelope.

Context manager

with VerdifaxClient(api_key="vfx_...") as client:
    receipt = client.attest(...)
# connection pool closed automatically

Environment variables

VariableEffect
VERDIFAX_API_URLDefault base URL
VERDIFAX_API_KEYDefault API key

Explicit constructor arguments override env vars.

Connection reuse

For high-throughput servers, instantiate one VerdifaxClient at startup and reuse. Don't construct a new client per request — that re-creates the connection pool and triggers extra TCP handshakes.

Continue