Liking cljdoc? Tell your friends :D

urd.consensus.validator

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 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.
raw docstring

-mainclj

(-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
sourceraw docstring

create-test-proposalclj

(create-test-proposal peer-id)

Create a test proposal for consensus.

Create a test proposal for consensus.
sourceraw docstring

get-finalizedclj

(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}
sourceraw docstring

get-stateclj

(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.
sourceraw docstring

load-validator-configclj

(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"}
sourceraw docstring

proposal-counterclj

source

send-event!clj

(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
sourceraw docstring

start-validator!clj

(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
sourceraw docstring

stop-validator!clj

(stop-validator! validator)

Stop a running validator.

Returns: Channel yielding true when stopped

Stop a running validator.

Returns:
  Channel yielding true when stopped
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close