> ## 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.

# JSON-RPC overview

> Endpoint, namespaces, encoding rules and error shapes for the Kronex RPC surface.

Kronex speaks standard Ethereum JSON-RPC. Everything the chain adds on top —
mining work, merge-mining data, rewards and supply — lives in the `krnx_`
namespace documented here.

```bash theme={null}
http://127.0.0.1:8545
```

## Namespaces

| Namespace                          | Contents                                                                     |
| ---------------------------------- | ---------------------------------------------------------------------------- |
| `eth_`, `net_`, `web3_`, `txpool_` | Standard go-ethereum surface: accounts, blocks, transactions, contract calls |
| `krnx_`                            | Mining work, merge-mining data, rewards, lockups, supply                     |
| `kheavyhash_`                      | The mining methods again, under the engine's own name                        |

The mining methods are registered three times — as `eth_getWork`,
`kheavyhash_getWork` and `krnx_getWork` — so pool software written against
stock go-ethereum needs no renaming.

<Note>
  A node also carries operator-only namespaces for running merge-mining
  infrastructure. They are not part of the public interface, they are not
  documented here, and they should never be reachable from outside the host that
  runs the node.
</Note>

The `krnx` namespace is not enabled by default. Start the node with it in
`--http.api`:

```bash theme={null}
krnxd --datadir ./data --http --http.addr 127.0.0.1 --http.port 8545 --http.api eth,net,web3,krnx
```

Then confirm it is live:

```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":"rpc_modules","params":[]}' | jq
```

The response must contain `"krnx": "1.0"`.

## Encoding

Kronex follows the Ethereum conventions, with one addition worth calling out.

* **Quantities** are `0x`-prefixed hex, no leading zeros: `0x41`, not `0x041`.
* **Byte strings** are `0x`-prefixed hex with an even number of digits.
* **Block parameters** accept a hex height, a 32-byte block hash, or one of
  `latest`, `pending`, `earliest`, `finalized`, `safe`.
* **Share difficulty** is the exception: it is a fixed-12 **decimal** string, not
  a hex quantity, because it is a real number rather than an integer.

State-backed methods — supply, locked balance, reward schedule — need the state
at the requested block. On a pruned node they answer only for recent blocks.

## Errors

Failures come back as a normal JSON-RPC error object:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "invalid argument 0: hex string has no 0x prefix"
  }
}
```

Some methods use a string sentinel in `message` instead of a numeric code — for
example the workshare explorer returns `KRNX_EXPLORER_RPC_DISABLED` when that
API is switched off on the node. Match on those sentinels, not on prose.

<Note>
  These pages are generated from the node source. Request and response schemas
  are expanded from the Go types the node actually serves, so if a field is
  documented here, the node returns it.
</Note>
