KCC Documents
  • Quickstart
  • Overview
    • Introduction
    • Features
    • Our Goal
    • Consensus Engine
    • Marketing Guide
      • Requirements
      • KCC Official Website Resource
      • KCC Social Media Promotion
      • PR & Third-Party Marketing Support
  • Developers
    • Network Endpoints
    • Deploy Smart Contract
      • Using Hardhat
      • Using Remix
    • Verify Smart Contract
      • Using Hardhat
      • Using Foundry
      • Using Remix
    • Issue ERC20 Token
    • Deploy NFTs
      • Create A Foundry Project
      • Create Your ERC721 Contract
      • Add Metadata
    • Run a Node
      • Hardware & System Requirements
      • Install KCC
      • Run A Full Node
      • Run A Validator Node
        • Block Rewards
        • Apply For Running A Validator
        • Manager Account And Validator Account
        • Run A Validator
      • Troubleshooting
    • Explorer
    • Oracles
      • KCC Oracle
    • Bridge
    • Dev Toolkit
    • Data
      • Indexing and Querying
        • The Graph
        • Using KCC's hosted subgraph
    • Gas Revenue Program
      • Rules for Calculation of Gas Revenue
      • How to Join the KCC Gas Revenue Program
  • Individuals
    • Wallet
      • Supported Wallet
      • Tutorial on how to set up wallet
      • Mutisig Wallet
        • Create New Safe
        • Send KCS From Your Safe
        • Use A DApp With Your Safe
    • Network Configuration
      • Configure Value
      • Tutorial on how to config KCC network in Metamask
      • Tutorial on how to config KCC network in Chainlist
    • Bridge Assets
      • Bridge assets from others chains
      • KCC Bridge
      • Bridge assets form Exchange
    • Find a dApp
      • Add Your dAPP
    • KCS Token
      • Get KCS
      • Stake KCS
        • How to participate in KCS Staking
        • How to redeem staked KCS
        • How to check or claim staking rewards
  • FAQs
    • FAQs
      • General FAQs
      • KCS and Staking FAQs
      • Validator FAQs
  • Future Developments
    • Milestone
  • CONTACT US
    • Contact Us
  • Disclosure
    • Disclaimers
    • Risk Statement
    • Media Kit
Powered by GitBook
On this page
  • Run Your Full Node From The Command Line
  • Enable HTTP & Websocket RPC Server
  • Run An Archive Node
  • Use A Process Manager
  • Run Your Full Node In A Docker Container
  1. Developers
  2. Run a Node

Run A Full Node

PreviousInstall KCCNextRun A Validator Node

Last updated 2 years ago

Run Your Full Node From The Command Line

Run the following command to connect to the KCC mainnet:

# We assume you have put the client binary "geth" in one of the directories in $PATH
geth --datadir /data/.kcc 

All the chain data is in the directory following the option --datadir. So you should ensure the disk mounted to this directory has enough free space.

And if you want to connect to the KCC testnet, you can use the following command instead:

# add "--testnet" to connect to the testnet
geth --testnet --datadir /data/.kcc 

In the following sections, we will only talk about the mainnet. However, all the following commands will work on testnet, except that you should add an extra --testnet option.

Enable HTTP & Websocket RPC Server

geth --datadir /data/.kcc  --http --ws

--http enables an HTTP-RPC server that listens onlocalhost:8545

--ws enables a Websocket-RPC server that listens onlocalhost:8546

With the commands above, you can only access your RPC servers from the same machine that runs your node. If you want to make your RPC servers publicly accessible, you need to specify the listening addresses of your RPC servers:

geth --datadir /data/.kcc  --http --ws --http.addr 0.0.0.0 --ws.addr 0.0.0.0

Use --http.addr to specify the listening address of your HTTP-RPC server and use --ws.addr for the listening address of your Websocket-RPC server.

Your node could be vulnerable if you make your RPC servers publicly accessible.

Run An Archive Node

The state is a snapshot of all accounts on KCC, which includes the balance and nonce of each account, the code of each contract, and the storage of each smart contract. If you want to query the historical state at some block, you can replay all the transactions starting from the genesis block to reconstruct the state at that block. However, if you want to save all states on your disk, that would take a lot of disk space. Therefore, although a full node saves all the historical blocks and receipts, it does not hold all the historical states.

Nevertheless, in some scenarios, you want to save all the historical states on your disk. For example, you are building some analyzing system that frequently queries the historical states, and you don't want to waste time reconstructing the historical states. You can run an archive node as follows:

geth --datadir /data/.kcc --syncmode full --gcmode archive  

"--syncmode full" tells the node to replay transactions in each block by itself, and "--gcmode archive" asks the node to record all the intermediate states when replaying those transactions.

Use A Process Manager

We highly recommend managing your node with a process manager. A process manager watches your node client process, collects and rotates the logs, and restarts your node if needed. Here is a list of some popular process managers:

Run Your Full Node In A Docker Container

The entry point of our docker image is geth, so it is quite straightforward to run your node in a docker container:

docker run --name kcc -d -v /host/path:/data/.kcc/ \
     kucoincommunitychain/kcc:latest --datadir /data/.kcc 

Use --name to specify the name of your running container

Use -d to make your container run in the background

Use -v to map a host path into the container

The trailing "--datadir /data/.kcc" are arguments passed to the `geth` process in the container.

"geth" is the client binary you have built or installed in . If it is not in one of your $PATH, you should use an absolute path (i.e., /path/to/geth ) Instead.

If you want to access your node through the , you can use the following command to enable the HTTP and WebSocket RPC servers:

the previous section
Ethereum JSON-RPC
PM2
Systemd
Supervisord