Bitcoin Forum
February 23, 2020, 05:32:12 AM *
News: Latest Bitcoin Core release: 0.19.0.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Electrum Personal Server on Windows 7  (Read 335 times)
chameleon22
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 07, 2020, 09:21:53 PM
Last edit: January 07, 2020, 09:52:44 PM by chameleon22
 #21

Question... will electrs download/build its own DB now? I guess yes, but will that be about 20-30% of the bitcoin DB?
Yes, it builds it's own database... my "electrs" dbDir is currently ~56gigs. Note that this in addition to the Bitcoin Core DB (which is currently ~324gigs)... you still need the Bitcoin Core DBs as well! Wink


Quote
Also, how about WLS moving it to another PC? is this possible?
Apparently you can... the WSL command (included when you setup WSL within Windows) has an --export command which will export a specified distro to a "tar" file and an --import argument that will allow you to then import that distro to another PC...

Quote
Arguments to manage Windows Subsystem for Linux:

    --export <DistributionName> <FileName>
        Exports the distribution to a tar file.
        The filename can be - for standard output.

    --import <DistributionName> <InstallLocation> <FileName>
        Imports the specified tar file as a new distribution.
        The filename can be - for standard input.

    --list, -l [Options]
        Lists distributions.

        Options:
            --all
                List all distributions, including distributions that are currently
                being installed or uninstalled.

            --running
                List only distributions that are currently running.

NOTE: I have not used this, so I've not experience with actually using it. I'd suggest trying Google for more info.

Hi HCP and thank you for the WSL and electrs DB info,

I tried it your way and while everything was going great up to the point I installed all the prerequisites, I hit a wall:

1. I installed WSL, and in it, all that is required by electrs to run using the information here:https://github.com/romanz/electrs/blob/master/doc/usage.md

2. When I issue the line  cargo run --release -- -vvv --timestamp --db-dir ./db --electrum-rpc-addr="127.0.0.1:50001" --daemon-dir /mnt/c/Bitcoin  while in electrs directory, I get the following output:

chameleon@DESKTOP-GALLM9T:~/electrs$ cargo run --release -- -vvv --timestamp --db-dir ./db --electrum-rpc-addr="127.0.0.1:50001" --daemon-dir /mnt/c/Bitcoin
    Finished release [optimized] target(s) in 0.43s
     Running `target/release/electrs -vvv --timestamp --db-dir ./db '--electrum-rpc-addr=127.0.0.1:50001' --daemon-dir /mnt/c/Bitcoin`
Config { log: StdErrLog { verbosity: Debug, quiet: false, timestamp: Millisecond, modules: [], writer: "stderr", color_choice: Auto }, network_type: bitcoin, db_path: "./db/mainnet", daemon_dir: "/mnt/c/Bitcoin", daemon_rpc_addr: V4(127.0.0.1:8332), electrum_rpc_addr: V4(127.0.0.1:50001), monitoring_addr: V4(127.0.0.1:4224), jsonrpc_import: false, index_batch_size: 100, bulk_index_threads: 12, tx_cache_size: 10485760, txid_limit: 100, server_banner: "Welcome to electrs 0.8.2 (Electrum Rust Server)!", blocktxids_cache_size: 10485760 }
2020-01-07T23:07:20.650+02:00 - DEBUG - Server listening on 127.0.0.1:4224
2020-01-07T23:07:20.651+02:00 - DEBUG - Running accept thread
2020-01-07T23:07:20.652+02:00 - WARN - failed to connect daemon at 127.0.0.1:8332: Connection refused (os error 111)
2020-01-07T23:07:23.654+02:00 - WARN - failed to connect daemon at 127.0.0.1:8332: Connection refused (os error 111)

3. I tried running my Windows bitcoind with rpcuser & rpcpassword, and also without them in the bitcoin.conf file. What is the line you use to run electrs in your WSL? It feels like it has to do with user & password but I can't get where to change what.


---------- UPDATE ------------
I used --> bitcoind -server=1 -rpcport=8332 when running bitcoind on Windows 10 and now I am getting the following in my WSL :

2020-01-07T23:35:08.723+02:00 - DEBUG - Server listening on 127.0.0.1:4224
2020-01-07T23:35:08.724+02:00 - DEBUG - Running accept thread
2020-01-07T23:35:08.726+02:00 - INFO - NetworkInfo { version: 190001, subversion: "/Satoshi:0.19.0.1/" }
2020-01-07T23:35:08.727+02:00 - INFO - BlockchainInfo { chain: "main", blocks: 611791, headers: 611791, bestblockhash: "00000000000000000003404e2461a0d394d207cf74739519907d6d623bb6e5ad", pruned: false, initialblockdownload: false }
2020-01-07T23:35:08.729+02:00 - DEBUG - opening DB at "./db/mainnet"
2020-01-07T23:35:08.763+02:00 - INFO - listing block files at "/mnt/c/Bitcoin/blocks/blk*.dat"
2020-01-07T23:35:08.782+02:00 - INFO - indexing 1923 blk*.dat files
2020-01-07T23:35:08.782+02:00 - DEBUG - found 0 indexed blocks
2020-01-07T23:35:45.821+02:00 - DEBUG - applying 611792 new headers from height 0


