Architecture
How oracle and contract identities, witnesses, watchers and credentials fit together.
KERI ecosystem

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 |
Payments
Cluster Controller / Management Node
| Component |
Role |
| Controller Logic |
Consumes services and triggers payments |
| Budget Policy Engine |
Limits spend per service |
| KERI AID Keys |
Signs requests |
| Nostr Wallet Connect Client |
Automated payments |
| Lightning Wallet |
BTC + Taproot Assets |
Fiat Payment Proof Layer
| Component |
Role |
| Bank / UPI App |
Initiates the fiat transfer |
| TLSNotary Client |
Local proof generator |
| Fiat Payment Proof |
Signed transcript |
Lightning Network
| Component |
Role |
| Path Finder |
Finds liquidity route |
| Taproot Asset Router |
USD/EUR/BTC conversion |
| Liquidity Providers |
Edge swaps |
Fiat Proof Verification
| Component |
Role |
| Proof Verifier |
Checks TLS transcript |
| Fiat Acceptance Policy |
Decides which verified fiat payments are accepted |
Service Node (Aggregator / Validator / Registry)
| Component |
Role |
| Service API |
Metrics / validation / control |
| Pricing Engine |
Determines service cost |
| Lightning Wallet |
Receives payments |
| KERI AID Keys |
Verifies caller |
| L402 Gateway |
402 challenge + macaroon minting |
Service Discovery Layer (Nostr)
| Component |
Role |
| Service Advertisement Event |
Price, assets, LN node |
| Nostr Relay |
Carries service advertisements |
Interactions: Payments
| From |
Interaction |
To |
| Service Advertisement Event |
broadcast event |
Nostr Relay |
| Controller Logic |
request service |
Service API |
| Service API |
lookup pricing |
Pricing Engine |
| Pricing Engine |
price + asset preference |
L402 Gateway |
| L402 Gateway |
HTTP 402 + invoice + macaroon |
Controller Logic |
| Controller Logic |
check identity |
KERI AID Keys |
| Controller Logic |
check budget |
Budget Policy Engine |
| Controller Logic |
approve payment |
Nostr Wallet Connect Client |
| Nostr Wallet Connect Client |
pay invoice |
Lightning Wallet |
| Lightning Wallet |
send USD / BTC |
Path Finder |
| Path Finder |
route via BTC |
Taproot Asset Router |
| Taproot Asset Router |
deliver sats or asset |
Lightning Wallet |
| Lightning Wallet |
payment preimage |
L402 Gateway |
| L402 Gateway |
mint access macaroon |
Service API |
| Controller Logic |
retry request + macaroon + preimage |
Service API |
| Controller Logic |
sign request |
KERI AID Keys |
| Service API |
verify signature |
KERI AID Keys |
| Service API |
serve response |
Controller Logic |
| Controller Logic |
initiate fiat payment |
Bank / UPI App |
| Bank / UPI App |
bank / UPI transfer |
Bank / PSP |
| Bank / UPI App |
TLS session transcript |
TLSNotary Client |
| TLSNotary Client |
generate cryptographic proof |
Fiat Payment Proof |
| Fiat Payment Proof |
submit proof |
Proof Verifier |
| Proof Verifier |
verify against policy |
Fiat Acceptance Policy |
| Fiat Acceptance Policy |
accept payment |
L402 Gateway |
| Service Node (Aggregator / Validator / Registry) |
publish service metadata |
Service Advertisement Event |
| Cluster Controller / Management Node |
subscribe to services |
Nostr Relay |
| Lightning Wallet |
multi-hop routed payment |
Lightning Network |
| Lightning Network |
settlement |
Lightning Wallet |