Go to file
2025-08-23 18:26:13 +07:00
cmd [PHASE-9] Fix graceful shutdown 2025-08-23 18:26:13 +07:00
docs [PHASE-9] Add architecture doc 2025-08-23 18:26:12 +07:00
internal [PHASE-8] Gather metrics in tcp server 2025-08-23 17:49:37 +07:00
test/integration [PHASE-8] Add proper configuration 2025-08-23 17:49:32 +07:00
.mockery.yaml [PHASE-5] Implement application layer 2025-08-23 12:35:04 +07:00
.pre-commit-config.yaml Add pre-commit hook 2025-08-22 19:29:59 +07:00
config.yaml [PHASE-8] Add proper configuration 2025-08-23 17:49:32 +07:00
Dockerfile [PHASE-8] Introduce Dockerfile 2025-08-23 17:49:38 +07:00
go.mod [PHASE-8] Update dependencies 2025-08-23 16:01:09 +07:00
go.sum [PHASE-8] Update dependencies 2025-08-23 16:01:09 +07:00
README.md [PHASE-9] Add README.md 2025-08-23 18:05:33 +07:00
Taskfile.yml Implement tests 2025-08-22 20:38:48 +07:00

Hash of Wisdom

A TCP server implementing the "Word of Wisdom" concept with proof-of-work challenges to protect against DDoS attacks.

Overview

The Hash of Wisdom server requires clients to solve computational puzzles (proof-of-work) before receiving wise quotes. This approach prevents spam and DDoS attacks by requiring clients to invest CPU time for each request.

Quick Start

Prerequisites

  • Go 1.24.3+
  • Docker (optional)

Building

# Build server
go build -o hash-of-wisdom ./cmd/server

# Build client  
go build -o client ./cmd/client

Running

# Start server (uses config.yaml by default)
./hash-of-wisdom

# Or with custom config
./hash-of-wisdom -config /path/to/config.yaml

# Connect with client
./client -addr localhost:8080

Using Docker

# Build image
docker build -t hash-of-wisdom .

# Run container
docker run -p 8080:8080 -p 8081:8081 hash-of-wisdom

Monitoring

Documentation

Protocol & Implementation

Production Readiness

Algorithm Choice

The server uses SHA-256 based proof-of-work with leading zero bits difficulty:

  • Why SHA-256: Cryptographically secure, well-tested, hardware-optimized
  • Leading Zero Bits: Simple difficulty scaling, easy verification
  • HMAC Authentication: Prevents challenge tampering and replay attacks
  • Configurable Difficulty: Adaptive to different threat levels (4-30 bits)

This approach provides strong DDoS protection while remaining computationally reasonable for legitimate clients.

Current Status

Complete: Core functionality, TCP server, client, metrics, containerization
🔄 In Progress: Documentation (Phase 9)
📋 Planned: See Production Readiness Guide for production deployment requirements

Testing

# Run all tests
go test ./...

# Run integration tests
go test ./test/integration/...

# Benchmarks
go test -bench=. ./internal/pow/...