Skip to content

Latest commit

 

History

History
331 lines (229 loc) · 11.8 KB

File metadata and controls

331 lines (229 loc) · 11.8 KB

BlockDAG NVIDIA GPU Miner Lab

Local BlockDAG mining lab for this machine. It includes:

  • GitHub/USB findings for the CPU miner reference.
  • A local Stratum pool that follows the USB pool's miner-facing message shape.
  • A dashboard on http://127.0.0.1:8088.
  • The official monitoring dashboard repo with a merged mining-pool page on http://127.0.0.1:5173/mining.
  • A Numba CUDA GPU miner tested against the local SHA lab pool.
  • A native mainnet Stratum pool built from the BlockDAG pool repo and wired to the local mainnet node.
  • An exact production scrypt_hash_data share tester for validating the BlockDAG scrypt-like algorithm.
  • A BlockDAG scrypt GPU miner for the RTX 2070 that points at an ASIC-compatible Stratum pool.

Source Findings

Official CPU nonce scanning code is in:

  • BlockdagEngineering/blockdag-core, services/miner/cpuworker.go
  • local mirror: C:\Users\Jeremy Harkness\Documents\BlockDAG\dev\BlockdagEngineering\blockdag-core\services\miner\cpuworker.go

The newer pool release on the USB drive is built around:

  • BlockdagEngineering/blockdag-corechain, branch feature/corechain-template-ws-pool-compatible
  • BlockdagEngineering/asic-pool, branch feature/block-template-stream

The current USB/official pool Stratum contract is:

  • mining.subscribe returns extranonce1 and extranonce2_size.
  • mining.notify params are [job_id, prevhash, bbversion, nbits, ntime, clean].
  • Miner submits [wallet, job_id, extranonce2, ntime, nonce].
  • The pool rebuilds an 80-byte header as: version || prevhash || sha256d(extranonce1 || extranonce2) || ntime || nbits || nonce.

Production BlockDAG validation uses the pool's scrypt_hash_data path:

  • blockdag-corechain\common\hash\scrypt.c
  • blockdag-corechain\common\hash\hashfuncs_scrypt.go
  • pool\internal\pool\server\scrypt.c

The algorithm is scrypt N=1024/r=1/p=1 with SHA256/PBKDF2, Salsa20/8 ROMix, and the BlockDAG post-ROMix tweak before the final PBKDF2. The earlier Windows GPU lab still uses a CUDA SHA-256d predicate for fast end-to-end GPU/pool/dashboard testing. The mainnet GPU path is now bdag_gpu_miner.gpu_scrypt_miner, which ports the production scrypt path to Numba CUDA and submits normal Stratum shares.

The GitHub monitoring dashboard repo is cloned at:

  • github/BlockdagEngineering-blockdag-monitoring-dashboard

It now has a Mining Pool sidebar item and /mining route that reads the local pool API from /api/status.

Run

Start the standalone local app with one command:

.\scripts\start-standalone-app.ps1

Point the GPU miner at a remote Stratum pool instead of the local pool:

.\scripts\start-standalone-app.ps1 -RemotePool -PoolHost <pool-host> -PoolPort <pool-port>

Start the local pool and dashboard:

python -m bdag_gpu_miner.local_pool --difficulty 262144 --job-interval 5

In another shell, start the GPU miner:

python -m bdag_gpu_miner.gpu_miner --host 127.0.0.1 --port 3334 --wallet 0xA1Ee1005c4Ff181e93e717D2C624554b66AB7DFc --runtime 0

Open the dashboard:

http://127.0.0.1:8088
http://127.0.0.1:5173/mining

Current tracking wallet:

0xA1Ee1005c4Ff181e93e717D2C624554b66AB7DFc

Mainnet Scrypt Pool

Start the BlockDAG mainnet node, native Stratum pool, and dashboard API:

.\scripts\start-mainnet-node.ps1 -StopExisting
.\scripts\start-mainnet-asic-pool.ps1 -Build -StopExisting
.\scripts\start-mainnet-dashboard-api.ps1

Start the RTX 2070 BlockDAG scrypt GPU miner against the local mainnet Stratum pool:

.\scripts\start-mainnet-gpu-scrypt-miner.ps1 -StopExisting

Start the standalone packaged GPU miner EXE against the same pool:

.\scripts\start-blockdag-gpu-miner-exe.ps1 -StopExisting

Run it in the foreground for testing:

