• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Detecting InstantSend transactions in a nodejs app.

Antti Kaikkonen

Active member
Prerequisites: node.js and npm, zeromq and of course Dash Core
1) Add this line to dash.conf:
then restart dash-qt or dashd.

2) Create a new directory, navigate to the directory in terminal/command prompt and then run

npm install zeromq
this should create a new directory "node_modules"

3) Create a new file "instansend-recorder.js" with the following content
var zmq = require('zeromq');

var sock = zmq.socket('sub');

sock.on('message', function(topic, message) {
  let topicStr = topic.toString('ascii');
  if (topicStr === "hashtxlock") {
    let txid = message.toString('hex');
    console.log("Detected InstantSend transaction: ", txid, new Date());
    //Add custom logic here
console.log("Started listening for InstantSend transactions");

4) run the app in terminal/command prompt
node instantsend-recorder.js

It will do nothing but print the txid and time when an InstantSend transaction is received. You can add your custom logic to for example process a payment.

Please note that if you don't have zeromq properly installed on your system, the application will still run but it doesn't detect any InstantSend transactions. You should test sending an InstantSend transaction to your own address to see if it will be properly detected.
Last edited: