Bitcoin CPU Lottery Miner Using Your Own Full Node

Bitcoin CPU Lottery Miner Using Your Own Full Node

Bitcoin CPU Lottery Miner on Linux Using Your Own Full Node

I have a 32 thread Ryzen CPU in my Debian PC and I definitely don’t use most of that computing power most of the time. I thought it would be fun to throw a few of those idle threads at solo lottery mining with my own full node.

Here are the steps if you want to try the same thing:

This is not profitable CPU mining. It is educational lottery mining. Odds are extremely low, but the setup performs real SHA256d mining against your own node.

(this guide assumes you already have a full node running on your PC that is started by a systemd service. If you do not use systemd for that then just disregard step 1 and start with step 2.)


1. Verify your Bitcoin node config path

systemctl --user status bitcoind.service

Look for:

-datadir=/path/to/your/bitcoin/datadir
-conf=/path/to/your/bitcoin.conf

2. Edit bitcoin.conf

nano /path/to/your/bitcoin.conf

Add or verify:

server=1
rpcbind=127.0.0.1
rpcallowip=127.0.0.1
zmqpubhashblock=tcp://127.0.0.1:28332

3. Create RPC credentials for ckpool

python3 - <<'PY'
import secrets, hmac, hashlib

user = "ckpool"
password = secrets.token_urlsafe(32)
salt = secrets.token_hex(16)
digest = hmac.new(salt.encode(), password.encode(), hashlib.sha256).hexdigest()

print("Add this line to bitcoin.conf:")
print(f"rpcauth={user}:{salt}${digest}")
print()
print("Use this password in ckpool.conf:")
print(password)
PY
  • Copy the printed rpcauth=ckpool:... line into bitcoin.conf
  • Save the printed password

4. Restart your node

systemctl --user daemon-reload
systemctl --user restart bitcoind.service

Test RPC:

bitcoin-cli \
  -datadir=/path/to/your/bitcoin/datadir \
  -conf=/path/to/your/bitcoin.conf \
  getblockchaininfo

Optional alias:

echo "alias bitcoin-cli-node='bitcoin-cli -datadir=/path/to/your/bitcoin/datadir -conf=/path/to/your/bitcoin.conf'" >> ~/.bashrc
source ~/.bashrc

5. Install all build dependencies

sudo apt update
sudo apt install -y \
  git build-essential autoconf automake libtool pkg-config \
  libssl-dev libevent-dev libzmq3-dev yasm \
  libcurl4-openssl-dev libjansson-dev \
  lm-sensors

6. Build ckpool-solo

mkdir -p ~/apps
cd ~/apps
git clone https://github.com/golden-guy/ckpool-solo.git
cd ckpool-solo
./autogen.sh
./configure
make -j"$(nproc)"

7. Configure ckpool

nano ~/apps/ckpool-solo/ckpool.conf

Replace the contents of the file with this:

{
  "btcd" : [
    {
      "url" : "127.0.0.1:8332",
      "auth" : "ckpool",
      "pass" : "PASTE_YOUR_GENERATED_RPC_PASSWORD_HERE",
      "notify" : true
    }
  ],
  "serverurl" : [
    "127.0.0.1:3333"
  ],
  "btcsig" : "/solo/"
}

8. Test ckpool manually

cd ~/apps/ckpool-solo
src/ckpool -k -B -c ckpool.conf

Expected output:

Connected to bitcoind: 127.0.0.1:8332
Mining solo to any incoming valid BTC address username

Stop with:

Ctrl+C

Start detached:

~/apps/ckpool-solo/src/ckpool -k -B -D -c ~/apps/ckpool-solo/ckpool.conf

Verify:

pgrep -a ckpool
ss -ltnp | grep 3333

9. Build cpuminer

cd ~/apps
git clone https://github.com/pooler/cpuminer.git
cd cpuminer
./autogen.sh
./configure
make -j"$(nproc)"

Test:

./minerd --help

10. Test mining manually

cd ~/apps/cpuminer

./minerd -a sha256d \
  -o stratum+tcp://127.0.0.1:3333 \
  -O YOUR_BITCOIN_ADDRESS.worker:x \
  -t 4

11. Check CPU temperature

sudo sensors-detect
sensors

Live monitoring:

watch -n 2 sensors

Temperature guidance:

<75°C   comfortable sustained load
75–85°C running a bit hot
85–90°C high, reduce load
>90°C   DANGER!!!

12. Enable services to run after logout

loginctl enable-linger "$USER"

13. Create ckpool systemd service

mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/ckpool.service
[Unit]
Description=ckpool solo Stratum server
After=bitcoind.service
Requires=bitcoind.service

[Service]
Type=simple
WorkingDirectory=/home/YOUR_USER/apps/ckpool-solo
ExecStart=/home/YOUR_USER/apps/ckpool-solo/src/ckpool -k -B -c /home/YOUR_USER/apps/ckpool-solo/ckpool.conf
ExecStop=/usr/bin/pkill -TERM -x ckpool
Restart=on-failure
RestartSec=10

[Install]
WantedBy=default.target

14. Create miner environment file

mkdir -p ~/.config/minerd
nano ~/.config/minerd/minerd.env
BTC_ADDRESS=YOUR_BITCOIN_ADDRESS
MINER_THREADS=4
CPU_QUOTA=200%

15. Create minerd systemd service

nano ~/.config/systemd/user/minerd.service
[Unit]
Description=Bitcoin CPU lottery miner
After=ckpool.service
Requires=ckpool.service

[Service]
Type=simple
EnvironmentFile=/home/YOUR_USER/.config/minerd/minerd.env
WorkingDirectory=/home/YOUR_USER/apps/cpuminer
ExecStart=/home/YOUR_USER/apps/cpuminer/minerd -a sha256d -o stratum+tcp://127.0.0.1:3333 -O ${BTC_ADDRESS}.worker:x -t ${MINER_THREADS}
Restart=on-failure
RestartSec=10
Nice=15
CPUWeight=10
CPUQuota=${CPU_QUOTA}
IOSchedulingClass=idle

[Install]
WantedBy=default.target

16. Stop manual processes

pkill minerd
pkill ckpool

17. Enable and start services

systemctl --user daemon-reload
systemctl --user enable ckpool.service minerd.service
systemctl --user start ckpool.service
systemctl --user start minerd.service

18. Verify everything

systemctl --user status ckpool.service
systemctl --user status minerd.service
pgrep -a ckpool
pgrep -a minerd
ss -ltnp | grep 3333

Logs:

journalctl --user -u ckpool.service -f
journalctl --user -u minerd.service -f

19. Adjust threads or CPU cap

nano ~/.config/minerd/minerd.env

Example:

MINER_THREADS=4
CPU_QUOTA=200%

Restart:

systemctl --user restart minerd.service

20. Expected result

Example output:

thread 0: 16700 khash/s
thread 1: 16700 khash/s
thread 2: 16700 khash/s
thread 3: 16700 khash/s

Total:

~66.8 MH/s

Final Notes

  • This is lottery mining, not income generation
  • You are mining directly against your own node
  • You control the full stack: node → stratum → miner
  • This is useful for learning and sovereignty, not profit
  • You have a better chance of winning the powerball than getting a block reward, but the point is, you are now fully participating in the Bitcoin network!

Later you can point any ASICs you have to mine to the same stratum server if you really want to get serious about solo mining.


Write a comment
No comments yet.