Bitcoin Forum

Bitcoin => Electrum => Topic started by: bnbstorm on January 31, 2023, 08:41:33 PM



Title: Request address balance from any Electrum server
Post by: bnbstorm on January 31, 2023, 08:41:33 PM
Hello
Can we request an Electrum server to tell us balance of an address? As electrum software does this by querying these servers to get balances of addresses so can we do this manually in browser or through some short code? What will be the process?
Can Electrum servers be used to confirm payments for website invoices?
Thanks


Title: Re: Request address balance from any Electrum server
Post by: Stalker22 on January 31, 2023, 09:18:14 PM
Why do you need an Electrum server when you can check the balance of any address on any blockchain explorer or via numerous blockchain APIs??
Or am I missing something here?


Title: Re: Request address balance from any Electrum server
Post by: bnbstorm on January 31, 2023, 09:26:25 PM
Why do you need an Electrum server when you can check the balance of any address on any blockchain explorer or via numerous blockchain APIs??
Or am I missing something here?


API usually have limits to check balances like you can request X amount of addresses in X seconds. some also require KYC. If we can query our own server or multiple public servers then it is decentralized way.


Title: Re: Request address balance from any Electrum server
Post by: Charles-Tim on January 31, 2023, 09:52:17 PM
Can we request an Electrum server to tell us balance of an address?
Just that if you use Electrum server, you are running your own node, but you can import the addresses just like the normal way on Electrum and see the coin balance after the addresses import.

