> For the complete documentation index, see [llms.txt](https://dxchain.gitbook.io/dxchain-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dxchain.gitbook.io/dxchain-wiki/stake-and-trade/develop-on-dxchain/compile-and-run.md).

# Compile and Run

## Download

Pull source code from `git`

```shell
git clone https://github.com/DxChainNetwork/dxc.git
```

## Install Golang

Reference: <https://go.dev/doc/install>

```bash
// or in linux:
$ sudo snap install go --classic
```

## Compile

```bash
$ cd /path/to/dxc
$ make geth
```

The compiled geth executable file is under the /path/to/dxc/build/bin path.

Run `./build/bin/geth --help` to get instruction, or refer to [command-line-options](https://geth.ethereum.org/docs/interface/command-line-options).

## Run

### Run Configuration&#x20;

* Access the working directory `/directory/of/geth`
* Create `config.toml`in the working directory

```toml
[Eth]
SyncMode = "snap"
TrieCleanCacheRejournal= 300000000000

[Eth.Miner]
GasFloor = 0
GasCeil = 40000000
GasPrice = 1000000000
Recommit = 3000000000
Noverify = false

[Node]
InsecureUnlockAllowed = true
IPCPath = "geth.ipc"
```

> Default to use `SyncMode = "snap"` for the node snyc mode, for the full node sync is `SyncMode = "full"`

* Create`start.sh` in the working directory

```bash
#!/bin/bash

set -e

# DXC_DIR the path of geth
DXC_DIR=/directory/of/geth

cd $DXC_DIR

# --datadir ./data Blockchain data storage directory
nohup ./geth --datadir ./data --config ./config.toml --verbosity 3 >>./data/system.log 2>&1 &
```

### Run Node

```shell
$ /bin/bash start.sh
```

## Network

The node program starts as `mainnet` by default, add the `--testnet` command at runtime if you want to start the testnet.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dxchain.gitbook.io/dxchain-wiki/stake-and-trade/develop-on-dxchain/compile-and-run.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
