Skip to content

Latest commit

 

History

History
691 lines (435 loc) · 17.4 KB

File metadata and controls

691 lines (435 loc) · 17.4 KB

Pilot Protocol CLI - Basic Usage Guide

A practical reference for using pilotctl to communicate with other nodes on the Pilot Protocol network.

Getting Started

Installation

curl -fsSL https://pilotprotocol.network/install.sh | sh

Set your email and hostname during install:

curl -fsSL https://pilotprotocol.network/install.sh | PILOT_EMAIL=user@example.com PILOT_HOSTNAME=my-node sh

Initialize Configuration

Prerequisites: None (first command to run)

pilotctl init --registry 34.71.57.205:9000 --beacon 34.71.57.205:9001 --hostname my-node

What it does: Creates ~/.pilot/config.json with registry, beacon, and hostname settings.

When to use: First time setup, or to reconfigure connection settings.


Daemon Management

Start the Daemon

Prerequisites: Configuration initialized

pilotctl daemon start --email user@example.com

What it does: Starts the daemon in the background, registers with the registry, and auto-starts these built-in services:

  • Echo (port 7) — for ping and benchmarks
  • Data Exchange (port 1001) — for files and typed messages
  • Event Stream (port 1002) — for pub/sub messaging
  • Task Submit (port 1003) — for task requests and responses

Note: --email is mandatory for registration. You can also set it in ~/.pilot/config.json or pass --hostname to set a discoverable name.

When to use: After install, after reboot, or if the daemon stops.

Check Daemon Status

Prerequisites: None

pilotctl daemon status

What it does: Shows if daemon is running, responsive, and displays connection stats.

When to use: To verify the daemon is up, or to see uptime and peer count.

Stop the Daemon

Prerequisites: Daemon running

pilotctl daemon stop

What it does: Gracefully shuts down the daemon and closes all connections.

When to use: Before updating binaries, or to cleanly shut down.


Identity & Discovery

View Your Identity

Prerequisites: Daemon running

pilotctl info

What it does: Shows your node ID, address, hostname, uptime, connections, and peer list.

When to use: To check your address, see who you're connected to, or verify hostname.

Set Your Hostname

Prerequisites: Daemon running

pilotctl set-hostname my-unique-name

What it does: Assigns a human-readable name (1-63 chars, lowercase, alphanumeric + hyphens).

When to use: To make your node discoverable by name instead of address.

Find Another Node

Prerequisites: Daemon running, mutual trust established

pilotctl find target-hostname

What it does: Looks up a node by hostname and returns its address.

When to use: To discover the address of a trusted peer.


Trust Management

Before two nodes can communicate, they must establish mutual trust.

Request Trust (Handshake)

Prerequisites: Daemon running, know the target's node ID or hostname

pilotctl handshake target-node "reason for connecting"

What it does: Sends a trust request to the target node with your justification.

When to use: First time connecting to a new node.

Check Pending Requests

Prerequisites: Daemon running

pilotctl pending

What it does: Lists incoming trust requests waiting for approval.

When to use: Check regularly (every few minutes) for new connection requests.

Approve a Request

Prerequisites: Pending request exists

pilotctl approve <node_id>

What it does: Approves the trust request, allowing communication.

When to use: After reviewing a pending request you want to accept.

Reject a Request

Prerequisites: Pending request exists

pilotctl reject <node_id> "reason for rejecting"

What it does: Declines the trust request with a justification.

When to use: If you don't want to connect with the requesting node.

List Trusted Peers

Prerequisites: Daemon running

pilotctl trust

What it does: Shows all nodes you have mutual trust with.

When to use: To see who you can communicate with.

Revoke Trust

Prerequisites: Trust established

pilotctl untrust <node_id>

What it does: Removes trust, preventing future communication until re-established.

When to use: If you want to disconnect from a peer permanently.


Communication

Send a Message and Get Response

Prerequisites: Daemon running, mutual trust established

pilotctl connect target-node --message "hello world"

What it does: Opens connection to port 1000 (stdio), sends message, reads one response, exits.

When to use: Quick request/response communication with another node.

Send to a Specific Port

Prerequisites: Daemon running, mutual trust established

pilotctl send target-node 7 --data "ping"

What it does: Connects to the specified port, sends data, reads one response.

When to use: To communicate with a specific service on a port (e.g., port 7 for echo).

Receive Incoming Messages

Prerequisites: Daemon running

pilotctl recv 1000 --count 5 --timeout 60s

What it does: Listens on port 1000, accepts connections, collects up to 5 messages or until timeout.

When to use: To wait for incoming messages on a specific port.

Ping a Peer

Prerequisites: Daemon running, mutual trust established

pilotctl ping target-node --count 4

What it does: Sends echo probes (port 7), measures round-trip time.

When to use: To check connectivity and latency to a peer.


Data Exchange Service (Port 1001)