Can Electrum servers be used to confirm payments for website invoices?
If you need what to help you process transactions for your website, it would be better to make use of a payment processor, check the list of payment processor. (https://bitcointalk.org/index.php?topic=5259548.0)


Title: Re: Request address balance from any Electrum server
Post by: DireWolfM14 on January 31, 2023, 10:29:53 PM
Hello
Can we request an Electrum server to tell us balance of an address? As electrum software does this by querying these servers to get balances of addresses so can we do this manually in browser or through some short code? What will be the process?
Can Electrum servers be used to confirm payments for website invoices?
Thanks

Yes, there is.  Install and run your own blockchain explorer.  Mempool.space is easy enough to install.  Blocstream can also be installed locally and used as a private blockchain explorer.  The easiest thing to do is follow Charles-Tim's suggestion; i.e. import all the public addresses into an Electrum watch-only wallet.


Title: Re: Request address balance from any Electrum server
Post by: bnbstorm on February 01, 2023, 12:07:03 AM
Hello
Can we request an Electrum server to tell us balance of an address? As electrum software does this by querying these servers to get balances of addresses so can we do this manually in browser or through some short code? What will be the process?
Can Electrum servers be used to confirm payments for website invoices?
Thanks

Yes, there is.  Install and run your own blockchain explorer.  Mempool.space is easy enough to install.  Blocstream can also be installed locally and used as a private blockchain explorer.  The easiest thing to do is follow Charles-Tim's suggestion; i.e. import all the public addresses into an Electrum watch-only wallet.

Importing watch only is a manual process. I am looking for a programmable solution. In which we can send requests to electrum servers. Like simple http or json requests



Can we request an Electrum server to tell us balance of an address?
Just that if you use Electrum server, you are running your own node, but you can import the addresses just like the normal way on Electrum and see the coin balance after the addresses import.

Can Electrum servers be used to confirm payments for website invoices?
If you need what to help you process transactions for your website, it would be better to make use of a payment processor, check the list of payment processor. (https://bitcointalk.org/index.php?topic=5259548.0)

Thank you. I understand payment processors and already went through this list. I want to query data from Electrum servers or nodes.


Title: Re: Request address balance from any Electrum server
Post by: DireWolfM14 on February 01, 2023, 03:11:26 AM
Importing watch only is a manual process. I am looking for a programmable solution. In which we can send requests to electrum servers. Like simple http or json requests

You'll have to forgive me, I'm trying to guess what you're trying to do, you haven't given us many details.  It sounds like you want to take the addresses from your website sales, and automatically check their balances.  You can do that with the Electrum client.  You can copy the entire list of public addresses and paste them into a new or existing watch-only wallet.  It's manual, but doesn't take very much time.  You don't have to do one address at a time.

I imagine you (or someone) can write a script that exports your web sales, extracts the addresses, and creates a new wallet with those addresses.  It's beyond my skills, but I reckon it's possible.  As for something that already exists that will do what you want, I don't know about anything.


Title: Re: Request address balance from any Electrum server
Post by: pooya87 on February 01, 2023, 04:55:02 AM
API usually have limits to check balances like you can request X amount of addresses in X seconds. some also require KYC. If we can query our own server or multiple public servers then it is decentralized way.
They place those limits to prevent spam, after all their computer (server) can only handle so many requests before it hangs. It is going to be the same with an Electrum node, they are not designed to handle too many requests either and I believe they may end up banning your IP.

Generally speaking Electrum is not designed for scaling, it is designed for convenience and ease of use for regular users with small number of addresses to check. Depending on the size of your requests it is best if you run your own indexed node.


Title: Re: Request address balance from any Electrum server
Post by: nc50lc on February 01, 2023, 05:36:33 AM
Can Electrum servers be used to confirm payments for website invoices?
It's possible if you can mimic Electrum's connection with the servers (it's open-source): github.com/spesmilo/electrum/blob/master/electrum/network.py (http://github.com/spesmilo/electrum/blob/master/electrum/network.py)
For example, there are other clients/wallets that can use Electrum's server like "Blue" and "Sparrow" to mention a few.

But as mentioned above, most Electrum server implementations have even smaller limits than blockexplorer APIs, which is set by default.


Title: Re: Request address balance from any Electrum server
Post by: bnbstorm on February 01, 2023, 08:39:46 AM
Importing watch only is a manual process. I am looking for a programmable solution. In which we can send requests to electrum servers. Like simple http or json requests

You'll have to forgive me, I'm trying to guess what you're trying to do, you haven't given us many details.  It sounds like you want to take the addresses from your website sales, and automatically check their balances.  You can do that with the Electrum client.  You can copy the entire list of public addresses and paste them into a new or existing watch-only wallet.  It's manual, but doesn't take very much time.  You don't have to do one address at a time.

I imagine you (or someone) can write a script that exports your web sales, extracts the addresses, and creates a new wallet with those addresses.  It's beyond my skills, but I reckon it's possible.  As for something that already exists that will do what you want, I don't know about anything.
API usually have limits to check balances like you can request X amount of addresses in X seconds. some also require KYC. If we can query our own server or multiple public servers then it is decentralized way.
They place those limits to prevent spam, after all their computer (server) can only handle so many requests before it hangs. It is going to be the same with an Electrum node, they are not designed to handle too many requests either and I believe they may end up banning your IP.

Generally speaking Electrum is not designed for scaling, it is designed for convenience and ease of use for regular users with small number of addresses to check. Depending on the size of your requests it is best if you run your own indexed node.
Can Electrum servers be used to confirm payments for website invoices?
It's possible if you can mimic Electrum's connection with the servers (it's open-source): github.com/spesmilo/electrum/blob/master/electrum/network.py (http://github.com/spesmilo/electrum/blob/master/electrum/network.py)
For example, there are other clients/wallets that can use Electrum's server like "Blue" and "Sparrow" to mention a few.

But as mentioned above, most Electrum server implementations have even smaller limits than blockexplorer APIs, which is set by default.

Thank you all for such generous response. I understand it now. I thought maybe these servers are limit less and work like nodes where we can query data. Was thinking to make a custom payment processor but it seems not possible with this approach.
Thank you


Title: Re: Request address balance from any Electrum server
Post by: ABCbits on February 01, 2023, 12:22:14 PM
Can Electrum servers be used to confirm payments for website invoices?
It's possible if you can mimic Electrum's connection with the servers (it's open-source): github.com/spesmilo/electrum/blob/master/electrum/network.py (http://github.com/spesmilo/electrum/blob/master/electrum/network.py)

Or just read Electrum protocol documentation[1].

But as mentioned above, most Electrum server implementations have even smaller limits than blockexplorer APIs, which is set by default.

And the limit is rather complex. Aside from maximum data size, there's also response delay after hitting soft limit and maximum connection[2].

I thought maybe these servers are limit less and work like nodes where we can query data. Was thinking to make a custom payment processor but it seems not possible with this approach.
Thank you

But unlike Electrum server, you can't just request specific data based on known address/txid to Bitcoin node. Most node implementation also have limit maximum upload/day.

[1] https://electrumx.readthedocs.io/en/latest/protocol-basics.html (https://electrumx.readthedocs.io/en/latest/protocol-basics.html)
[2] https://electrumx.readthedocs.io/en/latest/environment.html#envvar-INITIAL_CONCURRENT (https://electrumx.readthedocs.io/en/latest/environment.html#envvar-INITIAL_CONCURRENT)


Title: Re: Request address balance from any Electrum server
Post by: bnbstorm on February 01, 2023, 12:37:41 PM
Can Electrum servers be used to confirm payments for website invoices?
It's possible if you can mimic Electrum's connection with the servers (it's open-source): github.com/spesmilo/electrum/blob/master/electrum/network.py (http://github.com/spesmilo/electrum/blob/master/electrum/network.py)

Or just read Electrum protocol documentation[1].

But as mentioned above, most Electrum server implementations have even smaller limits than blockexplorer APIs, which is set by default.

And the limit is rather complex. Aside from maximum data size, there's also response delay after hitting soft limit and maximum connection[2].

I thought maybe these servers are limit less and work like nodes where we can query data. Was thinking to make a custom payment processor but it seems not possible with this approach.
Thank you

But unlike Electrum server, you can't just request specific data based on known address/txid to Bitcoin node. Most node implementation also have limit maximum upload/day.

[1] https://electrumx.readthedocs.io/en/latest/protocol-basics.html (https://electrumx.readthedocs.io/en/latest/protocol-basics.html)
[2] https://electrumx.readthedocs.io/en/latest/environment.html#envvar-INITIAL_CONCURRENT (https://electrumx.readthedocs.io/en/latest/environment.html#envvar-INITIAL_CONCURRENT)

Yes it seems this is the way. I am thinking to learn more about BTCPay server as it seems to be best and leading solution of all payment problems.
Thanks for your recommendations I will go through Electrum documentation as well.