0

I found a similar question, but rather outdated in my opinion: How to get instant notification of any Bitcoin transaction involving a specific public address as recipient without knowing the wallet or private key

I have a bitcoind running, however don't have any funds managed by it. I want to run a script by any transaction, which is going to one of my (many) addresses. All the addresses are not part of the bitcoind wallet.

The following I want to achieve:

  • Configure bitcoind with a list of my addresses (not part of the wallet), might be around 200
  • Remove some addresses (if not needed anymore) from watch notifications
  • Notifiy a script when a transaction to one of my addresses arrives (mempool transaction, no confirmations)
  • Notifiy when a transaction gets confirmed (first time, maybe also sixth time)

My Setup:

  • Newest version of bitcoin core (can be updated)
  • Scripts in PHP (could be other programming language with bindings to bitcoind)

Basically, I want to get the notification to the respective script. All relevant information can be crawled via the RPC API. However polling the bitcoind needs to be eliminated.

1 Answer 1

1

You can use the importaddress RPC to add addresses without associated private key to the wallet. The wallet code will now list transactions involve such addresses, and include them in balance calculations (though you may need to add an extra argument for includeWatchOnly to some RPC calls).

If you import an address that has existing confirmed transactions, you'll need to rescan, which is a lengthy and slow process. If you make sure you're importing before giving out the address anywhere (for example, because they're being generated on an offline treasure machine which you control), it's perfect though.

You'll get notifications in all the normal ways for these addresses, including using -walletnotify (with a shell script executed for each received or confirmed transaction), and ZMQ (if compiled and enabled).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.