Starting a mainnet node on the OKTC (OKX Chain) network is a crucial step for developers, validators, and blockchain enthusiasts who want to participate in network consensus, contribute to decentralization, or run decentralized applications. This comprehensive guide walks you through the process of setting up your own OKTC mainnet node using multiple methods—whether you're leveraging exchaind, Docker, or snapshot data for faster synchronization.
By the end of this article, you’ll understand how to properly install dependencies, configure your environment, and maintain a healthy node without risking data loss.
Method 1: Using exchaind with Snapshots
One of the fastest ways to launch an OKTC mainnet node is by using snapshots—pre-synchronized blockchain data that drastically reduces sync time from days to hours.
Before beginning, ensure your system meets the minimum requirements:
- Linux-based OS (Ubuntu 20.04+ recommended)
- 8+ CPU cores
- 16GB+ RAM
- 1TB+ SSD storage
- Stable internet connection
Step-by-Step Setup
Clone the exchain repository
git clone https://github.com/okx/exchain.git cd exchainCompile for mainnet
As noted in official guidelines, always compile using themainnetbuild flag:make mainnetThis ensures compatibility with the live OKTC network.
Install RocksDB (first-time users only)
If this is your first time runningexchaind, install RocksDB—a high-performance embedded database used for state storage:make rocksdbThis command automates the setup within the exchain directory.
👉 Learn how to optimize blockchain node performance with efficient storage solutions.
Download and restore snapshot
Visit the official snapshot link to download the latest compressed snapshot file. Extract it into your~/.exchaind/datadirectory:tar -xzf snapshot.tar.gz -C ~/.exchaind/dataStart the node
Run the following command to begin syncing from the restored state:exchaind start
Core Tip: Always verify the latest_version from the releases page before compiling to ensure you’re using the most stable and secure version.Method 2: Using exchaind with genesis.json
If you prefer a clean start from block zero, you can initialize your node using the genesis.json file instead of snapshots.
Initialization Steps
Initialize the node
exchaind init <your-moniker> --chain-id oktc-200Download the latest genesis file
Replace the defaultgenesis.jsonwith the official one:curl -O https://raw.githubusercontent.com/okx/exchain/master/networks/mainnet/genesis.json mv genesis.json ~/.exchaind/config/- Verify integrity
Check the SHA256 hash of the downloaded file against the official value to prevent corruption or tampering. - Recompile if needed
Again, usemake mainnetto ensure correct configuration. Start syncing
exchaind start
⚠️ Note: Syncing from genesis may take several days depending on hardware and bandwidth. For faster results, consider using snapshots instead.
Method 3: Using Docker with Snapshots
Docker provides a containerized, isolated environment ideal for production-grade node deployment.
Prerequisites
- Docker Engine 20.10+
- Docker Compose v2.0+
Setup Process
Pull the official image
docker pull okx/exchain:latestCreate a docker-compose.yml file
version: '3' services: oktc-node: image: okx/exchain:latest container_name: oktc-mainnet command: exchaind start volumes: - ./data:/root/.exchaind ports: - "26656:26656" - "26657:26657" restart: unless-stopped- Download and extract snapshot into
./datafolder
Same as in Method 1—ensure the data directory contains valid blockchain state. Launch the container
docker-compose up -d
Critical Node Operation Notices
Running a reliable node involves more than just setup—it requires careful operation to prevent data loss.
Avoid Forced Exits
exchaind stores incremental state changes in memory and periodically persists them to disk. If the process is interrupted abruptly (e.g., via kill -9), unsaved state data may be lost, leading to corruption.
✅ Recommended shutdown commands:
kill -2 ${pid}
# OR
kill -15 ${pid}For Docker:
docker stop -t 1200 oktc-mainnet
# OR
docker-compose down -t 1200The -t 1200 flag allows a 20-minute grace period for safe shutdown—critical for large nodes.
Confirming Graceful Exit
After stopping, check logs for messages like:
accepted signal, starting shutdown routine...
completing state sync and saving final block...
shutdown completed successfullyThese confirm that no data was lost during exit.
👉 Discover best practices for maintaining high-availability blockchain nodes.
Frequently Asked Questions (FAQ)
Q1: Why should I use snapshots instead of syncing from genesis?
Snapshots allow you to skip downloading and verifying years’ worth of blocks. Instead, you start from a recent, trusted state—reducing sync time from days to under a few hours.
Q2: What is RocksDB, and why is it required?
RocksDB is an embeddable key-value store optimized for fast storage. It's used by exchaind for efficient state management. First-time users must install it via make rocksdb.
Q3: Can I run multiple nodes on the same machine?
Yes, but each node must use isolated data directories and different ports to avoid conflicts.
Q4: How do I monitor my node’s health?
Use built-in RPC endpoints (http://localhost:26657) to query block height, peer count, and syncing status. Tools like Prometheus and Grafana can provide visual dashboards.
Q5: What happens if my node crashes unexpectedly?
If exchaind restarts after a crash, it will attempt replaying pending state updates. However, forced exits increase risk of irrecoverable corruption—always shut down gracefully.
Q6: Is Docker better than native installation?
Docker offers better isolation and easier version control but may have slight performance overhead. Choose based on your operational needs—Docker is ideal for production environments.
Final Recommendations
To ensure long-term stability of your OKTC mainnet node:
- Regularly update to the latest
exchaindversion. - Backup critical directories (
~/.exchaind/config,~/.exchaind/data/priv_validator_state.json) frequently. - Monitor disk usage—blockchain data grows continuously.
- Join community forums for real-time support and updates.
👉 Access developer tools and resources to supercharge your blockchain projects today.
By following this guide, you're not only contributing to network resilience but also positioning yourself at the forefront of decentralized innovation on OKTC. Whether you're building dApps, validating transactions, or exploring Web3 infrastructure, a well-maintained node is your gateway to full participation.
Remember: Consistency, caution, and proper maintenance are key to running a successful blockchain node in any ecosystem.