I want to run a python script when occur an incoming transaction. I think set zapwallettxes flag in bitcoin.conf but I don't know where set the script path to execute.
Is it possible to execute another executable file or another language script?
You're looking for walletnotify
setting in bitcoin.conf
It will call the specified script for every transaction received for your own wallets.
walletnotify=/some/path/mywalletscript.py
Here mywalletscript.py
will handle the JSON data passed into it.
Here is a sample walletnotify implementation including database access. It's a bit dated but should give you an idea on how to handle events.
As per this Bitcointalk thread you can also hook up handlers for blocknotify
and alertnotify
so you can create your own payment system by receiving alerts, checking block confirmations and so on.
Just wire up a walletnotify
handler via bitcoin.conf as answered here and here.