
Red Team Coin for crypto-mining operations.
RedTeamCoin is a blockchain-based cryptocurrency mining pool implementation designed for authorized security testing and red team operations. Built in Go with Java client support, it simulates real-world cryptomining attacks to help organizations assess their detection capabilities and quantify potential damage from threat actor mining operations.
This tool enables security teams to safely and legally demonstrate cryptomining attack scenarios on corporate systems, generate comprehensive impact reports, and validate security controls—all within a controlled environment using an isolated, non-public blockchain.
Why use RedTeamCoin?
System Components:
Get RedTeamCoin running in under 5 minutes:
Ubuntu/Debian:
sudo apt update
sudo apt install -y golang-go protobuf-compiler
macOS:
brew install go protobuf
Windows:
# Clone the repository
git clone https://github.com/xyplex3/RedTeamCoin.git
cd RedTeamCoin
# Install dependencies
make install-tools
make deps
# Build server and client
make build
Verify the build completed successfully:
ls -lh bin/
# Expected output: server and client binaries (1-5 MB each)
./bin/server --help
# Expected output: Usage information for the server
1. Start the server:
make run-server
You should see output like:
RedTeamCoin Mining Pool Server
Authentication Token: abc123def456...
Dashboard URL: http://localhost:8080?token=abc123def456...
gRPC server listening on port 50051
2. Start a miner (in a new terminal):
make run-client
You should see mining activity:
Connected to mining pool at localhost:50051
Registered as miner: miner-hostname-1234567890
Mining block #1... Hash rate: 2.5 MH/s
Block found! Nonce: 98765, Hash: 000000ab1cd...
3. View the dashboard:
Open the URL from step 1 in your browser, or navigate to:
http://localhost:8080?token=YOUR_AUTH_TOKEN_HERE
You'll see real-time statistics including active miners, hash rates, and mined blocks.
Note: The server listens on all network interfaces - replace localhost
with your server's IP for remote access.
The mining pool operates using a proof-of-work consensus mechanism:
Each block requires finding a hash with a specific number of leading zeros (configurable difficulty). Miners receive 50 RTC per block mined.
Client Miner Server
| |
|--RegisterMiner(IP,Hostname)->|
|<--RegistrationResponse-------|
|--GetWork()------------------>|
|<--WorkResponse(Block)--------|
| [Mining: compute hashes] |
|--SubmitWork(nonce,hash)----->|
| | [Validate proof-of-work
| | and add block to chain]
|<--SubmissionResponse---------|
|--Heartbeat(stats)----------->|
|<--HeartbeatResponse----------|
HTTP (Default):
./bin/server
HTTPS/TLS (Recommended):
# Generate certificates (one time)
./generate_certs.sh
# Start with TLS
RTC_SERVER_TLS_ENABLED=true ./bin/server
Note #1: With HTTPS, browsers will show a security warning for self-signed certificates. Click "Advanced" → "Proceed to localhost".
Note #2: The web dashboard and gRPC server will run on all interfaces of the server and can be used in place of localhost.
Basic usage:
./bin/client
Run multiple miners:
Open additional terminals and run ./bin/client in each.
RedTeamCoin provides two Java miner implementations:
Production-ready gRPC client for servers and automation.
Prerequisites:
Build using Makefile:
make build-java-client
Or build manually:
cd java-client
mvn clean package
Run:
# Connect to localhost
java -jar bin/redteamcoin-miner-client.jar
# Connect to remote server
java -jar bin/redteamcoin-miner-client.jar -server 192.168.1.100:50051
Features:
Desktop miner with graphical interface.
Prerequisites:
Build using Makefile:
make build-java-standalone
Or build manually:
cd java-standalone
mvn clean package
Run:
# GUI mode (default)
java -jar bin/redteamcoin-miner-standalone.jar
# CLI mode
java -jar bin/redteamcoin-miner-standalone.jar --pool localhost:50051
Features:
make build-java-all
Benefits of Java Miners:
See java-client/README.md for complete Java gRPC client documentation.
By default, clients connect to localhost:50051. To connect to a remote server:
Using command-line flag (recommended):
./bin/client -server 192.168.1.100:50051
./bin/client -s mining-pool.example.com:50051
Using environment variable:
export RTC_CLIENT_SERVER_ADDRESS=192.168.1.100:50051
./bin/client
Priority: Command-line flag > Environment variable > Default (localhost:50051)
RedTeamCoin supports GPU-accelerated mining for NVIDIA (CUDA) and AMD/Intel (OpenCL) GPUs. GPU mining is 100-400x faster and significantly more energy efficient than CPU mining.
NVIDIA CUDA:
sudo apt install cuda-toolkit
make build-cuda
AMD/Intel OpenCL:
sudo apt install ocl-icd-opencl-dev
make build-opencl
Auto-detect:
make build-gpu # Automatically detects and builds for available GPU
# Auto-detect GPU (default)
./bin/client
# Force CPU only
RTC_CLIENT_MINING_GPU_ENABLED=false ./bin/client
# Hybrid mode (CPU + GPU)
RTC_CLIENT_MINING_HYBRID_MODE=true ./bin/client
# GPU with remote server
./bin/client -server mining-pool.example.com:50051
Note: GPU mining is 100-150x more energy efficient than CPU mining.
# Test GPU detection
./bin/client 2>&1 | grep -i "gpu\|cuda\|opencl"
# Force CPU mining (verify fallback works)
RTC_CLIENT_MINING_GPU_ENABLED=false ./bin/client
# Force GPU mining (if available)
RTC_CLIENT_MINING_GPU_ENABLED=true ./bin/client
# Test hybrid CPU+GPU mode
RTC_CLIENT_MINING_HYBRID_MODE=true ./bin/client
See docs/GPU_MINING.md for complete GPU mining guide.
RedTeamCoin uses Viper for flexible configuration management. Settings can be specified via environment variables, YAML config files, or command-line flags with the following precedence:
Command-line flags > Environment variables > Config files > Defaults
Initialize configuration files:
# Initialize both server and client configs
make init-config
# Or initialize individually
make init-server-config # Creates server-config.yaml
make init-client-config # Creates client-config.yaml
This copies example YAML files to your working directory for editing. You can also place config files in ~/.rtc/ or /etc/rtc/.
Override with environment variables:
# Environment variables take precedence over config files
export RTC_SERVER_MINING_DIFFICULTY=8
export RTC_CLIENT_SERVER_ADDRESS=pool.example.com:50051
./bin/server
All environment variables use prefixes: RTC_SERVER_ for server, RTC_CLIENT_ for client.
Server Configuration:
Client Configuration:
Server config (server-config.yaml):
network:
grpc_port: 50051
api_port: 8443
http_port: 8080
mining:
difficulty: 8
block_reward: 100
tls:
enabled: true
cert_file: /etc/rtc/certs/server.crt
key_file: /etc/rtc/certs/server.key
logging:
update_interval: 30s
file_path: /var/log/rtc/pool.json
Client config (client-config.yaml):
server:
address: pool.example.com:50051
tls:
enabled: false
insecure_skip_verify: true
ca_cert_file: ""
mining:
gpu_enabled: true
hybrid_mode: false
auto_delete: true
gpu:
nonce_range: 1000000000
cpu_start_nonce: 5000000000
network:
heartbeat_interval: 30s
retry_interval: 10s
max_retry_time: 5m
All API endpoints (except the dashboard homepage) require Bearer token authentication.
Auto-generated token: The server generates a secure token on startup and displays it in the console.
Custom token:
export RTC_AUTH_TOKEN="your-secret-token"
./bin/server
Expected mining times vary by CPU performance and luck:
# Generate certificates
./generate_certs.sh
# Start with HTTPS using new config system
export RTC_SERVER_TLS_ENABLED=true
export RTC_AUTH_TOKEN="my-secure-token"
./bin/server
# Custom certificates
export RTC_SERVER_TLS_CERT_FILE="/path/to/cert.pem"
export RTC_SERVER_TLS_KEY_FILE="/path/to/key.pem"
./bin/server
See docs/TLS_SETUP.md for detailed TLS configuration.
Public endpoints:
GET / - Web dashboard (HTML)GET /blocks - View all blocks page (HTML)Authenticated endpoints:
GET /api/stats - Pool statistics (JSON)GET /api/miners - List of all miners (JSON)GET /api/blockchain - Complete blockchain (JSON)GET /api/blocks/{index} - Specific block details (JSON)GET /api/validate - Validate blockchain integrity (JSON)GET /api/cpu - CPU and GPU usage statistics (JSON)POST /api/miner/pause - Pause mining for a specific minerPOST /api/miner/resume - Resume mining for a specific minerPOST /api/miner/delete - Delete a miner (auto-terminates and self-deletes)POST /api/miner/throttle - Set CPU throttle percentage (0-100%)cURL:
# Get stats
curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8080/api/stats
# Get miners
curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8080/api/miners
# Pause a miner
curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"miner_id":"miner-hostname-1234567890"}' \
http://localhost:8080/api/miner/pause
# Set CPU throttle to 50%
curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"miner_id":"miner-hostname-1234567890","throttle_percent":50}' \
http://localhost:8080/api/miner/throttle
# HTTPS (with self-signed cert)
curl -k -H "Authorization: Bearer YOUR_TOKEN" https://localhost:8443/api/stats
JavaScript:
const token = "YOUR_TOKEN_HERE";
const headers = { Authorization: `Bearer ${token}` };
fetch("http://localhost:8080/api/stats", { headers })
.then((r) => r.json())
.then((data) => console.log(data));
Python:
import requests
headers = {'Authorization': 'Bearer YOUR_TOKEN'}
response = requests.get('http://localhost:8080/api/stats', headers=headers)
print(response.json())
service MiningPool {
rpc RegisterMiner(MinerInfo) returns (RegistrationResponse);
rpc GetWork(WorkRequest) returns (WorkResponse);
rpc SubmitWork(WorkSubmission) returns (SubmissionResponse);
rpc Heartbeat(MinerStatus) returns (HeartbeatResponse);
rpc StopMining(MinerInfo) returns (StopResponse);
}
make proto # Generate protobuf code
make build # Build server and client (CPU only)
make build-gpu # Build with GPU support (auto-detect)
make build-cuda # Build with NVIDIA CUDA
make build-opencl # Build with AMD/Intel OpenCL
make build-windows # Cross-compile for Windows
make build-all-platforms # Cross-compile for all platforms
make clean # Remove build artifacts
make deps # Download dependencies
make init # Full initialization
RedTeamCoin includes comprehensive unit tests for both server and client components.
Run all tests:
make test # Run all tests (server + client)
Run specific test suites:
# Server tests
cd server && go test -v
# Client tests
cd client && go test -v -short
# With coverage
cd server && go test -cover
cd client && go test -cover
Test Coverage:
Server: 76 tests, 66.3% coverage
blockchain_test.go: 15 tests - Blockchain validation, hash calculation,
concurrent accesspool_test.go: 26 tests - Miner management, work distribution, statisticsgrpc_server_test.go: 17 tests - gRPC endpoints, miner control, heartbeatsapi_test.go: 18 tests - REST API, authentication, miner operationsClient: 41 tests, 16.2% coverage
main_test.go: 24 tests - Mining logic, hash calculation, state managementgpu_test.go: 18 tests - GPU detection, device management, statisticsTotal: 117 unit tests covering core functionality
What's tested:
CI/CD Testing:
All tests run automatically on:
See .github/workflows/build-verification.yaml for CI configuration.
Windows (CPU-only):
make build-windows
Creates bin/client.exe
Windows with OpenCL (GPU support):
# Requires MinGW-w64 and Windows OpenCL SDK
make build-windows-opencl
Creates bin/client-windows-opencl.exe
See docs/WINDOWS_BUILD.md for complete Windows build instructions including:
Multiple Platforms:
make build-all-platforms
Creates:
client-linux-amd64 - Linux 64-bitclient-linux-arm64 - Linux ARM64client-windows-amd64.exe - Windows 64-bitclient-darwin-amd64 - macOS Intelclient-darwin-arm64 - macOS Apple SiliconNote: Cross-compiled binaries are CPU-only (CGO disabled) unless using build-windows-opencl.
Generate damage assessment reports for mining impact analysis:
make build-tools
./bin/generate_report -log pool_log.json
Report includes:
Cost Assumptions:
Converting Reports:
# PDF
pandoc Report_Miner_Activity_from_<date>_to_<date>.md -o report.pdf
# HTML
pandoc Report_Miner_Activity_from_<date>_to_<date>.md -o report.html
# DOCX
pandoc Report_Miner_Activity_from_<date>_to_<date>.md -o report.docx
Use Cases:
See tools/README.md for complete documentation.
Testing connectivity:
# Test connection
ping <server_ip>
nc -zv <server_ip> 50051
# Check server (on server side)
lsof -i :50051
ss -an | grep 50051
Common issues:
Build failures:
make deps to install dependenciesmake install-tools for protoc toolsConnection refused:
lsof -i :50051Authentication errors:
Authorization: Bearer TOKEN header formatWe welcome contributions! Here's how to get started:
git checkout -b feature/amazing-featuremake testgit commit -m 'Add amazing feature'git push origin feature/amazing-feature# Clone your fork
git clone https://github.com/YOUR_USERNAME/RedTeamCoin.git
cd RedTeamCoin
# Install dependencies
make install-tools
make deps
# Run tests
make test
# Build and test locally
make build
make run-server # Terminal 1
make run-client # Terminal 2
gofmt)This is a demonstration/educational project for authorized security testing and red team operations. It is intended for:
This tool is not intended for production use as a real cryptocurrency and lacks many features required for a production system (cryptographic signatures, wallets, transaction validation, network consensus, etc.).
Use only with explicit authorization on systems you own or have permission to test.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Created by:
| Configuration | Hash Rate | Speedup | Efficiency (MH/W) |
|---|
| CPU (1 core) | ~2 MH/s | Baseline | ~0.02 |
| CPU (8 cores) | ~16 MH/s | 8x | ~0.02 |
| GPU (RTX 3080) | ~500 MH/s | 250x | ~2.0 |
| GPU (RTX 3090) | ~600 MH/s | 300x | ~2.5 |
| GPU (AMD MI250) | ~800 MH/s | 400x | ~3.0 |
| Hybrid (CPU+GPU) | ~620 MH/s | 310x | ~2.0 |
| Variable | Description | Default |
|---|
RTC_SERVER_NETWORK_GRPC_PORT | gRPC server port | 50051 |
RTC_SERVER_NETWORK_API_PORT | HTTPS API port | 8443 |
RTC_SERVER_NETWORK_HTTP_PORT | HTTP web interface port | 8080 |
RTC_SERVER_MINING_DIFFICULTY | Mining difficulty (1-64) | 6 |
RTC_SERVER_MINING_BLOCK_REWARD | Block reward in coins | 50 |
RTC_SERVER_TLS_ENABLED | Enable HTTPS/TLS | false |
RTC_SERVER_TLS_CERT_FILE | TLS certificate path | certs/server.crt |
RTC_SERVER_TLS_KEY_FILE | TLS private key path | certs/server.key |
RTC_SERVER_API_READ_TIMEOUT | API read timeout | 15s |
RTC_SERVER_API_WRITE_TIMEOUT | API write timeout | 15s |
RTC_SERVER_API_IDLE_TIMEOUT | API idle timeout | 60s |
RTC_SERVER_LOGGING_UPDATE_INTERVAL | Stats update interval | 30s |
RTC_SERVER_LOGGING_FILE_PATH | Log file path | pool_log.json |
RTC_AUTH_TOKEN (legacy) | Custom authentication token | Auto-generated |
| Variable | Description | Default |
|---|
RTC_CLIENT_SERVER_ADDRESS | Pool server address (host:port) | localhost:50051 |
RTC_CLIENT_SERVER_TLS_ENABLED | Enable TLS for gRPC connection | false |
RTC_CLIENT_SERVER_TLS_INSECURE_SKIP_VERIFY | Skip certificate verification | true |
RTC_CLIENT_SERVER_TLS_CA_CERT_FILE | Path to CA certificate file | "" |
RTC_CLIENT_MINING_GPU_ENABLED | Enable GPU mining | true |
RTC_CLIENT_MINING_HYBRID_MODE | Enable CPU+GPU simultaneous mining | false |
RTC_CLIENT_MINING_AUTO_DELETE | Auto-delete on shutdown | true |
RTC_CLIENT_GPU_NONCE_RANGE | Nonce range per GPU batch | 500000000 |
RTC_CLIENT_GPU_CPU_START_NONCE | CPU start nonce (avoid GPU overlap) | 5000000000 |
RTC_CLIENT_NETWORK_HEARTBEAT_INTERVAL | Status update interval | 30s |
RTC_CLIENT_NETWORK_RETRY_INTERVAL | Connection retry delay | 10s |
RTC_CLIENT_NETWORK_MAX_RETRY_TIME | Max retry duration | 5m |
RTC_CLIENT_BEHAVIOR_WORKER_UPDATE_INTERVAL | Worker progress report interval | 100000 |
POOL_SERVER (legacy) | Remote server address | localhost:50051 |
GPU_MINING (legacy) | Enable/disable GPU mining | Auto-detect |
HYBRID_MINING (legacy) | Enable CPU+GPU mining | false |
| Parameter | Default | Notes |
|---|
| CPU Power | 150W | Full load |
| GPU Power | 250W | Full load |
| Electricity | $0.12/kWh | Adjust for region |
| Lifespan Reduction | 20-40% | From sustained mining |
| Problem | Solution |
|---|
| "cannot find -lcuda" | export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH |
| "nvcc not found" | sudo apt install cuda-toolkit |
| "No OpenCL device" | sudo apt install ocl-icd-opencl-dev |
| GPU slow | export RTC_CLIENT_MINING_GPU_ENABLED=true |
| CGo build error | sudo apt install build-essential |