Closed MyNameIsOka closed 5 years ago
Are you running that command on your host machine or within the container?
You'll need to either run it from within the container, or if you want to run it from your host, expose the RPC port.
I am running it from within the container.
I have to add that I am running on Regtest and set the block creation to 20 seconds.
Can you paste some console output?
Thank you for taking the time to look into this, much appreciated :)
ubuntu@:~$ docker ps
WARNING: Error loading config file: /home/ubuntu/.docker/config.json: stat /home/ubuntu/.docker/config.json: permission denied
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7e7ae0cfe13d electrumx "wait-for-it.sh bitc…" 3 hours ago Up 2 hours 0.0.0.0:55001->50001/tcp, 0.0.0.0:55002->50002/tcp electrumx_regtest
884621ffb792 bitcoind "/bin/sh -c /home/bi…" 6 weeks ago Up 5 days 8332-8333/tcp, 18332-18333/tcp, 18444/tcp, 0.0.0.0:3001->3000/tcp, 0.0.0.0:5000->18443/tcp bitcoin_rs
ubuntu@:~$ docker exec -it electrumx_regtest bash
WARNING: Error loading config file: /home/ubuntu/.docker/config.json: stat /home/ubuntu/.docker/config.json: permission denied
bash-4.4# electrumx_rpc stop
cannot connect - is ElectrumX catching up, not running, or is 18443 the wrong RPC port?
bash-4.4#
When I stop and restart the Docker container:
WARNING:Controller:received SIGTERM signal, initiating shutdown
INFO:Controller:shutting down
INFO:Prefetcher:cancelled; prefetcher stopping
INFO:BlockProcessor:flushing to DB for a clean shutdown...
INFO:SessionManager:closing down TCP, RPC listening servers
INFO:Controller:shutdown complete
INFO:electrumx:ElectrumX server terminated normally
wait-for-it.sh: waiting 15 seconds for bitcoind:3000
wait-for-it.sh: bitcoind:3000 is available after 0 seconds
INFO:electrumx:ElectrumX server starting
INFO:electrumx:logging level: INFO
INFO:Controller:Python version: 3.7.2 (default, Jan 30 2019, 23:45:31) [GCC 6.4.0]
INFO:Controller:software version: ElectrumX 1.11.0
INFO:Controller:aiorpcX version: 0.15.0
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 bitcoind:18443/ (current)
INFO:DB:switching current directory to /data
INFO:DB:using leveldb for DB backend
INFO:DB:opened UTXO DB (for sync: True)
INFO:DB:DB version: 6
INFO:DB:coin: BitcoinSegwit
INFO:DB:network: regtest
INFO:DB:height: 195,001
INFO:DB:tip: 10e97ef1f0ca56af8a317d4babea07338d505f44ac34d16759c6c69b5ada3f50
INFO:DB:tx count: 197,302
INFO:DB:flushing DB cache at 1,200 MB
INFO:History:history DB version: 0
INFO:History:flush count: 428
INFO:DB:deleted 427 stale undo entries
INFO:BlockProcessor:caught up to height 195001
INFO:DB:closing DBs to re-open for serving
INFO:DB:opened UTXO DB (for sync: False)
INFO:DB:DB version: 6
INFO:DB:coin: BitcoinSegwit
INFO:DB:network: regtest
INFO:DB:height: 195,001
INFO:DB:tip: 10e97ef1f0ca56af8a317d4babea07338d505f44ac34d16759c6c69b5ada3f50
INFO:DB:tx count: 197,302
INFO:History:history DB version: 0
INFO:History:flush count: 428
INFO:SessionManager:RPC server listening on electrumx:18443
INFO:DB:populating header merkle cache...
INFO:MemPool:beginning processing of daemon mempool. This can take some time...
INFO:DB:header merkle cache populated in 1.3s
INFO:Prefetcher:caught up to daemon height 195,001
INFO:SessionManager:max session count: 1,000
INFO:SessionManager:session timeout: 600 seconds
INFO:SessionManager:session cost hard limit 10,000
INFO:SessionManager:session cost soft limit 1,000
INFO:SessionManager:bandwidth unit cost 5,000
INFO:SessionManager:request sleep 2,500ms
INFO:SessionManager:request timeout 30s
INFO:SessionManager:initial concurrent 10
INFO:SessionManager:max response size 1,000,000 bytes
INFO:MemPool:compact fee histogram: []
INFO:MemPool:synced in 1.33s
INFO:MemPool:0 txs 0.00 MB touching 0 addresses
INFO:SessionManager:TCP server listening on electrumx:50001
INFO:SessionManager:SSL server listening on electrumx:50002
INFO:PeerManager:beginning peer discovery. Force use of proxy: False
INFO:PeerManager:trying to detect proxy on "localhost" ports [9050, 9150, 1080]
INFO:PeerManager:no proxy detected, will try later
When I am running the command from outside the container (I know, I didn't expose the RPC port for that)
ubuntu@:~$ docker exec -it electrumx_regtest bash electrumx_rpc
WARNING: Error loading config file: /home/ubuntu/.docker/config.json: stat /home/ubuntu/.docker/config.json: permission denied
/usr/local/bin/electrumx_rpc: line 3: __requires__: command not found
/usr/local/bin/electrumx_rpc: electrumx_rpc: line 4: syntax error near unexpected token `'pkg_resources''
/usr/local/bin/electrumx_rpc: electrumx_rpc: line 4: `__import__('pkg_resources').run_script('electrumX==1.11.0', 'electrumx_rpc')'
Looks like it's because the RPC port isn't being setup.
Will get this fixed for the v1.12.0 release.
Great, thank you for helping me out!
@MyNameIsOka v1.12.0 should be live now.
Can you update: https://github.com/lukechilds/docker-electrumx/pull/28#issuecomment-492876551
And let me know if this resolves your issue?
I'll just re-open this issue to keep it tracked until I know it's resolved.
The result is the same.
ubuntu@ip:~/btc_server/Regtest$ docker ps
WARNING: Error loading config file: /home/ubuntu/.docker/config.json: stat /home/ubuntu/.docker/config.json: permission denied
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7fb8c05272bb 112.dkr.ecr.ap-northeast-1.amazonaws.com/electrumx "wait-for-it.sh bitc…" 14 minutes ago Up 14 minutes 0.0.0.0:8000->8000/tcp, 50004/tcp, 0.0.0.0:55001->50001/tcp, 0.0.0.0:55002->50002/tcp electrumx_regtest
884621ffb792 bitcoind "/bin/sh -c /home/bi…" 7 weeks ago Up 13 days 8332-8333/tcp, 18332-18333/tcp, 18444/tcp, 0.0.0.0:3001->3000/tcp, 0.0.0.0:5000->18443/tcp bitcoin_rs
ubuntu@ip:~/btc_server/Regtest$ docker exec -it electrumx_regtest bash
WARNING: Error loading config file: /home/ubuntu/.docker/config.json: stat /home/ubuntu/.docker/config.json: permission denied
bash-4.4# electrumx_rpc getinfo
cannot connect - is ElectrumX catching up, not running, or is 8000 the wrong RPC port?
bash-4.4# electrumx_rpc getinfo
cannot connect - is ElectrumX catching up, not running, or is 8000 the wrong RPC port?
bash-4.4#
Going through the logs, I saw that the RPC server can't listen to port 8000:
ERROR:SessionManager:RPC server failed to listen on localhost:8000: [Errno 99] error while attempting to bind on address ('::1', 8000, 0, 0): address not available
I can't make much of this error. Do you have a suggestion?
INFO:electrumx:ElectrumX server starting
INFO:electrumx:logging level: INFO
INFO:Controller:Python version: 3.7.2 (default, Jan 30 2019, 23:45:31) [GCC 6.4.0]
INFO:Controller:software version: ElectrumX 1.12
INFO:Controller:aiorpcX version: 0.18.1
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 bitcoind:18443/ (current)
INFO:DB:switching current directory to /data
INFO:DB:using leveldb for DB backend
INFO:DB:opened UTXO DB (for sync: True)
INFO:DB:DB version: 6
INFO:DB:coin: BitcoinSegwit
INFO:DB:network: regtest
INFO:DB:height: 228,362
INFO:DB:tip: 6d23ec6e64bc76462b41d83dbba68d8b6259a070e7c77d12a135424fe6e32fce
INFO:DB:tx count: 237,864
INFO:DB:flushing DB cache at 1,200 MB
INFO:History:history DB version: 0
INFO:History:flush count: 2,109
INFO:DB:deleted 2,109 stale undo entries
ERROR:SessionManager:RPC server failed to listen on localhost:8000: [Errno 99] error while attempting to bind on address ('::1', 8000, 0, 0): address not available
INFO:Prefetcher:catching up to daemon height 228,431 (69 blocks behind)
INFO:BlockProcessor:our height: 228,372 daemon: 228,431 UTXOs 0MB hist 0MB
INFO:BlockProcessor:processed 10 blocks size 0.00 MB in 0.0s
INFO:BlockProcessor:processed 59 blocks size 0.02 MB in 0.0s
INFO:BlockProcessor:caught up to height 228431
INFO:DB:flushed filesystem data in 0.00s
INFO:History:flushed history in 0.0s for 69 addrs
INFO:DB:flushed 69 blocks with 69 txs, 69 UTXO adds, 0 spends in 0.0s, committing...
INFO:DB:flush #2,110 took 0.0s. Height 228,431 txs: 237,933 (+69)
INFO:DB:tx/sec since genesis: 5, since last flush: 81
INFO:DB:sync time: 11h 43m 01s ETA: 00s
INFO:DB:closing DBs to re-open for serving
INFO:DB:opened UTXO DB (for sync: False)
INFO:DB:DB version: 6
INFO:DB:coin: BitcoinSegwit
INFO:DB:network: regtest
INFO:DB:height: 228,431
INFO:DB:tip: 1795f8bdca0217d655bf791397bdea5460ec6ada85971fa90c412228ade69830
INFO:DB:tx count: 237,933
INFO:History:history DB version: 0
INFO:History:flush count: 2,110
INFO:DB:deleted 69 stale undo entries
INFO:DB:populating header merkle cache...
INFO:MemPool:beginning processing of daemon mempool. This can take some time...
INFO:SessionManager:max session count: 1,000
INFO:SessionManager:session timeout: 600 seconds
INFO:SessionManager:session cost hard limit 10,000
INFO:SessionManager:session cost soft limit 1,000
INFO:SessionManager:bandwidth unit cost 5,000
INFO:SessionManager:request sleep 2,500ms
INFO:SessionManager:request timeout 30s
INFO:SessionManager:initial concurrent 10
INFO:SessionManager:max response size 1,000,000 bytes
INFO:MemPool:synced in 0.01s
INFO:MemPool:compact fee histogram: []
INFO:MemPool:0 txs 0.00 MB touching 0 addresses
INFO:SessionManager:TCP server listening on all_interfaces:50001
INFO:SessionManager:SSL server listening on all_interfaces:50002
INFO:SessionManager:WSS server listening on all_interfaces:50004
INFO:PeerManager:peer discovery: ON
INFO:PeerManager:announce ourself: True
INFO:PeerManager:my clearnet self: None
INFO:PeerManager:force use of proxy: False
INFO:PeerManager:beginning peer discovery...
INFO:PeerManager:trying to detect proxy on "localhost" ports [9050, 9150, 1080]
INFO:PeerManager:no proxy detected, will try later
INFO:DB:header merkle cache populated in 1.6s
That's odd, @Mave95 any ideas?
It's trying to use the IPv6 loopback address. That was the reason I've set it to rpc://127.0.0.1:8000. You should try rpc://0.0.0.0:8000 and see if that works. If you don't need rpc on your host, you could just use the IPv4 loopback address.
@Mave95 Thanks for your input.
Any idea why it's trying to use IPv6 and failing but it's working for the other services?
So rpc://0.0.0.0:8000
should allow loopback and external connections, right? But just explicitly say we want to use IPv4?
The reason I want to allow remote connections is so people can do -p 127.0.0.1:8000:8000
and expose the port on the loopback address of the Docker host to query it directly, or query from other Docker images.
@MyNameIsOka Unfortunately I don't have access to a full node to test this right now and I'm pretty busy with work. If you're available to test this I can just keep pushing updates on Docker Hub for you to pull down and test. Can you spare a few minutes to test?
I've just tested it with rpc://0.0.0.0:8000. Works as expected. See #29
Thanks @Mave95.
@MyNameIsOka I've just pushed @Mave95's fix to Docker Hub. Can you update and try again?
@lukechilds @Mave95, sorry for the late response. Changing rpc://0.0.0.0:8000
worked and I can now use electrumx_rpc from within the docker container.
Thanks a lot!
@MyNameIsOka Great, thanks for helping us test!
Hi all,
I need to stop the ElectrumX server within the docker container in order to run the
electrumx_compact_history
script from within the container.When I use the command
electrumx_rpc stop
, it sayscannot connect - is ElectrumX catching up, not running, or is 18443 the wrong RPC port?
I already tried different ports.Do you have any experience in running that script in order to compact the history? The reason to run this script is if the flush_count of the database reaches 65535.