Crate: kinetic-core
Stage: 2
Reading Time: 45 mins
Depends On: 13_constants.md
What Is This?
This file (kinetic-core/src/config.rs) is the absolute heart of the Kinetic network’s configuration system.
It defines the comprehensive global configuration models, default values, and port definitions for the entire Kinetic network stack.
It provides the exact data structures that are serialized and deserialized into the config.toml file.
This is the exact file that all Kinetic node operators interact with on a daily basis when tuning their machines.
Beyond merely parsing a static file, this module is the authoritative, deterministic source for how a Kinetic node behaves when it first boots up from a cold start.
It dictates where the node looks for its initial peers.
It dictates what local network ports it binds to for peer-to-peer communication.
It dictates how it connects to the Drand randomness beacon for consensus operations.
It dictates where it physically stores its local database files on the host operating system.
Furthermore, it implements a critical “fail-closed” security posture across the entire application.
This ensures that misconfigured nodes refuse to start, rather than silently falling back to potentially unsafe default settings.
The code relies on Rust’s serde framework to seamlessly translate between typed Rust structs in memory and human-readable, easily editable TOML files on disk.
By encapsulating all default states within this single, cohesive file, Kinetic ensures that changes to network topology, port mappings, or core parameters are traceable.
This makes debugging node startup issues drastically easier for the core development team.
Why Kinetic Needs This
In a decentralized network environment like Kinetic, the underlying node software must be resilient.
It must be user-friendly for non-technical node operators.
And it must be deterministic in how it initializes its state.
Kinetic fundamentally needs this file for several critical architectural reasons:
1. Avoiding Port Collisions on Shared Hardware
The Kinetic ecosystem consists of multiple distinct binaries that often run concurrently.
These binaries are kinetic-daemon, kinetic-node, and kinetic-host.
Node operators, especially those running on cost-effective VPS environments (like DigitalOcean, Linode, or AWS EC2), frequently run all three of these background processes on the exact same server instance.
Without a coordinated, centralized registry of default ports, these discrete binaries would constantly fight over TCP and UDP socket bindings.
This would lead to unpredictable, frustrating crashes on startup.
This file physically separates the port ranges for each daemon type to guarantee smooth coexistence without manual operator intervention.
2. Bootstrapping the Decentralized Network from Zero
When a brand new node turns on for the very first time, it knows nothing about the outside world.
It has no peer connections.
It has no routing table.
It needs a predefined list of hardcoded, trusted entry points to successfully join the DHT (Distributed Hash Table).
Once connected to these entry points, it can start finding other peers dynamically.
This configuration file manages those critical bootstrap nodes and seed domains.
Without this hardcoded starting point, a node would be isolated forever on startup, unable to synchronize blocks or participate in consensus.
3. Cross-Platform Consistency and Path Resolution
Kinetic is uniquely designed to run literally anywhere.
It runs on headless Linux servers.
It runs on macOS desktop machines.
It runs on Windows workstations.
It even runs sandboxed inside the web browser via WebAssembly (Wasm).
The node software requires a unified, abstraction-layered way to figure out where its logical “home” directory is across all these drastically different operating systems.
This file abstracts away the OS-level file system differences.
It deterministically maps configuration paths to ~/.local/share on Linux.
It maps to AppData on Windows.
And it mocks virtual directories in the WebAssembly context to prevent immediate crashes.
4. Ironclad Security Against Fail-Open Scenarios
If a node operator accidentally mangles their config.toml file, bad things can happen.
For example, by adding a typo to a critical IP address field or forgetting a quotation mark.
A naive parser might fail to read the file and silently fall back to default, factory settings.
Falling back to a default 0.0.0.0 IP binding could accidentally expose a private, authenticated API port directly to the public internet.
This opens the node to immediate remote attacks.
Kinetic requires a strict, unforgiving parser that immediately crashes the application if the configuration is even slightly invalid.
5. Strict Separation of Global State vs Local State
Kinetic and deliberately distinguishes between two concepts: network.json and config.toml.
The network.json represents the global, immutable definition of the network.
This includes things like the genesis block hash and the canonical bootstrap nodes.
The config.toml represents the local, mutable configuration for a specific physical machine.
This includes things like which local ports to use for API traffic.
This file handles the local config.toml logic while simultaneously running compile-time tests to ensure the local code stays in perfect sync with the global network defaults.
6. Environment Variable Overrides for Modern Containerization
Modern backend infrastructure relies on containerization technologies.
Tools like Docker, Kubernetes, and HashiCorp Nomad are common for node deployment.
This configuration file provides crucial environmental hooks, specifically KINETIC_CONFIG_PATH and KINETIC_DATA_DIR.
These hooks allow orchestration tools to inject configuration variables dynamically at runtime.
This avoids the need to write physical configuration files to the container’s ephemeral disk beforehand.
7. Zero-Friction Extensibility for Future Upgrades
By using the serde serialization library, adding a brand new feature to the network is trivial.
Whether it is a new proxy protocol, a new consensus parameter, or a new background sub-service.
It only requires adding a single field to the Rust structs in this file.
The serialization logic automatically handles reading, writing, and parsing the new field.
No complex, custom, hand-written parser modifications are ever required.
How It Works
The configuration system in Kinetic relies on the serde crate (Serializer/Deserializer) to map deeply nested Rust structs directly to TOML text files on disk.
When a Kinetic binary starts up, the execution flow proceeds through several deterministic phases.
1. Configuration Resolution Order and Path Discovery
-> See: kinetic-core/src/config.rs — Lines 377 to 405
When the static method KineticConfig::load() is invoked, the system attempts to pinpoint the exact configuration file by traversing a very specific sequence of checks.
First, the code inspects the host operating system for the KINETIC_CONFIG_PATH environment variable.
If the node operator has defined this variable, the node will stubbornly use that exact file path, overriding all other logic.
Second, if the environment variable is missing, the code falls back to a standard, platform-specific default directory.
It does this by invoking the get_base_dir() helper function.
For a standard Linux deployment, this resolves to ~/.local/share/kinetic/config.toml.
Third, the code attempts to open the file at the resolved path.
If it discovers that the file does not exist at all, the software pivots into initialization mode.
This commonly occurs when a node is booting up for the very first time.
It will automatically generate a pristine, default configuration object in memory.
It achieves this by instantiating KineticConfig::default().
It then passes the struct through the TOML serializer to generate a formatted string.
It recursively creates any deeply nested parent directories on the physical disk using fs::create_dir_all.
Finally, it writes the raw string to the file using fs::write.
2. The “Fail-Closed” Security Posture and Panic Logic
-> See: kinetic-core/src/config.rs — Lines 382 to 389
This is one of the most important architectural decisions contained within the entire file.
You will notice that if toml::from_str(&config_str) returns a standard Rust Err, the node and abruptly aborts execution.
It does this via std::process::exit(1).
In many older, legacy software systems, if a configuration file is corrupt or unreadable, the system simply logs a polite warning to the console.
It then continues to boot up using factory default values.
In cybersecurity, this anti-pattern is known as “failing open”.
Failing open is a massive, systemic security risk for decentralized nodes.
Consider a realistic scenario where a cautious Kinetic operator configures their privileged internal API port to bind to 127.0.0.1 (localhost).
This keeps the API private and inaccessible from the outside world.
If the operator makes a simple typographical error in the configuration file, and the node’s software chooses to “fail open”, disaster strikes.
The node might automatically revert to a default behavior that accidentally binds the API to 0.0.0.0 (all available network interfaces).
This tiny, silent failure would inadvertently expose the privileged, private API to the hostile public internet.
This could potentially allow remote attackers to hijack the node or steal funds.
Kinetic’s strict usage of std::process::exit(1) guarantees that a broken configuration file results in a broken node that refuses to run.
It eliminates the risk of a node running insecurely in the background due to a typo.
3. Strict Port Allocation and Logical Namespacing Strategy
-> See: kinetic-core/src/config.rs — Lines 26 to 49
The ports submodule acts as the global, indisputable registry for all network socket bindings within the Kinetic framework.
By manually grouping these hardcoded constants together in a single module, the core developers ensure system stability.
They ensure that adding a new HTTP service to the kinetic-daemon process doesn’t accidentally trample on a port already in use by the kinetic-host process.
Notice specifically how the P2P network ports are tiered in a logical, sequential manner.
The Daemon’s P2P swarm is allocated port 6070.
The Node’s P2P swarm is allocated port 6071.
The Host’s P2P swarm is allocated port 6072.
This dead-simple, sequential tiering design means that system administrators and node operators can easily efficiently firewall a small block of ports.
They can open ports 6070 through 6072 and rest assured they have fully covered all P2P traffic for the entire ecosystem.
The exact same sequential pattern applies directly to the internal API ports.
The Daemon’s internal API is allocated port 16002.
The Node’s internal API is allocated port 16003.
The Host’s internal API is allocated port 16004.
By keeping these numbers centralized, Kinetic avoids spaghetti code where magic port numbers are scattered randomly across dozens of different files.
4. Custom Serialization Defaults to Maintain Clean Files
-> See: kinetic-core/src/config.rs — Lines 112 to 160
Rust’s macro-based serde crate is powerful.
Kinetic leverages its advanced features to drastically improve the operator experience.
If you closely examine the DaemonConfig struct, you will notice custom procedural macro attributes attached to fields.
For example: #[serde(default = "local_bind_ip", skip_serializing_if = "is_default_bind_ip")].
This dual-attribute optimization approach has two major, visible effects on the resulting software.
First, when reading the configuration from the physical disk, the field might be missing from the operator’s TOML file.
If it is missing, the Rust deserializer will automatically invoke the local_bind_ip helper function.
This function dynamically fills in the missing default value (127.0.0.1) in memory.
Second, and more importantly, this affects when writing the configuration back to disk.
Perhaps an operator dynamically updates an API via a REST call, triggering a save().
If the node’s current bind_ip is equal to the default value, the serde serializer will omit that specific field from the generated TOML file.
This specific optimization keeps the resulting config.toml file small.
It keeps it clean.
And it keeps it readable for human eyes.
Node operators will only ever see the specific fields they have actively chosen to override or change.
If an operator hasn’t touched the default API port, that port will not clutter up their configuration file with unnecessary, redundant lines of text.
5. Handling WebAssembly (Wasm) Compilation Constraints
-> See: kinetic-core/src/config.rs — Lines 410 to 414
The Kinetic network stack is ambitiously designed to run literally anywhere.
This includes running inside secure web browsers via WebAssembly (Wasm) compilation.
However, web browsers operate inside a strict security sandbox.
They do not have raw access to a user’s local, physical filesystem.
Executing standard std::fs calls to read files will fatally panic the Wasm module instantly.
Because reading and writing TOML files from disk is physically impossible in that sandboxed environment, the file loading architecture must adapt.
To solve this, the load and save methods within KineticConfig are guarded by Rust’s conditional compilation flags.
Specifically, the #[cfg(not(target_arch = "wasm32"))] attribute is used.
When the source code is compiled down for a WebAssembly target, the Rust compiler physically strips out the file-system logic entirely.
The load() function is replaced with a simple stub that returns a fresh, in-memory KineticConfig::default() object.
Similarly, the save() function is reduced to an empty, zero-cost stub.
This stub does nothing, modifies no files, and immediately returns a successful Ok(()).
This elegant, macro-driven workaround allows the core configuration logic to remain unified across all supported platforms.
It prevents fatal compilation errors when targeting the web browser environment.
6. The network.json Compile-Time Synchronization Guarantee
-> See: kinetic-core/src/config.rs — Lines 485 to 514
Right at the bottom of the source file, there is a seemingly simple but vital unit test.
This test directly compares the contents of ../network.json with a locally bundled default_network.json file.
In the Kinetic paradigm, the network.json file represents the global constitution of the entire network.
It rigidly defines the fundamental parameters that cannot be changed by individual, rogue operators.
These parameters include the canonical bootstrap nodes, the mathematical genesis block hash, and the core protocol version.
However, because Rust binaries are designed to compile down to a single, monolithic, self-contained executable file, they cannot rely on reading external JSON files at runtime.
They desperately need a hardcoded, baked-in version of this network data embedded directly into the binary file itself.
This specific unit test asserts that the statically hardcoded default_network.json file matches the global network.json file sitting at the root of the GitHub repository.
If a core developer pushes an update to the global network definition (perhaps adding a new bootstrap peer) but forgets to update the embedded copy inside kinetic-core, the build fails.
This unit test will fail the CI/CD pipeline immediately.
This prevents catastrophic split-brain network scenarios from ever reaching production environments.
Key Pieces
The ports Module
- What it does: This is the centralized, definitive registry for all default TCP/UDP network ports used across the entire Kinetic software stack.
- Location:
kinetic-core/src/config.rs— Lines 26 to 49. - Why it matters: It serves as the absolute single source of truth for port allocation across all binaries.
- Specific Allocations: It defines
P2P_DAEMON(6070),P2P_NODE(6071),P2P_HOST(6072). - Additional Allocations: It also defines API ports, Proxy routing ports, internal DNS ports, and the PAC server port.
- Operator Impact: By physically centralizing this data in one module, it actively prevents copy-paste developer errors and process collisions during local testing.
KineticConfig (Top-Level Configuration Struct)
- What it does: This is the primary, overarching container structure that holds the entire configuration state of the application.
- Location:
kinetic-core/src/config.rs— Lines 54 to 63. - Why it matters: This struct is the ultimate, undisputed source of truth for a running Kinetic node.
- Structure: It acts as the root object that gets dynamically serialized to and from the
config.tomlfile. - Sub-components: It is divided logically into three distinct, modular sub-structs:
daemonsettings for the local binary,networksettings for P2P routing, anddrandsettings for cryptography. - Operator Impact: It encapsulates the complete totality of a node’s configurable footprint in a single memory address.
DaemonConfig (Struct Fields and Operations Breakdown)
-
What it does: This deeply nested struct specifically configures the operational behavior of the
kinetic-daemonbackground process itself. -
Location:
kinetic-core/src/config.rs— Lines 108 to 160. -
Why it matters: It controls critical operational parameters that dictate how the node functions on the host machine. Let’s look at the specific, actionable fields in incredible detail:
-
bind_ip:- Type:
String - Purpose: The specific local IP address to bind internal services to.
- Operator Impact: This is usually set to
127.0.0.1for maximum security, ensuring privileged APIs are not exposed publicly to the internet.
- Type:
-
pac_bind_ip:- Type:
String - Purpose: The designated IP address used specifically and exclusively by the Proxy Auto-Config script server.
- Type:
-
api_port:- Type:
u16 - Purpose: The precise port number for the authenticated, privileged daemon REST API.
- Operator Impact: Operators use this port to monitor node health and execute administrative commands via the CLI.
- Type:
-
dns_port:- Type:
u16 - Purpose: The port for the daemon’s built-in, local UDP DNS resolver.
- Operator Impact: This almost always defaults to port 53. If the operator lacks root privileges on Linux, binding to port 53 will fail, requiring them to change this port or use capabilities mapping.
- Type:
-
proxy_port:- Type:
u16 - Purpose: The network port for the built-in HTTP reverse proxy.
- Operator Impact: This actively intercepts
.kindomain traffic on the local machine and routes it into the decentralized network.
- Type:
-
backend_port:- Type:
u16 - Purpose: The default local backend web server port mapping for routing internal requests.
- Type:
-
enable_dns:- Type:
bool - Purpose: A simple boolean flag that toggles the internal DNS resolver on or off.
- Type:
-
storage_dir:- Type:
PathBuf - Purpose: The exact, absolute filesystem path where the node’s local database engine (usually RocksDB or Sled) will physically write its state files.
- Operator Impact: critical for operators who want to mount a secondary, high-speed NVMe drive specifically for blockchain state.
- Type:
-
network_mode:- Type:
String - Purpose: A string that defines if the node operates as a heavy “FullNode” or a lightweight “LightNode”.
- Operator Impact: FullNodes actively participate in DHT storage and routing. LightNodes only query the network, refusing to store records for others, saving massive amounts of disk space.
- Type:
-
auto_update:- Type:
bool - Purpose: A vital boolean flag that controls OTA (Over-The-Air) binary updates.
- Operator Impact: If true, the background daemon will actively poll external servers for binary updates and automatically restart itself when a new version is detected.
- Type:
-
ipfs_gateway:- Type:
String - Purpose: The complete HTTP URL of the public IPFS gateway used to resolve external content links.
- Operator Impact: Used extensively when users navigate decentralized applications via the Kinetic proxy.
- Type:
-
atlas_port:- Type:
u16 - Purpose: The specific UDP port used to communicate locally with the Kinetic Atlas Bridge daemon.
- Operator Impact: Necessary for advanced blockchain state migrations and synchronization.
- Type:
-
P2pConfig (Struct Fields and Operations Breakdown)
-
What it does: This struct specifically configures the low-level libp2p networking stack and the various peer discovery subsystems.
-
Location:
kinetic-core/src/config.rs— Lines 224 to 274. -
Why it matters: It controls how the isolated node attempts to talk to the hostile outside world. Specific configuration fields include:
-
daemon_port&daemon_quic_port:- Type:
u16 - Purpose: The primary TCP and experimental QUIC listen ports for the daemon’s libp2p network swarm.
- Type:
-
node_port&node_quic_port:- Type:
u16 - Purpose: The designated routing ports for the lightweight node’s network swarm.
- Type:
-
host_port&host_quic_port:- Type:
u16 - Purpose: The designated routing ports for the host’s isolated network swarm.
- Type:
-
bootstrap_nodes:- Type:
Vec<String> - Purpose: An array of formatted libp2p multiaddrs.
- Operator Impact: These represent the initial, trusted peers the node contacts to break its isolation and join the global DHT routing network.
- Type:
-
seed_domain:- Type:
Vec<String> - Purpose: An array of DNS domains that the node queries for specialized TXT records.
- Operator Impact: Used to discover dynamic bootstrap peers when hardcoded peers are offline.
- Type:
-
enable_mdns:- Type:
bool - Purpose: A boolean flag that toggles local area network peer discovery.
- Operator Impact: When set to true, multiple Kinetic nodes on the exact same Wi-Fi network will automatically find and connect to each other without ever needing internet access.
- Type:
-
external_address:- Type:
Option<String> - Purpose: An optional field specifically built for nodes operating behind complex NATs, firewalls, or Docker containers.
- Operator Impact: It allows a frustrated operator to broadcast a public IP and port to the network to bypass automatic discovery failures.
- Type:
-
DrandConfig (Struct Fields and Operations Breakdown)
-
What it does: This struct configures exactly how the node fetches verifiable cryptographic randomness from the Drand Quicknet beacon network.
-
Location:
kinetic-core/src/config.rs— Lines 65 to 81. -
Why it matters: The Kinetic consensus algorithm requires unbiased, cryptographically verifiable randomness to function correctly. Specific fields include:
-
endpoints:- Type:
Vec<String> - Purpose: A ordered list of HTTP API endpoints (run by the League of Entropy) to query for randomness payloads.
- Type:
-
drand_domain:- Type:
Vec<String> - Purpose: A specific domain name used to query DNS TXT records to dynamically resolve and update Drand endpoints.
- Operator Impact: Ensures the node can find randomness even if the hardcoded endpoints go offline.
- Type:
-
p2p_only:- Type:
bool - Purpose: A critical boolean security flag.
- Operator Impact: If set to true, the node disables its HTTP clients entirely. It will only accept Drand randomness packets that arrive via the internal P2P Gossipsub network. This flag is designed for high-security, air-gapped node environments that lack outbound HTTP access.
- Type:
-
KineticConfig::load() (Core Initialization Function)
- What it does: This robust function attempts to read the TOML file from the physical disk, parse it, validate it, and instantiate the Rust structs in memory.
- Location:
kinetic-core/src/config.rs— Lines 377 to 405. - Why it matters: This single function physically implements the core file-system fallback logic and the crucial fail-closed security posture.
- Operator Impact: It rigorously manages environment variable overrides, automatically generates missing configs for new users, and intentionally panics the entire application on corrupted files to prevent hidden exploitation.
KineticConfig::save() (Core Serialization Function)
- What it does: This function executes the exact inverse of
load(). - Location:
kinetic-core/src/config.rs— Lines 416 to 441. - Why it matters: It serializes the current in-memory configuration state back into a nicely formatted TOML string and safely writes it to disk.
- Operator Impact: This function is utilized by the Kinetic CLI or the REST API whenever an operator attempts to change a setting dynamically while the node is currently running. It includes robust safeguards to ensure the parent directory physically exists on the disk before making any attempt to write the file.
get_base_dir() (Path Resolution Function)
- What it does: This useful helper function calculates the correct, platform-specific directory where the Kinetic application should store all of its sensitive data and configuration files.
- Location:
kinetic-core/src/config.rs— Lines 455 to 478. - Why it matters: This function ensures that Kinetic always behaves exactly like a properly written, native application on every single operating system it targets.
- Linux Behavior: On Linux, it correctly maps paths to
~/.local/share/{NETWORK_ID}. - Override Capability: Crucially, it deeply respects the
KINETIC_DATA_DIRenvironment variable. This is required for power users who want to move their blockchain data to a custom external hard drive or a mounted NAS system. - Dependencies: It utilizes the external
dirscrate to map standard OS paths seamlessly and flawlessly.
How This Connects to the Rest of Kinetic
This foundational configuration module directly touches almost every other critical system within the Kinetic ecosystem. It acts as the central nervous system for node initialization, network bindings, and routing protocols:
CROSS-CRATE DEPENDENCY (kinetic-daemon initialization)
When the main daemon process starts up in kinetic-daemon/src/main.rs, the very first operational instruction it executes is invoking KineticConfig::load(). The massive configuration object that is returned from this function call is then passed around by reference to almost every single subsystem. It is given to the API servers to know where to bind. It is given to the DNS resolvers to know which UDP ports to capture. It is given to the Proxy routing algorithms to understand .kin resolution. Furthermore, if the auto_update flag is enabled within this struct, the daemon will subsequently spawn active background threads to poll for new binary releases from GitHub.
CROSS-CRATE DEPENDENCY (kinetic-node networking)
The complex P2P swarm relies and exclusively on the parameters defined within the P2pConfig struct. When the libp2p framework starts initializing its transports, it looks specifically at the daemon_port and daemon_quic_port variables. It uses these variables to figure out exactly how to bind its listeners to the host OS’s networking sockets. It then immediately iterates through the bootstrap_nodes string array. For each multiaddr in that array, it attempts to forcefully establish its first outbound network connections. This process is the exact mechanism by which a cold node officially joins the global DHT routing table.
FORWARD DEPENDENCY (Atlas Bridge Integration and State Sync)
Take special notice of the atlas_port parameter located deep within the DaemonConfig. The Atlas Bridge is a separate, specialized background utility in the broader Kinetic ecosystem. It is utilized specifically for migrating historical chain state or syncing massive network datasets efficiently across large distances. The core network daemon uses this specific UDP port to orchestrate commands with the local Atlas instance securely.
FORWARD DEPENDENCY (Drand Cryptographic Networking)
The deeply integrated randomness module utilizes the endpoints and drand_domain string arrays from the DrandConfig to actively query the trusted League of Entropy servers. Crucially, if the operator sets p2p_only to true, the node modifies its internal network stack to disable its outbound HTTP client entirely. From that point on, it relies exclusively on the libp2p Gossipsub protocol to receive cryptographically signed Drand updates from other Kinetic peers. This complex architectural flow is critical for validating nodes running behind strict, unforgiving corporate firewalls where outbound HTTP traffic is blocked.
FORWARD DEPENDENCY (Proxy Subsystem Resolution)
The node’s built-in HTTP reverse proxy relies on the configured ipfs_gateway field located in DaemonConfig. When a local web browser requests a specialized .kin decentralized domain name that resolves to an IPFS CID on the backend, the local proxy intercepts this request. It uses this configured gateway URL to fetch the decentralized content via standard HTTP. It then rapidly streams it back to the user’s browser. This essentially translates complex decentralized web data into standard, legacy HTTP traffic that older browsers can instantly understand without native IPFS integration.
Quick Reference for Node Operators
Important Environment Variable Overrides
If an advanced system operator needs to quickly override the default software paths without actually editing the TOML file on disk (which is a very common requirement in automated CI/CD pipelines or immutable container deployments), the Kinetic binary deeply respects these global environment variables:
-
KINETIC_CONFIG_PATH: This variable forcefully commands the daemon to load a specific, customconfig.tomlfile from anywhere on the disk. Example usage:KINETIC_CONFIG_PATH=/etc/kinetic/my_custom_production_config.toml kinetic-daemon -
KINETIC_DATA_DIR: This variable fundamentally changes the primary root directory used for all database storage, all configuration files, and all sensitive API authentication tokens. Example usage:KINETIC_DATA_DIR=/mnt/nvme_storage_array/kinetic_data kinetic-daemon -
KINETIC_ENV: This variable is used in strict combination with hardcoded constants to determine the network ID. This is critical for isolatingtestnetdata frommainnetdata on the exact same physical server instance.
Default Port Mapping Overview for System Administrators
For network administrators configuring strict firewall constraints (using tools like UFW, iptables, pfSense, or AWS Security Groups), here is exactly how the Kinetic software logically maps its default local network ports:
- Ports 6070 - 6072: Dedicated to libp2p Networking. This supports standard TCP, UDP, and experimental QUIC protocols for the Daemon, Node, and Host background processes.
- Ports 16002 - 16004: Dedicated exclusively to Internal authenticated REST APIs and basic HTTP Health Check endpoints. These should never be exposed to the public internet.
- Port 17001:
Dedicated to the Built-in HTTP Reverse Proxy used specifically for internal
.kindomain name resolution routing. - Port 16001: Dedicated to the Proxy Auto-Config (PAC) HTTP server, which is queried automatically by local web browsers on the host machine.
- Port 53: Dedicated to the Local UDP DNS Resolver. This specific port usually requires root capabilities on Linux and is used for actively intercepting native OS-level domain queries before they hit the upstream ISP.
- Port 80: The default local backend port mapping for routing general web traffic to local applications.
- Port 34291: Dedicated specifically to the external Atlas Bridge utility for efficient UDP state communication.
Open Questions / Things to Revisit During Next Refactor
-
WebAssembly Persistent Configuration Limitations: Currently, the WebAssembly build targets have a empty, non-functional stub for configuration loading (
config::load()simply returns an emptydefault()object). If the engineering team ever wants Wasm-based web nodes to actively support persistent custom configurations (for example, saving custom user preferences directly into the browser’slocalStorageorIndexedDBAPIs across sessions), we will need to and rewrite the Wasm conditional implementation. Bothload()andsave()would need to deeply integrate with those specific browser storage APIs natively. -
Missing Semantic Input Validation for Edge Cases: While the strict TOML parser effectively protects against basic structural syntax errors (like missing quotes), there is surprisingly very little semantic validation of the parsed operational data itself. For an extreme example, if a rogue user configures
api_port = 99999(which is technically an invalid port number as it is vastly larger than a standardu16maximum of 65535, thoughserdemacro serialization will eventually catch strict type mismatches at runtime). But consider a far more dangerous edge case: what if an operator sets the proxy port to port1, which requires high-level root privileges on Linux? We desperately might want to add a robust, explicit.validate()method directly to theKineticConfigstruct. This method should actively check for things like privileged ports or overlapping internal port assignments before ever allowing the boot process to blindly continue forward and panic cryptically later in the startup sequence. -
Handling Configuration Schema Migrations Over Time: If a future iteration of the Kinetic core software decides to rename a configuration field (for a simple example, changing the variable name
storage_dirtodatabase_path), a catastrophic failure will occur for existing nodes. All older, existingconfig.tomlfiles will instantly fail to parse when the daemon boots up. Because of our strict security model, this will trigger the fail-closed panic exit, crashing all legacy nodes globally. We currently have no systemic mechanism in place for gracefully migrating outdated TOML configurations to newer schema formats without manual operator intervention. We likely need to introduce an explicitversionfield directly inside the config file to track these breaking schema changes safely. -
IPFS Gateway Hardcoding Reliability Risks: The
ipfs_gatewayfield currently defaults to a singular, specific public gateway defined statically insideconstants.rs. Public IPFS gateways are notoriously unreliable over long periods. They frequently implement aggressive rate-limiting protocols or experience massive, unpredictable downtime spikes. We desperately might want to update the schema to support a full array of fallback gateway URLs rather than a single string. Alternatively, we could perhaps implement a smart round-robin load balancing strategy for fetching external decentralized content reliably. -
Lack of Dynamic Port Allocation Fallbacks: If the default requested port is already actively in use by another random application on the host machine, the daemon will currently crash and burn instantly. Should the engineering team implement a smart, automatic port fallback mechanism? For example, attempting to natively bind to port 6073 if port 6070 is already taken by another process on the box? If successful, it would dynamically update the configuration file on disk. While this would drastically improve the non-technical user onboarding experience by avoiding cryptic “address already in use” panics, it would significantly complicate manual firewall rules for system administrators who expect 100% deterministic, predictable behavior.