I'm building a node.js app that uses a json-rpc connection to fetch information from the bitcoin daemon.

It works great, except every once in a while, the RPC connection "fails." It goes down for anywhere from 1-20 seconds. Querying it via the command line gives the response: error: couldn't connect to server. I have built in an error handling mechanism that waits a progressively larger amount of time for each unsuccessful connection, and it works well.

My problem, is over the course of progressively scanning the blockchain, over half of the running time is spent waiting for the daemon to come alive.

My thought was maybe its my hard drive/something with my computer, so I moved it to an ec2 instance (specifically c3.2xl) and moved the blockchain to the SSD. This actually increased the amount of time waiting versus running the node app locally.

Has anyone experienced this before and came up with a solution?

  • How many addresses does your client handle? Do you scan the blockchain through the RPC API? If you do I would suggest you take a look at this article: codeproject.com/Articles/784519/…
    – user11221
    Jun 24, 2014 at 0:56
  • That is a great analysis, unfortunately, I'm dealing with live data so stopping the daemon to safely use the blockchain files is not an option.
    – Nathan
    Jun 24, 2014 at 1:03
  • Have you changed some config in .bitcoin/bitcoin.conf? Have you tried tweaking the -par option?
    – knaperek
    Jun 24, 2014 at 13:05
  • 2
    You're probably running out of local TCP ports. You need to reuse your RPC connections rather than sending each RPC request over its own connection. Oct 22, 2014 at 18:35

1 Answer 1


I haven't had this issue before and I've been spamming my RPC pretty hard.

Does your bitcoind already contain the whole blockchain or is it still updating?

There's a debug.log and db.log in the bitcoind data directory, I guess those will tell you what's wrong.

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.