| Crates.io | colony-utils |
| lib.rs | colony-utils |
| version | 0.3.0 |
| created_at | 2025-06-29 03:52:50.460719+00 |
| updated_at | 2025-09-14 18:16:13.890784+00 |
| description | A collection of utilities for interacting with the colonylib metadata framework for the Autonomi decentralized network |
| homepage | |
| repository | https://github.com/zettawatt/colony-utils |
| max_upload_size | |
| id | 1730325 |
| size | 558,652 |
A collection of utilities for interacting with the colonylib metadata framework for the Autonomi decentralized network.
This repository contains a single Rust crate called colony-utils that provides four binary executables for managing pods and metadata on the Autonomi network:
colonyd - REST API ServerA high-performance server that implements the colonylib public APIs as REST endpoints.
Key Features:
colony - Command Line InterfaceA user-friendly CLI tool for interacting with the colonyd daemon.
Key Features:
ia_downloader - Internet Archive DownloaderA specialized tool for downloading content from the Internet Archive and preparing it for upload to Autonomi.
Key Features:
colony_uploader - Bulk Upload ToolA high-performance tool for uploading downloaded Internet Archive content to the Autonomi network via colonyd.
Key Features:
There are 3 options: directly install binaries (linux only), install from crates.io, or build from source:
Download the latest release:
# Linux (Desktop)
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colonyd-x86_64-unknown-linux-musl
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony-x86_64-unknown-linux-musl
wget https://github.com/zettawatt/colony-utils/releases/latest/download/ia_downloader-x86_64-unknown-linux-musl
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony_uploader-x86_64-unknown-linux-musl
# macOS (Intel CPU - Older Macs)
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colonyd-x86_64-apple-darwin
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony-x86_64-apple-darwin
wget https://github.com/zettawatt/colony-utils/releases/latest/download/ia_downloader-x86_64-apple-darwin
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony_uploader-x86_64-apple-darwin
# macOS (Apple Silicon - Newer Macs)
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colonyd-aarch64-apple-darwin
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony-aarch64-apple-darwin
wget https://github.com/zettawatt/colony-utils/releases/latest/download/ia_downloader-aarch64-apple-darwin
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony_uploader-aarch64-apple-darwin
# Windows
# NOTE: Windows will complain about this binary being 'unsafe'. Microsoft wants developers to pay for a certificate.
# You can ignore this warning.
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colonyd-x86_64-pc-windows-msvc.exe -outfile colonyd
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony-x86_64-pc-windows-msvc.exe -outfile colony
wget https://github.com/zettawatt/colony-utils/releases/latest/download/ia_downloader-x86_64-pc-windows-msvc.exe -outfile ia_downloader
wget https://github.com/zettawatt/colony-utils/releases/latest/download/colony_uploader-x86_64-pc-windows-msvc.exe -outfile colony_uploader
Make executable and move to PATH (Linux/macOS):
chmod +x colonyd-* colony-* ia_downloader-* colony_uploader-*
sudo mv colonyd-* /usr/local/bin/colonyd
sudo mv colony-* /usr/local/bin/colony
sudo mv ia_downloader-* /usr/local/bin/ia_downloader
sudo mv colony_uploader-* /usr/local/bin/colony_uploader
cargo install colony-utils
Clone the repository:
git clone https://github.com/zettawatt/colony-utils.git
cd colony-utils
Build the project:
cargo build --release
Move the binaries to a directory in your PATH:
sudo mv target/release/colonyd /usr/local/bin/
sudo mv target/release/colony /usr/local/bin/
sudo mv target/release/ia_downloader /usr/local/bin/
sudo mv target/release/colony_uploader /usr/local/bin/
Start the colonyd server:
# Basic usage (connects to main Autonomi network on port 3000)
colonyd
# Custom configuration
colonyd \
--port 8080 \
--listen 0.0.0.0 \
--network alpha \
--data /path/to/data \
--pass pass:mypassword
Once the daemon is running, use the CLI to interact with it:
# Search for content (public - no auth required)
colony search text "example query" --limit 10
# Refresh cache (public - no auth required)
colony refresh
# List all pods (protected - requires auth)
colony pods
# Create a new pod (protected - requires auth)
colony add pod "my-new-pod"
# Remove a pod (protected - requires auth)
colony rm pod <pod-address>
# Rename a pod (protected - requires auth)
colony rename pod <pod-address> "new-name"
# Upload all pods (protected - requires auth)
colony upload
Note: The CLI automatically handles JWT authentication for protected operations. You'll be prompted for your keystore password when needed.
The colonyd daemon supports various configuration options:
| Argument | Short | Description | Default |
|---|---|---|---|
--port |
-p |
Port to listen on | 3000 |
--listen |
-l |
IP address to bind to | 127.0.0.1 |
--network |
-n |
Autonomi network (local, alpha, main) |
main |
--data |
-d |
Path to data directory | ~/.local/share/colony |
--pass |
Password specification (see below) | Interactive prompt |
The --pass argument supports multiple formats:
pass:<password> - Direct passwordfile:<path> - Read password from file (NOT YET IMPLEMENTED)The daemon respects standard logging environment variables:
RUST_LOG - Set logging level for all (e.g., debug, info, warn, error) or can set to a specific level of debug logging based on what you're doing. This is a good verbose default:export RUST_LOG="colony_daemon=debug,colonylib=debug,tower_http=debug,axum=debug,autonomi=error"
Development Setup (Local Network):
colonyd --network local --port 3000 --listen 127.0.0.1
Production Setup (Main Network):
colonyd --port 3000 --listen 0.0.0.0
Alpha Testing:
colonyd --network alpha
The colony CLI provides a comprehensive interface to the daemon:
| Option | Short | Description | Default |
|---|---|---|---|
--server |
-s |
Server URL | http://localhost or $COLONYCLI_SERVER |
--port |
-p |
Server port | 3000 or $COLONYCLI_PORT |
--no-color |
Disable colored output | Colors enabled |
Cache Operations:
# Refresh cache
colony refresh
# Refresh with specific depth
colony refresh --depth 2
# Upload all pods
colony upload
# Upload specific pod
colony upload <pod-address>
Search Operations:
# Text search
colony search text "search term" --limit 50
# SPARQL query
colony search sparql "SELECT * WHERE { GRAPH { ?s ?p ?o }}"
# Search by type - list all files of the type MediaObject
colony search type "http://schema.org/MediaObject" --limit 20
# Search by predicate - list all files by name
colony search predicate "http://schema.org/name" --limit 10
# Search by subject. Returns everything about an address on the network.
colony search subject "c859818c623ce4fc0899c2ab43061b19caa0b0598eec35ef309dbe50c8af8d59"
Pod Management:
# List all pods
colony pods
# Create new pod
colony add pod "my-pod-name"
# Remove pod
colony rm pod <pod-address>
# Rename pod
colony rename pod <pod-address> <new-name>
# Add pod reference
colony add ref <pod-address> <reference>
# Remove pod reference
colony rm ref <pod-address> <reference>
# Store data in pod
colony put <pod-address> <subject> <JSON-LD data string>
Wallet Management:
# List all wallets
colony wallets
# Add a new wallet
colony add wallet "my-wallet" <private-key>
# Get active wallet
colony wallet get
# Set active wallet
colony wallet set "my-wallet"
# Check active wallet balance
colony wallet balance
File Operations:
# Upload file to Autonomi
colony file upload /path/to/file.txt
# Download file from Autonomi
colony file download <autonomi-address> /path/to/save/file.txt
COLONYCLI_SERVER - Default server URLCOLONYCLI_PORT - Default server portCOLONY_PASSWORD - Keystore password (avoids interactive prompts for protected operations) NOT YET IMPLEMENTEDBasic Workflow:
# Refresh all pods from the network to the local cache
colony refresh --depth 3
# Create a new pod and give it a name
colony add pod "music" # returns the pod address e.g. 8cca45fa078bc86f0861e23781632c2c3bfbd2012e259cf7c2b1f5025f3789ceb0910dd8e1943a700778f5f969a4261e
# Write metadata in JSON-LD format using [schema.org vocabulary](https://schema.org/) about a
# particular subject (i.e. a file on the network)
colony put 8cca45fa078bc86f0861e23781632c2c3bfbd2012e259cf7c2b1f5025f3789ceb0910dd8e1943a700778f5f969a4261e c859818c623ce4fc0899c2ab43061b19caa0b0598eec35ef309dbe50c8af8d59 '{\
"@context": {"schema": "http://schema.org/"},\
"@type": "schema:MediaObject",\
"@id": "ant://c859818c623ce4fc0899c2ab43061b19caa0b0598eec35ef309dbe50c8af8d59",\
"schema:name": "BegBlag.mp3",\
"schema:description": "Beg Blag and Steal",\
"schema:contentSize": "3000000"\
}'
# Write as much metadata as you want into the pod or multiple pods
# about any subject you want, regardless of whether you uploaded the data
# Then upload all pods to the Autonomi network
colony upload
# Now we can search for the data we just uploaded, either by a simple text query
colony search text "beg blag and steal" --limit 5
# Or by raw SPARQL query for more complex queries
colony search sparql '\
PREFIX schema: <http://schema.org/>\
SELECT DISTINCT ?ant WHERE { GRAPH {\
?ant schema:name "BegBlag.mp3" .\
}}'
The ia_downloader tool downloads content from the Internet Archive and prepares it for upload:
# Basic usage
ia_downloader "genesis pod" "https://archive.org/details/george-orwell-1984_202309" "pdf,txt,epub"
# With custom output directory
ia_downloader "my-books" "https://archive.org/details/some-book" "pdf" --output-dir /path/to/downloads
# Skip metadata enhancement
ia_downloader "test-pod" "https://archive.org/details/item" "mp3" --no-enhance
# Enable AI-powered metadata enhancement (need an API token from hugging face for this to work)
ia_downloader "enhanced-pod" "https://archive.org/details/item" "pdf" --ai-enhance
# Disable colors
ia_downloader "pod" "https://archive.org/details/item" "txt" --no-color
Arguments:
POD - Pod name or address to record metadata in (must already exist)URL - Internet Archive URL (e.g., https://archive.org/details/item-name)EXTENSIONS - Comma-separated list of file extensions to downloadOptions:
--output-dir - Output directory (default: colony_uploader)--no-enhance - Skip metadata enhancement from external sources--ai-enhance - Enable AI-powered metadata enhancement--no-color - Disable colored outputThe colony_uploader tool processes directories created by ia_downloader and uploads content to Autonomi:
# Basic usage (processes all directories in colony_uploader/)
colony_uploader colony_uploader/
# Custom server and port
colony_uploader --server 192.168.1.100 --port 3004 /path/to/upload/dir
# Multi-threaded processing
colony_uploader --threads 5 colony_uploader/
# Keep directories after processing
colony_uploader --keep colony_uploader/
Arguments:
DIRECTORY - Directory containing subdirectories to uploadOptions:
--server - Colonyd server location (default: 127.0.0.1)--port - Colonyd port (default: 3000)--threads - Number of directories to process in parallel (default: 1)--keep - Keep directories after processing (default: delete)Workflow Example:
# 1. Download content from Internet Archive
ia_downloader "books" "https://archive.org/details/alice-in-wonderland" "pdf,epub,txt"
# 2. Upload to Autonomi via colonyd
colony_uploader colony_uploader/
# 3. Search for uploaded content
colony search text "alice wonderland" --limit 10
The combination of ia_downloader and colony_uploader provides a powerful workflow for bulk uploading Internet Archive content to Autonomi:
# 1. Start colonyd daemon
colonyd
# 2. Create a pod for your content (using colony CLI)
colony add pod "classic-literature"
# 3. Download content from Internet Archive
ia_downloader "classic-literature" "https://archive.org/details/aliceinwonderland" "pdf,epub,txt" --ai-enhance
# 4. Download more content to the same collection
ia_downloader "classic-literature" "https://archive.org/details/prideandprejudice" "pdf,epub" --ai-enhance
ia_downloader "classic-literature" "https://archive.org/details/greatexpectations" "pdf,txt"
# 5. Upload all downloaded content to Autonomi
colony_uploader --threads 3
# 6. Search for your uploaded content
colony search text "alice wonderland" --limit 10
colony search type "http://schema.org/Book" --limit 20
ia_downloader Configuration:
Create ~/.config/ia_downloader/config.json:
{
"huggingface_api_key": "your_hf_token_here",
"tmdb_api_key": "your_tmdb_key_here", // Not yet implemented
"ai_model_url": "https://api-inference.huggingface.co/models/facebook/bart-large-cnn",
"enable_ai_enhancement": true,
"default_output_dir": "colony_uploader",
"max_concurrent_downloads": 3
}
Benefits of the Workflow:
βββββββββββββββββββ HTTP/REST βββββββββββββββββββ
β colony β βββββββββββββββΊ β colonyd β
β β β β
β β’ CLI Interface β β β’ REST API β
β β’ Progress Bars β β β’ JWT Auth β
β β’ Colored Outputβ β β’ Job Queue β
βββββββββββββββββββ βββββββββββββββββββ
β
βββββββββββββββββββ βΌ
β ia_downloader β βββββββββββββββββββ
β β β colonylib β
β β’ IA Downloads β β β
β β’ Metadata β β β’ PodManager β
β β’ Enhancement β β β’ DataStore β
βββββββββββββββββββ β β’ KeyStore β
β βββββββββββββββββββ
βΌ β
βββββββββββββββββββ βΌ
βcolony_uploader β βββββββββββββββββββ
β β βββββββββββββββΊ β Autonomi Networkβ
β β’ Bulk Upload β Files β β
β β’ Multi-thread β β β’ Decentralized β
β β’ Cost Tracking β β β’ Immutable β
βββββββββββββββββββ β β’ Secure β
βββββββββββββββββββ
The daemon exposes the following REST endpoints:
Authentication:
POST /colony-auth/token - Get JWT token (requires keystore password)GET /colony-health - Health check (public)Asynchronous Operations (Public - No Auth Required):
POST /colony-0/jobs/cache/refresh - Start cache refreshPOST /colony-0/jobs/cache/refresh/{depth} - Refresh with depthPOST /colony-0/jobs/search - Start search jobPOST /colony-0/jobs/search/subject/{subject} - Search by subjectGET /colony-0/jobs/{job_id} - Get job statusGET /colony-0/jobs/{job_id}/result - Get job resultAsynchronous Operations (Protected - Auth Required):
POST /colony-0/jobs/cache/upload - Upload all pods πPOST /colony-0/jobs/cache/upload/{address} - Upload specific pod πPOST /colony-0/file/upload - Upload file to Autonomi πFile Operations (Public/Protected):
POST /colony-0/file/download - Download file from Autonomi (public)POST /colony-0/file/upload - Upload file to Autonomi πSynchronous Operations (Protected - Auth Required):
GET /colony-0/pods - List pods πPOST /colony-0/pods - Create pod πDELETE /colony-0/pods/{pod} - Remove pod πPOST /colony-0/pods/{pod} - Rename pod πPUT /colony-0/pods/{pod}/{subject} - Store subject data πPOST /colony-0/pods/{pod}/pod_ref - Add pod reference πDELETE /colony-0/pods/{pod}/pod_ref - Remove pod reference πWallet Management (Protected - Auth Required):
GET /colony-0/wallet - Get active wallet πPOST /colony-0/wallet - Set active wallet πGET /colony-0/wallet/balance - Get active wallet balance πGET /colony-0/wallets - List all wallets πPOST /colony-0/wallets - Add new wallet πDELETE /colony-0/wallets/{wallet} - Remove wallet πPOST /colony-0/wallets/{wallet} - Rename wallet πGET /colony-0/wallets/{wallet} - Get wallet balance πThe colony-daemon implements a JWT-based authentication system to protect sensitive operations:
/auth/token with your keystore passwordAuthorization: Bearer <token> header# Get a JWT token
TOKEN=$(curl -s -X POST http://localhost:3000/colony-auth/token \
-H "Content-Type: application/json" \
-d '{"password": "your_keystore_password"}' | jq -r '.token')
# Use the token for protected endpoints
curl -X POST http://localhost:3000/colony-0/pods \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-new-pod"}'
Pod creation/management, data storage, upload operations, listing pods, wallet management, file uploads
# Clone repository
git clone https://github.com/zettawatt/colony-utils.git
cd colony-utils
# Build all components
cargo build
# Build with optimizations
cargo build --release
The repository includes a comprehensive test script that demonstrates all API endpoints:
# Run the example script (requires daemon to be running)
./scripts/example.sh
# Or with custom password
KEYSTORE_PASSWORD=your_password ./scripts/example.sh
The script tests both public and protected endpoints, showing proper JWT authentication flow.
colony-utils/
βββ src/
β βββ bin/
β βββ colonyd.rs # REST API server binary
β βββ colony.rs # CLI binary
β βββ ia_downloader.rs # Internet Archive downloader
β βββ colony_uploader.rs # Bulk uploader for Autonomi
βββ scripts/ # Testing and example scripts
βββ Cargo.toml # Single crate configuration
βββ ASYNC_JOBS.md # Documentation for async job system
βββ AUTHENTICATION.md # Authentication documentation
βββ bulk_uploader.org # Design documentation for bulk upload tools
βββ README.md # This file
Connection Refused:
# Ensure daemon is running
ps aux | grep colonyd
# Check if port is available
netstat -tlnp | grep :3000
Authentication Errors:
# Verify daemon is accessible
curl http://localhost:3000/colony-health
# Test authentication with correct password
curl -X POST http://localhost:3000/colony-auth/token \
-H "Content-Type: application/json" \
-d '{"password": "your_keystore_password"}'
# Check if you're using the correct keystore password
# The daemon will return 401 Unauthorized for incorrect passwords
Internet Archive Download Issues:
# Ensure the URL is valid and accessible
ia_downloader "test-pod" "https://archive.org/details/valid-item" "pdf"
# Check network connectivity to archive.org
curl -I https://archive.org/
# Verify pod exists in colonyd before downloading
colony pods | grep "test-pod"
Upload Issues:
# Check colonyd is running and accessible
curl http://localhost:3000/colony-health
# Verify wallet has sufficient funds
colony wallet balance
# Check file permissions for upload directories
ls -la colony_uploader/
Network Issues:
# Check network connectivity
colonyd --network local # Use local testnet
# Verify Ethereum wallet
# Ensure private key is valid and has sufficient funds
Enable debug logging for troubleshooting:
# Daemon with debug logging
RUST_LOG=debug colonyd
# Specific module logging
RUST_LOG=colony_daemon=debug,colonylib=info colonyd
This project is licensed under the GPL-3.0-only License - see the LICENSE file for details.