Posemesh Node Registration SDK
This crate packages the logic required for nodes to register with the discovery service.
Modules
crypto: helpers for secp256k1 key loading, signature generation, and timestamp formatting.http: anaxumrouter that handles DDS callbacks (e.g./internal/v1/registrations) and the DDS health probe.persist: in-memory storage used to cache the most recent node secret returned by DDS callbacks.state: persistence primitives for registration status, last DDS health check, and a file-based advisory lock.register: async registration client that periodically signs and submits node metadata to DDS.
Adding the Dependency
# Cargo.toml
[]
= "0.1.0"
Example: Mounting the HTTP Routes
use Router;
use ;
The callback handler automatically persists secrets in-memory via persist::write_node_secret.
Consumers that need to read the cached secret can call persist::read_node_secret().
Example: Spawning the Registration Loop
use ;
async
run_registration_loop takes care of:
- Deriving the secp256k1 public key and signatures for registration payloads.
- Persisting registration state and last health-check timestamps.
- Enforcing a cross-process file lock so that only one registrar runs at a time.
- Exponential backoff with jitter when DDS requests fail.