If you’ve ever tried to spin up a Codex storage node#you know the hard truth: the codex config.toml file is the heart and soul of your node. Get it right, and your node will sync seamlessly, maintain stable peer connections, and deliver consistent, reliable performance. Get even one critical parameter wrong, and you’ll be stuck staring at 0 active peers, sync failures, API errors, or a node that crashes on startup with zero explanation.
Most online guides skim over the granular details of the config.toml file, leaving you to troubleshoot vague errors for hours. Whether you’re a first-time node operator setting up your first Codex instance, or a seasoned operator looking to optimize your node’s performance, this guide covers everything you need to know: a full working sample config, line-by-line parameter explanations, advanced optimization tweaks, and fixes for the most common codex config.toml errors.

What Is codex config.toml, and Why It’s the Heart of Your Codex Node
First, let’s ground the basics: Codex is a decentralized, peer-to-peer (P2P) data storage network designed for secure, censorship-resistant file storage, retrieval, and content hosting. Unlike centralized cloud storage, Codex relies on a distributed network of user-operated nodes to store and serve data, with built-in redundancy and end-to-end encryption.
The codex config.toml file is the primary, persistent configuration file for your Codex node. It controls every single aspect of your node’s behavior, including:
- Network connectivity and peer discovery settings
- Maximum storage allocation for the network
- API access and security controls
- Logging and monitoring behavior
- Content discovery and block retention rules
- Bandwidth limits and network priority settings
While you can run a Codex node with temporary command-line flags, the config.toml file is the industry standard for production deployments. It lets you standardize node settings across multiple deployments, persist configuration through restarts, and fine-tune your node with granular control that command-line flags can’t match.
Full Working codex config.toml Sample (With Line-by-Line Explanations)
Below is a production-ready, fully commented codex config.toml file that works for the latest stable Codex node release. This sample is optimized for a standard home or small server deployment, with notes on which parameters to adjust for your specific hardware and network.
toml
# ==============================================# CODEX NODE CORE CONFIGURATION# ==============================================[node]# A human-readable name for your node (visible to peers on the network)node-name = "my-codex-storage-node-01"# The private key file for your node's cryptographic identity (auto-generated on first run if not specified)private-key-file = "./codex-private.key"# Data directory where the node will store all blocks, metadata, and configurationdata-dir = "./codex-data"# Log level: trace, debug, info, warn, error (use info for standard use, debug for troubleshooting)log-level = "info"# Enable/disable the node's built-in metrics collection for monitoringmetrics-enabled = true# Port for the metrics server (if enabled)metrics-port = 8008# ==============================================# NETWORK & PEER CONNECTION SETTINGS# ==============================================[network]# The TCP port your node will use for P2P peer connections (forward this port in your router!)listen-port = 45300# List of bootstrap nodes to join the Codex network (official mainnet bootstrap nodes included)bootstrap-nodes = ["/dns4/bootstrap.codex.storage/tcp/45300/p2p/16Uiu2HAm3rGQZJfX7qYwq8z9xK6L5M4N3B2V1C0Z9X8W7V6U5S4R3Q2P1O0N","/dns4/bootstrap-2.codex.storage/tcp/45300/p2p/16Uiu2HAm9X8W7V6U5S4R3Q2P1O0N9M8L7K6J5I4H3G2F1E0D9C8B7A6"]# Maximum number of active peer connections (adjust based on your bandwidth)max-peers = 100# Minimum number of peers to maintain for stable network syncmin-peers = 20# Enable/disable NAT traversal for nodes behind a router/firewallnat-traversal = true# Local IP address to bind to (leave as 0.0.0.0 to listen on all interfaces)bind-ip = "0.0.0.0"# ==============================================# STORAGE ALLOCATION & RETENTION SETTINGS# ==============================================[storage]# Maximum total storage (in GB) your node will allocate to the Codex networkmax-storage-gb = 500# Minimum free disk space (in GB) to reserve for your systemreserved-disk-space-gb = 50# How long to retain unused blocks (in hours) before pruningblock-retention-hours = 720# Enable/disable automatic storage pruning to stay within max-storage limitsauto-prune = true# Path to a dedicated storage drive (optional, defaults to data-dir if not set)storage-path = "/mnt/codex-storage"# ==============================================# API ACCESS & SECURITY SETTINGS# ==============================================[api]# Enable/disable the HTTP API for node management and integrationapi-enabled = true# Port for the HTTP APIapi-port = 8080# IP address to bind the API to (use 127.0.0.1 for local-only access, 0.0.0.0 for remote access)api-bind-ip = "127.0.0.1"# Enable/disable API authentication (CRITICAL for remote access)api-auth-enabled = true# Username for API authenticationapi-username = "codex-admin"# Secure password for API authentication (use a strong, unique password)api-password = "YOUR-SECURE-STRONG-PASSWORD-HERE"# Enable CORS for browser-based API accesscors-enabled = false# ==============================================# CONTENT DISCOVERY & DHT SETTINGS# ==============================================[discovery]# Enable/disable the Distributed Hash Table (DHT) for content and peer discoverydht-enabled = true# DHT port (must match the listen-port if using a single port, or a separate port if needed)dht-port = 45300# Enable/disable local network peer discoverylocal-discovery = true
Critical codex config.toml Parameters: Cheat Sheet
For quick reference, this table breaks down the most important parameters, their purpose, default values, recommended settings, and the most common mistakes operators make.
| Parameter | Config Section | Default Value | Recommended Setting | Core Purpose | Common Mistakes to Avoid |
| listen-port | [network] | 45300 | 45300 (forwarded in your router) | Defines the TCP port for P2P peer connections | Forgetting to forward the port in your router/firewall, leading to 0 active peers |
| max-storage-gb | [storage] | 100 | 50-80% of your available disk space | Sets the maximum storage your node will allocate to the network | Setting it higher than your available disk space, causing the node to crash when full |
| api-bind-ip | [api] | 127.0.0.1 | 127.0.0.1 (local only) | Controls which IPs can access the node’s API | Setting it to 0.0.0.0 without enabling API authentication, exposing your node to unauthorized access |
| max-peers | [network] | 50 | 50-150 (based on bandwidth) | Sets the maximum number of active peer connections | Setting it too high for your internet bandwidth, causing network lag and sync failures |
| log-level | [node] | info | info (standard) / debug (troubleshooting) | Controls the verbosity of node logs | Setting it to trace for production use, filling your disk with excessive log data |
| nat-traversal | [network] | TRUE | true (for home nodes) | Enables automatic NAT traversal for nodes behind a router | Disabling it without manual port forwarding, leading to peer connection failures |
| auto-prune | [storage] | TRUE | TRUE | Automatically prunes old blocks to stay within storage limits | Disabling it, leading to your disk filling up and the node crashing |
Step-by-Step Guide to Deploying Your codex config.toml File
Once you’ve customized your config.toml file using the sample and cheat sheet above, follow these steps to deploy it correctly and verify your node is working as expected:
- Save the Config FileSave your customized
config.tomlfile to the same directory where you’ve installed the Codex node binary. For production deployments, use a dedicated directory (e.g.,/etc/codex/on Linux) for consistent file permissions and access. - Validate the TOML SyntaxInvalid TOML syntax is the #1 cause of node startup failures. Validate your file using a free online TOML validator, or use a code editor like VS Code with a TOML extension to catch missing brackets, incorrect quotes, or broken formatting before deployment.
- Start the Codex Node With Your Config FileLaunch your node using the
--configflag to point to your customconfig.tomlfile. This overrides all default settings with your custom configuration: - bash
# Linux/macOS startup command
./codex --config ./config.toml
# Windows startup command
codex.exe --config .\config.toml
- Verify the Config Loaded CorrectlyCheck the node’s startup logs to confirm your custom configuration was applied. Look for lines like
Loaded config from ./config.tomland verify that your node name, storage limits, and port settings match what you set in the file. - Confirm Peer Connectivity & SyncAfter 2-5 minutes, check the node logs to confirm active peer connections. You should see lines like
Connected to new peerandDHT bootstrap complete. For a quick check, use the node’s API to verify peer count: - bash
curl http://127.0.0.1:8080/api/v1/peers
Advanced codex config.toml Tweaks to Optimize Node Performance & Reliability
Once your node is up and running, these advanced tweaks will help you maximize performance, improve uptime, and reduce common pain points for long-term node operation.
- Lock in Stable Peer Connectivity With a Fixed IP Address
The most common cause of long-term peer disconnections and sync failures is a dynamic, frequently changing IP address. Codex nodes rely on a consistent network identity for peer discovery and long-term connections. If your ISP resets your dynamic IP regularly, or you’re running the node across multiple network environments, your peers will drop the connection, and your node will struggle to rejoin the network.
The most reliable fix is to route your Codex node’s traffic through a static residential proxy from IPFLY. IPFLY’s fixed, ISP-assigned residential IPs provide a consistent network identity for your node, ensuring uninterrupted peer connectivity, reliable DHT discovery, and stable sync with the Codex network. You can also deploy geographically diverse nodes using IPFLY’s 190+ country coverage, improving your node’s network diversity and redundancy.
To implement this, add your IPFLY static proxy settings to your node’s startup command, or configure it at the system level to route all Codex traffic through the fixed IP.
- Optimize Storage Performance for HDD/SSD Deployments
If you’re using a dedicated HDD for Codex storage, adjust these [storage] parameters to reduce disk I/O load and improve performance:
toml
[storage]# Increase block retention to reduce frequent disk writesblock-retention-hours = 1440# Reduce prune frequency to once daily (instead of continuous)prune-interval-hours = 24# Disable real-time block validation for read-heavy nodesbackground-validation = false
For SSD deployments, you can reduce the prune interval and enable background validation for faster block verification and improved content availability.
- Harden API Security for Remote Node Management
If you need to access your node’s API remotely, these [api] tweaks will harden security and prevent unauthorized access:
toml
[api]# Bind to a specific remote IP instead of 0.0.0.0api-bind-ip = "YOUR-TRUSTED-REMOTE-IP"# Enable HTTPS for the API (use a valid SSL certificate)api-tls-enabled = trueapi-tls-cert-file = "./codex-api-cert.pem"api-tls-key-file = "./codex-api-key.pem"# Limit API request rate to prevent brute-force attacksapi-rate-limit-enabled = trueapi-rate-limit-requests-per-second = 10
Common codex config.toml Errors & Troubleshooting Fixes
Even with a perfect config file, you may run into errors. Below are the most common codex config.toml issues and their step-by-step fixes:
Error 1: Node Crashes Immediately on Startup
Root Cause: 90% of the time, this is invalid TOML syntax, a missing file path, or a storage limit that exceeds your available disk space.Fix:
- Validate your
config.tomlfile with a TOML validator to catch syntax errors. - Verify that all file paths (data-dir, storage-path, private-key-file) exist and have correct read/write permissions.
- Confirm that your
max-storage-gbsetting is less than your total available disk space, and that you’ve reserved enough space for your system.
Error 2: 0 Active Peers / Node Won’t Connect to the Network
Root Cause: Closed port, disabled NAT traversal, invalid bootstrap nodes, or a frequently changing IP address.Fix:
- Confirm that you’ve forwarded the
listen-portin your router/firewall for both TCP and UDP traffic. - Verify that
nat-traversalis set totruein your[network]section. - Update your
bootstrap-nodeslist with the latest official Codex mainnet bootstrap nodes. - If your IP address changes frequently, use a static residential proxy from IPFLY to lock in a consistent network identity for peer discovery.
Error 3: API Not Accessible / Connection Refused
Root Cause: API disabled, incorrect bind IP, wrong port, or missing authentication.Fix:
- Confirm that
api-enabledis set totruein your[api]section. - Verify that the
api-bind-ipis set correctly: use127.0.0.1for local access, or your trusted remote IP for external access. - Confirm that the
api-portis not being used by another application, and that the port is open in your firewall. - If
api-auth-enabledis true, ensure you’re including the correct username and password in your API requests.
Error 4: Node Fills Disk Space & Crashes
Root Cause: auto-prune disabled, incorrect storage limits, or insufficient reserved disk space.Fix:
- Set
auto-prune = truein your[storage]section to automatically prune old blocks. - Increase
reserved-disk-space-gbto ensure the node never fills your system disk. - Lower
max-storage-gbto a value that leaves at least 20% of your disk free.
FAQ: Your Top codex config.toml Questions Answered
Where do I put the codex config.toml file?
For most deployments, save the file in the same directory as your Codex node binary. For Linux production deployments, the standard location is /etc/codex/config.toml. You can also specify a custom file path using the --config flag when starting the node.
Can I use command-line flags alongside the codex config.toml file?
Yes. Command-line flags will override the corresponding settings in the config.toml file. This is useful for temporary tweaks (like changing the log level for troubleshooting) without editing the permanent config file.
How do I reset my codex config.toml to default settings?
Delete or rename your existing config.toml file, then start the Codex node without the --config flag. The node will generate a new default config file with all factory settings.
Why does my node ignore the settings in my codex config.toml file?
This is almost always caused by one of two issues: invalid TOML syntax that makes the file unreadable (the node will fall back to default settings), or you’re not using the --config flag to point to the correct file path when starting the node.
Can I use the same codex config.toml file for multiple nodes?
Yes, you can use a base config file for standardized deployments, but you must change the node-name and private-key-file for each node to avoid duplicate network identities, which will cause peer connection failures.

