Types
Oracle
The main STYX interface for querying node liveness.- A witness registry
- A witness report aggregator
- A finality engine (for irreversible death)
- A partition detector
- Historical witness reports
QueryResult
The full response from the Oracle, containing the belief and metadata about the query.Target- The node ID being queriedBelief- The probability distribution: alive + dead + unknown = 1.0Refused- Set totruewhen the Oracle cannot provide a confident answerRefusalReason- Explains why the Oracle refused (e.g., “network partition detected”)Dead- Set totruewhen finality declares the node irreversibly deadWitnessCount- Number of witness reports aggregatedDisagreement- Measures variance in witness opinions (0 = consensus, 1 = maximum disagreement)PartitionState- Indicates if a network partition was detectedEvidence- List of human-readable reasons for the belief
RequiredConfidence
Specifies minimum confidence thresholds for a query.Constructor
New
Creates a new Oracle instance.selfID- The NodeID of this Oracle instance
Methods
RegisterWitness
Adds a trusted witness to the Oracle’s registry.id- The NodeID of the witness to register
ReceiveReport
Records a witness report about a target node.witnessID- The witness providing the reporttarget- The node being reported onbelief- The witness’s belief about the target’s liveness
Query
Queries the Oracle about a node’s liveness. This is the main API.target- The node to query
QueryResult containing the belief and metadata
Key behaviors:
- Never returns a simple boolean
- Always returns uncertainty information
- May refuse to answer if confidence is too low
- Checks for finality (irreversible death)
- Detects network partitions
QueryWithRequirement
Queries the Oracle with specific confidence requirements.target- The node to queryreq- Minimum confidence requirements
QueryResult that either meets the requirements or has Refused = true
Example:
MustQuery
Queries the Oracle and panics if the Oracle refuses or the node is dead.target- The node to query
ErrRefused- If the Oracle refuses to answerErrDead- If the node is declared dead