Skip to content

Architecture

How metrics are written, carried, aggregated and recorded, and how key event logs anchor identity.

Decentralized metrics

Metrics architecture

Select the diagram to open it at full size.

Client-side metrics writer SDK

Component Role
Write metrics function Entry point for applications. Pushes a metric event to the queue asynchronously
Queue Decouples the caller from batching
Metrics batcher Pulls from the queue and stores entries until the batch is full or the timer elapses
Temp batch store Holds metric entries until they are packed
Metrics packet creator and UUID generator Creates a metrics packet from the entries of a batch
Hasher (SHA-256) Hashes the packet
Signer Signs the hash through the node signing agent
Metrics pusher Pushes the packet to the queue of every selected L2
Connections manager Adds and removes connections, with a queue and a client for each L2
L2 clients Publish packets to their L2 over gRPC
L1 query client Queries the L1 relays for available L2s
L2 selector Picks L2s from the candidates and maintains the selected list
L2 selector policy rule executor Ranks candidates with custom rules
Periodic L2 health checker Checks the selected L2s and asks the selector for a replacement when one is removed. The goal is to keep K L2s
Ping client and ping API client Execute the ping command and obtain the response for the health check
Node signing agent Signs with a private key on a local volume (default) or through a custom wallet client for remote signing

L2 ingestion and aggregation

Component Role
gRPC proxy Accepts packets and puts them on the local Redis queue
Local Redis queue Buffers packets between the proxy and the aggregator
Packet parser Pulls and parses packets
Signature verifier Verifies the packet signature
Internal processor Drives de-duplication and window assignment
De-dup checker Checks whether the packet is a duplicate
Redis cache Stores packet UUIDs with a TTL for de-duplication, the current window start so that it can be recovered after a failure, and current values
Window manager Assigns the event to a window and re-assigns its timestamp
Events buffer and metrics processor Pass windowed events to the aggregator
Aggregator Aggregates metrics for each node_id and block_id. Current values stay in cache for the cluster and each block for fast lookup
Metrics DB writer Writes aggregates to the TimescaleDB of this L2

L2 control

Component Role
Initializer Initializes the config store and publishes the initial registration
Config store and config Redis store Hold configuration, with Redis as the backend
Management commands API Reads and changes configuration
L2 registration event publisher Submits the L2 onboarding event on L1
Timer, health event signal and events buffer Drive the heartbeat
Heartbeat event publisher Publishes heartbeats through Nostr
L2 signing agent client and container Sign with a local wallet on a local volume or a remote signing client
Nostr API client Connects to the L1 relays

Cluster controller

Component Role
API to deploy an ingestor Accepts a request for a new L2
Pre-check policy executor Checks that the configuration is acceptable to the cluster
L2 request parser Parses the request and generates the Kubernetes custom resource
L2 resource allocator policy rule executor Allocates resources from the storage requirements
L2 deployer and Kubernetes driver Deploy the aggregator with the custom resource
Cluster agent client and cluster signing agent Sign the creation event with a local key or a wallet
Nostr client module Publishes the event about the creation

L1

L2s are published on the public L1 relays. A registration carries the L2 id, URL, metadata, type (cluster or global) and cluster id (NA for global L2s). A heartbeat carries the L2 id, timestamp and status.

KERI ecosystem

KERI architecture

Select the diagram to open it at full size.

Overall architecture

From Interaction To
Identity and key management identity state Trust guard and policy
Authority and credentials (ACDC) authority facts Trust guard and policy
Trust guard and policy ALLOW / DENY Evidence store
Identity and key management publish KEL events Transport
Authority and credentials publish ACDC events Transport
Evidence store publish evidence references Transport
Transport KEL event Witness KEL verification (signature, sequence, hash)
Witness KEL verification verified event Append-only KEL store
Witness KEL verification event hash and sequence Receipt issuer
Receipt issuer signed receipt Receipt store
Witness receipt event Transport
Transport observed events Watcher event ingestion
Event ingestion normalized events Indexers (KEL, ACDC, receipts)
Indexers state updates Watcher state database
Indexers sequence streams Fork and conflict detector
Fork and conflict detector conflict alerts Watcher state database
Trust guard and policy query identity, credential and conflict state Query and evidence API
Identity and key management KEL history query Witness KEL store
Witness KEL store KEL and receipts Identity and key management

The transport layer, for example Nostr, is plain publish and subscribe. It is not trusted.

Embeddable library: identity and KEL system

Component Role
Role config Selects the role: org, block or instance
Genesis policy loader Loads the policy the identity is created with
Governance rules loader Loads thresholds, witnesses and related rules
Inception engine Creates the inception event
KEL manager Extends the key event log
KEL self-validator Validates the log of this identity
KEL store CRUD module and append-only store Persist events
Identity state database and identity API Provide AID, sequence and state

Embeddable library: key management

Component Role
Key vault Generates keys if no external wallet is connected, and signs
External wallet or storage Optional backend for key management
Hot keys cache Holds keys in current use
Pre-rotated keys saver Holds the keys committed for the next rotation
Recovery keys manager Holds recovery keys

Embeddable library: credentials and authority

Component Role
Input gateway and parser Parse input and put it on the task queue
Sender credential verifier Obtains the sender's credential reference
Credential verifier Verifies credentials
Delegation chain resolver Resolves the chain of delegations
Revocation cache API Checks for revoked credentials
Credential store cache API Retrieves cached credentials
Credential issuer Derives credentials from the current key state and identity
ACDC schemas and templates Define issued credentials

Embeddable library: decisions, audit and output

Component Role
Decision context builder Assembles the facts for a decision
Policy engine Evaluates rules of the genesis policy
Trust guard Allows or denies from the evaluated rules and the chain of facts
Evidence builder, hasher and hash signer Build, hash and sign evidence of the decision
Evidence store API Stores evidence
Output manager, signer and collector Attach the evidence reference, sign the output and return it

Witness

Component Role
Ingress queue Receives inception, rotation and interaction events
KEL event parser and normalizer Produce the canonical event
Signature verifier Checks signatures
Sequence and continuity verifier Requires a monotonic sequence
Prior-event hash verifier Checks the link to the previous event
KEL store and AID index Persist verified events and the pointer for each identifier
Receipt builder, signer and store Produce and keep receipts
KEL query handler and proof assembler Answer queries with entries and receipts
Internal event log Records ingestion
Health and integrity monitor Checks the stores

Watcher

Component Role
Input queue Receives observed KEL, ACDC, receipt and alert events
Event parser, normalizer and structural validator Produce the canonical form
Canonical hash computer Computes the content hash
Dedup cache checker Drops events seen within the TTL
KEL, credentials and receipt indexers Index each kind of event
Sequence tracker Follows the sequence of each identifier
Fork and duplicity checker Detects conflicting events
Conflict classifier Classifies conflicts and raises alerts
Database layer KEL, alerts and conflicts, credentials, and receipts databases