RPC

RPC (HTTP) — Wallet / dApp Connectivity

trac-peer can expose an HTTP JSON API intended for wallet and dApp connectivity.

Operator actions (admin changes, writer/indexer changes, deploy subnet) are CLI-only.

For a strict endpoint-by-endpoint reference, see PEER_RPC.md.

Start a peer with RPC enabled

npm run peer:run -- \
  --msb-bootstrap=<hex32> \
  --msb-channel=<string> \
  --rpc \
  --rpc-host=127.0.0.1 \
  --rpc-port=5001

To allow clients to submit transactions over RPC:

--api-tx-exposed

Core endpoints

  • GET /v1/health

  • GET /v1/status

  • GET /v1/contract/schema

  • GET /v1/contract/nonce

  • GET /v1/contract/tx/context

  • POST /v1/contract/tx

  • GET /v1/state?key=<key>&confirmed=true|false

Transaction signing model (high level)

trac-peer does not receive private keys.

Instead, a client:

  1. fetches tx context (/v1/contract/tx/context)

  2. chooses prepared_command ({ type, value })

  3. chooses a nonce (/v1/contract/nonce)

  4. computes the tx hash locally

  5. asks a wallet to sign the tx hash

  6. submits { tx, prepared_command, address(pubKeyHex), signature, nonce } to /v1/contract/tx

Minimal curl examples

Health:

Contract schema:

Nonce:

Tx context:

Read state (unconfirmed):

Last updated