Bitcoin Forum

Bitcoin => Electrum => Topic started by: BioMike on September 28, 2014, 09:49:28 AM



Title: Questions regarding Electrum on a server
Post by: BioMike on September 28, 2014, 09:49:28 AM
In the past I've used bitcoind on a server to run a web service and used bitcoind to arrange the payments. The problem was that the whole blockchain was too heavy in disc usage. For a different project I have to interface with the bitcoin network again, but bitcoind is out of the question. I'm looking into Electrum instead.

Things that I need for my project:
- query for a new address.
- periodically, check the balance of that address.
- sometimes send funds from the server to an other address.

I think I can manage do those things with Electrum (been playing a bit with it for now).

My question is how to interface with Electrum programmatically. I was thinking to use Python, but can't seem to find what to import and if there is a general class available that allows me to call the methods I need for the 3 things mentioned above.

I guess I can import Electrum from Python by using:

Code:
from Electrum import *

Right? And then? How would I continue then?

The server has no x/qt/gtk libraries, so everything has not to depend on those.


Title: Re: Questions regarding Electrum on a server
Post by: Abdussamad on September 30, 2014, 03:25:11 AM
You can do this via the command line. Type `electrum help` to see the available commands and `electrum help <command_name>` for command specific help.

As for balance checks in recent electrum versions it spawns a daemon that listens for multiple requests. The daemon automatically dies if no new requests are forthcoming. So you can do periodic bulk checks via  a cron job.


Title: Re: Questions regarding Electrum on a server
Post by: BioMike on October 03, 2014, 08:55:43 AM
You can do this via the command line. Type `electrum help` to see the available commands and `electrum help <command_name>` for command specific help.

As for balance checks in recent electrum versions it spawns a daemon that listens for multiple requests. The daemon automatically dies if no new requests are forthcoming. So you can do periodic bulk checks via  a cron job.

Thank you for your reply. I prefer to avoid calling the shell (the shellshock bug shows nicely why I don't like it), else I would not be asking the question.

Past few days I've been going through the code and started writing the python code to interface with Electrum in a programmable way. The problem that I'm running now in to is that the Electrum code is poorly documented and to my opinion made more complex than it should be (Wallet and WalletStore classes to mention one example).


Title: Re: Questions regarding Electrum on a server
Post by: Abdussamad on October 04, 2014, 01:16:46 AM
I don't know python very well but you could hire one of the electrum developers to make this for you.


Title: Re: Questions regarding Electrum on a server
Post by: BioMike on October 04, 2014, 06:51:55 AM
I don't know python very well but you could hire one of the electrum developers to make this for you.

Yeah, I know, but I managed yesterday to get the functionality that I needed working (except for the new addresses, but on second thought that isn't really needed for my project).