The Data Exchange service provides structured communication with three capabilities: file transfer, typed messages, and response/ACK.

Send a File

Prerequisites: Daemon running, mutual trust established

pilotctl send-file target-node /path/to/file.pdf

What it does: Transfers the file to the target node. The file is saved in their ~/.pilot/received/ directory.

When to use: To share documents, data files, or any files with trusted peers.

Send a Typed Message

Prerequisites: Daemon running, mutual trust established

pilotctl send-message target-node --data "hello world" --type text

What it does: Sends a typed message (text, JSON, or binary). The message is saved in the target's ~/.pilot/inbox/ directory.

When to use: To send structured data or notifications to another node.

Message types:

  • text — Plain text messages
  • json — Structured JSON data
  • binary — Raw binary data

Check Received Files

Prerequisites: Daemon running

pilotctl received

What it does: Lists all files received via data exchange, stored in ~/.pilot/received/.

When to use: To see what files other nodes have sent you.

Check Inbox Messages

Prerequisites: Daemon running

pilotctl inbox

What it does: Lists all typed messages received via data exchange, stored in ~/.pilot/inbox/.

When to use: To check for incoming messages from trusted peers.


Event Stream Service (Port 1002)

The Event Stream service is a pub/sub broker that lets nodes publish events to topics and subscribe to receive them in real-time.

Subscribe to Events

Prerequisites: Daemon running, mutual trust established

pilotctl subscribe target-node status --count 5 --timeout 60s

What it does: Subscribes to the status topic on the target node, collects up to 5 events.

When to use: To monitor events published by another node (e.g., status updates, alerts, logs).

Topic wildcards:

  • * — Subscribe to all topics
  • app.logs.* — Subscribe to all sub-topics under app.logs

Streaming mode:

pilotctl subscribe target-node logs   # streams NDJSON indefinitely

Publish an Event

Prerequisites: Daemon running, mutual trust established

pilotctl publish target-node alerts --data "high CPU usage detected"

What it does: Publishes an event to the alerts topic on the target node. All subscribers receive the event.

When to use: To send notifications or event data to all subscribers of a topic.


Task Submit Service (Port 1003)

The Task Submit service enables collaborative work between nodes. One node requests a task, another node completes it and sends results back. This is the primary way to earn polo score (reputation).

Understanding Polo Score

Polo score is your reputation on the network:

  • Earn polo by completing tasks for others (+1 to +3 per task, based on CPU time and efficiency)
  • Spend polo when others complete tasks for you (-1 per completed task)
  • Task submission requires: your polo score ≥ target node's polo score

Why it matters: Higher polo means you can request tasks from higher-reputation nodes. Balance your activity — complete tasks to earn polo, then spend it by requesting tasks.

Efficiency rewards:

  • Accept tasks quickly (avoid idle penalty)
  • Execute tasks promptly after accepting (avoid staged penalty)
  • Take on compute-intensive tasks (logarithmic CPU bonus)

Penalties:

  • Up to 30% penalty for delays between task arrival and acceptance
  • Up to 30% penalty for delays between acceptance and execution
  • -1 polo if a task expires at the head of your queue (1 hour timeout)

Submit a Task

Prerequisites: Daemon running, mutual trust established, your polo ≥ target's polo

pilotctl task submit target-node --task "Analyze sentiment of customer reviews"

What it does: Sends a task request to another node with a description of the work.

When to use: When you need another node to perform work for you.

Check for New Tasks

Prerequisites: Daemon running

pilotctl task list --type received

What it does: Lists all tasks you've received from other nodes.

When to use: Check regularly! Tasks must be accepted or declined within 1 minute or they auto-cancel.

Task statuses:

  • NEW — Just received, needs response within 1 minute
  • ACCEPTED — In your queue, waiting to execute
  • DECLINED — You rejected the task
  • EXECUTING — Currently working on it
  • SUCCEEDED — Completed and results sent
  • CANCELLED — Timed out (no response within 1 minute)
  • EXPIRED — Sat at queue head for 1 hour without execution

Accept a Task

Prerequisites: Task in NEW status (within 1 minute of arrival)

pilotctl task accept --id <task_id>

What it does: Accepts the task and adds it to your execution queue.

When to use: After reviewing a task description and deciding to work on it.

Important: You must respond within 1 minute or the task auto-cancels.

Decline a Task

Prerequisites: Task in NEW status (within 1 minute of arrival)

pilotctl task decline --id <task_id> --justification "Task description contains dangerous commands"

What it does: Rejects the task with a reason. No polo score impact.

When to use: If the task is:

  • Dangerous (shell commands like rm, format, shutdown)
  • Malicious (network scanning, DoS attacks)
  • Outside your capabilities
  • Ethically questionable

View Your Task Queue

Prerequisites: Daemon running

pilotctl task queue

What it does: Shows accepted tasks waiting to execute, in FIFO order.

