Bitcoin Forum
September 20, 2024, 12:27:22 PM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: -walletnotify command  (Read 198 times)
Asaf1993 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 10, 2018, 01:48:10 PM
 #1

Hey, Could really use ur help!!

I have a node running on a VM, when I am trying to use walletnotify I am not getting anything.

My goal is to get an event listener on my wallet to notify when a relevant transaction is updated.

Tried both walletnotify and blocknotify - non of them worked..

I am writing Java and communicating with the node via JSON RPC impl'

My .conf file:

testnet=1
rpcuser=rpcuser
rpcpassword=rpcpassword
rpcallowip=0.0.0.0/0
rpcbind=0.0.0.0
walletnotify="echo %s | nc REMOTE_IP PORT"

on the other end I can validate that the socket is open and listening on the specific port.

Can some one help??
TNX!!!
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
June 10, 2018, 01:57:02 PM
 #2

walletnotify="echo %s | nc REMOTE_IP PORT"


You might try it with

Code:
walletnotify=/path/to/your/script.sh %s

Then inside your script.sh you can access the TXID with $1


Note that walletnotify is called when you (1) receive a transaction, (2) send a transaction and (3) a received transaction got its first confirmation.
blocknotify is called each time a new block is received. In this case the block hash is being passed as the argument.

Asaf1993 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 10, 2018, 02:14:47 PM
 #3

Hey.
So I tried to make the adjustments and start with something simple as echo "Hello" within the .sh file.

litecoin.conf:
walletnotify=/home/node_scripts/example.sh

The file exists on that path..
I restarted the core after modifying the .conf file but still not working.

Any ideas?
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
June 10, 2018, 04:49:21 PM
 #4

walletnotify=/home/node_scripts/example.sh

You need to pass the argument (TX ID) to your script. Put %s at the end:

Code:
walletnotify=/home/node_scripts/example.sh %s



Mind posting your shell script to see if you have made a mistake there?

HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4318

<insert witty quote here>


View Profile
June 10, 2018, 09:52:31 PM
 #5

Another thing that you might want to do is to check the permissions for the script and/or the directory that it is contained in. Does the user that litecoind is running as have permission to read/execute that script? Huh

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Asaf1993 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 12, 2018, 08:17:17 AM
 #6

Tried also with adding %s to the script,

Regarding permissions I gave the .sh file 777 permissions but still not luck  Huh Huh Huh

Anymore ideas?

Tnx!
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4318

<insert witty quote here>


View Profile
June 12, 2018, 09:41:53 AM
 #7

To rule out issues with networking and the VM... Have you tried a really simple script that just writes something to a file on the local (VM) disk?

This will at least confirm that the walletnotify functionality is working... you can then attempt to troubleshoot why your script is not working (ie. try running the script manually etc.)

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
June 12, 2018, 10:23:02 AM
 #8

Regarding permissions I gave the .sh file 777 permissions but still not luck

Did you also check whether the user who is running the daemon does have permission (read and execute) on the directory?
Because usually user do NOT have permissions to read the home directory of another user (/home/node_scripts/).

Asaf1993 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 17, 2018, 01:09:02 PM
 #9

Regarding permissions I gave the .sh file 777 permissions but still not luck

Did you also check whether the user who is running the daemon does have permission (read and execute) on the directory?
Because usually user do NOT have permissions to read the home directory of another user (/home/node_scripts/).

I am not 100% sure what do u mean by the user which is running the process but, litecoind owned by root and the script is owned by a user which is part of sudoers. The script has 777 permissions, Does the bitcoind process should have a permission for this file as well?
Asaf1993 (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
June 17, 2018, 03:27:44 PM
 #10

I managed to solve the problem,

When I started litecoind with -walletnotify='/full/path/to/script.sh %s' it worked.

Tnx everyone for the effort!

I tried to lock this thread but I couldn't understand how  Undecided

If some one can show me or one of the admins can shut it down by himself it would be great/
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4318

<insert witty quote here>


View Profile
June 18, 2018, 03:49:50 AM
Last edit: November 15, 2023, 07:57:14 AM by HCP
 #11

I managed to solve the problem,
Awesome... glad you got it sorted.

Quote
I tried to lock this thread but I couldn't understand how  Undecided
If some one can show me or one of the admins can shut it down by himself it would be great/
Bottom left hand corner just about the "Quick Reply" box is a link that says "Lock Topic"... click that.


or

Edit the 1st post, click "Additional Options"... then check the "Lock Topic" and click "save" (Adding [SOLVED] tag to the subject line is also recommended):


█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!