Pages:
Author

Topic: [Questions] Running my own electrum server - page 2. (Read 532 times)

HCP
legendary
Activity: 2086
Merit: 4361
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
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Assuming you're 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.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
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
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Yes. You need to configure the environment variable which mentioned on the electrumx environment docs.

Thanks. Are these environment variables located at home\\scripts\electrumx\daemontools\env ?
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
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?
HCP
legendary
Activity: 2086
Merit: 4361
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= 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.
copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
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:



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.


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 @localhost
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
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 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= getinfo
error: Authorization failed: Incorrect rpcuser or rpcpassword

I have entered the same username and password on bitcoin.conf. What am I doing wrong?
HCP
legendary
Activity: 2086
Merit: 4361
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.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
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 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.  Lips sealed
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
Do you mean Ubuntu LTS which run though VirtualBox/WSL? It should work.
I mean the Ubuntu LTS 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.
HCP
legendary
Activity: 2086
Merit: 4361
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, 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. Wink 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/
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
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, 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?
Pages:
Jump to: