I am using node-bitcoin-rpc to do some api calls to bitcoind, but I am getting 401 error. I know this simply means unauthorized, but I have no authorization enable in my config file.

Howerver I can query bitcoin client using vitcoin-cli --regtest listaccounts, I get the results.

My bitcoin.conf file is pretty simple


PS: I didn't have any bitcoin.conf initially, so I create above one inside .bitcoin folder in home directory.


The RPC interface is an authenticated interface. You need to provide a username and password in order to send RPC commands. These are usually specified in the bitcoin.conf file with the rpcuser and rpcpassword options or the rpcauth option. There are also temporary RPC credentials stored in the .cookie file that can be found in the datadir.

The reason that you have no problems with bitcoin-cli is because it looks up the RPC credentials from the bitcoin.conf file or the .cookie file..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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