How-To Guide: Monitor Your Bitcoin Miners on Umbrel with Public Pool and n8n
This guide walks you through setting up an automated system to monitor your Bitcoin miners using an Umbrel node running the Public Pool app, with alerts sent via email using n8n. You’ll learn how to check if your miners are online, verify their hashrate, and even detect if a block has been found. This is perfect for home miners who want peace of mind without constantly checking their setup.
What Is This Process?
You’ll need:
- Umbrel: A user-friendly operating system for running a Bitcoin node and other apps on a device like a Raspberry Pi.
- Public Pool: An Umbrel app that lets you run your own Bitcoin mining pool, connecting your miners to mine directly to your node. Of course you’ll need all the prerequisites for PP.
- n8n: An open-source automation tool (also an Umbrel app) that can fetch data, process it, and send alerts.
- Gmail: To send email alerts when something’s wrong with your miners.
The setup queries your local umbrel’s Public Pool’s API to check:
- Total Miners: How many miners are connected (e.g., 2 miners).
- Total Hashrate: The combined mining power (e.g., 1.5 TH/s or higher).
- Blocks Found: If your pool has successfully mined a Bitcoin block.
If the number of miners drops or the hashrate falls below a threshold, you’ll get an email alert. You can also check for newly found blocks as a bonus feature. I haven’t defined precisely how to do this, but I bet you’ll see the pattern and can figure this one out. 
Why Is This Needed?
Running Bitcoin miners at home is exciting, but it’s not set-and-forget. Miners can go offline due to power issues, network problems, or hardware failures. A low hashrate might mean a miner is underperforming or even offline. Without monitoring, you could miss these issues for hours or days, wasting electricity and losing mining rewards. Plus, if your pool finds a block (a rare and awesome event), you’ll want to know immediately!
This system:
- Saves time by automating checks.
- Can Alert you instantly if something’s wrong.
- Lets you celebrate block wins without manual monitoring: If you code it - but I know you can do it.
- Runs entirely on your Umbrel, keeping everything local and private.
Prerequisites
Before starting, ensure you have:
- Umbrel Node: Set up and running.
- Public Pool App: Installed on your Umbrel via the Umbrel App Store. Configure it to connect your miners (e.g., Bitaxe).
- n8n App: Installed on your Umbrel via the App Store. This handles automation.
- Gmail Account: For sending alerts. You’ll need Gmail credentials (preferably OAuth2 or an App Password).
- Bitcoin Miners: Connected to your Public Pool (e.g., 2 miners with ~1.5 TH/s combined hashrate).
- Basic Network Access: Your Umbrel should be accessible at http://umbrel.local or a similar local address (e.g., http://192.168.1.1).
Step-by-Step Setup
Follow these steps to create the monitoring system.
Step 1: Verify Public Pool API Access
Public Pool provides a simple API to check your miners’ status. Let’s confirm it works.
- Open a Browser:
- On a device on the same network as your Umbrel, go to http://umbrel.local:2019/api/pool (replace umbrel.local with your Umbrel’s address, e.g., 192.168.1.1).
- Port 2019 is typically used by Public Pool.
- Check the Response:
- You should see JSON data like:
`{
"totalHashRate": 1975861260404.7617,
"blockHeight": 891926,
"totalMiners": 1,
"blocksFound": [],
"fee": 0
}`
- totalHashRate: Your miners’ combined hashrate (in hashes/second; divide by 10^12 for TH/s).
- totalMiners: Number of connected miners.
- blocksFound: Array of blocks your pool has mined (empty if none).
- If you get an error or HTML instead, ensure Public Pool is running and try other ports (e.g., 2018).
- Note the URL:
Step 2: Set Up n8n on Umbrel
n8n will fetch the API data, check conditions, and send emails.
- Install n8n:
- Log In to n8n:
- Set up an admin account if prompted (save your credentials securely).
- You’ll land on the n8n workflow editor.
Step 3: Create the n8n Workflow
We’ll build a workflow to check miners, hashrate, and blocks, then send an email if something’s off.
- Start a New Workflow:
- In n8n, click New to create a blank workflow.
- Add a Cron Node (Schedule):
- Drag a Cron node from the left sidebar (under “Trigger”).
- Settings:
- Name: “Check Miners Every 3 Hrs”.
- Interval: Hour.
- Hour: Every 3
- This triggers the check periodically.
- Add an HTTP Request Node (Fetch API Data):
- Add an HTTP Request node, connected to the Cron node.
- Settings:
- Name: “Get Public Pool Data”.
- URL: http://umbrel.local:2019/api/pool (use your API URL from Step 1).
- Method: GET.
- Authentication: None (Public Pool’s API typically doesn’t require credentials).
- This fetches the JSON data (totalMiners, totalHashRate, blocksFound).
Here’s what you’ll get back from the API call:
{"totalHashRate":1975861260404.7617,"blockHeight":891926,"totalMiners":1,"blocksFound":[],"fee":0}
- Add an IF Node (Check Conditions):
- Add an IF node, connected to the HTTP Request node.
- Settings:
- Name: “Check Miners and Hashrate”.
- Conditions: Add two numeric conditions:
- Condition 1:
- Value 1: {{$json.totalHashRate}} (fetches hashrate from API).
- Operation: Smaller.
- Value 2: 1500000000000 (1.5 TH/s in hashes/second).
- Condition 2:
- Value 1: {{$json.totalMiners}}.
- Operation: Not Equal.
- Value 2: 2 (expects exactly 2 miners).
- Combine Operation: OR (alert if either condition is true).
- This checks if hashrate is below 1.5 TH/s OR miners aren’t exactly 2. You’ll adjust to your specifications. You could also add in logic to see if a block was found.
- Add a Gmail Node (Send Alert):
- Add an EmailSend node (search for “Gmail”), connected to the True output of the IF node.
- Settings:
- Name: “Send Miner Alert”.
- Credentials: Select or create Gmail credentials (see Step 4 below).
- From Email: your.email@gmail.com (replace with your Gmail address).
- To Email: Your email (e.g., your.email@gmail.com).
- Subject: “Miner Alert: Issue Detected”.
- Send HTML: Enable (toggle ON).
- HTML:
<p><strong>Warning: Miner issue detected!</strong></p>
<p>Total Miners: {{$json.totalMiners}}</p>
<p>Hashrate: {{($json.totalHashRate / 1000000000000).toFixed(2)}} TH/s</p>
<p>Blocks Found: {{$json.blocksFound.length > 0 ? 'Yes! Block found!' : 'None'}}</p>
<p>Check your miners on <a href="http://umbrel.local:2019">Public Pool</a>.</p>`
* **Note**: The Blocks Found line checks if blocksFound array has entries, alerting you to new blocks.
Step 4: Set Up Gmail Credentials
The Gmail node needs access to your Gmail account.
- Create Credentials:
- In n8n, go to Credentials → Add Credential → Select Gmail.
- Option 1: OAuth2 (Recommended):
- Option 2: App Password (Simpler but less secure):
- Enable 2FA on your Google account (myaccount.google.com/security).
- Generate an App Password (select “Mail” and “Other” → name it “n8n”).
- In n8n, enter your Gmail address and the App Password.
- Save the credential.
- Link to Gmail Node:
- In the Gmail node, select your new Gmail credential from the dropdown.
- Test the connection (n8n will confirm it works).
Step 5: Test the Workflow
Let’s ensure everything works.
- Run Manually:
- Click Execute Workflow in n8n.
- Watch the nodes:
- HTTP Request: Should return JSON with totalMiners, totalHashRate, blocksFound.
- IF: Should evaluate based on your miners (e.g., if totalMiners ≠2, it triggers the email).
- Gmail: Sends an email if conditions are met.
- Check Your Email:
- Open Gmail and look for an email with subject “Miner Alert: Issue Detected”.
- Expected body (example):
Warning: Miner issue detected! Total Miners: 1 Hashrate: 2.69 TH/s Blocks Found: None Check your miners on Public Pool.
- “Warning” is bold, “Public Pool” is a clickable link, and line breaks are clean.
- Simulate Issues:
- Disconnect a miner to drop totalMiners to 1.
- Run again to confirm an email is sent.
- Check if blocksFound shows “Yes! Block found!” when a block is mined (you may need to wait for this rare event).
Step 6: Activate and Monitor
- Save: Click Save in n8n.
- Activate: Toggle Active (top-right) to run every 5 minutes.
- Monitor your Gmail inbox for alerts. If miners go offline or hashrate drops below 1.5 TH/s, you’ll know instantly.
Troubleshooting
- No API Data:
- No Emails:
- Test Gmail credentials in n8n’s Credentials section.
- Check spam/junk in Gmail.
- Ensure the IF node triggers (use n8n’s Execution Log to debug).
- Messy Email Formatting:
- Confirm Send HTML is enabled in the Gmail node.
* Ensure the **HTML** field has no \n characters (use <p> tags for spacing).
- Check Gmail’s raw email source (three dots → Show original) for Content-Type: text/html.
- Wrong Alerts:
- Adjust 1500000000000 (1.5 TH/s) or 2 (miners) in the IF node to match your setup.
- Log API data with a Set Node to debug totalMiners and totalHashRate.
Tips
- Adjust Thresholds: If your miners’ hashrate changes (e.g., 2 TH/s), update the IF node’s totalHashRate condition.
- Add Logging: Use a Google Sheets or File Write node to track hashrate over time.
- Secure Your Umbrel: Ensure http://umbrel.local:2019/api/pool isn’t exposed to the internet (use a local firewall).
- Check Blocks Manually: If you suspect a block was found, visit Public Pool’s dashboard or recheck the API.