Running Locally

Guide for running NCN Network services on your local machine for development.


Quick Start

# Terminal 1: Start P2P Registry
cargo run --bin p2p_registry_node

# Terminal 2: Start Gateway
cargo run --bin gateway_node

# Terminal 3: Start Compute Node
cargo run --bin compute_node -- --gateway-addr http://127.0.0.1:50051

# Terminal 4: Run Test Client
cargo run --bin test_client

Prerequisites


Step 1: Start P2P Registry

The P2P Registry must start first as other services depend on it.

Expected Output

Verify Registry


Step 2: Start Gateway Node

Open a new terminal:

Environment Variables

Create or edit gateway_node/.env:

Expected Output

Verify Gateway


Step 3: Start Compute Node

Open a new terminal:

Configuration Options

Environment Variables

Expected Output

Verify Compute Node

The Gateway logs should show:


Step 4: Run Test Client

Open a new terminal:

Expected Output


Local Development Workflow

Full Stack Command Reference

Using cargo-watch (Auto-Restart)


Local Blockchain (Optional)

For testing with payments:

Start Anvil

Deploy Contracts

Configure Gateway for Payments


Port Reference

Service
Port
Protocol

P2P Registry gRPC

50050

gRPC

P2P Registry P2P

8828

libp2p

Gateway gRPC

50051

gRPC

Gateway HTTP

8080

HTTP

Gateway WebSocket

9000

WebSocket

Anvil (optional)

8545

JSON-RPC


Debugging Tips

Enable Debug Logging

Check Service Connectivity

View Active Connections


Common Issues

"Connection refused" to Registry

"No compute nodes available"

  • Ensure Compute Node is running

  • Check Gateway logs for registration

  • Verify model paths exist

"Sandbox failed" on Compute

Changes not taking effect


Next Steps

Last updated