@echo off setlocal enabledelayedexpansion title DogsHash Rig rem ============================================================================ rem DOGSHASH RIG - miner launcher for the DogsHash pool (Windows 10/11) rem rem What it does: downloads the official SRBMiner and the Cloudflare client, rem opens a secure channel to the DogsHash pool and starts mining Pearl on your rem GPU. Shares go to the pool, you earn tickets for the dog draw, credited to rem the address you enter below. rem rem Order matters: we ask for the antivirus exception FIRST, then download. rem The other way round, Defender eats the miner archive mid-download. rem rem This file is plain ASCII on purpose. cmd.exe parses a .cmd byte by byte in rem the active code page, so non-ASCII text can desync the parser and make it rem execute fragments of prose as commands. Keep it ASCII. rem ============================================================================ set POOL_HOST=pool.dogshash.app set LOCAL_PORT=3340 set DIR=%USERPROFILE%\DogsHash-Rig set CFG=%DIR%\rig.cfg set OKFLAG=%DIR%\defender-ok.flag set MINER=%DIR%\SRBMiner-Multi-3-6-6\SRBMiner-MULTI.exe cls echo. echo ============================================================ echo ## DOGSHASH RIG ## echo mine Pearl on your GPU, tickets go to your address echo ============================================================ echo. echo Three honest things before we start: echo. echo 1. This is a REAL miner. Your GPU will run flat out, get hot echo and loud, and the electricity is on you. echo. echo 2. Your antivirus will flag it. Windows Defender marks EVERY echo GPU miner as Riskware:BitCoinMiner - that is a file-type echo match, not a sign something is wrong. Without an exception echo the miner file is deleted while downloading, so we ask for echo it first. echo. echo 3. To stop: close this window. Nothing is installed into the echo system, no autostart. Everything lives in one folder: echo %DIR% echo. echo Not comfortable with any of that? Just close the window. echo. pause if not exist "%DIR%" mkdir "%DIR%" cd /d "%DIR%" rem ---- step 1: antivirus exception, BEFORE any download ---- if exist "%OKFLAG%" goto :defender_done :defender_ask cls echo. echo ------------------------------------------------------------ echo STEP 1 of 2: allow the miner in your antivirus echo ------------------------------------------------------------ echo. echo SRBMiner is flagged as Riskware:BitCoinMiner by most antivirus echo engines. It is a false positive based on what the file does echo (uses your GPU to mine), not on anything hidden inside. echo You can check the official release yourself on virustotal.com echo - search for "SRBMiner-Multi 3.6.6". echo. echo We need to exclude exactly ONE file - the miner itself: echo %MINER% echo. echo Only that file, not the whole folder. You can remove the echo exception at any time in Windows Security. echo. echo [1] Do it for me ^(Windows will ask you to confirm - click Yes^) echo [2] I will do it myself, show me how echo [3] Quit echo. set "CHOICE=" set /p CHOICE= your choice [1]: if "!CHOICE!"=="" set CHOICE=1 if "!CHOICE!"=="3" exit /b 0 if "!CHOICE!"=="2" goto :defender_manual if not "!CHOICE!"=="1" goto :defender_ask echo. echo Opening the Windows prompt. Click "Yes" in the window that appears... powershell -NoProfile -Command "try { Start-Process powershell -Verb RunAs -Wait -WindowStyle Hidden -ArgumentList '-NoProfile','-Command','Add-MpPreference -ExclusionPath ''%MINER%''' ; exit 0 } catch { exit 1 }" if errorlevel 1 ( echo. echo [!] That did not work - looks like the prompt was declined. echo. goto :defender_manual ) echo Done, the miner is allowed. > "%OKFLAG%" echo ok goto :defender_done :defender_manual cls echo. echo ------------------------------------------------------------ echo How to add the exception by hand echo ------------------------------------------------------------ echo. echo 1. Start menu, type: Windows Security echo 2. "Virus ^& threat protection" echo 3. "Manage settings" echo 4. Scroll down to "Exclusions" - "Add or remove exclusions" echo 5. "Add an exclusion" and pick "File" (not "Folder") echo 6. Paste this path: echo. echo %MINER% echo. powershell -NoProfile -Command "Set-Clipboard -Value '%MINER%'" >nul 2>&1 echo The path is already in your clipboard - just paste it. echo. echo Done? Come back here and press any key. pause >nul > "%OKFLAG%" echo manual :defender_done rem ---- step 2: wallet address ---- set ADDR=%~1 if "%ADDR%"=="" if exist "%CFG%" (for /f "usebackq delims=" %%a in ("%CFG%") do set ADDR=%%a) if "%ADDR%"=="" ( cls echo. echo ------------------------------------------------------------ echo STEP 2 of 2: your wallet address echo ------------------------------------------------------------ echo. echo Paste an address like 0x... ^(42 characters^) and press Enter. echo Tickets for what you mine are credited to it. No wallet echo connection, nobody asks for private keys - the public echo address is all we need. echo. set /p ADDR= address: ) rem Address check: exactly 42 chars, 0x prefix, hex after that. rem IMPORTANT: do not build a regex from 40 repeated character classes - rem findstr dies on that with "FINDSTR: Out of memory" and rejects every address. set "OK=1" if /i not "!ADDR:~0,2!"=="0x" set "OK=0" if "!ADDR:~41,1!"=="" set "OK=0" if not "!ADDR:~42,1!"=="" set "OK=0" echo !ADDR!| findstr /r /i "^0[xX][0-9a-fA-F]*$" >nul || set "OK=0" if "!OK!"=="0" ( echo. echo [!] The address must start with 0x and be 42 characters long. Try again. echo. pause exit /b 1 ) > "%CFG%" echo !ADDR! set WORKER=%COMPUTERNAME% set WORKER=!WORKER: =! rem The computer name can be empty or junk (for example "-"); fall back to a default echo !WORKER!| findstr /r "^[0-9A-Za-z][0-9A-Za-z_-]*$" >nul || set WORKER=rig if "!WORKER!"=="-" set WORKER=rig cls echo. echo address: !ADDR! echo rig name: !WORKER! echo. rem ---- 1. channel client ---- if not exist "%DIR%\cloudflared.exe" ( echo [1/3] downloading the channel client... curl -fL -s -o "%DIR%\cloudflared.exe" "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-amd64.exe" if errorlevel 1 (echo [!] could not download the channel client & pause & exit /b 1) ) else ( echo [1/3] channel client already here ) rem ---- 2. miner ---- if not exist "%MINER%" ( echo [2/3] downloading SRBMiner ^(~30 MB^)... curl -fL -s -o "%DIR%\srb.zip" "https://github.com/doktor83/SRBMiner-Multi/releases/download/3.6.6/SRBMiner-Multi-3-6-6-win64.zip" if errorlevel 1 (echo [!] miner download failed & pause & exit /b 1) rem On Windows, tar reads "C:\..." as a remote host ("Cannot connect to C:"), rem so extract with a relative path: we are already inside %DIR%. tar -xf srb.zip if errorlevel 1 ( echo. echo [!] Extraction failed - the antivirus deleted the file after all. echo. echo The exception did not apply. Check that your Defender echo exclusion list contains exactly this file: echo %MINER% echo. echo Then delete defender-ok.flag in this folder and run echo the script again - it will offer to help once more. echo. pause & exit /b 1 ) del "%DIR%\srb.zip" >nul 2>&1 ) else ( echo [2/3] miner already in place ) rem ---- 3. channel + mining ---- rem The local port may be taken (by other software, or by a pool running on this rem same machine). Then cloudflared binds 127.0.0.1 on top of someone else's rem 0.0.0.0, the miner talks into its own tunnel, which comes back to the same rem port - a loop: connections hang and the GPU sits at zero. So take a free one. for /f %%p in ('powershell -NoProfile -Command "$p=%LOCAL_PORT%; while (Get-NetTCPConnection -State Listen -LocalPort $p -ErrorAction SilentlyContinue) { $p++ }; $p"') do set LOCAL_PORT=%%p echo local port: %LOCAL_PORT% rem Belt and braces. Closing the window kills the two children below, because start /b rem leaves them attached to THIS console and Windows sends them the close event. But if the rem launcher dies any other way - End Task on cmd.exe, a crash - nothing would stop the miner, rem and the card keeps burning with nobody watching. So a detached watcher waits for this rem window's process to disappear and then kills whatever is still pointed at our local port. rem That port is unique to this run, so another rig on the same machine is never touched. for /f %%p in ('powershell -NoProfile -Command "(Get-CimInstance Win32_Process -Filter ('ProcessId=' + $PID)).ParentProcessId"') do set MYPID=%%p start "" powershell -NoProfile -WindowStyle Hidden -Command "Wait-Process -Id %MYPID% -ErrorAction SilentlyContinue; Start-Sleep -Seconds 2; Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*127.0.0.1:%LOCAL_PORT%*' -and $_.ProcessId -ne $PID -and $_.Name -ne 'powershell.exe' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }" echo [3/3] opening the channel to the pool... rem Channel and miner start HIDDEN: you get our dashboard, not the raw SRBMiner rem console with hashrate tables and pool internals. rem start /b keeps the child attached to THIS console, so closing the window sends it rem CTRL_CLOSE_EVENT and it dies with us. Start-Process made an independent process that rem survived the window and kept the GPU at 99% with nobody watching. start /b "" "%DIR%\cloudflared.exe" access tcp --hostname %POOL_HOST% --url 127.0.0.1:%LOCAL_PORT% >"%DIR%\link.log" 2>&1 rem give the channel a moment ping -n 6 127.0.0.1 >nul echo. echo Here we go. Closing this window stops mining. echo. rem The miner writes to miner.log and the window below reads it. Its own console is hidden. start /b "" "%MINER%" --algorithm pearlhash --disable-cpu --pool 127.0.0.1:%LOCAL_PORT% --wallet !ADDR!.!WORKER! --password x --nocolor --log-file "%DIR%\miner.log" >nul 2>&1 set "DASH=https://dogshash.app/me/!ADDR!" cls echo. echo ============================================================ echo DOGSHASH RIG - running echo ============================================================ echo. echo Full dashboard - hashrate, your share of the pool, earnings echo and your odds on a dog - live in the browser: echo. echo !DASH! echo. echo The first job takes about 30 seconds and the first share 1-2 echo minutes. The line below keeps updating - leave the window open. echo ============================================================ echo. rem Live status. The first job takes ~30 s and the first share 1-2 minutes; a rem silent window in that gap makes people think it froze and close it - that is rem exactly what we saw happen. So always show motion: a state, a timer, counters. powershell -NoProfile -Command "$log='%DIR%\miner.log'; $t0=Get-Date; $acc=0; while(1){ $c=@(); if(Test-Path $log){$c=Get-Content $log -Tail 300 -ErrorAction SilentlyContinue}; $a=@($c | Select-String 'share accepted').Count; $cn=@($c | Select-String 'Connected to').Count; $hr=''; $m=@($c | Select-String 'Total:'); if($m.Count -gt 0 -and $m[-1].ToString() -match 'Total:\s*([0-9.]+\s*[A-Za-z]+/s)'){ $hr=$Matches[1] }; if($a -gt $acc){$acc=$a; Write-Host (' [' + (Get-Date -Format HH:mm:ss) + '] SHARE ACCEPTED total: ' + $acc) -ForegroundColor Green}; $el=[int]((Get-Date)-$t0).TotalSeconds; if($a -gt 0){$st='mining'}elseif($hr -ne ''){$st='hashing, looking for the first share'}elseif($cn -gt 0){$st='connected, waiting for the GPU'}else{$st='connecting to the pool'}; $sp=$(if($hr -ne ''){$hr}else{'GPU starting'}); Write-Host -NoNewline ([char]13 + ' ' + $st + ' | running ' + $el + 's | ' + $sp + ' | shares ' + $a + ' '); Start-Sleep 3 }" echo. echo Stopping the miner and closing the channel. rem Windows are hidden, so we cannot kill by title. The miner goes by name; the rem channel client ONLY ours (matched by our hostname on its command line), so we rem never touch somebody else's cloudflared. taskkill /im SRBMiner-MULTI.exe /f >nul 2>&1 powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter \"Name='cloudflared.exe'\" | Where-Object { $_.CommandLine -like '*%POOL_HOST%*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }" >nul 2>&1 pause