.\scripts\run-mainnet-gpu-scrypt-miner.ps1 -Runtime 60

Run the packaged EXE in the foreground for testing:

.\scripts\start-blockdag-gpu-miner-exe.ps1 -Runtime 60 -Foreground

Rebuild the packaged EXE:

.\scripts\build-mainnet-gpu-miner-exe.ps1 -Python .\.venv-build\Scripts\python.exe

Rebuild the exact production scrypt DLL if needed:

.\scripts\build-bdag-scrypt-dll.ps1

Submit one exact BlockDAG scrypt share to the local mainnet Stratum pool:

.\scripts\test-mainnet-scrypt-share.ps1 -Wallet 0xA1Ee1005c4Ff181e93e717D2C624554b66AB7DFc

Current local endpoints:

Stratum:        stratum+tcp://127.0.0.1:3334
LAN Stratum:    stratum+tcp://192.168.1.108:3334
Pool metrics:   http://127.0.0.1:9091/metrics
Dashboard API:  http://127.0.0.1:8088/api/status
Dashboard UI:   http://127.0.0.1:5173/mining

External Stratum Miners

The native BlockDAG Stratum pool is configured to listen on all local interfaces:

.\scripts\start-mainnet-asic-pool.ps1 -StopExisting

For miners on the same LAN, use:

URL:      stratum+tcp://192.168.1.108:3334
User:     0xA1Ee1005c4Ff181e93e717D2C624554b66AB7DFc
Password: x

The firewall rule is limited to the local subnet:

.\scripts\enable-stratum-firewall.ps1 -Port 3334

The pool metrics endpoint stays bound to 127.0.0.1:9091, so external miners can submit shares without exposing the dashboard metrics service. The mining dashboard shows the current external Stratum endpoint under Dashboard API -> External Stratum.

GPU Mining Save Point

Working GPU mining save point:

savepoints\20260517-173754-gpu-mining-mainnet-working
savepoints\20260517-173754-gpu-mining-mainnet-working.zip

Optimized standalone GPU miner save point:

savepoints\20260517-181450-gpu-miner-optimized-standalone
savepoints\20260517-181450-gpu-miner-optimized-standalone.zip

Standalone GPU miner:

dist\BlockDAGGpuMiner\BlockDAGGpuMiner.exe
dist\BlockDAGGpuMiner\gpu-miner.json

Run the standalone miner app:

.\scripts\start-blockdag-gpu-miner-exe.ps1 -StopExisting

The miner app serves its own status screen at:

http://127.0.0.1:8787

When launched directly, BlockDAGGpuMiner.exe reads gpu-miner.json, detects the CUDA GPU, checks whether the saved tuning signature matches that GPU, and auto-tunes if it is a new machine or a different GPU. Tuning benchmarks safe BlockDAG scrypt launch sizes and prefers low-latency settings when raw hashrate is close, so it does not trade a small synthetic gain for stale shares.

The sidecar gpu-miner.json contains the Stratum destination and reward address:

{
  "host": "127.0.0.1",
  "port": 3334,
  "wallet": "0xA1Ee1005c4Ff181e93e717D2C624554b66AB7DFc",
  "worker_name": "rtx2070",
  "runtime": 0,
  "auto_tune": true,
  "dashboard_enabled": true,
  "dashboard_port": 8787,
  "batch_size": 8192,
  "threads_per_block": 32,
  "max_results": 64
}

Current optimized RTX 2070 Max-Q settings are batch_size=8192, threads_per_block=32, and max_results=64. The miner uses a reusable CUDA scrypt scanner so the 1 GB scrypt scratch buffers stay allocated on the GPU instead of being recreated every scan. Status writes are throttled so accepted share traffic does not dominate the mining loop.

The built-in miner screen shows:

  • Mining status, pool, wallet, and worker name
  • Live hashrate and total hashes
  • Accepted, submitted, rejected, and last share age
  • GPU name, utilization, temperature, power, and launch settings
  • Auto-tune summary and on-chain wallet balance when balance_rpc_url is configured

The dashboard API reads the newest GPU status file from either the workspace Python miner logs or the packaged EXE logs, so the dashboard works whether mining is launched from Python or from BlockDAGGpuMiner.exe.

CUDA Notes

The shell had CUDA_VISIBLE_DEVICES set to a blank value, hiding the RTX 2070 from CUDA. The miner sets it to 0 if it is blank or a quoted blank string.

