Localhost peer not detected error when trying to connect to Bitcoind server via JSON RPC from Java Application

81 views
Skip to first unread message

Juhar Ahmed

unread,
Sep 3, 2022, 4:51:16 AM9/3/22
to bitcoinj
I am running Bitcoin Network on local Ubuntu machine. The network consists of multiple nodes. I want to connect to the network from a java application running on the same machine via JSON RPC. I can connect to the Bitcoind server from command line using bitcoin-cli. However, I cannot to the Bitcoind server from the Java application using Bitcoinj Libraray. I suspect that the problem is related to RPC authentication. I specified rpc username and password in the bitcoin.conf file and I tried to use Java Authenticator in my Java code. However, it hasn't solved the problem.

        Authenticator.setDefault(new Authenticator() {
                    protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication (rpcuser, rpcpassword.toCharArray());
                    }});


My bitcoin.conf file is as follows:

    regtest=1
    server=1
    listen=1
    rpcuser=user
    rpcpassword=password
    fallbackfee=0.0001
    [regtest]
    port=10000
    rpcport=20000
    bind=127.0.0.1
    rpcbind=127.0.0.1
    rpcallowip=127.0.0.1

This is the log message I see when from the Bitcoind server side:
https://i.stack.imgur.com/ttEyH.png

And this is the error I am receiving on the application side:
https://i.stack.imgur.com/84WvF.png

I am using Bitcoin core version 22 for the server and Bitcoinj library version 16.1 (https://bitcoinj.org/getting-started) to connect to the server

Reply all
Reply to author
Forward
0 new messages