Bitcoin Forum

Bitcoin => Electrum => Topic started by: BlackHatCoiner on April 23, 2021, 08:42:43 AM



Title: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 23, 2021, 08:42:43 AM
I have been experimenting with electrum as a wallet since I learnt about bitcoin, a year ago, and I can admit that it's the simplest and most useful one. I'd like to run my own electrum server, but not for privacy reasons, just for exercise. I also have bought a Windows VPS that isn't being used at the moment, so why not providing it to the electrum community?

I picked electrumx (https://github.com/spesmilo/electrumx), because it's the most popular implementation. It seems that I can't install it on windows, only on unix. The thing is that I don't have an Ubuntu installed right now. Could this work with Windows 10 on an Ubuntu LTS?

Other questions too:
  • Is the same procedure if I want to run a testnet server? I don't have the storage for downloading the entire blockchain.
  • How does it return the balance of address(es) instantly? On Bitcoin Core it has to rescan the blockchain (which will take a lot of time).
  • Will I be shown on others' network servers? If no, how can I be shown?


Title: Re: [Questions] Running my own electrum server
Post by: HCP on April 23, 2021, 09:07:02 AM
I also have bought a Windows VPS that isn't being used at the moment, so why not providing it to the electrum community?
Be wary of any storage, bandwidth or CPU caps that your VPS has... an Electrum server isn't necessarily "huge" in terms of requirements, but cheap VPSes often have relatively low caps.


I picked electrumx (https://github.com/spesmilo/electrumx), because it's the most popular implementation. It seems that I can't install it on windows, only on unix. The thing is that I don't have an Ubuntu installed right now. Could this work with Windows 10 on an Ubuntu LTS?
Possibly... I've run other Electrum servers on WSL (ie. electrs) but it's obviously not ideal for performance reasons (and you're also doubling up on OS storage space requirements.)


  • Is the same procedure if I want to run a testnet server? I don't have the storage for downloading the entire blockchain.
usually you need a fully synced, unpruned node, running with txindex=1... and you set the "network" type in electrumx and then point it at the appropriate data directory.

  • How does it return the balance of address(es) instantly? On Bitcoin Core it has to rescan the blockchain (which will take a lot of time).
you'll want to read up about SPV and bloom filters. ;) but ElectrumX basically builds its own index of the blockchain


  • Will I be shown on others' network servers? If no, how can I be shown?
Will generally depend on how you set it up and firewalls etc

peer discovery is also explained in the ElectrumX docs: https://electrumx-spesmilo.readthedocs.io/en/latest/


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 23, 2021, 09:20:07 AM
Do you mean Ubuntu LTS which run though VirtualBox/WSL? It should work.
I mean the Ubuntu LTS (https://www.microsoft.com/en-us/p/ubuntu/9nblggh4msv6) that requires enabling the WSL. But, going through a virtual box seems better, I hadn't thought of it.

usually you need a fully synced, unpruned node, running with txindex=1... and you set the "network" type in electrumx and then point it at the appropriate data directory.
Since it creates its own index, is there a reason why I should “carry” the entire blockchain? Also, are these things detailed on the documentation or I should use the search button whenever I have a similar query? I just want to know if it's a complicated setup.

peer discovery is also explained in the ElectrumX docs: https://electrumx-spesmilo.readthedocs.io/en/latest/
Nice, thanks.


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 23, 2021, 08:35:36 PM
I admit defeat... I've been trying to run electrumx for my testnet bitcoin node but can't understand how it works! Is that HOWTO (https://github.com/spesmilo/electrumx/blob/master/docs/HOWTO.rst#id52) tutorial is too complicated or is it just me? I still haven't found out what is the running file.


Is this the part that should start my electrumx server? Because it returns me this when I enter “systemctl start electrumx”.:
Code:
System has not been booted with systemd as init system (PID 1). Can't operate.

I also haven't understood yet how it'll connect with my bitcoind. Is it written on the HOWTO and I've missed it? Need help.  :-X


Title: Re: [Questions] Running my own electrum server
Post by: HCP on April 23, 2021, 09:12:01 PM
Since it creates its own index, is there a reason why I should “carry” the entire blockchain?
It builds the index from the bitcoind blockchain, hence why you need it.


I don't think you can use systemd with WSL... you can however use it with WSL2: https://gist.github.com/djfdyuruiry/6720faa3f9fc59bfdf6284ee1f41f950

note that systemd is not entirely necessary to use ElectrumX... it's just a method for setting it up as a background service and autostart etc. You should be able to just "run" ElectrumX assuming you have the config etc setup correctly.


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 24, 2021, 10:18:58 AM
It builds the index from the bitcoind blockchain, hence why you need it.
Does it need the entire chain once it builds the index? Can't you get rid of it later? Just wondering why you can't build the index by running pruned node.



I found this tutorial (https://freedomnode.com/blog/how-to-install-an-electrum-server-using-full-bitcoin-node-and-electrumx/) on the internet and I think that he explains it simpler than on the one of github. I haven't worked on Bitcoin Core a lot, for example I've never used its command line program, and thus I'm getting an error I don't understand. By running ./bitcoin-cli --testnet getinfo on the terminal I should be getting information about my node (such as block height).

I have opened the Bitcoin Core application (using ./bitcoind --testnet) but once I run the above command I get:
Code:
angelo@angelo:~/bitcoin/bin$ ./bitcoin-cli -testnet -rpcuser=root -rpcpassword=<PASSWORD> getinfo
error: Authorization failed: Incorrect rpcuser or rpcpassword

I have entered the same username and password on bitcoin.conf. What am I doing wrong?


Title: Re: [Questions] Running my own electrum server
Post by: DireWolfM14 on April 24, 2021, 12:21:10 PM
Since it creates its own index, is there a reason why I should “carry” the entire blockchain?
It builds the index from the bitcoind blockchain, hence why you need it.


I don't think you can use systemd with WSL... you can however use it with WSL2: https://gist.github.com/djfdyuruiry/6720faa3f9fc59bfdf6284ee1f41f950

note that systemd is not entirely necessary to use ElectrumX... it's just a method for setting it up as a background service and autostart etc. You should be able to just "run" ElectrumX assuming you have the config etc setup correctly.

You can't use systemd on wsl, it's not given access to base hardware functions like that.  I love using WSL, it's definitely the most convenient way I've found to SSH into another machine, VPS, and I even use it access my VirtualBox instances on the same host.

@BlackHatCoiner, you can install Ubuntu server onto VirtualBox, start the instance in "headless" mode, and access it with WSL.  The advantage is that you can copy and paste commands right from your windows desktop without installing all the VirtualBox additions.  I'll be a relatively light install without any bloat, and should work for your needs.

Also note worthy; ElectrumX requires bitcoin core to run unpruned, so you will have to download the entire blockchain.


In case anyone cares, here's how to set up a VirtualBox so you can ssh into it using WSL:

Obviously your VM needs to have SSH server installed, but you don't need to generate a key pair.

On your VM:
Code:
sudo apt install openssh-server

On your host, go to your vbox settings, click on network, on the "Adapter 1" tab click on Advanced to expand the field, and then click on the "Port Forwarding" button:

https://i.ibb.co/1nSd4Cp/Untitled01.png

Create a rule as shown below.  The host port isn't critical but choose something you're certain isn't being used by another service.
https://i.ibb.co/p0brdR3/Untitled02.png

Now you'll be able to start your vbox in headless mode, open a WSL window, and connect using this command:
Code:
ssh -p 2200 <vboxusername>@localhost


Title: Re: [Questions] Running my own electrum server
Post by: HCP on April 24, 2021, 09:32:12 PM
It builds the index from the bitcoind blockchain, hence why you need it.
Does it need the entire chain once it builds the index? Can't you get rid of it later? Just wondering why you can't build the index by running pruned node.
The short answer is "Yes"... the long answer is: I don't know if you can remove it later, there are personal servers that run on Pruned nodes, with the caveat that if you attempt to import addresses/keys or a new wallet, it may not show the full balance given that blocks are "missing". However, ElectrumX requires the full blockchain, AFAIK.

Why don't you try and prune the blockchain after ElectrumX has synced and then report your findings here?


I have opened the Bitcoin Core application (using ./bitcoind --testnet) but once I run the above command I get:
Code:
angelo@angelo:~/bitcoin/bin$ ./bitcoin-cli -testnet -rpcuser=root -rpcpassword=<PASSWORD> getinfo
error: Authorization failed: Incorrect rpcuser or rpcpassword

I have entered the same username and password on bitcoin.conf. What am I doing wrong?
Don't use rpcuser and rpcpassword... they're being deprecated... either use the rpcauth or the .cookie file...

The .cookie method is easiest... if you used the "default" datadir then you should just be able to not specify anything and it will just work... if you've specified a custom datadir, then you'll then to provide it on the commandline using -datadir or you can just use datadir=your/custom/path in the bitcoin.conf file.


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 28, 2021, 09:22:14 AM
Alright, let's see. I've redone the entire procedure, because I was very sure that I was doing something wrong.

I run electrumx_server on the terminal, but I get these errors:

Code:
angelo@DESKTOP-5QOEJVC:~/electrumx$ electrumx_server
INFO:electrumx:ElectrumX server starting
ERROR:electrumx:ElectrumX server terminated abnormally
Traceback (most recent call last):
  File "/home/angelo/.local/bin/electrumx_server", line 31, in main
    env = Env()
  File "/home/angelo/.local/lib/python3.7/site-packages/electrumx/server/env.py", line 46, in __init__
    self.db_dir = self.required('DB_DIRECTORY')
  File "/home/angelo/.local/lib/python3.7/site-packages/electrumx/lib/env_base.py", line 40, in required
    raise cls.Error(f'required envvar {envvar} not set')
electrumx.lib.env_base.EnvBase.Error: required envvar DB_DIRECTORY not set

Could it be a configuration issue?


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 28, 2021, 11:34:32 AM
Yes. You need to configure the environment variable (https://linuxconfig.org/how-to-set-and-list-environment-variables-on-linux) which mentioned on the electrumx environment docs (https://github.com/spesmilo/electrumx/blob/master/docs/environment.rst).

Thanks. Are these environment variables located at home\<user>\scripts\electrumx\daemontools\env ?


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 29, 2021, 09:15:06 AM
But few configuration file such as "DB_DIRECTORY" should be available by default.
The bitcoin's testnet block chain is downloaded on my external drive. Not inside any of the ubuntu's directories. Could this be the issue?

This is how I've modified DB_DIRECTORY on scripts\electrumx\daemontools\env:
Code:
E:\p2p\BTC\AppData\testnet


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 29, 2021, 10:07:07 AM
Assuming you're using daemontools (https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#using-daemontools) and install as regular user (not as root), then yes.

What would be the difference? I'm not sure if I have installed it as a regular user. I have used sudo for most of the commands, because it kept returning me that I don't have permission. The electrumx directory is located on the main user (angelo) and not on electrumx.


Title: Re: [Questions] Running my own electrum server
Post by: HCP on April 29, 2021, 10:18:46 AM
This is how I've modified DB_DIRECTORY on scripts\electrumx\daemontools\env:
Code:
E:\p2p\BTC\AppData\testnet
That's not likely to work... WSL knows nothing of "Windows" paths... so things like "E:\" etc don't mean anything.

However, WSL should be mounting all the Windows drive letters under /mnt (and in lowercase!)... so you should be able to use something like:
Code:
/mnt/e/p2p/BTC/AppData/testnet


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 29, 2021, 10:54:12 AM
Code:
/mnt/e/p2p/BTC/AppData/testnet

Thanks for that, but it seems that something else goes wrong, because I still get the same error. I reads that I haven't set a DB_DIRECTORY while I do have on scripts\electrumx\daemontools\env.


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 29, 2021, 11:25:20 AM
Sorry, i made a mistake, it's been some time since i tried electrumx and not familiar with daemontools (usually i use systemd).
If you're using an implementation of the server that has a simpler tutorial, feel free to give me a link please! The problem with systemd is that I get this:
Code:
angelo@DESKTOP-5QOEJVC:~/electrumx$ systemctl start electrumx
System has not been booted with systemd as init system (PID 1). Can't operate.

sudo affect how you run Electrum with daemontools, not where environment file is locate
I meant that I'm running the commands from “angelo”, which is the main user probably.

How do run electrumx? Simply by typing electrumx_server? If yes, i think that's the problem since you're following guide to configure/run electrum with daemontools.
I don't understand. Should there be a command for daemontools that will start the electrumx server? The only thing that is mentioned about those tools is this:  https://github.com/spesmilo/electrumx/blob/master/docs/HOWTO.rst#using-daemontools


Title: Re: [Questions] Running my own electrum server
Post by: ABCbits on April 29, 2021, 12:02:22 PM
In the end, i decided to try setup electrumx from scratch and i think successfully setup it based on the log file.

Code:
Launching ElectrumX server...
INFO:electrumx:ElectrumX server starting
INFO:electrumx:logging level: INFO
INFO:Controller:Python version: 3.8.7 (default, Jan 31 2021, 21:48:01)  [GCC 10.2.1 20201224]
INFO:Controller:software version: ElectrumX 1.16.0
INFO:Controller:aiorpcX version: 0.18.7
INFO:Controller:supported protocol versions: 1.4-1.4.2
INFO:Controller:event loop policy: None
INFO:Controller:reorg limit is 8,000 blocks
INFO:Daemon:daemon #1 at localhost:18332/ (current)
INFO:DB:switching current directory to /home/user/Desktop/electrumx/DB
INFO:DB:using leveldb for DB backend
INFO:DB:created new database
INFO:DB:creating metadata directory
INFO:DB:UTXO DB version: 8
INFO:DB:coin: Bitcoin
INFO:DB:network: testnet
INFO:DB:height: -1
INFO:DB:tip: 0000000000000000000000000000000000000000000000000000000000000000
INFO:DB:tx count: 0
INFO:DB:flushing DB cache at 1,200 MB
INFO:DB:sync time so far: 00s
INFO:History:history DB version: 1
INFO:History:flush count: 0
INFO:Prefetcher:catching up to daemon height 1,973,091 (1,973,092 blocks behind)
INFO:Prefetcher:verified genesis block with hash 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
INFO:BlockProcessor:our height: 9 daemon: 1,973,091 UTXOs 0MB hist 0MB
INFO:BlockProcessor:our height: 104,142 daemon: 1,973,091 UTXOs 58MB hist 111MB



This is how i do it. Hopefully i don't forget any step or copy wrong command

1. Install daemontools

Code:
sudo apt install daemontools

2. Move to proper path

Code:
cd ~/Desktop
git clone https://github.com/kyuupichan/electrumx.git
cd electrumx

3. Configure Python virtual environment (optional)

Code:
python3.8 -m venv .venv
source .venv/bin/activate
mkdir ./DB

4. Install electrumx (i think it's optional)

Code:
pip install .

5. Create directory service

Code:
mkdir ./service

6. Copy the daemontools script

Code:
mkdir -p ./scripts/electrumx
cp -R ./contrib/daemontools ./scripts/electrumx

7. Configure ENV. Make sure to read this guide https://electrumx.readthedocs.io/en/latest/environment.html#environment (https://electrumx.readthedocs.io/en/latest/environment.html#environment)

Code:
cd ./scripts/electrumx/daemontools/env
nano DB_DIRECTORY

Here's value i used

Code:
FILENAME=VALUE

COIN=BITCOIN
DAEMON_URL=USERNAME:PASSWORD@LOCALHOST
DB_DIRECTORY=/home/user/Desktop/electrum/DB
NET=TESTNET
ELECTRUMX=/home/user/Desktop/electrumx/.venv/bin/electrumx_server
USERNAME=user

8. Configure log path. Change /path/to/log/dir to /home/user/Desktop/electrumx/scripts/electrumx/daemontools/log

Code:
cd /home/user/Desktop/electrumx/scripts/electrumx/daemontools
nano run

9.  Start svscan

Code:
cd /home/user/Desktop/electrumx
svscan ./service

If you can't have multiple terminal run this instead

Code:
cd /home/user/Desktop/electrumx
svscan ./service & disown

10. Add the service

Code:
cd /home/user/Desktop/electrumx/service
ln -s /home/user/Desktop/electrumx/scripts/electrumx/daemontools electrumx

11. To see output from Electrum

Code:
cd /home/user/Desktop/electrumx/scripts/electrumx/daemontools/log
tail current

P.S. It's very complicated compared with setup for systemd system or using docker (https://github.com/lukechilds/docker-electrumx (https://github.com/lukechilds/docker-electrumx)).


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 29, 2021, 12:28:25 PM
Thank you for your time!

9.  Start svscan

If you can't have multiple terminal run this instead

Code:
cd /home/user/Desktop/electrumx
svscan ./service & disown

I have an issue with svscan Fixed. I'm now running electrum-personal-server.


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 30, 2021, 08:42:37 AM
I didn't fix it. I don't know why it didn't work, but I was feeling a little alienated after all those tries. I then watched a video on YouTube (https://www.youtube.com/watch?v=1JMP4NZCC5g) which was much more simpler than with electrumx's tutorial. Thus, I discovered electrum personal server (https://github.com/chris-belcher/electrum-personal-server) which seems a great implementation under some serious development.

So, I just switched to EPS. I didn't fix electrumx. I may formulated it wrongly, but "fixed" goes to my main purpose, which is running electrum without trusting anyone. I achieved it, thank you for your help.  :)


Title: Re: [Questions] Running my own electrum server
Post by: HCP on April 30, 2021, 08:59:51 AM
oh man... if I had known you just wanted a little local Electrum server... I would have recommended electrs (https://github.com/romanz/electrs) :P I thought you were trying to get your own public facing Electrum server up and running.  ::)

I have successfully had electrs running under WSL+Ubuntu (reading a Windows based Bitcoin data directory and connecting to it from Windows based Electrum)... it works a treat and has a relatively small footprint. It "syncs" relatively quickly if it's been offline for a few days, although the initial build+initial sync process can take a while.


Title: Re: [Questions] Running my own electrum server
Post by: ABCbits on April 30, 2021, 09:42:58 AM
So, I just switched to EPS. I didn't fix electrumx. I may formulated it wrongly, but "fixed" goes to my main purpose, which is running electrum without trusting anyone. I achieved it, thank you for your help.  :)

As long as you accomplish your goal ::)

But if you want to use electrumx to make Electrum server which is publicly accessible, you can consider,
1. Easy installer, https://github.com/bauerj/electrumx-installer (https://github.com/bauerj/electrumx-installer). Although i don't know how well it works.
2. Docker, https://github.com/lukechilds/docker-electrumx (https://github.com/lukechilds/docker-electrumx)
3. Setup with systemd, https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#using-systemd (https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#using-systemd)


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on April 30, 2021, 12:53:51 PM
oh man... if I had known you just wanted a little local Electrum server... I would have recommended electrs (https://github.com/romanz/electrs) :P I thought you were trying to get your own public facing Electrum server up and running.  ::)
I do. I just wanted to firstly setup a personal server. Running a server publicly is secondary.

3. Setup with systemd, https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#using-systemd (https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#using-systemd)
The problem with electrumx is that I still haven't understood how it works. For example, on electrum-personal-server, you're starting the server with electrum-personal-server config.ini. With what file do you start electrumx? service/electrumx?

The tutorial doesn't tell you much. It just says "run that command, then another command etc.". Where's the explanation? How am I supposed to know what does that do and from what directory should I run it?:
Code:
systemctl start electrumx

This is what it returns me when I execute the above command:
Code:
angelo@angelopc:~/Desktop/electrumx$ systemctl start electrumx
Warning: The unit file, source configuration file or drop-ins of electrumx.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for electrumx.service failed because of unavailable resources or another system error.
See "systemctl status electrumx.service" and "journalctl -xe" for details.

And then with systemctl status electrumx.service (as it's been said in the error):
Code:
angelo@angelopc:~/Desktop$ systemctl status electrumx.service
● electrumx.service - Electrumx
   Loaded: loaded (/etc/systemd/system/electrumx.service; disabled; vendor prese
   Active: failed (Result: resources)

Aπρ 30 15:21:48 angelopc systemd[1]: electrumx.service: Failed with result 'reso
Aπρ 30 15:21:48 angelopc systemd[1]: Failed to start Electrumx.
Aπρ 30 15:21:53 angelopc systemd[1]: electrumx.service: Failed to load environme
Aπρ 30 15:21:53 angelopc systemd[1]: electrumx.service: Failed to run 'start' ta
Aπρ 30 15:21:53 angelopc systemd[1]: electrumx.service: Failed with result 'reso
Aπρ 30 15:21:53 angelopc systemd[1]: Failed to start Electrumx.
Aπρ 30 15:22:14 angelopc systemd[1]: electrumx.service: Failed to load environme
Aπρ 30 15:22:14 angelopc systemd[1]: electrumx.service: Failed to run 'start' ta
Aπρ 30 15:22:14 angelopc systemd[1]: electrumx.service: Failed with result 'reso
Aπρ 30 15:22:14 angelopc systemd[1]: Failed to start Electrumx.

(Aπρ is Apr on my lang)



As I said, I have a VPS left over and I'd like to "donate" its operation to the electrum community instead of having it shut down. I also like practicing in this field. I'd have probably given up with this setup, but it seems that I'm a stubborn...


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on May 01, 2021, 11:27:40 AM
Honestly if the VPS use linux, you can use easy installer/docker (which i mentioned above), which is very easy to use.

I saw the docker, but I haven't ever used docker in the past for setups. Would you mind guiding me a hand? There's no steps, just a “docker run /” script.


Title: Re: [Questions] Running my own electrum server
Post by: Trechometer on May 02, 2021, 09:53:42 AM
I have been experimenting with electrum as a wallet since I learnt about bitcoin, a year ago, and I can admit that it's the simplest and most useful one. I'd like to run my own electrum server, but not for privacy reasons, just for exercise. I also have bought a Windows VPS that isn't being used at the moment, so why not providing it to the electrum community?

I picked electrumx (https://github.com/spesmilo/electrumx), because it's the most popular implementation. It seems that I can't install it on windows, only on unix. The thing is that I don't have an Ubuntu installed right now. Could this work with Windows 10 on an Ubuntu LTS?

Other questions too:
  • Is the same procedure if I want to run a testnet server? I don't have the storage for downloading the entire blockchain.
  • How does it return the balance of address(es) instantly? On Bitcoin Core it has to rescan the blockchain (which will take a lot of time).
  • Will I be shown on others' network servers? If no, how can I be shown?

Hello,

Please share some more informations, I also wanted to start with electrum, but failed to install and run. Lets help us each other if you are also at the beginning.
And the VPS is hardware or software or rented? Because I heard that is possible, personally I didnt saw such a witchcraft :)))
Thanks!


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on May 02, 2021, 01:20:53 PM
If you see message "Hello from Docker!", then Docker run correctly.
On the WSL I don't get it. I returns me an error instead. But don't worry, I'll setup it on my Ubuntu machine. On my Ubuntu 18.04 the hello-world works properly, but not the script you've given:


Please share some more informations, I also wanted to start with electrum, but failed to install and run. Lets help us each other if you are also at the beginning.
If you read the entire thread, you'll find the information you're searching. In a few words, I'm fumbled with the whole server thing...  :D.  I feel better now that I see that I am not the only one with these issues.  :P

And the VPS is hardware or software or rented?
I think it's software, but I ain't completely sure. It's really cheap so I doubt if it'd be a hardware one.


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on May 03, 2021, 07:06:27 AM
Update.

It works!  :D


Sorry, but I hadn't noticed that the DAEMON_URL was expecting two input fields (username and password). Once I entered it correctly, it started the server. That actually happened yesterday, couple hours after my last post, but I went offline, so I couldn't inform about it.

Alright, so I have some questions to make regarding electrumx:
  • Before exposing it to the internet, I'd like to firstly try it on LAN. It seems that with the way you've described me, it works only on localhost. Do I simply change the DAEMON_URL from localhost to 192.168.x.x?
  • Can you explain a little further the last one you mentioned (container)? I don't have the electrumx files on my computer. Where does it execute the commands and from what files? Github?
  • How do I change the banner/donation address? I've created a file called "DONATION_ADDRESS" containing a legacy address as being said on electrumx's documentation, but it doesn't seem to read it.



Title: Re: [Questions] Running my own electrum server
Post by: ABCbits on May 03, 2021, 09:08:45 AM
Sorry, but I hadn't noticed that the DAEMON_URL was expecting two input fields (username and password). Once I entered it correctly, it started the server.

I'd like to mention that you can change value of other parameter (such as where do you store electrumx file) or add additional environment parameter.

  • Before exposing it to the internet, I'd like to firstly try it on LAN. It seems that with the way you've described me, it works only on localhost. Do I simply change the DAEMON_URL from localhost to 192.168.x.x?
  • Can you explain a little further the last one you mentioned (container)? I don't have the electrumx files on my computer. Where does it execute the commands and from what files? Github?
  • How do I change the banner/donation address? I've created a file called "DONATION_ADDRESS" containing a legacy address as being said on electrumx's documentation, but it doesn't seem to read it.

1. AFAIK yes.
2. You should search what is docker and how docker works. Here's an article i found https://devopscube.com/what-is-docker/ (https://devopscube.com/what-is-docker/).
3. You need to add another parameter when run electrumx

Code:
-e DONATION_ADDRESS=YOUR_BITCOIN_ADDRESS

P.S. Those are good question, but unfortunately i'm still newbie when using Docker.


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on May 04, 2021, 06:26:12 AM
Thank you @ETFbitcoin. It now works like a charm.


Title: Re: [Questions] Running my own electrum server
Post by: DireWolfM14 on May 06, 2021, 01:38:59 PM
1. Easy installer, https://github.com/bauerj/electrumx-installer (https://github.com/bauerj/electrumx-installer). Although i don't know how well it works.
2. Docker, https://github.com/lukechilds/docker-electrumx (https://github.com/lukechilds/docker-electrumx)
3. Setup with systemd, https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#using-systemd (https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#using-systemd)

I've read about the installer, but this is the first I've heard about people using docker to run electrumx.  I'm not familiar with docker, so seems like a rabbit hole of it's own.  I just use systemd to run bitcoind and electrumx.  Old dog, new tricks, and all that.

Does the docker method allow one to use all the same environment variables (https://electrumx-spesmilo.readthedocs.io/en/latest/environment.html) that one might enable in electumx.conf?


Title: Re: [Questions] Running my own electrum server
Post by: BlackHatCoiner on May 06, 2021, 01:51:33 PM
Does the docker method allow one to use all the same environment variables (https://electrumx-spesmilo.readthedocs.io/en/latest/environment.html) that one might enable in electumx.conf?

Was there such configuration file for electrumx? In the docs you linked it says that there should be different files for each environment variable. For example, it says that you'll have to create the COIN, DB_DIRECTORY and DAEMON_URL necessarily and some others optionally.

Anyway, yes, if I understood your question correctly, docker does allow you to do that. You just need to add parameters on your script (https://github.com/lukechilds/docker-electrumx#usage). Three posts above, @ETFbitcoin included the DONATION_ADDRESS param. You can do the same for the banner:

Code:
-e BANNER_FILE=LOCATION_OF_YOUR_BANNER_FILE

Note that the location starts from the electrumx data directory which means that if you enter BANNER_FILE=banner.txt, it'll search for /home/user/electrumx:/data/banner.txt


Title: Re: [Questions] Running my own electrum server
Post by: DireWolfM14 on May 06, 2021, 04:55:27 PM
Was there such configuration file for electrumx?

Yes, you'll find it in .../contrib/systemd/

https://github.com/spesmilo/electrumx/tree/master/contrib/systemd


In the docs you linked it says that there should be different files for each environment variable. For example, it says that you'll have to create the COIN, DB_DIRECTORY and DAEMON_URL necessarily and some others optionally.

No, all you need is one .conf file, all the environment variables can go there.  For example:

Code:
COIN = Bitcoin
DAEMON_URL = myrpcusername:myrpcpassword@localhost:port
SERVICES = tcp://my.domain.name:50001,ssl://my.domain.name:50002,rpc://
REPORT_SERVICES = tcp://myaddress.onion:50001,ssl://myaddress.onion:50002
SSL_CERTFILE = /path/to/sslcertfile.crt
SSL_KEYFILE = /path/to/sslkeyfile.key
DONATION_ADDRESS = 157v67atJjnx7Fdi2wmcBBpChugHNmDWup
BANNER_FILE = /path/to/file.banner



Anyway, yes, if I understood your question correctly, docker does allow you to do that. You just need to add parameters on your script (https://github.com/lukechilds/docker-electrumx#usage). Three posts above, @ETFbitcoin included the DONATION_ADDRESS param. You can do the same for the banner:

Code:
-e BANNER_FILE=LOCATION_OF_YOUR_BANNER_FILE

Note that the location starts from the electrumx data directory which means that if you enter BANNER_FILE=banner.txt, it'll search for /home/user/electrumx:/data/banner.txt

Yeah, that was my question.  I guess it does simplify the installation by using the docker image.  I'm just so used to systemd, and I find it simple to enable a process to run at machine startup.