Get the DTN Bundle System up and running in 5 minutes.
- Python 3.12 (recommended) or 3.10+
- Git (to clone the repository)
# 1. Navigate to project directory
cd /Users/annhoward/src/solarpunk_utopia
# 2. Create virtual environment
python3.12 -m venv venv
# 3. Activate virtual environment
source venv/bin/activate
# 4. Install dependencies
pip install -r requirements.txt# Start the server (from project root)
python -m app.mainYou should see:
INFO: Uvicorn running on http://0.0.0.0:8000
DTN Bundle System started successfully
API available at http://localhost:8000
Docs available at http://localhost:8000/docs
The server is now running! 🎉
Open a new terminal and try:
# Health check
curl http://localhost:8000/health | python3 -m json.tool
# Create a bundle
curl -X POST http://localhost:8000/bundles \
-H "Content-Type: application/json" \
-d '{
"payload": {"message": "Hello from DTN!"},
"payloadType": "test:Message",
"priority": "normal",
"audience": "public",
"topic": "coordination",
"tags": ["test"]
}' | python3 -m json.tool
# List bundles
curl http://localhost:8000/bundles?queue=outbox | python3 -m json.tool# Unit tests
python test_dtn_system.py
# API integration tests
chmod +x test_api.sh
./test_api.shVisit http://localhost:8000/docs for interactive API documentation.
Emergency Bundle:
curl -X POST http://localhost:8000/bundles \
-H "Content-Type: application/json" \
-d '{
"payload": {"message": "Emergency: Fire in garden"},
"payloadType": "alert:Emergency",
"priority": "emergency",
"audience": "public",
"topic": "coordination",
"tags": ["emergency", "fire"]
}'TTL: 12 hours
Perishable Food Offer:
curl -X POST http://localhost:8000/bundles \
-H "Content-Type: application/json" \
-d '{
"payload": {"type": "offer", "content": "Fresh tomatoes available"},
"payloadType": "vf:Listing",
"priority": "perishable",
"audience": "local",
"topic": "mutual-aid",
"tags": ["food", "perishable", "tomatoes"]
}'TTL: 48 hours
Knowledge Article:
curl -X POST http://localhost:8000/bundles \
-H "Content-Type: application/json" \
-d '{
"payload": {"title": "Composting Guide", "content": "How to make compost..."},
"payloadType": "protocol:Guide",
"priority": "normal",
"audience": "public",
"topic": "knowledge",
"tags": ["composting", "permaculture"]
}'TTL: 270 days
Queue Statistics:
curl http://localhost:8000/bundles/stats/queues | python3 -m json.toolCache Statistics:
curl http://localhost:8000/sync/stats | python3 -m json.toolNode Info:
curl http://localhost:8000/node/info | python3 -m json.toolGet Index:
curl "http://localhost:8000/sync/index?queue=pending&limit=100" | python3 -m json.toolPull Bundles:
curl "http://localhost:8000/sync/pull?max_bundles=10&peer_trust_score=0.8&peer_is_local=true" | python3 -m json.toolPress Ctrl+C in the terminal where the server is running.
app/
├── main.py - FastAPI application entry point
├── models/ - Data models (Bundle, Priority, Queue)
├── database/ - SQLite database and queue management
├── services/ - Business logic (crypto, TTL, cache, forwarding)
└── api/ - HTTP endpoints (bundles, sync)
data/
├── dtn_bundles.db - SQLite database (created on first run)
└── keys/ - Ed25519 keypair (generated on first run)
├── node_private.pem
└── node_public.pem
Edit app/main.py to configure:
-
Cache budget: Default 2GB
cache_service = CacheService(storage_budget_bytes=2 * 1024 * 1024 * 1024)
-
TTL check interval: Default 60 seconds
ttl_service = TTLService(check_interval_seconds=60)
-
Server host/port: Default 0.0.0.0:8000
uvicorn.run("app.main:app", host="0.0.0.0", port=8000)
ImportError: No module named 'pydantic'
- Make sure virtual environment is activated:
source venv/bin/activate - Reinstall dependencies:
pip install -r requirements.txt
Address already in use
- Another process is using port 8000
- Change the port in
app/main.pyor stop the other process
Database locked
- Stop all running instances of the server
- Delete
data/dtn_bundles.dbto start fresh (will lose all bundles)
- Read the full README:
DTN_BUNDLE_SYSTEM_README.md - Explore the API: http://localhost:8000/docs
- Run the tests:
python test_dtn_system.py - Build on top: Implement ValueFlows, agents, or Android integration
- Full documentation:
DTN_BUNDLE_SYSTEM_README.md - Implementation summary:
DTN_BUNDLE_SYSTEM_SUMMARY.md - Spec:
solarpunk_node_full_spec.md(Section 4) - Proposal:
openspec/changes/dtn-bundle-system/proposal.md
Happy bundling! 📦