Overview
Every claim has afulfillment_condition in its contract. When you submit an event, the API evaluates the condition against the full array of event payloads in the claim’s event log. If the condition is satisfied, the claim immediately transitions to PENDING.
Node types
A condition tree is made of three node types:Leaf node
Matches when a specific event type has been submitted to the claim:event is the type field of a submitted event. It must be a non-empty string.
A leaf node can optionally include value matching or numeric comparisons (see below).
Operator node
Combines child conditions with boolean logic:op | Satisfied when |
|---|---|
AND | All children are satisfied |
OR | At least one child is satisfied |
NOT node
Negates a single child condition:Value matching (match)
A leaf node can include a match value to require that the event’s value field equals a specific string, number, or boolean:
type and a value equal to the match is present in the event log.
Submitting that event:
Numeric comparisons
A leaf node can compare the event’s numericvalue using one of five operators:
| Comparator | Meaning |
|---|---|
gt | Greater than |
gte | Greater than or equal |
lt | Less than |
lte | Less than or equal |
eq | Equal to |
match and comparators are mutually exclusive — a leaf node can use one or the other, not both.
Examples
Simple — single event
The claim resolves when"downloaded" is submitted:
AND — all parties must sign
OR — any one of multiple triggers
NOT — signed but not revoked
Nested — threshold with an escape hatch
The claim resolves when both parties sign, or an admin overrides:Value matching — inspection with a specific result
The claim resolves only when an inspection event hasvalue equal to "pass":
Numeric comparison — minimum score threshold
The claim resolves when a rating event has avalue of 4 or higher:
Multi-step verification
Empty conditions arrays
| Expression | Result |
|---|---|
{ "op": "AND", "conditions": [] } | true (vacuous truth) |
{ "op": "OR", "conditions": [] } | false (no condition can be satisfied) |
How evaluation works
On everyPOST /v1/events:
- All existing event log entries for the claim are fetched.
- An array of full event payloads is built from those entries, including the new event.
- The condition tree is evaluated recursively against the event payload array.
- Leaf nodes check whether any event in the array matches the
typeand (if specified) thematchvalue or numeric comparator againstvalue. - NOT nodes negate the result of their child condition.
- AND/OR nodes combine children with boolean logic.
- Leaf nodes check whether any event in the array matches the
- If the result is
true, the claim atomically transitions toPENDINGand the event is appended to the event log in the same database transaction. - If
false, only the event insert happens.
Validation
The condition tree is validated at schema creation time viaCreateSchemaSchema. Invalid trees (wrong node structure, missing fields) return a VALIDATION_ERROR with details pointing to the exact path.