HCP PHASE 4 · ARCHITECTURE DOCUMENTATION
Production Infrastructure Architecture
Phase 4 hardens and scales the existing HCP stack. The MCF consensus function, JSVL validation layer, and HTIV settlement certificates are untouched — every Phase 4 module builds on top of them. No tokens, no mining, no staking economics.
Rust Workspace Layout
hcp-production/ ├── Cargo.toml # Workspace manifest ├── crates/ │ ├── hcp-core/ # EXISTING — MCF, JSVL, HTIV (unchanged) │ ├── hcp-security/ # Module 1 — zero-trust, mTLS, HSM, key lifecycle │ │ ├── src/identity.rs # NodeIdentity, enrollment attestation │ │ ├── src/mtls.rs # rustls-based mutual TLS transport │ │ ├── src/hsm.rs # trait HsmProvider (PKCS#11 / KMS impls) │ │ ├── src/rotation.rs # 90-day key rotation scheduler │ │ ├── src/audit.rs # hash-chained tamper-evident log │ │ └── src/pqc.rs # optional PQC abstraction (ML-DSA/ML-KEM) │ ├── hcp-network/ # Module 2 — multi-region deployment │ │ ├── src/topology.rs # region clusters, quorum weights │ │ ├── src/heartbeat.rs # heartbeat protocol (tokio interval) │ │ ├── src/failover.rs # automatic failover + quorum rebalance │ │ ├── src/routing.rs # latency-aware request routing │ │ └── src/bootstrap.rs # snapshot-based node bootstrap │ ├── hcp-observability/ # Module 3 — metrics, tracing, alerting │ │ ├── src/metrics.rs # Prometheus exporters │ │ ├── src/tracing.rs # OpenTelemetry distributed traces │ │ └── src/alerts.rs # threshold + anomaly alerting │ ├── hcp-bench/ # Module 4 — benchmark suite │ │ ├── src/throughput.rs # settlement TPS harness │ │ ├── src/latency.rs # consensus/finality/cross-region │ │ ├── src/resources.rs # CPU, memory, disk, bandwidth, energy │ │ └── src/report.rs # CSV / JSON / chart generation │ ├── hcp-gateway/ # Module 5 — REST / gRPC / WebSocket gateway │ │ ├── src/rest.rs # axum REST endpoints │ │ ├── src/grpc.rs # tonic gRPC services │ │ ├── src/stream.rs # WebSocket settlement event streams │ │ ├── src/auth.rs # OAuth2 / OIDC / JWT / API keys │ │ └── src/webhooks.rs # registration, delivery, retry │ ├── hcp-enterprise/ # Module 6 — RBAC, multi-tenancy, ops │ ├── hcp-agent-finality/ # Module 7 — AI action receipts, M2M settlement │ └── hcp-testing/ # Module 9 — chaos, fault injection, load └── deploy/ # Module 8 — Docker, K8s, Terraform, Ansible
Global Deployment Topology
┌──────────────────────────────┐
│ Global Load Balancer │
│ (latency-aware routing) │
└──────┬───────────┬───────────┘
┌────────────┤ ├────────────┐
▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ NA (P) │ │ EU │ │ APAC │ │ SA/AF/ME│
│ 5V + 2O │ │ 3V + 1O │ │ 3V + 1O │ │ 3V + 1O │
└────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘
│ mTLS mesh + heartbeat (5s) │
└────────────┴─────┬─────┴────────────┘
▼
┌───────────────────────────┐
│ HCP Consensus Core (MCF) │ ◄── unchanged
│ JSVL validation · HTIV │
│ Snapshot sync · Anchoring │
└───────────────────────────┘
V = validator node O = observer node (P) = primaryCore Interfaces (Traits)
/// Module 1 — HSM abstraction. Implementations: Pkcs11Hsm, AwsKmsHsm, SoftHsm.
#[async_trait]
pub trait HsmProvider: Send + Sync {
async fn generate_keypair(&self, spec: KeySpec) -> Result<KeyHandle, HsmError>;
async fn sign(&self, key: &KeyHandle, msg: &[u8]) -> Result<Signature, HsmError>;
async fn rotate(&self, key: &KeyHandle) -> Result<KeyHandle, HsmError>;
async fn revoke(&self, key: &KeyHandle) -> Result<(), HsmError>;
}
/// Module 1 — tamper-evident audit sink (hash-chained records).
#[async_trait]
pub trait AuditSink: Send + Sync {
async fn append(&self, event: SecurityEvent) -> Result<ChainedRecord, AuditError>;
async fn verify_chain(&self, from: u64) -> Result<ChainVerdict, AuditError>;
}
/// Module 2 — failover coordinator. Never alters consensus finality rules.
#[async_trait]
pub trait FailoverCoordinator: Send + Sync {
async fn on_heartbeat_miss(&self, region: RegionId) -> FailoverDecision;
async fn rebalance_quorum(&self) -> Result<QuorumWeights, TopologyError>;
async fn recover(&self, region: RegionId) -> Result<RecoveryPlan, TopologyError>;
}
/// Module 4 — benchmark harness.
#[async_trait]
pub trait Benchmark: Send + Sync {
fn name(&self) -> &'static str;
async fn run(&self, ctx: &BenchContext) -> Result<BenchResult, BenchError>;
}Deployment Manifests
# deploy/k8s/validator-statefulset.yaml (excerpt)
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: hcp-validator
spec:
replicas: 3
updateStrategy:
type: RollingUpdate # rolling deploys, automatic rollback
template:
spec:
containers:
- name: hcp-node
image: mandelux/hcp-node:4.0.0
ports:
- { name: consensus, containerPort: 7420 }
- { name: metrics, containerPort: 9090 }
env:
- name: HCP_REGION
valueFrom: { fieldRef: { fieldPath: metadata.labels['hcp/region'] } }
volumeMounts:
- { name: node-identity, mountPath: /etc/hcp/identity, readOnly: true }
livenessProbe:
httpGet: { path: /health, port: 9090 }
readinessProbe:
httpGet: { path: /ready, port: 9090 }Implementation Roadmap
Security hardening GA
mTLS mesh, HSM integration, key lifecycle, tamper-evident audit chain in production.
Multi-region rollout
NA + EU live, APAC/SA/AF/ME staged; failover drills and quorum rebalancing validated.
Observability & benchmarks
Prometheus/OTel stack, continuous benchmark validation in CI, public benchmark report.
Enterprise gateway GA
OAuth2/OIDC, gRPC + streaming, SDKs for Rust, TypeScript, Python, Java, Go.
Institutional pilots
Bank, payment processor, and healthcare pilot deployments with dedicated tenancy.
Risk Assessment
HSM vendor lock-in
MediumTrait-based HsmProvider abstraction; PKCS#11 baseline supported by all vendors.
Cross-region partition
HighQuorum weights rebalance automatically; snapshot-based recovery keeps RTO < 5 min.
Key compromise
HighImmediate revocation excludes node from consensus; 90-day forced rotation limits blast radius.
Benchmark drift
LowContinuous validation in CI fails builds on >10% regression.
Audit chain growth
LowPeriodic checkpointing anchors chain heads to HTIV settlement certificates.
Modules 5–10 in the Current Platform
The API gateway (REST endpoints, API keys, webhooks with retry), enterprise operations (organizations, RBAC roles, audit exports), and AI agent finality (machine identity, action receipts, policy verification) already run in this platform — see API Keys, Webhooks, Machine Agents, and Agent Finality. Deployment manifests, the testing framework, and the full documentation set (Deployment Guide, Operations Manual, Security Guide, DR Guide, Pilot Guide) are specified in the Phase 4 engineering document maintained alongside this architecture.