Ethereum: Bitcoind WalletNotify More than 6 Confirmations
As a frequent user of the popular cryptocurrency wallet and node software, you’ve likely encountered the need for notifications from your wallet whenever certain events occur. In this article, we’ll explore how to set up WalletNotify
on Bitcoin Core (BTC) with PHP scripts to notify when more than 6 confirmations are received.
Understanding WalletNotify
Before diving into the solution, let’s quickly review what WalletNotify
does:
- When you configure
WalletNotify
, it sends notifications to your configured email address or other destinations as soon as certain events occur.
- The notification is triggered by callback signals sent from Bitcoin Core when specific actions are performed on your wallet.
Setting up PHP Scripts for Notifications
To send notifications with more than 6 confirmations, we’ll use a custom PHP script that’s connected to the WalletNotify
callback. Here’s an example of how you can set this up:
Step 1: Install Node.js and npm
Before proceeding, ensure your system has Node.js installed (version 14 or higher) along with npm (Node Package Manager). You can download both from [nodejs.org](
For Windows users:
npm install -g node
Step 2: Create a New PHP Script
Create a new file called notify.php
in your preferred directory, and add the following code:
// Set the Bitcoin Core wallet connection details
$bcConn = new BitcoinCore('
// Define the callback function to trigger notifications
function onNotify($cb, $result) {
// Log the notification data in the console
echo "Notification triggered: " . json_encode($result) . "\n";
// Send the notification via email or other destination (choose your method)
$email = "[email protected]"; // Replace with your email address
require_once 'vendor/autoload.php';
use MailChimp\MailChimp;
$mailchimp = new MailChimp("YOUR_API_KEY", "YOUR_SECRET_KEY");
$mailchimp->send("your_notification_group", "subject", "Notification: " . json_encode($result));
}
Step 3: Configure the PHP Script to Send Notifications with More Than 6 Confirmations
To send notifications when more than 6 confirmations are received, modify your bcconf.json
file (located in the Bitcoin Core directory) as follows:
"notify": {
"callback": onNotify,
"params": [
{
"callback": "confirm",
"method": "post",
"url": "
},
{
"callback": "confirm",
"method": "post",
"url": "
}
]
}
In this example, we’re configuring the notify
option to use two callback functions (confirm
) for notification delivery:
- The first confirmation callback is triggered when a new poll or form submission occurs.
- The second confirmation callback is triggered when a new transaction with more than 6 confirmations has been received.
Setting Up Bitcoin Core
To enable the notify
option in your Bitcoin Core installation, follow these steps:
- Download and install the latest version of Bitcoin Core from [bitcoin.org](
- Start Bitcoin Core (
bc --regen
) to update the configuration files.
- Configure the
bcconf.json
file with the necessary settings (e.g., notification email addresses, API keys).
Testing Your Configuration
After configuring your wallet and running the PHP script with more than 6 confirmations, you should receive notifications via email or another destination.
Keep in mind that this configuration requires a working Bitcoin Core node and a Mailchimp account to send emails.