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 connect 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 i start the Bitcoind server: Server Log
- List item
And this is the error I am receiving on the application side: Application side error message
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
rpcport
, does your Java code try to connect to that port?