Php and Zcashd Optimization ideas (operation id)

Hello Dear Zcash Community,

I’m behind a problem since some days,
I develop an application which use php mainly(curl for request to zcash-cli, …) and zcash cli for linux.

Before start :

When a transaction are made, there is a ‘operation id’ number for get later result and error(or not) of transaction

The problems are:

  • Operation id have limit of call ( one or two) and disappear really fast of zcash node(still connected and synchronized)
  • Don’t stay in memory… (impossible to get an history for later verification)

My questions is : How to efficiently make and check a transaction on zcash mainnet network and php and bypass problem above ?
(Maybe in zcash.conf)

I’m really in doubt about this situation, I need, after making transaction, a way for check transaction multiple time,(if possible, without operation id) and stay in memory but How ?!!!

Thanks for your help
Cordially

Maybe the command line option walletnotify could help you. It will make zcashd execute a script when a transaction that affects your wallet occurs.

1 Like

Thanks for your answer,

I didn’t find walletnotify command on https://zcash-rpc.github.io !!

It was added to bitcoin but I can’t find it on any of the bitcoincore rpc call lists as well and I don’t run bitcoind to check -help

It is not a rpc but a command line argument when you launch zcashd.

2 Likes

expanding @hanh 's answer :

walletnotify example usage

in your zcash.conf

walletnotify=/home/myapp/handle_transaction.sh %s

in the above case handle_transaction.sh is a shell script that will be executed when you receive or send a transaction.
%s will have the tx id. ( I am not sure if it will called exactly once or not ! ). Please do some further research.

1 Like

It gets called twice - first time is when the transaction is received, second time is when it gets the first confirmation (ie: mined)

It also gets called when your node is ‘catching up’, when its been off for a while and is downloading blocks and the new blocks contain transactions for your wallet.

3 Likes

Finally,

I used this method : z_getoperationstatus - Zcash 4.5.1-1 RPC Docs who remain in memory until zcash node is shut down!