A receipt-log is an ordered, append-only record of all key event receipts for a given set of witnesses, providing cryptographic evidence that witnesses have observed and attested to specific key events in a KERIidentifier's history.
Related Concepts
No related concepts available
Comprehensive Explanation
receipt-log
Structure Definition
A receipt-log is a fundamental data structure in the KERI (Key Event Receipt Infrastructure) protocol that maintains an ordered sequence of key event receipts from a designated set of witnesses. The receipt-log serves as cryptographic proof that witnesses have observed, verified, and attested to specific key events in an AID's (Autonomic Identifier) history.
Purpose and Role
The receipt-log fulfills several critical functions in KERI's security architecture:
Distributed Validation: Provides independent verification of key events through witness attestations, enabling duplicity detection without requiring a centralized authority or blockchain.
Availability Guarantee: Ensures that key event history remains accessible even when the identifier's controller is offline, supporting indirect mode operations.
Consensus Evidence: Documents witness agreement on key events, forming the basis for KAACE (KERI's Agreement Algorithm for Control Establishment) consensus.
Duplicity Detection: Enables validators to detect conflicting versions of key event histories by comparing receipt-logs from multiple witnesses, implementing .
Implementation Notes
Critical Implementation Considerations
Witness Pool Configuration
Minimum Requirements:
At least 3 witnesses for basic duplicity detection
Threshold should be set to N - F where N is total witnesses and F is maximum tolerable faults
For production systems, 5-7 witnesses recommended
Witness Selection Criteria:
Geographic distribution to prevent regional outages
Text Domain: Base64 URL-safe encoding for human readability and debugging
Binary Domain: Compact binary representation for efficient streaming and storage
Composability: Round-trip conversion between text and binary without crossing primitive boundaries
1. Controller creates inception event
2. Controller sends event to designated witnesses
3. Each witness validates event cryptographically
4. Witnesses generate signed receipts
5. Receipts are collected into receipt-log
6. Controller verifies threshold is met
Updates and Modifications
Append-Only Property: Receipt-logs are strictly append-only; existing receipts cannot be modified or deleted. This immutability is fundamental to KERI's security model.
Receipt Addition Process:
Event Promulgation: Controller sends new key event to witnesses
Witness Validation: Each witness independently verifies:
Event signature validity
Sequence number correctness
Hash chain integrity
Pre-rotation commitment (for rotation events)
Receipt Generation: Witness creates signed receipt message
Receipt Storage: Receipt is appended to the receipt-log
Threshold Check: System verifies sufficient receipts exist
Witness Rotation: When witnesses are rotated:
New witnesses begin receipting subsequent events
Old witness receipts remain in historical log
Receipt-log reflects witness pool changes over time
Verification and Validation
Receipt Verification Process:
Signature Validation: Verify witness signature on receipt using witness's public key
Receipt-log structure preserved while hiding event details
Enables private witness attestation
Conclusion
The receipt-log is a cornerstone data structure in KERI's security architecture, enabling distributed validation, duplicity detection, and high availability without requiring centralized infrastructure or blockchain consensus. By maintaining ordered records of witness attestations, receipt-logs provide the cryptographic evidence necessary for validators to establish trust in identifier key states through ambient verifiability. Proper implementation of receipt-log management, including witness pool configuration, threshold selection, and storage optimization, is essential for building robust KERI-based identity systems that can scale from individual use cases to global infrastructure like the vLEI ecosystem.
Use multiple independent witness operators
Implement watcher networks for ambient duplicity detection
Monitor for network partition scenarios
Duplicity Detection
Implementation Strategy:
Compare receipts from all witnesses for each sequence number
Flag any sequence where witnesses receipted different event digests
Construct DEL (Duplicitous Event Log) for detected conflicts
Alert validators immediately upon duplicity detection
First-Seen Policy:
Witnesses must record the first version of an event they observe
Subsequent conflicting versions should be rejected or logged separately
Implement timestamp recording for first-seen events
Threshold Management
Dynamic Threshold Adjustment:
Allow threshold changes through rotation events
Ensure threshold changes are properly receipted
Validate that new thresholds satisfy M ≥ N - F constraint
Threshold Verification:
Always verify threshold is met before accepting key state
Implement timeout handling if threshold not reached
Consider partial threshold acceptance for non-critical operations
Testing and Validation
Test Scenarios:
Test with various witness pool sizes (3, 5, 7, 9 witnesses)
Simulate witness failures and verify threshold handling
Test duplicity detection with conflicting receipts
Verify receipt-log recovery after witness restart
Test performance under high event throughput
Integration Testing:
Test receipt-log integration with KEL validation
Verify KERL construction from KEL + receipt-log
Test cross-witness consistency checks
Validate OOBI-based witness discovery
Monitoring and Observability
Key Metrics:
Receipt collection latency per witness
Threshold satisfaction rate
Witness availability and uptime
Duplicity detection events
Receipt-log storage growth rate
Alerting:
Alert on threshold not met within timeout
Alert on duplicity detection
Alert on witness unavailability
Alert on receipt signature validation failures
Compatibility Considerations
KERIpy Compatibility:
Receipt-logs must use CESR encoding
Follow KERIpy's LMDB storage patterns
Implement compatible witness protocol
Support KERIpy's OOBI resolution
Cross-Implementation Interoperability:
Ensure receipt format compatibility across KERI implementations (KERIpy, KERIox, etc.)
Test receipt-log exchange between different implementations
Validate CESR encoding/decoding consistency
Scalability Considerations
Large-Scale Deployments:
Implement receipt-log sharding for high-volume identifiers
Use distributed storage for receipt-logs
Consider CDN-like distribution for popular identifiers
Implement caching layers for frequently accessed receipt-logs
Resource Management:
Monitor storage growth and implement archival strategies
Implement receipt-log pruning for inactive identifiers
Use compression for archived receipt-logs
Consider tiered storage (hot/warm/cold) based on access patterns