Node Setup

This guide covers building, initializing, and running a dregg-node from source. A dregg-node is the backend daemon that hosts an AgentCipherclerk, participates in federation consensus, and serves the HTTP API.

Building from Source

Requirements:

git clone https://github.com/emberian/dregg
cd dregg
cargo build -p dregg-node --release

The binary is at target/release/dregg-node.

Initializing the Data Directory

dregg-node init --data-dir ~/.dregg

This creates the data directory and generates an Ed25519 node keypair:

The command prints your node's public key. Share this with federation operators who need to add you as a peer.

The node.key file is your node's identity. In production, use an OS keychain or HSM rather than a plaintext file. Set restrictive permissions: chmod 600 ~/.dregg/node.key.

Running the Node

dregg-node run \
  --port 8420 \
  --data-dir ~/.dregg \
  --federation-peers "peer1.example.com:8420,peer2.example.com:8420"

CLI Reference

FlagDefaultDescription
--port8420HTTP API listen port
--data-dir~/.dreggPersistent state directory
--federation-peers(none)Comma-separated peer addresses (host:port)
--node-index0This node's index in federation (0-based)
--enable-pruningfalsePrune old Blocklace blocks below latest checkpoint
--checkpoint-interval100Committed blocks between ledger checkpoints
--enable-faucetfalseEnable POST /api/faucet (devnet only)

Devnet Deployment

For local testing, generate a complete devnet configuration (validator keys, genesis state, environment files):

# Generate 4-node devnet config
dregg-node genesis \
  --validators 4 \
  --epoch-length 1000 \
  --checkpoint-interval 100 \
  --output ./devnet-config

This produces:

# Launch the devnet cluster
cd devnet-config
docker-compose up

Checking Node Status

# Check if the node is running
dregg-node status --port 8420

# Or hit the API directly
curl http://127.0.0.1:8420/status

MCP Server Mode

The node can also run as an MCP (Model Context Protocol) server for AI agents. This reads JSON-RPC from stdin and writes responses to stdout:

dregg-node mcp --data-dir ~/.dregg --federation-peers "peer1:8420"

AI assistants (Claude, GPT, etc.) can then use dregg tools: authorize, submit turns, manage capabilities, and post intents.

Next Steps