Search code examples
pythontransactionspaymentbitcoinverify

Using Electrum console to verify payments


I am trying to go about making a payment verification system, I found Electrum online and am now trying it out as it has a console that ties in with python. What I am wanting to do is: read from a text file full of BTC address, then search through the transaction history of my own address on Electrum to try and find one of the addresses from the file, after that I want it to find information about the transaction; e.g how much was paid and a comment or message. Is this possible to do this in the Electrum console? Or is there a better alternative. I have already looked into things such as GOURL and found that it seemed rather complex and confusing with the documentation they provided. Any help appreciated.


Solution

  • You may want to run electrum in daemon mode, for querying specifics of addresses and transactions. I've used the notify feature for this sort of thing, to react to payments sent to a specific address. You'll need an endpoint in your web application to handle the notifications, and despite the electrum docs stating a POST request is sent to your endpoint when activity is detected on a monitored address, it seems no data is included.

    So one approach is to include the monitored address in the endpoint you configure electrum to POST to:

    electrum notify <address> https://your.webapp/notice_receiver?addr=<address>

    You can then send RPC calls to your electrum daemon to examine the changes and process as needed.

    This doc may be helpful: Electrum Merchant Example