2

Playing around with litecoin json-rpc running on windows (the API is the same as bitcoin, so I am using bitcoin's references).

My litecoin.conf has the following data:

rpcuser=user
rpcpassword=pass
txindex=1

Based on the documentation I started the core client as .\litecoind.exe -server, and it looks like it works just fine because I can run various commands from another window (.\litecoin-cli.exe getblockcount and many other work as expected).

Now I wanted to make some json-rpc calls and I tried Go's library which bitcoin's developers recommend. I used the example from that library's github and the only modifications which I introduced were my user and pass in the definition of the ConnConfig.

The code fails during the execution of client.GetBlockCount() with an error:

Post http://localhost:8332: dial tcp [::1]:8332: connectex: No connection could be made because the target machine actively refused it.

I think that the problem is with json-rpc server but I have no idea how to verify that it works properly. Any idea how to fix it?

7
  • So the machine you are trying to connect to refuses tcp or http over tcp ports. Note it does say http not https, Google browser refuses http connections as well as related software api's I assume as well. Http is generally considered outdated as it is completely insecure/no encryption. Commented Dec 18, 2017 at 7:05
  • @marshalcraft when I changed it to https, the result was the same: Post https://localhost:8332: dial tcp [::1]:8332: connectex: No connection could be made because the target machine actively refused it. Commented Dec 18, 2017 at 9:44
  • Well I don't know best strategy to trouble shoot, but I would try to establish an tcp https connection to rule out that the server simply closed on the relevant port. From the error it says you do not even have a connection. Sometimes errors can give misleading causes. This is deterministic approach but if you have more experience, maybe it's another issue. Commented Dec 18, 2017 at 11:19
  • Also barring that it isn't an http refusal I would go back to http then if you aren't concerned about security, slightly better performance. Commented Dec 18, 2017 at 11:20
  • Like if your any good with Berkeley sockets or winsock do a http get request on the http port and you should get an redirect or even a refusal and then close but you don't get a winsock error code for failure to tcp connect you know then it's http JavaScript API configuration issue and not that there isn't a server. Commented Dec 18, 2017 at 11:24

1 Answer 1

2

I was using bitcoin's port. Should have provided a port for litecoin: 9332.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.