Ethereum: Bitcoind WalletNotify More than 6 Confirmations
As a frequent user of the popular cryptocurrency node and wallet software, you’ve probably encountered the need to receive notifications from your wallet whenever certain events occur. In this article, we’ll explore how to set up WalletNotify
in Bitcoin Core (BTC) with PHP scripts to notify when more than 6 confirmations are received.
Understanding WalletNotify
Before we dive into the solution, let’s quickly review what WalletNotify
does:
- When you set up
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 hooked into the WalletNotify
callback. Here’s an example of how you can set it up:
Step 1: Install Node.js and npm
Before you continue, make sure your system has Node.js (version 14 or higher) installed 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 connection details for the Bitcoin Core wallet
$bcConn = new BitcoinCore('
// Define the callback function to trigger notifications
function onNotify($cb, $result) {
// Log the notification data to the console
echo "Notification triggered: " . json_encode($result) . "\n";
// Send the notification via email or other destination (choose your method)
$email = "your_email@example.com"; // 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 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 are configuring the notify
option to use two callback functions (confirm
) callback for notification delivery:
- The first confirmation callback is triggered when a new survey or form submission occurs.
- The second confirmation callback is triggered when a new transaction with more than 6 confirmations has been received.
Configuring Bitcoin Core
To enable the notify
option on 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 you configure your wallet and run the PHP script with more than 6 confirmations, you should receive notifications via email or other destination.
Please note that this setup requires a running Bitcoin Core node and a Mailchimp account to send emails.