I guess this is what should happen? I will give it time to see how it goes and report back.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1582435932
Hero Member
*
Offline Offline

Posts: 1582435932

View Profile Personal Message (Offline)

Ignore
1582435932
Reply with quote  #2

1582435932
Report to moderator
1582435932
Hero Member
*
Offline Offline

Posts: 1582435932

View Profile Personal Message (Offline)

Ignore
1582435932
Reply with quote  #2

1582435932
Report to moderator
1582435932
Hero Member
*
Offline Offline

Posts: 1582435932

View Profile Personal Message (Offline)

Ignore
1582435932
Reply with quote  #2

1582435932
Report to moderator
HCP
Legendary
*
Offline Offline

Activity: 1246
Merit: 2264

<insert witty quote here>


View Profile
January 07, 2020, 10:01:50 PM
Last edit: January 07, 2020, 11:00:35 PM by HCP
 #22

Awesome, glad you got it sorted... I was going to say that it looked like either the port was closed, or that your bitcoind wasn't configured to accept incoming RPC connections. The "-server" part is probably what fixed it if you didn't already have that in bitcoin.conf Wink

One more piece of advice... if you see errors when trying to connect using Electrum. It might be because, as far as I'm aware, electrs still doesn't support direct SSL connections, you need to use a proxy... and Electrum tries to use it by default.

So, I created an "Electrum - Local" shortcut within Windows... that runs as follows:
Code:
"C:\Program Files (x86)\Electrum\electrum-3.3.8.exe" --oneserver --server localhost:50001:t

It prevents my Electrum from connecting to anything other than my local server (--oneserver)... and it specifies that it should just use ordinary "tcp" connection... that's the "t" part on the end of the server spec.

Not having SSL isn't a huge deal for me, because this is a "personal" server, so it's all internal communication. If I was going to open this for external connections (if I wanted to be able to use Electrum from my Android phone for instance), then I'd investigate setting up the SSL stuff.



EDIT:

Ok, so mentioning SSL got me curious about how hard it was to setup... the answer is... Not very Wink

I installed the prebuilt NGINX using apt-get as outlined here, created some SSL self-signed certs using openssl as outlined here (I just changed "apache-selfsigned" to "nginx-selfsigned" for the .key and .crt)... and then added the NGINX .conf changes as specified in the electrs docs

Started up NGINX, then connected using Electrum with a new SSL shortcut:
Code:
"C:\Program Files (x86)\Electrum\electrum-3.3.8.exe" --oneserver --server localhost:50002:s

et voilà... Electrum running using SSL... at some point, I might attempt to make this externally accessible, so I could connect from external networks. But for a "proof of concept" it was pretty easy to do.

chameleon22
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 08, 2020, 01:20:07 AM
Last edit: January 12, 2020, 05:56:46 PM by chameleon22
 #23

Awesome, glad you got it sorted... I was going to say that it looked like either the port was closed, or that your bitcoind wasn't configured to accept incoming RPC connections. The "-server" part is probably what fixed it if you didn't already have that in bitcoin.conf Wink

One more piece of advice... if you see errors when trying to connect using Electrum. It might be because, as far as I'm aware, electrs still doesn't support direct SSL connections, you need to use a proxy... and Electrum tries to use it by default.

So, I created an "Electrum - Local" shortcut within Windows... that runs as follows:
Code:
"C:\Program Files (x86)\Electrum\electrum-3.3.8.exe" --oneserver --server localhost:50001:t

It prevents my Electrum from connecting to anything other than my local server (--oneserver)... and it specifies that it should just use ordinary "tcp" connection... that's the "t" part on the end of the server spec.

Not having SSL isn't a huge deal for me, because this is a "personal" server, so it's all internal communication. If I was going to open this for external connections (if I wanted to be able to use Electrum from my Android phone for instance), then I'd investigate setting up the SSL stuff.



EDIT:

Ok, so mentioning SSL got me curious about how hard it was to setup... the answer is... Not very Wink

I installed the prebuilt NGINX using apt-get as outlined here, created some SSL self-signed certs using openssl as outlined here (I just changed "apache-selfsigned" to "nginx-selfsigned" for the .key and .crt)... and then added the NGINX .conf changes as specified in the electrs docs

