> For the complete documentation index, see [llms.txt](https://docs.validator247.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.validator247.com/mainnet/nockchain.md).

# Nockchain

> <https://www.nockchain.org/>

## Nockchain Mainnet (Dumbnet) Installation & Run Guide

#### 1. Install dependencies

```bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential clang llvm-dev libclang-dev make pkg-config git
```

Install Rust:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
```

***

#### 2. Clone the code & prepare the environment

```bash
git clone https://github.com/zorp-corp/nockchain.git
cd nockchain
cp .env_example .env
```

***

#### 3. Build components

```bash
make install-hoonc
make install-nockchain-wallet
make install-nockchain
```

Make sure `$HOME/.cargo/bin` is in your PATH:

```bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

***

#### 4. Create a wallet for mining

Generate a new key:

```bash
nockchain-wallet keygen
```

📌 Save the following:

* **Public Key** (to be added to `.env`)
* **Private Key + Seed Phrase** (for backup)

Edit `.env` and set:

```env
MINING_PUBKEY=<your-generated-public-key>
```

***

#### 5. Backup/restore keys (recommended)

Export keys:

```bash
nockchain-wallet export-keys
```

Restore keys when needed:

```bash
nockchain-wallet import-keys --input keys.export
```

***

#### 6. Run mainnet node

Node only (no mining, sync only):

```bash
bash ./scripts/run_nockchain_node.sh
```

Node + Miner (mine NOCK tokens):

```bash
bash ./scripts/run_nockchain_miner.sh
```

👉 When running miner for the first time, clear old data if you previously joined testnet:

```bash
rm -rf ~/.nockchain
```

***

#### 7. Verify it’s working

* Miner logs showing:

  ```
  [%mining-on …]
  ```

  → means mining is active.
* Block logs showing:

  ```
  block … added to validated blocks at <height>
  ```

  → means your node is synced with mainnet.

***

#### 8. Notes for mainnet

* Recommended server: **8 cores CPU, 16GB+ RAM, NVMe SSD**.
* Open **P2P port 40333 (default)** to allow other nodes to connect.
* If you see `Address already in use` → change port in `.env`.
* Use **screen** or **tmux** to keep the process running after logout.
