Mining/site-docs/development/building.md
snider 69376b886f feat: Rebrand xmrig to miner and vendor XMRig ecosystem
Complete rebranding of all components:
- Core miner: xmrig -> miner (binary, version.h, CMakeLists.txt)
- Proxy: xmrig-proxy -> miner-proxy
- CUDA plugin: xmrig-cuda -> miner-cuda
- Heatmap: xmrig-nonces-heatmap -> miner-nonces-heatmap
- Go CLI wrapper: miner-cli -> miner-ctrl

Vendored XMRig ecosystem into miner/ directory:
- miner/core - XMRig CPU/GPU miner
- miner/proxy - Stratum proxy
- miner/cuda - NVIDIA CUDA plugin
- miner/heatmap - Nonce visualization tool
- miner/config - Configuration UI
- miner/deps - Pre-built dependencies

Updated dev fee to use project wallet with opt-out (kMinimumDonateLevel=0)
Updated branding to Lethean (domain, copyright, version 0.1.0)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 19:43:02 +00:00

3.2 KiB

Building from Source

Complete guide to building the Mining Dashboard from source.

Prerequisites

Required

Tool Version Purpose
Go 1.21+ Backend compilation
Node.js 20+ Frontend build
npm 10+ Package management
Make any Build automation

Optional

Tool Purpose
golangci-lint Code linting
swag Swagger doc generation
Docker Containerized builds

Quick Build

# Clone repository
git clone https://github.com/Snider/Mining.git
cd Mining

# Build everything
make build

# Output: ./miner-ctrl

Backend Build

Standard Build

make build
# or
go build -o miner-ctrl ./cmd/mining

With Version Info

VERSION=1.0.0
go build -ldflags "-X main.version=$VERSION" -o miner-ctrl ./cmd/mining

Cross-Platform Builds

# Build for all platforms
make build-all

# Or manually:
GOOS=linux GOARCH=amd64 go build -o dist/miner-ctrl-linux-amd64 ./cmd/mining
GOOS=darwin GOARCH=amd64 go build -o dist/miner-ctrl-darwin-amd64 ./cmd/mining
GOOS=windows GOARCH=amd64 go build -o dist/miner-ctrl-windows-amd64.exe ./cmd/mining

Frontend Build

cd ui

# Install dependencies
npm install

# Development build
ng build

# Production build
ng build --configuration production

# Output: ui/dist/

Generate Documentation

Swagger Docs

# Install swag
go install github.com/swaggo/swag/cmd/swag@latest

# Generate
make docs
# or
swag init -g ./cmd/mining/main.go

MkDocs Site

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install MkDocs
pip install mkdocs-material mkdocs-glightbox

# Serve locally
mkdocs serve

# Build static site
mkdocs build

Running Tests

Unit Tests

# All tests with coverage
make test

# Specific package
go test -v ./pkg/mining/...

# With race detection
go test -race ./...

E2E Tests

cd ui

# Install Playwright
npx playwright install

# Run all E2E tests
npm run e2e

# API tests only (faster)
npm run e2e:api

# Interactive UI mode
npm run e2e:ui

Development Server

# Start backend + frontend
make dev

# Or separately:
# Terminal 1: Backend
./miner-ctrl serve

# Terminal 2: Frontend
cd ui && ng serve

Access:

Docker Build

Single Binary

docker build -t mining-cli .
docker run -p 9090:9090 mining-cli serve

Multi-Node Setup

docker-compose -f docker-compose.p2p.yml up

Release Build

# Using GoReleaser
make package

# Creates:
# - dist/miner-ctrl_linux_amd64.tar.gz
# - dist/miner-ctrl_darwin_amd64.tar.gz
# - dist/miner-ctrl_windows_amd64.zip

Troubleshooting

CGO Issues

SQLite requires CGO. If you get errors:

# Enable CGO
CGO_ENABLED=1 go build ./cmd/mining

Node Modules

If frontend build fails:

cd ui
rm -rf node_modules package-lock.json
npm install

Swagger Generation

If swagger fails:

go install github.com/swaggo/swag/cmd/swag@latest
export PATH=$PATH:$(go env GOPATH)/bin
swag init -g ./cmd/mining/main.go