json rpc – Easy methods to use `blockchain.scripthash.subscribe` from a tcp socket in Electrum server

0
75


As a private train I wish to write a minimal copy of BTCPayServer. I made a decision to make use of Electrum server as an alternative of a node to fetch info from the community. My closing purpose is to have the ability to observe the transactions obtained by an tackle, however to this point I am caught. I used to be ready to make use of blockchain.scripthash.get_balance after some work, however now I am having points with blockchain.scripthash.subscribe. There are 2 issues that confuse me:

  1. This methodology is meant to ascertain a subscription and return a notification each time the scripthash modifications, as defined right here. How are these notifications returned? If I maintain the tcp socket open for too lengthy, the connection is ultimately closed. After I learn the jsonrpc spec, notifications are extra akin to one thing the shopper sends to the server, not the opposite manner round.

  2. How can I decode the returned standing? I’ve learn the electrumx’s docs, however I am undecided find out how to reverse this final step

  1. The standing of the script hash is the sha256() hash of the total string expressed as a hexadecimal string, or null if the string is empty as a result of there aren’t any transactions.

I might actually respect it if anybody has any expertise, or can level me to some code/articles that specify intimately find out how to correctly combine electrum.

LEAVE A REPLY

Please enter your comment!
Please enter your name here