KCC Documents
English
Search…
⌃K

Run A Full Node

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
"geth" is the client binary you have built or installed in the previous section. If it is not in one of your $PATH, you should use an absolute path (i.e., /path/to/geth ) Instead.
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

If you want to access your node through the Ethereum JSON-RPC, you can use the following command to enable the HTTP and WebSocket RPC servers:
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.