Author

Topic: Electrum to notify on address status change (CLI) (Read 167 times)

legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
I understand that these messages to backend reflects changes on address (confirmations)
status is hash of transaction history, ok. You said "status" is useless.

How I can confirm payment? if "status" would be equal to transaction ID - I can check it my "electrum get_tx_status txID"? but..

thanx.
It isn't. The script hash format is defined here: https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-basics.html#status. You can't reverse the SHA256 hash, you cannot get the inputs of that specific hash. This command merely indicates that there has been some changes to the address, ie getting confirmed or having new transactions. If you want, then you can call getaddresshistory whenever the status changes.
newbie
Activity: 3
Merit: 0
How I can check status of transactions from the hash of the transaction history ?
hash of tx history is not tx_hash (I can check tx_hash on blockchain)
The method got changed to blockchain.scripthash.subscribe. You can't. The hash orders the transactions in specific order together with their confirmations, -1 for unconfirmed and 0 for confirmed. The way this works is for scripts to monitor and compare the hashes between different calls and they will know that there is either a new transaction or an unconfirmed transaction has gotten a confirmation, this allows for a quick and easy way to determine the status of transactions without much hassle. It's a one way function so you can't get the list from the hash alone.

If you want to get the list of transaction and it's information, you should be looking at blockchain.scripthash.get_history.

what is a typical workflow to get notified and confirm transaction (1 is enough)?

1 electrum daemon -d
2 electrum load_wallet

then JSONRPC calls:

3 electrum getunusedaddress
{"id":"myquery","method":"getunusedaddress","params":[]}
=>>>>
{
    "id": "myquery",
    "jsonrpc": "2.0",
    "result": "tb1qfzvln0uccwvqf9n727l9eyaaklyhpprru5rhyj"
}

display address for payer person

4 set notify to backend
{"jsonrpc":"2.0","id":"curltext","method":"notify", "params": {"address":"tb1qfzvln0uccwvqf9n727l9eyaaklyhpprru5rhyj", "URL":"192.168.0.1/notify"}}

when person pays I get responses at backend:

{
  address: 'tb1qfzvln0uccwvqf9n727l9eyaaklyhpprru5rhyj',
  status: '3a54b412d59fcad712f3d6f8120b65f3bd670b448a2ec7ae238b3ec05ec4d8e4'
}

{
  address: 'tb1qfzvln0uccwvqf9n727l9eyaaklyhpprru5rhyj',
  status: 'd28c3faa2a3632f33d2bae516f2bc6b79f94c0ef58f914aeead9ff29bf4015e3'
}

{
  address: 'tb1qfzvln0uccwvqf9n727l9eyaaklyhpprru5rhyj',
  status: 'a47c8b54068215ff6e5c672e870a81a11d590924fb82ab3d30539715f79c61c9'
}

I understand that these messages to backend reflects changes on address (confirmations)
status is hash of transaction history, ok. You said "status" is useless.

How I can confirm payment? if "status" would be equal to transaction ID - I can check it my "electrum get_tx_status txID"? but..

thanx.


legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
How I can check status of transactions from the hash of the transaction history ?
hash of tx history is not tx_hash (I can check tx_hash on blockchain)
The method got changed to blockchain.scripthash.subscribe. You can't. The hash orders the transactions in specific order together with their confirmations, -1 for unconfirmed and 0 for confirmed. The way this works is for scripts to monitor and compare the hashes between different calls and they will know that there is either a new transaction or an unconfirmed transaction has gotten a confirmation, this allows for a quick and easy way to determine the status of transactions without much hassle. It's a one way function so you can't get the list from the hash alone.

If you want to get the list of transaction and it's information, you should be looking at blockchain.scripthash.get_history.
newbie
Activity: 3
Merit: 0
Check out the documentation:

blockchain.address.subscribe

A request to send to the client notifications when status (i.e., transaction history) of the given address changes. Status is a hash of the transaction history. If there isn’t any transaction for the address yet, the status is null.


You will get notified, but still have to request the history to actually get the new transactions if you want to parse and/or react to them.

The documentation contains all necessary commands to get the information you are looking for. It is worth checking out.

How I can check status of transactions from the hash of the transaction history ?
hash of tx history is not tx_hash (I can check tx_hash on blockchain)
newbie
Activity: 9
Merit: 6
Hey,

I guess I started to read Electrum Protocol section but content was marked as outdated (redirecting to ElectrumX doc) so I may have missed it. Anyways.

Thank you so much for your help !
legendary
Activity: 1624
Merit: 2481
Check out the documentation:

blockchain.address.subscribe

A request to send to the client notifications when status (i.e., transaction history) of the given address changes. Status is a hash of the transaction history. If there isn’t any transaction for the address yet, the status is null.


You will get notified, but still have to request the history to actually get the new transactions if you want to parse and/or react to them.

The documentation contains all necessary commands to get the information you are looking for. It is worth checking out.
newbie
Activity: 9
Merit: 6
Hello,

As a developer, I've been testing Electrum command line interface (as well as JSON RPC) for some days to receive payments through my web apps.

I've been trying to use notify (address, [url]) command to get notified every time a wallet's address status changes.

It works quite well, I receive JSON responses but I don't know how to process the status string, which appears to be encoded. I don't know whether this is a binary or encrypted string actually.

Typical JSON response:

Code:
{"address": "tb1poly23484gvhb9atztrvaydzh0t9hcadncrmba1", "status": "34a4e9286fa705980e42edbc95db515593d46f30164f8d45d4b2387e0541b211"}

I may be missing something obvious but I haven't found specific documentation on this.

I tested this with Electrum 4.0.7 and a read-only Testnet wallet.

Any further information ?

Thanks





Jump to: