Run A Full Node

Run Your Full Node From The Command Line

Run the following command to connect to the DCC mainnet:

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

"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 DCC testnet, you can use the following command instead:

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

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/.dcc  --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/.dcc  --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 DCC, 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/.dcc --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 dcc -d -v /host/path:/data/.dcc/ \
     docoincommunitychain/dcc:latest --datadir /data/.dcc 

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/.dcc" are arguments passed to the `geth` process in the container.

Last updated