BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
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, 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?
|
|
|
|
HCP
Legendary
Offline
Activity: 2086
Merit: 4316
<insert witty quote here>
|
|
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, 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/
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
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 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. Nice, thanks.
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
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 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”.: 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.
|
|
|
|
HCP
Legendary
Offline
Activity: 2086
Merit: 4316
<insert witty quote here>
|
|
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 WSL 2: https://gist.github.com/djfdyuruiry/6720faa3f9fc59bfdf6284ee1f41f950note 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.
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
April 24, 2021, 10:18:58 AM Last edit: April 24, 2021, 11:12:27 AM by BlackHatCoiner |
|
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: 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?
|
|
|
|
DireWolfM14
Copper Member
Legendary
Offline
Activity: 2212
Merit: 4247
Join the world-leading crypto sportsbook NOW!
|
|
April 24, 2021, 12:21:10 PM Last edit: April 24, 2021, 03:09:05 PM by DireWolfM14 |
|
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 WSL 2: https://gist.github.com/djfdyuruiry/6720faa3f9fc59bfdf6284ee1f41f950note 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: 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: ssh -p 2200 <vboxusername>@localhost
|
|
|
|
HCP
Legendary
Offline
Activity: 2086
Merit: 4316
<insert witty quote here>
|
|
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: 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.
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
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: 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?
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
April 28, 2021, 11:34:32 AM |
|
Thanks. Are these environment variables located at home\<user>\scripts\electrumx\daemontools\env ?
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
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: E:\p2p\BTC\AppData\testnet
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
April 29, 2021, 10:07:07 AM Last edit: May 02, 2021, 08:32:25 PM by BlackHatCoiner |
|
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.
|
|
|
|
HCP
Legendary
Offline
Activity: 2086
Merit: 4316
<insert witty quote here>
|
|
April 29, 2021, 10:18:46 AM |
|
This is how I've modified DB_DIRECTORY on scripts\electrumx\daemontools\env: 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: /mnt/e/p2p/BTC/AppData/testnet
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
April 29, 2021, 10:54:12 AM |
|
/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.
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
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: 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
|
|
|
|
ABCbits
Legendary
Offline
Activity: 2940
Merit: 7665
Crypto Swap Exchange
|
In the end, i decided to try setup electrumx from scratch and i think successfully setup it based on the log file. 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 daemontoolssudo apt install daemontools
2. Move to proper path cd ~/Desktop git clone https://github.com/kyuupichan/electrumx.git cd electrumx
3. Configure Python virtual environment (optional) python3.8 -m venv .venv source .venv/bin/activate mkdir ./DB
4. Install electrumx (i think it's optional) 5. Create directory service 6. Copy the daemontools script 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#environmentcd ./scripts/electrumx/daemontools/env nano DB_DIRECTORY
Here's value i used 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/logcd /home/user/Desktop/electrumx/scripts/electrumx/daemontools nano run
9. Start svscan cd /home/user/Desktop/electrumx svscan ./service
If you can't have multiple terminal run this instead cd /home/user/Desktop/electrumx svscan ./service & disown
10. Add the service cd /home/user/Desktop/electrumx/service ln -s /home/user/Desktop/electrumx/scripts/electrumx/daemontools electrumx
11. To see output from Electrum 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).
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
April 29, 2021, 12:28:25 PM Last edit: April 30, 2021, 08:25:18 AM by BlackHatCoiner |
|
Thank you for your time! 9. Start svscan If you can't have multiple terminal run this instead cd /home/user/Desktop/electrumx svscan ./service & disown
I have an issue with svscan Fixed. I'm now running electrum-personal-server.
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1582
Merit: 7746
Masses won't buy bitcoin. Masses will earn bitcoin
|
|
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 which was much more simpler than with electrumx's tutorial. Thus, I discovered 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.
|
|
|
|
HCP
Legendary
Offline
Activity: 2086
Merit: 4316
<insert witty quote here>
|
|
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 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.
|
|
|
|
|
|