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
$PATHusingwhich. If not found, prints a helpful hint explaining what that specific component does before exiting.
Warning
Sudo Support: The
kinetic dnscommands require port 53.service.rsknows this (via theneeds_sudoflag) and automatically prependssudoto the execution on Unix, warning the user they might be prompted for a password.
- OS-Aware Status & Logs: When running
statusorlogs, it doesn’t just pass the command down. It translates them into OS-native commands:
| OS | Command |
|---|---|
| Linux | systemctl is-active <binary>, journalctl -u <binary> -f |
| macOS | launchctl 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:
- Reads a pre-signed governance JSON file from disk (
signed_action.json). These files are generated in an offline, air-gapped environment bykinetic-OS(the governance operating system) to keep the cold keys safe. POST /publish-governanceto the local daemon (using the Bearer token for authentication).- 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:
| Mode | Behavior |
|---|---|
| 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.
| Part | Description |
|---|---|
| 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:
- Reads a text file containing one libp2p Multiaddr per line.
- Creates
kintree-leaf:<addr>records and hashes them. - Groups up to 50 leaf hashes into a branch:
kintree-branch:<hash1>,<hash2>...and hashes the branch. - Repeats recursively until there is a single
kintree-roothash. - Hashes use SHA-256 encoded as base32 (truncated to 32 chars) so they fit perfectly as DNS subdomain labels.
- 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.