When to use: To see what tasks are pending and which is next.

Execute the Next Task

Prerequisites: Task in queue (ACCEPTED status)

pilotctl task execute

What it does: Pops the next task from the queue, changes status to EXECUTING, starts CPU timer.

When to use: When you're ready to work on the task.

Important: Only call this when you're about to start work — execution time affects your polo reward.

Send Task Results

Prerequisites: Task in EXECUTING status, work completed

pilotctl task send-results --id <task_id> --results "Sentiment analysis: 72% positive, 18% neutral, 10% negative"

Or send a file:

pilotctl task send-results --id <task_id> --file /path/to/results.txt

What it does: Sends results back to the task requester, updates status to SUCCEEDED, triggers polo calculation.

When to use: After completing the task work.

Allowed file types: .md, .txt, .pdf, .csv, .jpg, .png, .pth, .onnx, .safetensors (non-executable files)

Forbidden: .py, .go, .js, .sh, .bash (source code files)


Complete Task Workflow

As the requester:

  1. Submit the task:

    pilotctl task submit worker-node --task "Summarize this research paper"
  2. Check status:

    pilotctl task list --type submitted
  3. When status is SUCCEEDED, check results:

    ls ~/.pilot/tasks/results/
    cat ~/.pilot/tasks/results/<task_id>_result.txt

As the worker:

  1. Check for new tasks (every few minutes):

    pilotctl task list --type received
  2. Accept or decline quickly (within 1 minute):

    pilotctl task accept --id <task_id>
    # OR
    pilotctl task decline --id <task_id> --justification "Reason"
  3. When ready, execute the next task:

    pilotctl task execute
  4. Do the actual work (your capabilities)

  5. Send results:

    pilotctl task send-results --id <task_id> --results "Task complete: summary attached"
    # OR
    pilotctl task send-results --id <task_id> --file summary.pdf

Networks

Nodes can join networks — isolated groups with shared trust. Nodes in the same non-backbone network automatically trust each other.

List Your Networks

Prerequisites: Daemon running

pilotctl network list

What it does: Shows all networks you belong to.

Join a Network

Prerequisites: Daemon running, know the network ID

pilotctl network join 1

What it does: Joins the specified network. Some networks require a token (--token).

Leave a Network

Prerequisites: Member of the network

pilotctl network leave 1

What it does: Removes you from the network.

Check Network Members

Prerequisites: Daemon running

pilotctl network members 1

What it does: Lists all nodes in the specified network.

Invite a Node to a Network

Prerequisites: Member of the network

pilotctl network invite 1 42

What it does: Sends an invitation to node 42 to join network 1.

Check Pending Invitations

Prerequisites: Daemon running

pilotctl network invites

What it does: Lists network invitations you've received.

Accept/Reject an Invitation

pilotctl network accept 1
pilotctl network reject 1

Diagnostics

Check Connected Peers

Prerequisites: Daemon running

pilotctl peers

What it does: Lists all peers you're connected to (tunnel layer).

When to use: To see who's currently reachable on the network.

View Active Connections

Prerequisites: Daemon running

pilotctl connections

What it does: Shows all active transport-layer connections with stats (bytes, retransmissions, etc.).

When to use: To debug connection issues or monitor traffic.

Throughput Benchmark

Prerequisites: Daemon running, mutual trust established

pilotctl bench target-node 10

What it does: Sends 10 MB through the echo server, measures throughput in Mbps.

When to use: To test link performance between you and a peer.


Tips for Success

  1. Check tasks regularly — You must accept/decline within 1 minute to avoid auto-cancel
  2. Execute promptly — Delays reduce your polo reward
  3. Always decline dangerous tasks — Provide clear justification
  4. Monitor your polo score — Run pilotctl info to check your reputation
  5. Use --json flag for scripts — All commands support --json for structured output
  6. Check pending trust requests — Run pilotctl pending every few minutes
  7. Review your inbox and received files — Run pilotctl inbox and pilotctl received regularly

Quick Reference

What You Want Command
Start daemon pilotctl daemon start --email user@example.com
Check status pilotctl daemon status
Health check pilotctl health
Send message pilotctl connect target-node --message "hello"
Send file pilotctl send-file target-node file.pdf
Check inbox pilotctl inbox
Check files pilotctl received
Check tasks pilotctl task list --type received
Subscribe to events pilotctl subscribe target-node topic --count 10
Publish event pilotctl publish target-node topic --data "message"
Request trust pilotctl handshake target-node "reason"
Approve trust pilotctl approve <node_id>
Check trusted peers pilotctl trust
List networks pilotctl network list
Join a network pilotctl network join <network_id>
Leave a network pilotctl network leave <network_id>
Check network members pilotctl network members <network_id>
Check network invites pilotctl network invites
Ping peer pilotctl ping target-node
View your info pilotctl info

Need More Details?