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

# Command-line RPC

The `parallax-cli` binary is Parallax's JSON-RPC client for talking to a running node, in the same spirit as Bitcoin Core's `bitcoin-cli`. Rather than curling the RPC endpoint directly or entering the [JavaScript console](./js-console) for a quick status check, you invoke short subcommands:

```sh theme={null}
parallax-cli info         # → JSON node overview
parallax-cli blockcount   # → 12345
parallax-cli stop         # → graceful shutdown
```

Each subcommand opens an RPC connection, issues a single request, prints the result, and exits.

## Endpoint resolution

By default every command connects to `<datadir>/parallax.ipc`, picking the data directory from `--datadir` (honoring `--testnet` as `<datadir>/testnet/parallax.ipc`). You can override the endpoint with `--rpc`, which accepts a filesystem path (IPC) or a `http://`, `https://`, or `ws://` URL:

```sh theme={null}
parallax-cli --datadir ~/.parallax info
parallax-cli --rpc http://127.0.0.1:8545 info
parallax-cli --rpc /tmp/parallax.ipc info
```

If the node cannot be reached the command exits non-zero with a short hint.

## Output conventions

The command output mirrors `bitcoin-cli`:

* **Object or array responses** are pretty-printed JSON (2-space indent), safe to pipe into `jq`.
* **Scalar responses** (numbers, hashes, decimal amounts) are printed as a bare value plus a newline, so `$(parallax-cli blockcount)` works in shell scripts.
* **Mutating commands** (`stop`, `addpeer`, `removepeer`) print nothing on success and return exit code 0. Errors are written to stderr and produce exit code 1.

## Command reference

All commands below accept `--datadir`, `--testnet`, and `--rpc`.

### `start [config]`

Convenience wrapper for `parallaxd --daemon`. Starts the node in the background, detached from the controlling terminal, with logs redirected to `<datadir>/parallax.log`. An optional positional argument points at a TOML configuration file to pass through as `--config`.

Every global flag placed before `start` on the command line is preserved, so:

```sh theme={null}
parallax-cli --datadir /var/lib/parallax start /etc/parallax.toml
```

is exactly equivalent to:

```sh theme={null}
parallaxd --datadir /var/lib/parallax --daemon --config /etc/parallax.toml
```

See [Daemon mode](../fundamentals/daemon-mode) for the detachment mechanics, log rotation, and PID-file conventions.

### `stop`

