How to Start the OKTC Mainnet Node

·

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:

Step-by-Step Setup

  1. Clone the exchain repository

    git clone https://github.com/okx/exchain.git
    cd exchain
  2. Compile for mainnet
    As noted in official guidelines, always compile using the mainnet build flag:

    make mainnet

    This ensures compatibility with the live OKTC network.

  3. Install RocksDB (first-time users only)
    If this is your first time running exchaind, install RocksDB—a high-performance embedded database used for state storage:

    make rocksdb

    This command automates the setup within the exchain directory.

    👉 Learn how to optimize blockchain node performance with efficient storage solutions.

  4. Download and restore snapshot
    Visit the official snapshot link to download the latest compressed snapshot file. Extract it into your ~/.exchaind/data directory:

    tar -xzf snapshot.tar.gz -C ~/.exchaind/data
  5. Start 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

  1. Initialize the node

    exchaind init <your-moniker> --chain-id oktc-200
  2. Download the latest genesis file
    Replace the default genesis.json with the official one:

    curl -O https://raw.githubusercontent.com/okx/exchain/master/networks/mainnet/genesis.json
    mv genesis.json ~/.exchaind/config/
  3. Verify integrity
    Check the SHA256 hash of the downloaded file against the official value to prevent corruption or tampering.
  4. Recompile if needed
    Again, use make mainnet to ensure correct configuration.
  5. 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

Setup Process

  1. Pull the official image

    docker pull okx/exchain:latest
  2. Create 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
  3. Download and extract snapshot into ./data folder
    Same as in Method 1—ensure the data directory contains valid blockchain state.
  4. 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 1200

The -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 successfully

These 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:

👉 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.