Using walletnotify

+1 vote
Hi

I was trying to use walletnotify as

multichaind chain_name walletnotify=/home/script.sh %m

And in my script, I'm just doing echo $1

The script gets triggered for transactions but I'm unable to see the parameter passed. What am I doing wrong?
asked Aug 28, 2017 by amolpednekar

1 Answer

+1 vote
 
Best answer

You need to pass the entire script with variables in a quoted parameter like this:

multichaind chain_name -walletnotify="/home/script.sh %m"

Alternatively add a line like this in multichain.conf then stop and restart MultiChain:

walletnotify=/home/script.sh %m

answered Aug 28, 2017 by MultiChain
selected Aug 29, 2017 by amolpednekar
Works perfectly now.

A related question - The event gets triggered twice when I do something like publishing to the stream? Why is this? Once when the node SEES the transaction and second when its CONFIRMED?

Perhaps the -walletnotify parameter in "MultiChain runtime parameters" page can be updated to show its usage as it is not immediately clear.
Thanks! :)
Yes, exactly – once when the transaction is seen and once when it's confirmed. You can use the %c parameter to differentiate between these cases.
...