feat: add extended CLI command routing and update P2P architecture documentation
- Added 135-line command interceptor in unified_cli.py for 75+ advanced commands - Implemented routing for contract, mining, agent, network, wallet, AI, resource, ollama, marketplace, economics, analytics, automate, cluster, performance, security, compliance, script, and API commands - Added dynamic kwargs extraction from raw_args for command parameters - Added fallback to extended_features.py backend for stateful command
This commit is contained in:
40
docs/advanced/01_blockchain/P2P_MESH_UPDATE.md
Normal file
40
docs/advanced/01_blockchain/P2P_MESH_UPDATE.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Direct TCP P2P Mesh Network Update
|
||||
|
||||
The AITBC blockchain network has been upgraded from a Redis-backed PubSub gossip model to a **Direct TCP P2P Mesh Network** running on port `7070`.
|
||||
|
||||
## Architecture Changes
|
||||
- The `P2PNetworkService` (`p2p_network.py`) now directly binds to port `7070` via `asyncio.start_server`.
|
||||
- The `gossip_backend` variable is now strictly set to `memory` since external block/transaction propagation is handled via P2P TCP streams rather than a centralized Redis bus.
|
||||
- Nodes identify themselves securely via a JSON handshake (`{'type': 'handshake', 'node_id': '...'}`).
|
||||
|
||||
## Configuration Flags
|
||||
The `/etc/aitbc/blockchain.env` configuration now requires explicit peer targeting instead of Redis connection strings:
|
||||
|
||||
```bash
|
||||
# Removed:
|
||||
# gossip_backend=broadcast
|
||||
# gossip_broadcast_url=redis://localhost:6379
|
||||
|
||||
# Updated/Added:
|
||||
gossip_backend=memory
|
||||
p2p_bind_host=0.0.0.0
|
||||
p2p_bind_port=7070
|
||||
p2p_peers=aitbc1:7070,aitbc2:7070 # Comma-separated list of known nodes
|
||||
```
|
||||
|
||||
## Systemd Service
|
||||
The systemd service (`/etc/systemd/system/aitbc-blockchain-p2p.service`) has been updated to reflect the new CLI arguments:
|
||||
```ini
|
||||
ExecStart=/opt/aitbc/venv/bin/python -m aitbc_chain.p2p_network \
|
||||
--host ${p2p_bind_host} \
|
||||
--port ${p2p_bind_port} \
|
||||
--peers ${p2p_peers} \
|
||||
--node-id ${proposer_id}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
If a node is failing to sync, verify that TCP port `7070` is open between the nodes (`ufw allow 7070/tcp`), and check the mesh connectivity status using the journal logs:
|
||||
```bash
|
||||
journalctl -u aitbc-blockchain-p2p -n 50 --no-pager
|
||||
```
|
||||
You should see output similar to `Successfully dialed outbound peer at aitbc1:7070` or `Handshake accepted from node...`
|
||||
@@ -84,7 +84,7 @@ To connect nodes in a production network:
|
||||
### 2. Gossip Backend
|
||||
- Use Redis for distributed gossip:
|
||||
```env
|
||||
GOSSIP_BACKEND=redis
|
||||
GOSSIP_BACKEND=memory
|
||||
GOSSIP_BROADCAST_URL=redis://redis-server:6379/0
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user