This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
TrustMesh is a blockchain-enabled distributed computing framework for trustless heterogeneous IoT environments. It implements a three-layer architecture combining permissioned blockchain (Hyperledger Sawtooth) with multi-phase PBFT consensus for secure task scheduling and execution.
The codebase follows a three-layer architecture:
auto-docker-deployment/- Application deployment infrastructuremanage-dependency-workflow/- Workflow orchestration and dependency management
compute-node/- Docker-in-Docker compute nodes with blockchain consensusscheduling/- Task scheduling with multiple transaction processors (TPs)peer-registry/- Node registration and discovery
iot-node/- IoT device simulation and blockchain interactionsample-apps/- Demo applications including cold-chain monitoring
# Build all Docker images (update DOCKER_USERNAME in script first)
chmod +x build-project.sh && ./build-project.sh
# Deploy entire network to K3s cluster
chmod +x build-and-deploy-network.sh && ./build-and-deploy-network.sh
# Clean up environment
chmod +x clean-k8s-environment.sh && ./clean-k8s-environment.sh# Set up K3s cluster (see k3s-cluster-setup-guide/)
cd k3s-cluster-setup-guide
chmod +x setup-k3s-server.sh && ./setup-k3s-server.sh
chmod +x setup-k3s-agent.sh && ./setup-k3s-agent.sh# Check pod status (all should be Running)
kubectl get pods
# Monitor system status
kubectl describe pods- Blockchain: Hyperledger Sawtooth with PBFT consensus
- Containerization: Docker + Kubernetes (K3s)
- Language: Python 3.8
- Database: CouchDB cluster for distributed storage
- Message Queue: Redis cluster for coordination
- Security: ZMQ CURVE authentication, SSL/TLS certificates
Each component has its own TP for blockchain operations:
peer-registry-tp- Node registrationdocker-image-tp- Application deploymentdependency-management-tp- Workflow managementscheduling-request-tp- Task schedulingschedule-confirmation-tp- Schedule validationstatus-update-tp- Task status updatesiot-data-tp- IoT data processing
- Build and compress application with
build-project.sh - Deploy using application deployment client:
kubectl exec -it network-management-console-xxxxx -c application-deployment-client bash python docker_image_client.py deploy_image application.tar app_requirements.json - Create workflow with DAG specification in
graph.json - Initiate processing from IoT nodes
- Compute Nodes: Min 1 CPU core, 4GB RAM
- Control Nodes: Min 1 CPU core, 8GB RAM (Recommended: 8 cores, 32GB RAM)
- IoT Nodes: Min 1 CPU core, 4GB RAM
- Minimum viable cluster: 6 nodes (1 control + 1 IoT + 4 compute)
- Each component has its own
requirements.txtand Dockerfile - No centralized test framework - testing is component-specific
- Update
DOCKER_USERNAMEin build scripts before building - All inter-node communication uses SSL/TLS and ZMQ CURVE authentication
- Performance: Framework overhead is 3.25-4.19 seconds for typical workflows