> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kronex.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a node

> Build krnxd, initialize from a genesis file, and join the testnet.

## Prerequisites

* Go 1.21 or newer
* Git, make, a C toolchain
* Roughly 20 GB of free disk for a testnet full node

## Build

```bash theme={null}
git clone https://github.com/rewrewby/kroxy-blockchain.git
cd kroxy-blockchain
make krnxd
```

The binary lands in `build/bin/krnxd`.

## Initialize

A Kronex node is initialized from a genesis file, not from a network ID. The
repository ships the testnet genesis and a matching node config:

```bash theme={null}
krnxd --datadir ./data-krnx-test init configs/krnx-testnet/genesis.json
```

<Warning>
  `--networkid` overrides only the p2p network identifier. It does not select a
  genesis. Two nodes with the same `--networkid` and different genesis files
  will find each other and then refuse to sync.
</Warning>

## Run

```bash theme={null}
krnxd --datadir ./data-krnx-test --config configs/krnx-testnet/node.toml console
```

To expose RPC, add the HTTP flags and include `krnx` in the API list:

```bash theme={null}
krnxd --datadir ./data-krnx-test \
  --config configs/krnx-testnet/node.toml \
  --http --http.addr 127.0.0.1 --http.port 8545 \
  --http.api eth,net,web3,krnx
```

Bind to `127.0.0.1` unless the node sits behind a proxy you control. The `krnx`
namespace contains submit methods, and `krnxadmin` should never be reachable
from outside the host.

## Verify

```bash theme={null}
curl -s -X POST http://127.0.0.1:8545 \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"krnx_getBuildInfo","params":[]}' | jq
```

Then check that merged mining is arriving:

```bash theme={null}
curl -s -X POST http://127.0.0.1:8545 \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"krnx_getAuxPowStatus","params":["latest"]}' | jq
```

A `null` result means the head block carries no AuxPoW extension yet.

## Private network

For an isolated network, write your own genesis and give every node the same
one:

```bash theme={null}
krnxd --datadir ./data-krnx-private init ./genesis.json
krnxd --datadir ./data-krnx-private \
  --networkid 42071 \
  --bootnodes "enode://...@10.10.0.11:30303" \
  --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,web3,krnx
```

Pick a network ID that is not `42068` or `42069` so a misconfigured node cannot
half-join a real network.
