Code. Create. Rebel.
Matt
This stripped down version of https://github.com/SOVEREIGN-NET/The-Sovereign-Network
Created: 2025-10-20 04:05:31https://www.anarchyspace.com/git_code/Matt/sovereign_network_node.git
Use the AnarchySpace token system or browser-based pushes.
ssh://Matt@anarchyspace.com:22/var/www/html/git_code/Matt/sovereign_network_node.git
Quick login: ssh Matt@anarchyspace.com -p 22 (restricted to /var/www/html/git_code)
Use your AnarchySpace password. Contributors can push updates to other repos, but only the creator can delete or remove them.
# 🛰️ Sovereign Network Node
A minimalist, universal ZHTP mesh node built for peer-to-peer sovereignty.
## ✅ Features
- Runs a ZHTP JSON-RPC interface over HTTP (port 4200 by default)
- Supports lightweight citizen broadcasting via key files
- Can auto-register users via CLI or PHP
- Fully self-contained and non-centralized
## 🔧 Setup
```bash
# Clone your node (replace host and path as needed)
git clone https://www.anarchyspace.com/git_code/Matt/sovereign_network_node.git
cd sovereign_network_node
# Install optional dependencies (if you plan to extend the node)
npm install
# Start the node
node zhtp_node.js
```
## 🔁 JSON-RPC Smoke Test
```bash
curl -s http://localhost:4200 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"ping","params":[]}'
```
## 🔑 Registering Users
```bash
# CLI helper
./register_user.sh alice
# Via PHP endpoint
curl -X POST https://your-host/git_code/Matt/sovereign_network_node/auto_register.php \
-d 'user_id=alice'
```
## 🛰 Deployment Tips
1. Ensure `/var/www/html/git_code/Matt/sovereign_network_node.git` is the bare repo that serves HTTP/SSH clones.
2. Mount or persist the `users/` directory if the node is stateful.
3. Keep your SSH credentials safe — contributors can push updates, but only the creator can delete the repo.
name: Lint
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- run: npm install
continue-on-error: true
- run: npm run lint
continue-on-error: true<?php
$user_id = $_POST['user_id'] ?? '';
$user_id = preg_replace('/[^a-zA-Z0-9_-]/', '', $user_id);
if (!$user_id) {
http_response_code(400);
exit('Missing or invalid user_id');
}
$key = shell_exec('php /var/www/zhtp/genkey.php ' . escapeshellarg($user_id));
if (!$key) {
http_response_code(500);
exit('Key generation failed');
}
file_put_contents(__DIR__ . "/users/{$user_id}.key", trim($key));
echo "✅ {$user_id} registered to sovereign mesh.";{
"zhtpPort": 4200,
"broadcastFrequency": 300,
"peers": [],
"allowAutoRegister": true
}# 🛰️ Sovereign Network Node
A minimalist, universal ZHTP mesh node built for peer-to-peer sovereignty.
## ✅ Features
- Runs a ZHTP JSON-RPC interface over HTTP (port 4200 by default)
- Supports lightweight citizen broadcasting via key files
- Can auto-register users via CLI or PHP
- Fully self-contained and non-centralized
## 🔧 Setup
```bash
# Clone your node (replace host and path as needed)
git clone https://www.anarchyspace.com/git_code/Matt/sovereign_network_node.git
cd sovereign_network_node
# Install optional dependencies (if you plan to extend the node)
npm install
# Start the node
node zhtp_node.js
```
## 🔁 JSON-RPC Smoke Test
```bash
curl -s http://localhost:4200 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"ping","params":[]}'
```
## 🔑 Registering Users
```bash
# CLI helper
./register_user.sh alice
# Via PHP endpoint
curl -X POST https://your-host/git_code/Matt/sovereign_network_node/auto_register.php \
-d 'user_id=alice'
```
## 🛰 Deployment Tips
1. Ensure `/var/www/html/git_code/Matt/sovereign_network_node.git` is the bare repo that serves HTTP/SSH clones.
2. Mount or persist the `users/` directory if the node is stateful.
3. Keep your SSH credentials safe — contributors can push updates, but only the creator can delete the repo.#!/bin/bash
set -euo pipefail
USER=${1:-}
if [[ -z "$USER" ]]; then
echo "Usage: $0 <username>" >&2
exit 1
fi
SAN_USER=$(echo "$USER" | tr -cd 'A-Za-z0-9_-')
if [[ -z "$SAN_USER" ]]; then
echo "Invalid username." >&2
exit 1
fi
KEY=$(php /var/www/zhtp/genkey.php "$SAN_USER")
echo "$KEY" > "users/${SAN_USER}.key"
echo "✅ Registered ${SAN_USER} to sovereign mesh."const http = require('http');
const fs = require('fs');
const config = JSON.parse(fs.readFileSync('config.json', 'utf8'));
const PORT = config.zhtpPort || 4200;
const PEERS = config.peers || [];
function loadKeys() {
const dir = './users';
if (!fs.existsSync(dir)) return [];
return fs
.readdirSync(dir)
.filter(name => name.endsWith('.key'))
.map(name => fs.readFileSync(`${dir}/${name}`, 'utf8').trim());
}
function handleRequest(req, res) {
let body = '';
req.on('data', chunk => (body += chunk));
req.on('end', () => {
try {
const json = JSON.parse(body || '{}');
if (json.method === 'ping') {
return res.end(JSON.stringify({ jsonrpc: '2.0', id: json.id, result: 'pong' }));
}
if (json.method === 'getCitizens') {
return res.end(JSON.stringify({ jsonrpc: '2.0', id: json.id, result: loadKeys() }));
}
return res.end(JSON.stringify({ jsonrpc: '2.0', id: json.id, error: 'Unknown method' }));
} catch (err) {
return res.end(JSON.stringify({ error: 'Invalid JSON-RPC input' }));
}
});
}
http.createServer(handleRequest).listen(PORT, () => {
console.log(`✅ Sovereign ZHTP node listening on port ${PORT}`);
if (PEERS.length > 0) {
console.log(`🔗 Peers: ${PEERS.join(', ')}`);
}
});No snippets uploaded yet.
No comments yet.