Metadata-Version: 2.1
Name: matrix-compute-node
Version: 0.1.0
Summary: Decentralized worker daemon for Distributed Matrix Multiplication network
Author: Distributed Matrix Multiply Team
License: MIT
Keywords: distributed-computing,matrix-multiplication,l402,nostr,grpc
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matrix-contracts
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: grpcio>=1.50.0
Requires-Dist: protobuf>=4.21.0
Requires-Dist: numpy>=1.22.0
Requires-Dist: cryptography>=39.0.0
Requires-Dist: websockets>=11.0
Requires-Dist: httpx>=0.24.0
Provides-Extra: gpu
Requires-Dist: torch>=2.0.0; extra == "gpu"
Requires-Dist: pynvml>=11.5.0; extra == "gpu"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: grpcio-tools>=1.50.0; extra == "dev"

# matrix-compute-node

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/matrix-compute/matrix-compute-colab/blob/main/01_quickstart_distributed_matmul.ipynb)

Decentralized worker daemon for the Distributed Matrix Multiplication network.

## Overview
`matrix-compute-node` is a high-performance, zero-trust compute daemon that:
- Discovers work and announces availability via Nostr relays (Kind 30000).
- Performs hardware attestation across NVML, `nvidia-smi`, and CPU fallbacks.
- Enforces a strict 5-step L402 pre-allocation payment gate to prevent DoS attacks.
- Executes distributed block GEMM matrix multiplications ($C = A \times B$) with hardware acceleration (CuPy / PyTorch / NumPy).
- Computes SHA256 result digests and cryptographically signs results using Secp256k1.
- Services tasks streamed directly via gRPC.

## Architecture
- `src/config/`: Central configuration management (`NodeConfig`) supporting CLI flags, environment variables (`MATRIX_*`), and defaults.
- `src/crypto/`: Secp256k1 key management, signing, and verification (`WorkerSigner`).
- `src/attestation/`: Hardware attestation engine (NVML, `nvidia-smi`, CPU).
- `src/relay/`: Nostr discovery relay client (Kind 30000).
- `src/auth/`: Strict pre-allocation L402 payment gate.
- `src/engine/`: Multi-backend GEMM acceleration core.
- `src/p2p/`: P2P gRPC compute service (`MatrixComputeService`).
- `src/test_doubles/`: Hermetic in-memory test doubles (`MockSettlementService`, `MockNostrRelay`).

## Quickstart

```bash
# Install package in editable mode
pip install -e .

# Run daemon
matrix-compute-node --p2p-port 50051

# Run unit tests
pytest tests/unit
```