Gracefully shuts down the running daemon. Equivalent to `bitcoin-cli stop`. Prints `Parallax server stopping` on success. Uses the [`admin_stop`](./json-rpc-namespaces/admin#admin_stop) RPC.

```sh theme={null}
parallax-cli --datadir ~/.parallax stop
```

### `info`

Combined overview of chain, network, and mempool state. Merges the fields you would get from `getblockchaininfo`, `getnetworkinfo`, and `getmempoolinfo` in Bitcoin Core into a single JSON object.

```sh theme={null}
$ parallax-cli info
{
  "blocks": 1234567,
  "chainid": 2110,
  "connections": 8,
  "enode": "enode://...",
  "gasprice": "1000000000",
  "id": "3a...e4",
  "listenaddr": ":32110",
  "mempool": {
    "pending": 3,
    "queued": 1
  },
  "mining": false,
  "networkid": "2110",
  "protocolversion": 66,
  "syncing": false,
  "version": "Parallax/v2.0.0-.../linux-amd64/go1.22.0"
}
```

### `chaininfo`

Chain state only (no network or mempool). Equivalent to `bitcoin-cli getblockchaininfo`.

```sh theme={null}
$ parallax-cli chaininfo
{
  "bestblockhash": "0x2e9f...0150",
  "blocks": 1234567,
  "chainid": 2110,
  "difficulty": "0x1",
  "gaslimit": 11500000,
  "gasused": 0,
  "networkid": "2110",
  "syncing": false,
  "timestamp": 1700000000,
  "totaldifficulty": "0x1"
}
```

### `netinfo`

Network state only. Equivalent to `bitcoin-cli getnetworkinfo`. Uses `admin_nodeInfo` + `net_peerCount` + `net_listening`.

```sh theme={null}
$ parallax-cli netinfo
{
  "connections": 8,
  "enode": "enode://...",
  "id": "3ab8...cecf",
  "ip": "127.0.0.1",
  "listenaddr": ":32110",
  "listening": true,
  "ports": { "discovery": 32110, "listener": 32110 },
  "protocolversion": 66,
  "version": "Parallax/v2.0.0/.../go1.22.0"
}
```

### `uptime`

Seconds since the running node started. Equivalent to `bitcoin-cli uptime`. Backed by a new `admin_uptime` RPC.

```sh theme={null}
$ parallax-cli uptime
86400
```

### `blockcount`

Prints the latest block number as a bare integer. Equivalent to `bitcoin-cli getblockcount`. Uses `eth_blockNumber`.

```sh theme={null}
$ parallax-cli blockcount
1234567
```

### `syncing`

Prints `false` if the node is caught up, otherwise a JSON object with sync progress. Uses `eth_syncing`.

```sh theme={null}
$ parallax-cli syncing
false
```

### `mempool`

Summary of the node's transaction pool. Uses `txpool_status`.

```sh theme={null}
$ parallax-cli mempool
{
  "pending": 42,
  "queued": 5
}
```

### `mempool-content`

Dump the full transaction pool as JSON, or narrow it with `--address <sender>` (useful when you're debugging a specific account). Pass `--inspect` for one-line summaries instead of full transaction objects — handy when the pool is large.

Uses `txpool_content`, `txpool_contentFrom`, or `txpool_inspect` depending on the flags.

```sh theme={null}
parallax-cli mempool-content
parallax-cli mempool-content --address 0xabc...123
parallax-cli mempool-content --inspect
```

Output shape (both variants):

```json theme={null}
{
  "pending": { "0xabc…": { "42": { "from": "…", "to": "…", ... } } },
  "queued":  {}
}
```

### `estimategas`

Estimates the gas required to execute a transaction. Prints a bare integer, matching the scalar-output convention used by `gasprice`. Errors from the RPC (e.g. insufficient funds, revert) are surfaced to stderr with exit 1.

```sh theme={null}
# Simple transfer (always 21000 on basic accounts)
parallax-cli estimategas 0x1111...2222

# With value and calldata
parallax-cli estimategas 0xcontract... --from 0xsender... --value 1000000000000000000 --data 0xa9059cbb...
```

`--value` accepts decimal wei or 0x-prefixed hex. Uses `eth_estimateGas`.

### `peers`

JSON array of connected peers. Equivalent to `bitcoin-cli getpeerinfo`. Uses `admin_peers`.

```sh theme={null}
$ parallax-cli peers
[
  {
    "enode": "enode://...",
    "id": "...",
    "name": "Parallax/v2.0.0/...",
    "caps": ["eth/66", "snap/1"],
    "network": {
      "localAddress": "10.0.0.2:32110",
      "remoteAddress": "203.0.113.1:32110",
      "inbound": false,
      "trusted": false,
      "static": false
    },
    "protocols": { "eth": { "version": 66, "difficulty": 123, "head": "0x..." } }
  }
]
```

### `balance <address>`

Prints the balance of an account. Equivalent to `bitcoin-cli getbalance` (applied to a specific address, since the daemon has no wallet of its own). By default prints a decimal LAX value; pass `--wei` for the exact integer. Supports `--block` for historical queries.

```sh theme={null}
$ parallax-cli balance 0xabc...123
1.234567890123456789

$ parallax-cli balance 0xabc...123 --wei
1234567890123456789

$ parallax-cli balance 0xabc...123 --block 1000000
0.5
```

Uses `eth_getBalance`.

### `nonce <address>`

Prints the transaction count (nonce) of an account as a bare integer. Essential when crafting raw transactions. Supports `--block` for historical queries. Uses `eth_getTransactionCount`.

```sh theme={null}
$ parallax-cli nonce 0xabc...123
42

$ parallax-cli nonce 0xabc...123 --block 1000000
37
```

### `code <address>`

Prints the deployed bytecode at an address as a 0x-prefixed hex string, or `0x` if the address is an externally owned account. Uses `eth_getCode`.

```sh theme={null}
$ parallax-cli code 0xcontract...
0x608060405234801561001057600080fd5b50...

$ parallax-cli code 0xeoa...
0x
```

Combine with `[ "$(parallax-cli code $addr)" = "0x" ]` to branch on contract vs EOA in shell scripts.

### `storage <address> <slot>`

Reads a 32-byte storage slot from a contract and prints it as a 0x-prefixed hex string. `<slot>` accepts a decimal index or a 0x-prefixed hex key. Uses `eth_getStorageAt`.

```sh theme={null}
$ parallax-cli storage 0xcontract... 0
0x000000000000000000000000000000000000000000000000000000000000002a

$ parallax-cli storage 0xcontract... 0x1
0x0000000000000000000000000000000000000000000000000000000000000000
```

Supports `--block` for historical reads.

### `gettx <txhash>`

Fetches a transaction by hash and prints it as JSON. Equivalent to `bitcoin-cli getrawtransaction <txid> 1`. Uses `eth_getTransactionByHash`.

```sh theme={null}
parallax-cli gettx 0xabc...
```

Exits non-zero with `transaction ... not found` if the node does not know the hash.

### `getreceipt <txhash>`

Fetches the receipt of a mined transaction as JSON. Uses `eth_getTransactionReceipt`. Exits non-zero if the transaction is not mined yet or unknown.

```sh theme={null}
parallax-cli getreceipt 0xabc...
```

### `getblock <number|hash> [--full]`

Fetches a block as JSON. Accepts a decimal block number, a hex block hash, or one of the tags `latest`, `earliest`, `pending`, `safe`, `finalized`. Pass `--full` to include full transaction objects instead of only hashes.

```sh theme={null}
parallax-cli getblock 1234567
parallax-cli getblock latest --full
parallax-cli getblock 0xabc...def
```

Uses `eth_getBlockByNumber` or `eth_getBlockByHash` depending on the argument shape.

### `getblockhash <number>`

Prints the canonical hash of the block at a given height. Equivalent to `bitcoin-cli getblockhash`. Refuses hash input (use `getheader` for the hash → header direction).

```sh theme={null}
$ parallax-cli getblockhash 0
0xb3a45e5033f0a0a4ccfa8a82cbe2fbf93bbc26c50fc3340fa749e5a5678d4391
```

Backed by `eth_getBlockByNumber(n, false)` since there is no dedicated `eth_getBlockHash` RPC.

### `getheader <number|hash>`

Fetches a block header as JSON — same shape as `getblock` but without the `transactions` list, so it's smaller and faster when you only need metadata. Equivalent to `bitcoin-cli getblockheader`.

```sh theme={null}
parallax-cli getheader 1234567
parallax-cli getheader 0xabc...def
parallax-cli getheader latest
```

Uses `eth_getHeaderByNumber` or `eth_getHeaderByHash` depending on the argument shape.

### `tip`

Condensed JSON view of the chain tip: number, hash, parent, timestamp, miner, gas used and limit, transaction count, size, difficulty. Useful at the top of operational scripts or in health checks.

```sh theme={null}
$ parallax-cli tip
{
  "difficulty": "0x2",
  "gaslimit": 11556255,
  "gasused": 0,
  "hash": "0xc8a6...15a8",
  "miner": "0x0000000000000000000000000000000000000000",
  "number": 5,
  "parent": "0xa5a9...a284",
  "size": 578,
  "timestamp": 1776147050,
  "txs": 0
}
```

Derived from a single `eth_getBlockByNumber("latest", false)` call.

### `gasprice`

Prints the current suggested gas price as a bare wei integer. Uses `eth_gasPrice`.

```sh theme={null}
$ parallax-cli gasprice
1000000000
```

### `sendraw <hex>`

Submits a signed, hex-encoded transaction and prints the resulting hash on a single line. Equivalent to `bitcoin-cli sendrawtransaction`. The `0x` prefix is optional. Uses `eth_sendRawTransaction`.

```sh theme={null}
$ parallax-cli sendraw 0xf86c...
0xabc...def
```

### Peer identifiers

The four peer-admin commands (`addpeer`, `removepeer`, `addtrusted`, `removetrusted`) accept either form:

* **Full enode URL** — `enode://<64-hex-id>@host:port[?discport=…]`, or an `enr:<base64>` record. Always works.
* **`host:port`** — resolved against the running node's current peer list by matching IP and advertised listen port.
* **`host`** — as above, but without the port constraint; must uniquely identify a connected peer. If multiple peers share the same host, the error message lists them so you can disambiguate.

The host-based forms only work when the target peer is **currently connected** (so its cryptographic node ID is known to us). If the lookup fails the command exits non-zero with a pointer to use the full enode form. The shortcut deliberately never dials an unknown address to discover its node ID, because adopting an arbitrary pubkey picked up that way would let any process at that address get itself trusted.

### `addpeer <enode|host[:port]>`

Adds a static peer. Equivalent to `bitcoin-cli addnode <node> add`. Silent on success, non-zero exit on failure. Uses `admin_addPeer`.

```sh theme={null}
parallax-cli addpeer enode://a979...@1.2.3.4:32110
parallax-cli addpeer 1.2.3.4:32110   # resolves via connected peers
```

### `removepeer <enode|host[:port]>`

Removes a static peer. Silent on success. Uses `admin_removePeer`.

```sh theme={null}
parallax-cli removepeer enode://a979...@1.2.3.4:32110
parallax-cli removepeer 1.2.3.4:32110
```

### `addtrusted <enode|host[:port]>`

Marks a peer as trusted, so it is always allowed to connect even when the node has hit its `--maxpeers` limit. Silent on success. Uses `admin_addTrustedPeer`.

```sh theme={null}
parallax-cli addtrusted enode://a979...@1.2.3.4:32110
parallax-cli addtrusted 1.2.3.4:32110
```

### `removetrusted <enode|host[:port]>`

Removes a peer from the trusted list. The peer is not disconnected automatically — run `removepeer` afterwards if you also want to drop the connection. Uses `admin_removeTrustedPeer`.

```sh theme={null}
parallax-cli removetrusted enode://a979...@1.2.3.4:32110
parallax-cli removetrusted 1.2.3.4:32110
```

### `mining`

Shows the miner's current state as JSON: whether mining is enabled, current hashrate, configured coinbase, and a snippet of chain-tip context. Equivalent to `bitcoin-cli getmininginfo`.

```sh theme={null}
$ parallax-cli mining
{
  "bestblockhash": "0xc73d...5f8f",
  "bestblocktime": 1700000000,
  "blocks": 1234567,
  "coinbase": "0x9af3f6517b7a2152ccaf0126d39b6464f73e8918",
  "hashrate": "0",
  "mining": true
}
```

`coinbase` is `null` when no coinbase is configured (e.g. fresh dev node without `--miner.coinbase`). Hashrate is printed as a bare decimal string so it composes cleanly with other scalar-output commands.

### `startmining [threads]`

Starts the built-in miner, optionally pinned to the given number of CPU threads. Silent on success. Uses `miner_start`.

```sh theme={null}
parallax-cli startmining          # one worker per logical CPU
parallax-cli startmining 2        # two workers
```

### `stopmining`

Stops the miner. Silent on success. Uses `miner_stop`.

```sh theme={null}
parallax-cli stopmining
```

### `setcoinbase <address>`

Updates the coinbase — the address credited with block rewards — without restarting the node. Silent on success. Uses `miner_setCoinbase`.

```sh theme={null}
parallax-cli setcoinbase 0xabc...123
```

### `setextra <data>`

Updates the extra-data bytes embedded in blocks this node mines. Accepts a plain string or a 0x-prefixed hex blob (auto-detected). Must fit the 32-byte extradata limit; longer values are rejected by the miner with a clear error. Uses `miner_setExtra`.

```sh theme={null}
parallax-cli setextra "my-pool-v1"
parallax-cli setextra 0xdeadbeef
```

### `loglevel <level|pattern>`

Adjusts log verbosity at runtime, without restarting the node. Equivalent to `bitcoin-cli logging`.

* Integer `0..5` (silent, error, warn, info, debug, detail) → `debug_verbosity`.
* Anything else is treated as a vmodule pattern like `eth/*=5,p2p=4` → `debug_vmodule`.

```sh theme={null}
parallax-cli loglevel 4                   # bump everything to debug
parallax-cli loglevel 3                   # back to info
parallax-cli loglevel "eth/*=5,p2p=4"     # per-package overrides
```

Silent on success; bad patterns exit non-zero with the server's validation message.

### `trace <txhash>`

Traces the execution of a mined transaction. Equivalent to geth's `debug.traceTransaction` from the JS console. Two modes:

* Without `--tracer`: returns the full opcode-by-opcode execution log. Output can be very large; consider redirecting to a file.
* With `--tracer <name>`: runs a named tracer and returns its condensed output. Common values: `callTracer` (call tree), `prestateTracer` (pre-execution state), `4byteTracer` (function-selector histogram).

```sh theme={null}
parallax-cli trace 0xabc...
parallax-cli trace 0xabc... --tracer callTracer
parallax-cli trace 0xabc... --tracer callTracer --timeout 2m
```

`--timeout` accepts any Go duration (`30s`, `2m`, `10m`). Default is 5 minutes because non-tracer runs can take a while on large transactions. Uses `debug_traceTransaction`.

### `dbstats`

Summary of on-disk database state: per-category ancient-freezer sizes in bytes plus the raw LevelDB compaction stats. Uses a new `debug_dbStats` RPC.

```sh theme={null}
$ parallax-cli dbstats
{
  "ancients": {
    "bodies": 123456789,
    "diffs": 12345,
    "hashes": 23456,
    "headers": 3456789,
    "receipts": 234567890
  },
  "leveldb": "Compactions\n Level |   Tables   |    Size(MB)   ..."
}
```

Intended for quick "am I running out of disk?" checks. For a full per-prefix chaindata walk, use `parallaxd db inspect` (offline, reads the database directly).

## Wallet / accounts

All commands below hit the running node's `personal_*` namespace. By default `personal_*` is refused over HTTP-RPC (it can expose key material); the sugar commands reach it via the IPC socket, which is the intended transport. If you must expose it over HTTP, enable it explicitly with `--http.api personal` and combine with `--allow-insecure-unlock`.

**Never pass a passphrase as a CLI argument** — it would land in process listings and shell history. Pass it through `--password <file>` (first non-empty line) or let the command prompt on stdin.

### `listaccounts`

JSON array of addresses the running node can see. Equivalent to the offline `parallax-wallet list`, but works without stopping the daemon. Uses `personal_listAccounts`.

```sh theme={null}
$ parallax-cli listaccounts
[
  "0xa202...5108",
  "0x96a5...6b4d"
]
```

### `newaccount`

Creates a new keystore entry on the running node. Prompts for a passphrase with confirmation, or reads it from `--password <file>`. Prints the bare address. Uses `personal_newAccount`.

```sh theme={null}
parallax-cli newaccount
parallax-cli newaccount --password /etc/parallax/newkey.pass
```

### `unlock <address>`

Unlocks an account so the node can sign transactions on its behalf. Equivalent to `bitcoin-cli walletpassphrase`. Silent on success. Uses `personal_unlockAccount`.

```sh theme={null}
parallax-cli unlock 0xabc...123
parallax-cli unlock 0xabc...123 --password /run/secrets/acct.pass --duration 1h
parallax-cli unlock 0xabc...123 --duration 0     # keep unlocked until the node stops
```

Default duration is 5 minutes (matching geth's built-in default). `--duration 0` passes a null duration to the RPC, which geth interprets as "until node stops".

### `lock <address>`

Clears the in-memory decrypted key for an account. Silent on success. Uses `personal_lockAccount`.

```sh theme={null}
parallax-cli lock 0xabc...123
```

### `sign <address> <data>`

Signs `<data>` with the account's key (prefixed with the standard Ethereum signed-message preamble). Prints the 65-byte signature as a 0x-prefixed hex string.

`<data>` accepts a plain UTF-8 string or a 0x-prefixed hex blob (auto-detected). Prompts for the passphrase unless `--password` is set.

```sh theme={null}
parallax-cli sign 0xabc...123 "approve this request"
parallax-cli sign 0xabc...123 0xdeadbeef --password /run/secrets/acct.pass
```

Uses `personal_sign`.

### `sendtx --from <addr> ...`

Builds a transaction from flags and submits it via `personal_sendTransaction` (signs client-side at the node using the sender's unlocked key). Prints the transaction hash on success.

Required: `--from`.
Optional: `--to` (omit for contract deploy), `--value` (wei, decimal or 0x-hex), `--data` (hex), `--gas`, `--gasprice`, `--nonce` (all decimal or 0x-hex).

```sh theme={null}
parallax-cli sendtx --from 0xabc... --to 0xdef... --value 1000000000000000000 --password /run/secrets/from.pass

parallax-cli sendtx --from 0xabc... --data 0x608060...   # contract deploy
```

Prompts for the passphrase unless `--password` is set.

## Offline utilities

Two commands run entirely client-side and do not require a running daemon — useful for air-gapped key handling and tx inspection.

### `decoderaw <hex>`

Decodes a 0x-prefixed RLP-encoded signed transaction and prints its fields as JSON, including the recovered sender. Equivalent to `bitcoin-cli decoderawtransaction`. Works for legacy, EIP-2930, and EIP-1559 transactions; dynamic-fee fields (`maxfeepergas`, `maxpriorityfeepergas`) only appear on EIP-1559 txs so legacy output stays clean.

```sh theme={null}
$ parallax-cli decoderaw 0xf86580843b9aca00825208941111111111111111111111111111111111111111010180820a96a0...
{
  "chainid": "1337",
  "data": "0x",
  "from": "0x43Ec477b3dd00BF4434Fc457425b0425AB39F00f",
  "gas": 21000,
  "gasprice": "1000000000",
  "hash": "0xabc...",
  "nonce": 0,
  "r": "...",
  "s": "...",
  "to": "0x1111111111111111111111111111111111111111",
  "type": 0,
  "v": "2710",
  "value": "1"
}
```

No RPC call is made. Parsing and sender recovery happen in the binary itself.

### `toaddr <privkey-hex>`

Derives and prints the 0x-address for a hex-encoded secp256k1 private key. Runs entirely client-side — the key is never sent to any node or written to disk. Useful when verifying a backup or wiring up a key before funding it.

```sh theme={null}
$ parallax-cli toaddr 0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318
0x2c7536E3605D9C16a7a3D7b1898e529396a65c23

$ parallax-cli toaddr 4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318   # 0x prefix optional
0x2c7536E3605D9C16a7a3D7b1898e529396a65c23
```

## When to use the JS console instead

For one-off scripted calls and shell pipelines these subcommands are the quickest path. For interactive exploration of the full RPC surface, or any call that doesn't have a sugar wrapper, prefer the [JavaScript console](./js-console) via `parallaxd attach`.
