"Could not connect to the server". Compiled Bitcoin 0.18.1. #16676

issue openGLnoob opened this issue on August 22, 2019
  1. openGLnoob commented at 12:27 AM on August 22, 2019: none

    Finally I could compile Bitcoin 0.18.1 on Win7 with MinGW-w64-i686-posix-sjlj. I tried many combination all of it, but the successfully versions of libs is:

    boost 1.57
    libdb 4.8.30
    openssl 1.0.1
    libevent 2.0.22
    

    Here my bitcoin.conf:

    server=1
    rpcuser=username
    rpcpassword=password
    rpcallowip=127.0.0.1
    rpcport=8332
    onlynet=ipv4
    datadir=F:\BitcoinData
    

    I use bitcoind and bitcoin-cli without any additional parameters. When I start installed Bitcoin 0.18.1 official version everything works fine, BUT... when I start my compiled 0.18.1 version and getbalance I get:

    error: Could not connect to the server 127.0.0.1:8332
    Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
    

    Same thing with other bitcoin-cli requests. Both versions use the same conf file and wallet data. Both version works with turned-on firewall and windows RPC services. What is wrong with compiled version? I can't realise which parameters in ./configure I missed. ((

  2. openGLnoob commented at 12:38 AM on August 22, 2019: none

    Couple of comments.. In debug.log I see problems:

    WARNING: option -rpcallowip was specified without -rpcbind; this doesn't usually make sense
    libevent: getaddrinfo: no address associated with nodename
    Binding RPC on address ::1 port 8332 failed.
    

    If I replace a compiled version of bitcoin-cli from installed and request a balance I get :

    error: Could not connect to the server 127.0.0.1:8332 (error code 2 - "error while reading header, or invalid header")
    

    But bitcoin-cli.exe stop works fine in this case.

  3. emilengler commented at 1:50 PM on August 22, 2019: contributor

    How you use the bitcoin-cli command? Try bitcoin-cli --datadir=F:\BitcoinData Or bitcoin-cli --conf=\path\to\your\bitcoin.conf

  4. openGLnoob commented at 7:43 PM on August 22, 2019: none

    My .bat files was: bitcoin-cli stop, bitcoin-cli getbalance and etc. and it worked on official version. I tried now your lines, but I get the same errors. I tried to compile 0.16.1 with the same libs on MinGW-w64 and I get a similar error :

    error : couldn't connect to server : unknown (code -1) (make sure server is running and you are connecting to the correct RPC port)

  5. openGLnoob commented at 7:56 PM on August 22, 2019: none

    If I start bfgminer, he tells me: Pool 0 slow/down or URL or credentials invalid. Unable to get work from pool 0 http://127.0.0.1:8332 But at the same time in the debug.log I see: CreateNewBlock():....

  6. openGLnoob commented at 5:13 PM on August 26, 2019: none

    I tried to compile 0.18.1 version on MinGW-w64 with win32 threads but I had the same error. I tried run both versions (compiled/original) on another machine but no luck: original version works as expect, but compiled version had the same error. I use the same bicoin.conf, described above, and the simple comands bitcoin-cli getinfo, etc.

    When I run both version I get in netstat:

    TCP     127.0.0.1:8332    hostname:0             LISTENING
    TCP     127.0.0.1:8332    hostname:64015    TIME_WAIT
    

    When I call JSON-RPC manually by this:

    curl --data-binary '{"jsonrpc":"1.0","method":"getinfo","params":[
    ]}' http://username:password@127.0.0.1:8332/
    

    In the original bitcoind I get:

    {"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}
    

    But in compiled version I get empty string. It seems to me that bitcoind do not send any data by RPC. What's wrong? I don't change the source code from this repo at all. When I configure it I used no hexdump, no Qt, no miniupnpc, no zeromq. Are these libraries really important? Is this the cause of the problem?

  7. emilengler commented at 5:20 PM on August 26, 2019: contributor

    Try curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/ You forgot id and content-type

  8. openGLnoob commented at 5:53 PM on August 26, 2019: none

    @emilengler In the origianal installed version I get:

    {"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}
    

    In the compiled version I get empty string. ;((

  9. openGLnoob commented at 8:52 PM on August 26, 2019: none

    Ok, solved! A few days I spent on this shit. The problem was in libevent 2.0.22, if to be more precisely obtain_evhttp_request() from libevent make a mess. libevent 2.1.11 fixed this problem. Now bitcoin-cli works and responds fine. Thanks anyway!

  10. openGLnoob closed this on Aug 26, 2019

  11. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me