The codex config.toml file is more than just a settings document—it’s the blueprint for a stable, high-performing Codex node. While it can feel overwhelming at first, breaking down the file into core sections, understanding the critical parameters, and following the deployment steps in this guide will help you avoid the most common pitfalls that trip up new and experienced node operators alike.
For long-term reliability, the most impactful tweak you can make is to lock in a consistent, stable network identity for your node. A static residential proxy from IPFLY eliminates the peer connectivity issues that come with dynamic IP addresses, ensuring your node stays synced, maintains active peers, and delivers consistent performance for the long haul.
Whether you’re running a single home node for personal use, or a fleet of production nodes for enterprise storage, mastering the codex config.toml file is the key to success on the Codex network.
About IPFLY: IPFLY delivers enterprise-grade static and dynamic residential proxy solutions purpose-built for stable, secure node operation and peer-to-peer network connectivity. With a global pool of over 90 million high-purity residential IPs across 190+ countries, 99.9% uptime, full support for all standard network protocols, and end-to-end traffic encryption, IPFLY is the trusted solution for Codex node operators looking to maintain consistent peer connectivity, eliminate dynamic IP-related sync failures, and deploy geographically diverse nodes with reliable, fixed network identities. Our dedicated proxy infrastructure ensures uninterrupted node operation, stable DHT peer discovery, and seamless access to the Codex network, even in environments with restrictive network policies or dynamic IP addressing.