chris-belcher / electrum-personal-server

Maximally lightweight electrum server for a single user
MIT License
602 stars 110 forks source link

Help with OSX #76

Open JamesTwitter opened 5 years ago

JamesTwitter commented 5 years ago

I am having trouble running Electrum Personal Server on OSX and was hoping someone has already figured it out. I have attached some information about what issues I am running into.

Step 1: install python

anons-MacBook-Pro:electrum-personal-server-eps-v0.1.6 anonanon1$ python3 --version Python 3.7.2 anons-MacBook-Pro:electrum-personal-server-eps-v0.1.6 anonanon1$

python 3 is installed.

Step 2: Install Node

Node is installed and synced (pic attached)

screen shot 2018-12-29 at 11 10 52 am

Step 3: Ensure server=1 in bitcoin.conf

screen shot 2018-12-29 at 10 19 47 am

Step 4: Install Electrum. Installed.

Step 5: edit the config.cfg file for Electrum Personal Server (attached)

## Electrum Personal Server configuration file
## Comments start with #

[master-public-keys]
## Add electrum master public keys to this section
## Create a wallet in electrum then go Wallet -> Information to get the mpk

#any_name_works = deleted for privacy

# Multisig wallets use format `required-signatures [list of master pub keys]`
#multisig_wallet = 2 xpub661MyMwAqRbcFseXCwRdRVkhVuzEiskg4QUp5XpUdNf2uGXvQmnD4zcofZ1MN6Fo8PjqQ5cemJQ39f7RTwDVVputHMFjPUn8VRp2pJQMgEF xpub661MyMwAqRbcFseXCwRdRVkhVuzEiskg4QUp5XpUdNf2uGXvQmnD4zcofZ1MN6Fo8PjqQ5cemJQ39f7RTwDVVputHMFjPUn8VRp2pJQMgEF

[watch-only-addresses]
## Add addresses to this section

#addr = 1DuqpoeTB9zLvVCXQG53VbMxvMkijk494n
# A space separated list is accepted
#my_test_addresses = 3Hh7QujVLqz11tiQsnUE5CSL16WEHBmiyR 1PXRLo1FQoZyF1Jhnz4qbG5x8Bo3pFpybz bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq

[bitcoin-rpc]
host = 127.0.0.1
port = 8332
#empty means look in the default location
datadir = 
#if you dont want to use the .cookie method, uncomment to config u/p here
#rpc_user =
#rpc_password =

#to be used with the multi-wallet feature
# see https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.15.0.md#multi-wallet-support
# empty means default file, for when using a single wallet file
wallet_filename =

# how often in seconds to poll for new transactions when electrum not connected
poll_interval_listening = 30
# how often in seconds to poll for new transactions when electrum is connected
poll_interval_connected = 5

# Parameters for dealing with deterministic wallets
# how many addresses to import first time, should be big because if you import too little you may have to rescan again
initial_import_count = 1000
# number of unused addresses kept at the head of the wallet
gap_limit = 25

[electrum-server]
# 0.0.0.0 to accept connections from any IP
#127.0.0.1 to accept from only localhost
host = 127.0.0.1
port = 50002

# space-separated whitelist of IP addresses
# accepts CIDR notation eg 192.168.0.0/16 or 2a01:4f8:1f1::/120
# star (*) means all are accepted
# generally requires host binding (above) to be 0.0.0.0
ip_whitelist = *

#uses the default one, which is fine because by default nobody should be
# allowed to connect to your server or scan your packets
#to generate another certificate see https://github.com/spesmilo/electrum-server/blob/ce1b11d7f5f7a70a3b6cc7ec1d3e552436e54ffe/HOWTO.md#step-8-create-a-self-signed-ssl-cert
certfile = certs/cert.crt
keyfile = certs/cert.key

Step 6: Install Electrum Personal Server with pip3 install --user . (see below)

anons-MacBook-Pro:electrum-personal-server-eps-v0.1.6 anonanon1$ pip3 install --user . Processing /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6 Installing collected packages: electrum-personal-server Found existing installation: electrum-personal-server 0.1.4.dev0 Uninstalling electrum-personal-server-0.1.4.dev0: Successfully uninstalled electrum-personal-server-0.1.4.dev0 Running setup.py install for electrum-personal-server ... done Successfully installed electrum-personal-server-0.1.4.dev0 anons-MacBook-Pro:electrum-personal-server-eps-v0.1.6 anonanon1$

Step 7: Run Electrum Personal Server (see below)

