Main API for creating and managing consensus validators.
A validator encapsulates:
This is the primary entry point for using the consensus system.
Main API for creating and managing consensus validators. A validator encapsulates: - Consensus state machine (the algorithm) - Network interface (simulation or real P2P) - Runtime (effect interpreter) - Storage (consensus log) This is the primary entry point for using the consensus system.
(-main & args)Run a validator node.
Usage: clojure -M -m urd.consensus.validator <config-file>
Or with default config: clojure -M -m urd.consensus.validator
Run a validator node. Usage: clojure -M -m urd.consensus.validator <config-file> Or with default config: clojure -M -m urd.consensus.validator
(create-test-proposal peer-id)Create a test proposal for consensus.
Create a test proposal for consensus.
(get-finalized validator)Get finalized proposals from validator's state machine.
Returns: Map of {height -> proposal}
Get finalized proposals from validator's state machine.
Returns:
Map of {height -> proposal}(get-state validator)Get current state machine state.
Returns: State map with :height, :round, :finalized, etc.
Get current state machine state. Returns: State map with :height, :round, :finalized, etc.
(load-validator-config config-path)Load validator configuration from file or use defaults.
Config file should be EDN with: {:peer-id #uuid "..." :network-type :kabel :port 47291 :validator-set {#uuid "v1" "pubkey-1" ...} :connect-to "ws://localhost:47292"}
Load validator configuration from file or use defaults.
Config file should be EDN with:
{:peer-id #uuid "..."
:network-type :kabel
:port 47291
:validator-set {#uuid "v1" "pubkey-1" ...}
:connect-to "ws://localhost:47292"}(send-event! validator event)Send an event to the validator's consensus runtime.
Args: validator - Validator instance event - Event map (e.g., {:type :start-round})
Returns: true if event was sent
Send an event to the validator's consensus runtime.
Args:
validator - Validator instance
event - Event map (e.g., {:type :start-round})
Returns:
true if event was sent(start-validator! config)Start a validator with given configuration.
Required config: :peer-id - UUID for this validator :validator-set - Map of {peer-id -> public-key} :network-type - :simulation or :kabel
Network-specific config: For :simulation: :router - Shared router atom (from sim/create-router)
For :kabel: :port - Port to listen on (server mode) OR :connect-to - URL to connect to (client mode)
Optional config: :on-propose - (fn [context]) -> proposal, or (fn []) (default: throws) :on-finalize - (fn [vertices]), or the legacy (fn [proposal height])
Returns: Channel yielding Validator instance
Start a validator with given configuration.
Required config:
:peer-id - UUID for this validator
:validator-set - Map of {peer-id -> public-key}
:network-type - :simulation or :kabel
Network-specific config:
For :simulation:
:router - Shared router atom (from sim/create-router)
For :kabel:
:port - Port to listen on (server mode)
OR
:connect-to - URL to connect to (client mode)
Optional config:
:on-propose - (fn [context]) -> proposal, or (fn []) (default: throws)
:on-finalize - (fn [vertices]), or the legacy (fn [proposal height])
Returns:
Channel yielding Validator instance(stop-validator! validator)Stop a running validator.
Returns: Channel yielding true when stopped
Stop a running validator. Returns: Channel yielding true when stopped
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |