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:
- Rust 1.94+ (edition 2024)
- A C compiler (for ed25519-dalek, blake3)
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:
~/.dregg/node.key-- 32-byte secret key (protect this file)
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
| Flag | Default | Description |
|---|---|---|
--port | 8420 | HTTP API listen port |
--data-dir | ~/.dregg | Persistent state directory |
--federation-peers | (none) | Comma-separated peer addresses (host:port) |
--node-index | 0 | This node's index in federation (0-based) |
--enable-pruning | false | Prune old Blocklace blocks below latest checkpoint |
--checkpoint-interval | 100 | Committed blocks between ledger checkpoints |
--enable-faucet | false | Enable 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:
devnet-config/genesis.json-- Genesis state with initial cells and faucetdevnet-config/node-0/throughnode-3/-- Per-node key materialdevnet-config/docker-compose.yml-- Ready-to-run multi-node cluster
# 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
- Joining a Federation -- Configure peer discovery and sync
- Bridge Nodes -- Connect multiple federations
- Monitoring -- Tracing, logs, and observability
- Security Hardening -- Production deployment best practices