anons-MacBook-Pro:electrum-personal-server-eps-v0.1.6 anonanon1$ /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 5: [master-public-keys]: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 15: [watch-only-addresses]: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 22: [bitcoin-rpc]: command not found ;; connection timed out; no servers could be reached /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 24: port: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 26: datadir: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 34: wallet_filename: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 37: poll_interval_listening: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 39: poll_interval_connected: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 43: initial_import_count: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 45: gap_limit: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 48: [electrum-server]: command not found ;; connection timed out; no servers could be reached /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 52: port: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 58: ip_whitelist: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 63: certfile: command not found /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg: line 64: keyfile: command not found anons-MacBook-Pro:electrum-personal-server-eps-v0.1.6 anonanon1$

This is where I'm stuck. Does anyone have any suggestions for me or know what I am doing wrong?

suvayu commented 5 years ago

With the following, you are trying to run the config file as an executable:

anons-MacBook-Pro:electrum-personal-server-eps-v0.1.6 anonanon1$ /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg

You should be running the electrum-personal-server script with the config file as argument. I am not sure about Macs, but it should be somewhere in your home; try: /Users/anonanon1/.local/bin/.

JamesTwitter commented 5 years ago

Suvayu, thank you for your feedback. I have attempted running electrum-personal-server and I am still getting "command not found." Please see attached.

As a side note, I also bought another computer and installed Ubuntu. I was able to successfuly run electrum-personal-server but I am getting an error "Unable to find .cookie file," so I am trying the Mac again.

screen shot 2019-01-03 at 7 06 07 pm
suvayu commented 5 years ago

I think you misunderstood my suggestion. You are trying to run it from the directory where you unpacked EPS. Also, you should be able to check if the script exists (for that matter any file) with the ls command first.

Try this: ls ~/.local/bin/ (~ is an abbreviation for your home, on a Mac it's most likely /Users/anonanon1). You should see these two scripts: electrum-personal-server, and electrum-personal-server-rescan. If the above path does not have the EPS scripts, you could also look for them in ~/Library/Python/<python version>. <python version> is 3.5, 3.6, 3.7, etc; whatever Python version you are using. You may check that with python --version.

Once you have located the scripts, you can then execute like this (replace with the appropriate paths):

$ ~/.local/bin/electrum-personal-server /path/to/config-file.cfg

PS: Sorry the paths may not be exact, I have rarely used a Mac and I am guessing based on expected behaviour on UNIX-like systems and Python documentation.

JamesTwitter commented 5 years ago

Suvayu, it worked.

Last login: Fri Jan 4 11:03:09 on ttys000 anons-MacBook-Pro:~ anonanon1$ /Users/anonanon1/Library/Python/3.7/bin/electrum-personal-server-rescan /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg INFO:2019-01-04 11:05:46,746: Starting the Electrum Personal Server rescan script INFO:2019-01-04 11:05:46,746: Logging to /var/folders/tl/lqj8q72551d9vtwq64b94rt40000gp/T/electrumpersonalserver.log Enter earliest wallet creation date (DD/MM/YYYY) or block height to rescan from: Rescan from block height ? (y/n):y INFO:2019-01-04 11:08:00,138: Rescanning. . . for progress indicator see the bitcoin node's debug.log file INFO:2019-01-04 11:17:08,591: end anons-MacBook-Pro:~ anonanon1$ /Users/anonanon1/Library/Python/3.7/bin/electrum-personal-server /Users/anonanon1/Desktop/electrum-personal-server-eps-v0.1.6/config.cfg INFO:2019-01-04 11:20:29,379: Starting Electrum Personal Server INFO:2019-01-04 11:20:29,379: Logging to /var/folders/tl/lqj8q72551d9vtwq64b94rt40000gp/T/electrumpersonalserver.log INFO:2019-01-04 11:20:29,446: Displaying first 3 addresses of each master public key: INFO:2019-01-04 11:20:29,446: Obtaining bitcoin addresses to monitor . . . INFO:2019-01-04 11:20:29,446: Obtained list of addresses to monitor in 0.0021419525146484375sec INFO:2019-01-04 11:20:29,446: Building history with addresses . . . INFO:2019-01-04 11:20:29,931: Found txes. History built in 0.4842650890350342sec INFO:2019-01-04 11:20:29,932: Starting electrum server INFO:2019-01-04 11:20:29,932: Listening for Electrum Wallet on ('127.0.0.1', 50002) INFO:2019-01-04 11:20:35,178: Electrum connected from ('127.0.0.1', 54909)

Electrum is showing my coins as "unconfirmed" for some reason. Also, block height for all my coins is being shown as "-2."

I am extremely grateful for your kindness in helping me figure this out. Do you have a bitcoin address I can donate to?

suvayu commented 5 years ago

Glad I could be of help. Thanks for asking, but no donations are necessary; welcome to the world of opensource software :)