Numba needed local CUDA 12.1 NVVM/runtime files. They were installed in workspace-local folders:

  • .vendor_cuda121
  • .vendor_cuda121_runtime

No system CUDA installation was changed.

The missing Clang CUDA runtime wrapper headers were added under the workspace-local Zig/Clang resource directories. That gets past the original __clang_cuda_runtime_wrapper.h failure, but this Windows PC still does not have a complete nvcc/MSVC CUDA compiler stack on PATH. The working mainnet miner therefore uses the local CUDA 12.1 runtime through Numba and the production BlockDAG scrypt logic port in bdag_gpu_miner/gpu_bdag_scrypt.py.

Verified Run

On this RTX 2070 Max-Q machine:

  • python -m pytest -q: 1 passed
  • CUDA warmup: OK
  • 20 second local mining run: 1,711,276,032 hashes, 85,554,747 H/s average
  • Pool/dashboard result: 6,577 accepted shares, 0 rejected shares
  • Native mainnet Stratum pool: built as bdagstack-live\asic-pool.exe
  • Exact BlockDAG scrypt share test: 2 submitted, 2 accepted, 0 rejected against 127.0.0.1:3334
  • GPU BlockDAG scrypt miner: running against 127.0.0.1:3334 with wallet 0xA1Ee1005c4Ff181e93e717D2C624554b66AB7DFc
  • GPU scrypt verification: GPU hashes match bdag_scrypt.dll; live run accepted shares on mainnet Stratum.
  • Dashboard GPU panel: shows hashrate, accepted/submitted shares, GPU utilization, temperature, pool target, and worker status.
  • Dashboard wallet panel: queries eth_getBalance from http://127.0.0.1:18545 and shows the configured mining wallet's on-chain BDAG balance.
  • Packaged EXE benchmark: 184,360.3 H/s on NVIDIA GeForce RTX 2070 with Max-Q Design
  • Packaged EXE live mining test: 1,654,784 hashes in 8.067 seconds, 205,085.8 H/s average, 731 submitted, 731 accepted, 0 rejected.
  • Packaged EXE launcher test: 630,784 hashes in 3.0 seconds, 206,307.2 H/s average, 300 submitted, 300 accepted, 0 rejected.
  • Self-tuned EXE app test: detected NVIDIA GeForce RTX 2070 with Max-Q Design, selected 8192 x 32, served http://127.0.0.1:8787, and mined around 210-215 kH/s.

Dashboard screenshot:

  • logs/dashboard.png
  • logs/mining-dashboard-merged.png

Real Chain Status

A native Windows bdag.exe was built from the local blockdag-corechain repo with production scrypt support and started with:

  • EVM RPC: http://127.0.0.1:18545
  • DAG RPC: http://127.0.0.1:38131
  • Mining address: 0xA1Ee1005c4Ff181e93e717D2C624554b66AB7DFc

The node is reachable by RPC, but it is not synced yet:

  • eth_blockNumber: 0x0
  • DAG block count: 1
  • peer count: 0

The public stack page at https://bdagstack.bdagdev.xyz/ points to a release bundle and snapshot flow, but the snapshot host and discovered peer endpoints were unreachable from this PC during setup. The dashboard reports this as Live Node: Waiting.

Mainnet Node From Windows Release

The Windows AMD64 release in Downloads was used here:

C:\Users\Jeremy Harkness\Downloads\blockdag-pool-windows-amd64-release-20260517-151144

The release is a Docker Desktop stack, but Docker is not on PATH on this PC, so the mainnet data seed was restored into the release's native data folder and run with the local Windows bdag.exe:

C:\Users\Jeremy Harkness\Downloads\blockdag-pool-windows-amd64-release-20260517-151144\unpacked\blockdag-pool-windows-amd64-release-20260517-151144\data\node1

Repeatable launch commands:

.\scripts\start-mainnet-node.ps1 -StopExisting
.\scripts\start-mainnet-dashboard-api.ps1 -StopExisting

Current mainnet dashboard:

http://127.0.0.1:5173/mining

Current mainnet RPC status after restoring the release chain seed and connecting to peers:

  • Network: mainnet
  • Chain ID: 1404
  • EVM RPC: http://127.0.0.1:18545
  • DAG RPC: http://127.0.0.1:38131
  • EVM block: about 7.40M
  • DAG block count: about 7.53M
  • DAG peers observed: 14

The dashboard labels this state as Connected when the DAG RPC has peers and block-template pushes are arriving. EVM peer count may still show 0 while DAG peers and templates are active.