Hey,
I'm trying to Setup a script that executes whenever my wallet receives a Transaction and found out that walletnotify is a good solution to that. Though there is really only one helpful thread about this on here and that thread's solution didn't work for me.(
https://bitcointalk.org/index.php?topic=203438.0)
I would prefer do this with nodejs, though I don't know nodejs's equivalent to argv and argv, so I tried the php solution that the above thread suggests:
my bitcoin.conf:
bitcoin.conf:
server=1
daemon=1
rpcuser=user
rpcpassword=password
walletnotify =/usr/bin/php /var/www/laravel/app/views/walletnotify.php %s
my walletnotify.php:
if(2==$argc){
require_once('/var/www/laravel/app/controllers/easybitcoin.php');
$bitcoin = new Bitcoin('user', 'password', 'localhost', '8332');
$walletinfo = $bitcoin->getinfo();
$trxinfo = $bitcoin->gettransaction($argv[1]);
// Append data to the file
$new = "\n\nTransaction hash: ".$argv[1]."\nGetinfo balance: ".$walletinfo["balance"]
."\n Gettransaction amount: ".$trxinfo["amount"]
."\n Gettransaction confirmations: ".$trxinfo["confirmations"]
."\n Gettransaction blockhash: ".$trxinfo["blockhash"]
."\n Gettransaction blockindex: ".$trxinfo["blockindex"]
."\n Gettransaction blocktime: ".$trxinfo["blocktime"]
."\n Gettransaction txid: ".$trxinfo["txid"]
."\n Gettransaction time: ".$trxinfo["time"]
."\n Gettransaction timereceived: ".$trxinfo["timereceived"]
."\n Gettransaction account: ".$trxinfo["details"][0]["account"]
."\n Gettransaction address: ".$trxinfo["details"][0]["address"]
."\n Gettransaction category: ".$trxinfo["details"][0]["category"]
."\n Gettransaction amount: ".$trxinfo["details"][0]["amount"]
//."\n Gettransaction fee: ".$trxinfo["details"][0]["fee"]
$fp=fopen("notify_wallet.txt","a");
fwrite($fp,$new);
}
with this i got the error "Undefined variable: argc", so I did some Research that led me to putting this into my php.ini(line 650):
I'm still getting the "undefined variable: argc" error though.
If anyone could help me out here, I would highly appreciate it!(If anyone knows how to do this with nodejs, that would be even better!)