Started up NGINX, then connected using Electrum with a new SSL shortcut:
Code:
"C:\Program Files (x86)\Electrum\electrum-3.3.8.exe" --oneserver --server localhost:50002:s

et voilà... Electrum running using SSL... at some point, I might attempt to make this externally accessible, so I could connect from external networks. But for a "proof of concept" it was pretty easy to do.

GREAT WORK. I also run it with localhost:50001:t so far, will try your ngix ssl solution soon.

The main reason I wanted all this with running my personal electrs etc., was to be able to use Python to create multiple wallets automatically and work with them fast, thus the private server. Normal Electrum wallet GUI starts normally and connects to localhost just fine, without any issues.

It all works fine now, I get much better speed in my project than with the public electrum servers, but there is an issue that I am 99% certain is not related to my Python programming on Electrum but it must have to do with Electrs server.

What happens is, I get (in electrs) errors like " failed to send PeriodicUpdate to peer 81: sending on a full channel" and I can see that electrs keeps disconnecting my connections to it from different wallets. It appears that there must be some more arguments that could probably help my wallets not disconnecting the way they do in electrs.

Do you know if there are, and what are they, more arguments for electrs when it starts? Like timeout args or similar?

------UPDATE------
Hi HCP, I managed to fix everything, without SSL yet, this I will try soon. electrs works fine and what was wrong was in the Python script. Thank you for your help, as it saved a lot of time and effort.

P.S. I tried porting the WSL to another system but not everything was as it should be even though the import-export works, the ported WSL wasn't starting in the same user (now it was root by default) and things like that. I just reinstalled everything to the other computer in a new WSL just to be sure.
HCP
Legendary
*
Offline Offline

Activity: 1246
Merit: 2264

<insert witty quote here>


View Profile
January 12, 2020, 08:42:56 PM
 #24

Interesting. Thanks for the headsup regarding WSL import/export.

I've not actually tried it as yet as I have not had the need to backup WSL and move to a new machine. Generally, I just install from fresh and start again Tongue I wonder if the "different user" thing is a result of different UID's being created in the new instance? Huh

What I do know is that you can start a WSL distro using a specified username, by using the --u or --username arguments. Refer: https://winaero.com/blog/run-wsl-linux-distro-as-specific-user-in-windows-10/

Also, you might be able to change the "default user" that a distro will start up with, depending on the distro you're using. With Ubuntu, it's something like "ubuntu.exe config --default-user MYUSERNAME". But you need to figure out what distro you're running. refer: https://docs.microsoft.com/en-us/windows/wsl/user-support

chameleon22
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
January 15, 2020, 05:05:36 PM
 #25

Interesting. Thanks for the headsup regarding WSL import/export.

I've not actually tried it as yet as I have not had the need to backup WSL and move to a new machine. Generally, I just install from fresh and start again Tongue I wonder if the "different user" thing is a result of different UID's being created in the new instance? Huh

What I do know is that you can start a WSL distro using a specified username, by using the --u or --username arguments. Refer: https://winaero.com/blog/run-wsl-linux-distro-as-specific-user-in-windows-10/

Also, you might be able to change the "default user" that a distro will start up with, depending on the distro you're using. With Ubuntu, it's something like "ubuntu.exe config --default-user MYUSERNAME". But you need to figure out what distro you're running. refer: https://docs.microsoft.com/en-us/windows/wsl/user-support

Thanks for the info HCP.
It appears that while things are working, I still get (in electrs) errors like " failed to send PeriodicUpdate to peer 81: sending on a full channel" and I can see that electrs keeps disconnecting my connections to it from different wallets. It appears that there must be some more arguments that could probably help my wallets not disconnecting the way they do in electrs.

It's like electrs can't keep up with the speed of things?
HCP
Legendary
*
Offline Offline

Activity: 1246
Merit: 2264

<insert witty quote here>


View Profile
January 18, 2020, 02:05:54 AM
 #26

It appears that while things are working, I still get (in electrs) errors like " failed to send PeriodicUpdate to peer 81: sending on a full channel" and I can see that electrs keeps disconnecting my connections to it from different wallets. It appears that there must be some more arguments that could probably help my wallets not disconnecting the way they do in electrs.

It's like electrs can't keep up with the speed of things?
Possibly... I'm not sure what the scaling is like and how it handles a large number of wallets/concurrent connections. I use it basically as a replacement for EPS... so i generally only ever have 1 connection to it from one Electrum instance (with possibly multiple wallet files open).

You'd need to contact the electrs dev (via github or the thread on here) and see if they can shed some light on it.

Pages: « 1 [2]  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!