Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Service, Governance, and Misc Commands

Files: service.rs, governance.rs, clock.rs, dns_tree.rs Crate: kinetic-cli | Stage: 14


service.rs — The System Delegator

#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/service.rs`
}

The CLI binary doesn’t run the daemon, node, or proxy itself. Instead, it provides a unified interface (kinetic daemon start, kinetic host install) that shells out to the actual binaries (kinetic-daemon start, kinetic-host install).

Key mechanics:

  • Path Verification: Checks if the target binary is installed and on the $PATH using which. If not found, prints a helpful hint explaining what that specific component does before exiting.

Warning

Sudo Support: The kinetic dns commands require port 53. service.rs knows this (via the needs_sudo flag) and automatically prepends sudo to the execution on Unix, warning the user they might be prompted for a password.

  • OS-Aware Status & Logs: When running status or logs, it doesn’t just pass the command down. It translates them into OS-native commands:
OSCommand
Linuxsystemctl is-active <binary>, journalctl -u <binary> -f
macOSlaunchctl list <binary>

governance.rs — Broadcasting Proposals

#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/governance.rs`
}

Submits a post-quantum governance proposal to the network.

Flow:

  1. Reads a pre-signed governance JSON file from disk (signed_action.json). These files are generated in an offline, air-gapped environment by kinetic-OS (the governance operating system) to keep the cold keys safe.
  2. POST /publish-governance to the local daemon (using the Bearer token for authentication).
  3. The daemon then validates the signatures and broadcasts the proposal via P2P gossip.

clock.rs — Kinetic Network Time (KNT)

#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/clock.rs`
}

Displays the current Kinetic Network Time (which is strictly synchronized to the Drand beacon epochs).

Two-tier resolution:

ModeBehavior
1. API mode:Attempts to GET /api/time from the local daemon. If successful, prints [Synced] and the time.
2. Offline fallback:If the daemon is unreachable, mathematically calculates the time using SystemTime::now(), DRAND_GENESIS_TIME, and DRAND_PERIOD. Prints [Offline/Mathematical].

With the --listen flag, it enters a loop and prints the updated time every 3 seconds (the Drand beacon interval).


dns_tree.rs — Merkle DNS Tree Generator

#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/dns_tree.rs`
}

A developer utility to generate Cloudflare-ready DNS Tree zone files for P2P bootstrap node discovery.

PartDescription
Problem:How do you distribute a list of 5,000 bootstrap node IPs to new users without centralizing on a single HTTP endpoint or making the client binary 10MB larger?
Solution:A Merkle tree encoded into standard DNS TXT records (EIP-1459 style).

How it works:

  1. Reads a text file containing one libp2p Multiaddr per line.
  2. Creates kintree-leaf:<addr> records and hashes them.
  3. Groups up to 50 leaf hashes into a branch: kintree-branch:<hash1>,<hash2>... and hashes the branch.
  4. Repeats recursively until there is a single kintree-root hash.
  5. Hashes use SHA-256 encoded as base32 (truncated to 32 chars) so they fit perfectly as DNS subdomain labels.
  6. Outputs a standard BIND zone file that can be imported into Cloudflare or Route53.

Clients can then use standard DNS lookups to traverse the tree and discover bootstrap multiaddrs securely.