Running peer

Running trac-peer Nodes

This page documents the node runners, CLI flags/env, and how “bootstrapping vs joining” works.

Two layers run together

trac-peer currently runs on top of an in-process MSB client node (from trac-msb).

That MSB client node is required to:

  • broadcast subnet deployments + contract tx payloads to MSB, and

  • observe MSB “confirmed” state to decide which MSB txs can be executed locally in the subnet.

You still run your own MSB network separately; trac-peer just joins it via this embedded client node.

Runners

npm run peer:run -- --msb-bootstrap=<hex32> --msb-channel=<string>

Pear runner

npm run peer:pear -- --msb-bootstrap=<hex32> --msb-channel=<string>

Pear is useful when you want parity with Pear-based MSB runs. If Pear warns about PATH, follow its message once so pear resolves directly.

Required MSB params

You must provide:

  • --msb-bootstrap=<hex32> (64 hex chars)

  • --msb-channel=<string>

Or env vars:

  • MSB_BOOTSTRAP

  • MSB_CHANNEL

Stores (running multiple nodes on one machine)

Each node has:

  • a peer store (subnet state/logs)

  • an msb store (embedded MSB client state/logs)

Use distinct names when running multiple nodes locally:

Defaults:

  • --peer-stores-directory defaults to stores/

  • --msb-stores-directory defaults to stores/

  • --msb-store-name defaults to <peer-store-name>-msb

Keypairs are stored at:

  • stores/<msb-store>/db/keypair.json

  • stores/<peer-store>/db/keypair.json

Subnet identity: channel + bootstrap

All nodes in the same subnet must share:

  • --subnet-channel=<string>

  • --subnet-bootstrap=<hex32>

Creating a new subnet (bootstrap node)

If you omit --subnet-bootstrap, trac-peer will generate one and persist it to:

  • stores/<peer-store-name>/subnet-bootstrap.hex

That file is the join-code for other peers.

Joining an existing subnet (joiners)

Pass the bootstrap hex and the same channel:

RPC mode vs interactive CLI

scripts/run-peer.mjs disables the interactive terminal when RPC is enabled.

Enable RPC:

If you also want dApps/wallets to submit txs over HTTP, add:

If you start without --rpc, --api-tx-exposed is ignored (operator safety).

Env equivalents:

  • PEER_RPC=1

  • PEER_RPC_HOST=127.0.0.1

  • PEER_RPC_PORT=5001

  • PEER_API_TX_EXPOSED=1

Flag format (important for shells)

Both are accepted:

  • --subnet-bootstrap=<hex32>

  • --subnet-bootstrap <hex32>

When using npm run ..., remember the double-dash:

Without the second --, npm will swallow flags.

Last updated