Hi
I'm trying to make a connection with the multichain through a java client.
I tried to use both API as show below however, both show connection error refused.
I'm trying to connect through a client on the server, I tried to run the .jar on own server and the error messages were the same.
I also tried to follow the orientations of the following topics with the same doubts, but had no success. Below as well as station I view the files and params.dat multichain.conf
http://www.multichain.com/qa/362/issue-while-connecting-with-node-using-java-client
http://www.multichain.com/qa/633/connect-multichain-using-json
In server multichain.conf: (ip client)
rpcuser=multichainrpc
rpcpassword=XYZ
server=1
rpcallowip=10.20.20.47/255.255.255.0
rpcport=4368
And params.dat
anyone-can-connect = true # Anyone can connect. Ignored if public-network=true.
anyone-can-send = true # Anyone can send.
anyone-can-receive = true # Anyone can receive.
API BitcoinRPCClient
https://github.com/cdelargy/BitcoinRPCClient
RPCClient c = new RPCClient();
c.getInfo();
public class RPCClient {
private static final String COMMAND_GET_INFO = "getinfo";
private JSONObject invokeRPC(String id, String method, List<String> params) {
DefaultHttpClient httpclient = new DefaultHttpClient();
JSONObject json = new JSONObject();
json.put("id", id);
json.put("method", method);
if (null != params) {
JSONArray array = new JSONArray();
array.addAll(params);
json.put("params", params);
}
JSONObject responseJsonObj = null;
try {
httpclient.getCredentialsProvider().setCredentials(new AuthScope("10.20.20.221", 4368),
new UsernamePasswordCredentials("multichainrpc", "XYZ"));
StringEntity myEntity = new StringEntity(json.toJSONString());
System.out.println(json.toString());
HttpPost httppost = new HttpPost("http://10.20.20.221:4368");
httppost.setEntity(myEntity);
System.out.println("executing request" + httppost.getRequestLine());
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
System.out.println(response.getStatusLine());
if (entity != null) {
System.out.println("Response content length: " + entity.getContentLength());
}
JSONParser parser = new JSONParser();
responseJsonObj = (JSONObject) parser.parse(EntityUtils.toString(entity));
(... catch)
}
public JSONObject getInfo() {
JSONObject json = invokeRPC(UUID.randomUUID().toString(), COMMAND_GET_INFO, null);
return (JSONObject)json.get("result");
}
}
ERROR:
API Bitcoin-JSON-RPC-Client​
https://bitbucket.org/azazar/bitcoin-json-rpc-client/wiki/Home
public static void balance() throws BitcoinException {
System.out.println(new BitcoinJSONRPCClient().getBalance());
}
ERROR: