Loading vLEI.wiki
Fetching knowledge base...
Fetching knowledge base...
This comprehensive explanation has been generated from 38 GitHub source documents. All source documents are searchable here.
Last updated: October 7, 2025
This content is meant to be consumed by AI agents via MCP. Click here to get the MCP configuration.
Note: In rare cases it may contain LLM hallucinations.
For authoritative documentation, please consult the official GLEIF vLEI trainings and the ToIP Glossary.
The first-seen policy is a fundamental ordering rule in KERI where validators (witnesses/watchers) permanently accept the first valid event they receive for a given sequence position in a Key Event Log (KEL), establishing an immutable record under the principle 'first seen, always seen, never unseen' that enables detection across the distributed network.
The first-seen policy is a core consensus mechanism in KERI that defines how validators (specifically witnesses and watchers) handle incoming key events to establish authoritative ordering within a Key Event Log (KEL). When a validator receives an event, it is considered "first-seen" if it meets three critical criteria:
Once an event meets these criteria and is accepted into the validator's KEL, it becomes permanently fixed under the foundational principle: "First seen, always seen, never unseen". This immutability is not merely a design preference but a security requirement that enables KERI's duplicity detection mechanism.
The first-seen policy operates independently of the timing of events held in escrow. Events may arrive out of order or be temporarily held in escrow if they cannot yet be validated (for example, if they reference a sequence number not yet reached). The escrow mechanism can contain invalid or garbage data, but only valid events that fit the proper sequence position trigger the first-seen acceptance.
The first-seen policy involves several key participants in the KERI ecosystem:
When a validator receives a key event message, the first-seen process follows this sequence:
Step 1: Event Arrival
Step 2: Structural Validation
Step 3: Cryptographic Verification
Step 4: Sequence Position Check
Step 5: First-Seen Determination
Step 6: Permanent Acceptance
The first-seen policy interacts with KERI's escrow mechanism in specific ways:
Escrow Independence: Events in escrow do not affect first-seen determination. An event waiting in escrow because it references a future sequence number does not prevent a properly sequenced event from being accepted as first-seen.
Escrow Resolution: When a first-seen event is accepted, the validator checks escrow for any events that can now be processed. Events in escrow that reference the newly accepted event's sequence number as their predecessor can be evaluated for first-seen acceptance.
Garbage Collection: Invalid events in escrow that cannot be validated even after waiting for dependencies are eventually discarded. These never achieve first-seen status.
The first-seen process includes several critical decision points:
Valid vs. Invalid: If an event fails cryptographic validation, it is immediately rejected without consideration for first-seen status. Invalid events may be logged for security analysis but never enter the KEL.
Sequence Match vs. Mismatch: Events with sequence numbers that don't match the expected next position are handled differently:
First vs. Subsequent: The critical branching point:
The first-seen policy depends on robust cryptographic verification:
Signature Verification: All events must be signed by authoritative keys. For multi-sig identifiers, the signing threshold must be met. Signature verification uses the current key state established by previous events in the KEL.
Digest Verification: Events include cryptographic digests for:
Cryptographic Strength: KERI requires minimum 128-bit security strength for all cryptographic operations. This ensures that collision attacks on digests are computationally infeasible, preventing attackers from creating alternative events with the same digest.
Network Propagation: The first-seen policy operates in a distributed network where events propagate at different speeds to different validators. This creates natural timing variations:
Different First-Seen Numbers: Different validators may have different first-seen sequence numbers for the same originating transaction event. This is acceptable as long as the events themselves are consistent.
Microsecond Propagation: When a watched set of validators agrees on first-seen events, watchers observing these validators propagate the consensus within microseconds across the validator network.
Escrow Timeout: Events in escrow have implicit timeouts. If dependencies don't arrive within reasonable time windows, escrowed events may be discarded.
Clock Synchronization: While KERI doesn't require precise clock synchronization across validators, reasonable time agreement helps with:
The first-seen policy includes specific error handling mechanisms:
Duplicitous Events: When a validator receives a second, conflicting event for a sequence position where a first-seen event already exists:
Key Compromise Recovery: The first-seen policy is critical for detecting duplicity that may not be discovered until after a key rotation event:
KEL Correction: Once an erroneous KEL has been corrected through the recovery process:
Scenario 1: Normal Event Processing
In the most common case, events arrive in proper sequence:
This scenario demonstrates the first-seen policy operating smoothly with no conflicts or escrow delays.
Scenario 2: Out-of-Order Arrival
Events may arrive out of sequence due to network conditions:
This demonstrates escrow handling without affecting first-seen determination.
Scenario 3: Duplicity Detection
A malicious controller attempts to create conflicting event histories:
This scenario shows how first-seen policy enables ambient duplicity detection.
For Controllers:
For Witnesses:
For Watchers:
Witness Pool Configuration: The first-seen policy operates within the context of witness pools configured by controllers:
Watcher Network Integration: Watchers complement witnesses by providing independent verification:
Recovery Protocol Integration: The first-seen policy integrates with KERI's recovery mechanisms:
The first-seen policy serves several critical architectural functions:
The policy establishes clear, irreversible ordering of events within each validator's perspective. This determinism is essential for:
The first-seen policy creates forensic evidence when controllers attempt to create conflicting event histories:
The policy enables rapid consensus across distributed validators without traditional consensus algorithms:
The first-seen policy provides the basis for detecting and recovering from key compromise attacks:
The first-seen policy represents a fundamental departure from blockchain-based consensus, achieving security through ambient duplicity detection rather than computational proof-of-work or stake-based mechanisms. This approach enables KERI to provide strong security guarantees while maintaining the scalability and portability required for internet-scale identity infrastructure.
Implementations MUST enforce the "first seen, always seen, never unseen" principle with absolute rigor. Once an event is accepted as first-seen:
This immutability is not a performance optimization but a security requirement. Violations compromise the entire duplicity detection mechanism.
Escrow implementation requires careful attention:
In production systems, multiple events may arrive simultaneously:
When rejecting events due to first-seen conflicts:
Witnesses must coordinate effectively:
Thorough testing is essential: