Abstract / Overview
Direct answer: A Raspberry Pi can coordinate Bitcoin mining, but cannot profitably mine with its CPU. Use it as a low-power controller for USB ASIC sticks or as a learning node. This article rewrites and modernizes the classic “Bitcoin Mining Using Raspberry Pi” tutorial into a 2025-ready playbook: wallets, pools, secure configuration, BFGMiner from source, headless service, health checks, logging, and realistic ROI notes. Assumption: Raspberry Pi 4/5, clean Raspberry Pi OS 64-bit, basic Linux familiarity.
Important to READ: https://www.c-sharpcorner.com/article/can-you-make-money-mining-cryptocurrency-with-a-raspberry-pi-in-2025/
![raspberry-pi-crypto-mining-hero]()
Two quick facts that frame expectations:
Network difficulty rose by orders of magnitude since 2015. Consumer CPUs earn effectively $0/month on SHA-256.
Energy is the dominant cost driver. Industrial ASICs reach >100 TH/s at ~3 kW. A Pi CPU reaches ~0.02 MH/s at ~5 W.
Use the Pi to learn, to supervise USB ASICs, to run nodes, or to stake PoS chains. Do not expect Pi-only mining profits.
Hero image filename: bitcoin-mining-raspberry-pi-2025-hero.png
Conceptual Background
Bitcoin basics. Miners assemble transactions into blocks and search for a nonce that satisfies a network target. See the conceptual overviews on Blockchain fundamentals and consensus basics.
Why pools exist. Solo success is statistically improbable for small hash rates. Pools smooth rewards by paying for contributed “shares.”
Why Pi CPU fails for SHA-256. ASICs outclass general CPUs/GPUs by many orders of magnitude on SHA-256. The Pi is ideal as a controller, not as a workhorse.
Where Pi still shines. Low power, always-on host; USB management; telemetry; secure tunneling; running a full node; education.
Step-by-Step Walkthrough
1) Prepare wallet and pool
Wallet. Create a mainnet wallet and back up its seed securely (paper or hardware wallet). Never mine to an exchange deposit address.
Pool. Register at any reputable Bitcoin pool. Create a worker credential (name + password or token). Note the Stratum endpoint, port, and your payout address.
2) Hardware checklist
Raspberry Pi 4 (4–8 GB) or Pi 5.
32 GB+ microSD (or SSD via USB 3.0).
Stable Ethernet or Wi-Fi.
Powered USB hub if using USB ASIC sticks (GekkoScience-class or similar).
Optional: small OLED/LCD for status, heat-sinks/fans for ASIC sticks.
3) Base OS and packages
# Update base system
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y git build-essential pkg-config \
autoconf automake libtool \
libusb-1.0-0-dev libcurl4-openssl-dev libjansson-dev \
libncurses5-dev screen tmux fail2ban ufw jq
Notes:
libusb
, libcurl
, and jansson
are required by most miners.
screen
/tmux
let you detach mining sessions.
ufw
and fail2ban
harden SSH.
4) Build BFGMiner from source (2025-ready)
cd ~
git clone https://github.com/luke-jr/bfgminer.git
cd bfgminer
./autogen.sh
./configure --enable-scrypt --with-libudev
make -j$(nproc)
sudo make install
Verify:
bfgminer --version
5) Connect USB ASIC(s)
lsusb
dmesg | tail -n 50
Thermal note: small fans materially improve stability and frequency.
6) One-shot mining command (replace placeholders)
bfgminer \
-o stratum+tcp://POOL_HOST:PORT \
-u YOUR_POOL_USERNAME.WORKER \
-p YOUR_WORKER_PASSWORD \
-S all \
--api-listen --api-allow W:127.0.0.1
Interpretation:
Current speed: MH/s, GH/s, or TH/s.
Accepted shares: valid contributions to pool work.
HW errors: keep this low; add cooling or tune clocks.
Stale shares: reduce by improving network latency.
7) Run as a systemd service (headless)
Create service unit:
sudo tee /etc/systemd/system/bfgminer.service >/dev/null <<'EOF'
[Unit]
Description=BFGMiner service
After=network-online.target
Wants=network-online.target
[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi
ExecStart=/usr/local/bin/bfgminer -o stratum+tcp://POOL_HOST:PORT \
-u YOUR_POOL_USERNAME.WORKER -p YOUR_WORKER_PASSWORD -S all \
--api-listen --api-allow W:127.0.0.1
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now bfgminer
sudo systemctl status bfgminer --no-pager
journalctl -u bfgminer -f
8) Firewall and SSH hardening
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw enable
# Optional fail2ban basic enablement
sudo systemctl enable --now fail2ban
9) JSON-based config for repeatability
{
"mining": {
"pool": "stratum+tcp://POOL_HOST:PORT",
"user": "YOUR_POOL_USERNAME.WORKER",
"pass": "YOUR_WORKER_PASSWORD",
"devices": "all",
"api_listen": true,
"api_allow": "W:127.0.0.1",
"log_file": "/home/pi/miner.log",
"env": {
"GPU_USE_SYNC_OBJECTS": "1"
}
}
}
Persist this to /home/pi/miner.json
, then:
bfgminer --config /home/pi/miner.json
10) Monitoring and alerts
Use watch -n 5 "bfgminer --api-listen --api-allow W:127.0.0.1 --debug | tail"
for quick checks.
Push logs to a remote syslog or lightweight stack (e.g., promtail
→ loki
).
Alert on hashrate drop, high HW error rate, device disconnects, and temperature thresholds.
Diagram: End-to-End Mining Topology (Raspberry Pi Controller)
![raspberry-pi-usb-asic-mining-topology]()
Use Cases / Scenarios
Education. Learn pools, Stratum, shares, difficulty, and device tuning.
USB ASIC controller. Pi runs cool and stable for 24/7 device orchestration.
Node operation. Run a Bitcoin full node on external SSD and keep the miner separate.
Telemetry gateway. Export metrics to dashboards for lab or classroom demos.
For conceptual primers and developer-oriented context, see Blockchain basics, hashing, and public-key cryptography.
Limitations / Considerations
Profitability. Pi CPU mining yields effectively zero. USB ASIC sticks add only modest hashrate; most users remain net-negative after power costs.
Volatility. BTC price, fees, and difficulty vary. Do not borrow to buy hardware.
Thermals. USB sticks can throttle or error without airflow.
Security. Treat wallets and pool creds like production secrets.
Aging tutorials. Pool endpoints, ports, and miner flags change; always verify current docs.
Fixes (Common Pitfalls and Solutions)
Miner builds, but the devices are not detected. Confirm lsusb
; add udev
rules; use a powered hub; try different cable/port.
High HW error rate. Lower clock or increase cooling; check 5V rail stability.
Many stale shares. Improve network path; pick a closer pool endpoint.
Service restarts repeatedly. Inspect journalctl -u bfgminer
; test in foreground to isolate flags.
Payouts not arriving. Verify payout threshold and address; check pool dashboard; confirm worker actually submitting accepted shares.
FAQs
Is CPU-only mining on a Pi worth it?
No. Treat it as a demo only.
Which miner should I use?
BFGMiner remains a solid choice for USB ASICs. Cgminer forks also exist. Build from source for ARM stability.
How many USB sticks per Pi?
CPU is not the bottleneck. Power and cooling are. Start with 1–3 sticks on a robust powered hub.
Can I solo mine with sticks?
Statistically pointless. Use pools.
Can I mine altcoins with a Pi?
For SHA-256 altcoins, the same ASIC dynamic applies. For CPU-friendly coins, a Pi’s performance remains low. Consider running nodes instead.
References
Conclusion
Use the Raspberry Pi as a controller and learning platform, not as the main hasher. Attach USB ASICs if you want to see real shares and payouts, but keep expectations conservative. Focus on correctness, security, and observability. If profit is the goal, the correct lever is industrial ASIC hardware plus cheap energy, not the Pi’s CPU.
Disclaimer
This material is educational, not financial, investment, tax, or legal advice. Cryptocurrency prices, mining difficulty, fees, and pool policies change without notice and can render configurations unprofitable. Verify local laws, export controls, KYC/AML rules, and tax obligations before operating miners or receiving payouts. Use strong operational security for wallets, seeds, and pool credentials. Mining hardware draws continuous current and produces heat; follow electrical and fire-safety standards and use powered USB hubs rated for your load. You are responsible for backups, data loss, pool trust, firmware integrity, and any damage to hardware or facilities. No warranty or guarantees of earnings or outcomes are provided.