Amadeus MatMul Solver

High-performance matrix multiplication solver for Amadeus uPoW (Useful Proof of Work) protocol, targeting the TensTorrent Blackhole p150a RISC-V hardware.

  • 0 Raised
  • 392 Views
  • 0 Judges

Tags

  • Hard Hack

Categories

  • Hard Hack: RISC-V Edition

Gallery

Description

Amadeus MatMul Solver (RISC-V Edition)

High-performance matrix multiplication solver for the Amadeus uPoW (Useful Proof of Work) protocol, optimized for Tenstorrent Blackhole p150a (RISC-V) hardware.

🔍 Overview

This solver performs the core Amadeus uPoW computation using deterministic matrix generation and probabilistic verification.

Matrix Specification

  • Matrix A: 16 × 50,240 (uint8)

  • Matrix B: 50,240 × 16 (int8, signed)

  • Result (C): 16 × 16 (int32, little-endian)

Verification

  • Freivalds’ Algorithm for fast probabilistic correctness checks

 Features

  • Deterministic matrix generation via Blake3 XOF

  • Parallel matrix multiplication using Rayon

  • Freivalds verification for result validation

  • Proof-of-Work mining with configurable difficulty

  • Built-in Amadeus testnet API client

  • Approx. 347 hashes/sec on a standard CPU

 Quick Start

Build

cargo build --release

Commands

# Test connection to Amadeus testnet./target/release/amadeus-solver test# Compute and validate (no mining)./target/release/amadeus-solver compute# Mine a valid PoW solution./target/release/amadeus-solver mine -d 16 -t 60# Validate an existing Base58 solution./target/release/amadeus-solver validate # Run performance benchmarks./target/release/amadeus-solver benchmark

Environment Variables

VariableDescription

AMADEUS_TESTNET_URLCustom testnet endpoint (default: http://46.4.179.184)

📊 Performance

MetricValue

Matrix Size16×50240 × 50240×16
Compute Time~2.9 ms
Hash Rate~347 H/s
Throughput~8.9 GFLOPS

Solution Format

Total Size: 1264 bytes

1. Seed (240 bytes)

FieldSize

Epoch (LE)4 bytes
Segment VR Hash32 bytes
BLS Public Key48 bytes
Proof of Possession96 bytes
Computor Public Key48 bytes
Nonce12 bytes

2. Tensor C (1024 bytes)

  • 16 × 16 matrix

  • int32 values

  • Little-endian encoding

🌐 API Endpoints

MethodEndpointDescription

GET/api/upow/seedFetch computation seed
GET/api/upow/seed_with_matrix_a_bSeed with pre-computed matrices
POST/api/upow/validateValidate PoW solution

- Validation Response

{  "valid": true,  "valid_math": true}

  • valid: PoW hash meets difficulty target

  • valid_math: Matrix multiplication is correct

🐳 Docker

Build

docker build -t amadeus-matmul .

Run

docker run amadeus-matmul compute

Attachments