> 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/private-chain-construction.md).

# Private Chain Construction

## Prepare an Account

Access the working directory `/directory/of/geth`

```shell
$ ./geth account new --datadir ./data
```

The `keystore` file of the new account is located under the path`/directory/of/dxc/build/bin/data/keystore`.

![](/files/xu7JbM6rGjbONzichbO0)

Import the JSON file in Metamask.

![](/files/5rYGVlgMXKFbRuNW3Gd1)

## Create genesis.json

1. Create gensis.json file under `/path/to/dxc/build/bin/`
2. Change `chainId` to 72
3. Replace the initial address in `extraData` with your new account address

```
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a88548e97af8809afac9dc7a930650c1179510590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
===>>>
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000'your new account'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
```

&#x20; 4\. Set the initial balance in `alloc` for the new address, at least `0x50c783eb9b5c85f2a80000000`

```json
{
    "config": {
        "chainId": 72,
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "eip155Block": 0,
        "eip158Block": 0,
        "byzantiumBlock": 0,
        "constantinopleBlock": 0,
        "petersburgBlock": 0,
        "istanbulBlock": 0,
        "muirGlacierBlock": 0,
        "dpos": {
            "period": 3,
            "epoch": 28800
        }
    },
    "nonce": "0x0",
    "timestamp": "0x5fc58968",
    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a88548e97af8809afac9dc7a930650c1179510590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x280de80",
    "difficulty": "0x1",
    "alloc": {
        "0xa88548e97af8809afac9dc7a930650c117951059": {
            "balance": "0x50c783eb9b5c85f2a80000000"
        }
    },
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
```

## Initialize the Genesis Block

```bash
$ ./geth init /path/to/genesis.json --datadir ./data
```

## Start the Node

{% content-ref url="/pages/qff9iXV6YrAy9I1RtBmU" %}
[Compile and Run](/dxchain-wiki/stake-and-trade/develop-on-dxchain/compile-and-run.md)
{% endcontent-ref %}

## Start Mining

* Open the console `./geth attach --datadir ./data`
* Unlock miner account `personal.unlockAccount("miner address","password",0)`
* Start mining `miner.start()`

## Multi-nodes Mining

1. Other nodes use the same `genesis.json` initial nodes
2. Get the enode information for the master node`admin.nodeInfo`
3. New node `geth attach`&#x20;
4. Open the console, add the node information for master node `admin.addPeer("enode info")`
