Bitcore-wallet-client errors

I’ve been trying for 4 hours straight to work with bitcoin-wallet-client to no avail, apart from the provided examples.

I’ve tried both the public bws instance ( and one deployed on my test machine (localhost:3232/bws/api). Installing the bws server in itself was a huge pain due to incompatibilities between mongodb and debian jessie. For those who are reading, libkrb5-dev is also needed to install bws server.

Now, for the good part. After hours of trying (since it isn’t documented anywhere) I finally figured out how to import the .dat wallet that is created in one of the examples with api.import.

This is how I did it: client.import(fs.readFileSync('wallet.dat'));

Is it correct? Is it the intended use-case? Who knows?! It is not documented, so it is just a guess. It works. How do I know? Well, now if I type client.credentials I can see the imported wallet. So, apparently, the behavior of .import is to store all the relevant data inside of the client object (in particular, the .credentials attribute). Good to know, since this behavior is also not documented.

Now, since the client objects seems to know about our wallet, one would guess we can get to know its balance, right? Wrong.

There is no single useful and relevant command from your API that won’t return an error. Let’s try it.

client.getBalance(function callback(a){console.log(a)})

Error: Illegal State.

What does it mean? Let’s try something simpler…

client.getStatus(function callback(a){console.log(a)})

[warn] DEPRECATED WARN: getStatus should receive 2 parameters.

So, apparently, .getStatus needs 2 arguments. Which are not documented (only the callback argument is documented).



Despite having joined other 2 contributors to my 3-2 wallet (so it should return true… or should it?). At least it seems to be responding not with an error.



Regardless of the answer to these problems, please, PLEASE, PLEASE! Do document your code. Do provide examples and intended use-cases for each one of your API calls. Do provide useful error messages.

I’m sure your bws-server is probably the coolest piece of tech of the decade (it really is!) but, as it is now, it is completely useless. There is only one person who can make sense of this code and that is the person who wrote it. For us mere mortals it is unusable.

5 minutes of your time can save 5000 minutes multiplied by the number of lost souls who will try to use your API.

1 Like


Yes BWC/BWS extensive documentation is still a pending issue, we would love to see to community contribution regarding this.

BWC is used in Copay and Bitcore-wallet. You can check the usage of all API calls, at bitcore-wallet scripts at:

for example, you can see openWallet at

In copay (a more complex usage) you can see the BWC usage at: