2

So I am in the process of downloading the blocks after installing bitcoin on my ubuntu server. I have followed the guide on https://bitcoin.org/en/full-node.

Everything is working correctly. Blocks are downloading just fine to ~/.bitcoin/blocks. bitcoin-cli commands are working without error.

If I switch users and I try to issue a bitcoin-cli command naturally I get "Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set."

However when using the correct user where cli commands do work, there is still no bitcoin.conf file inside ~/.bitcoin/ As the node is downloading the blocks and the cli commands work I assume there must be a conf file - yet its not where every single document and support answer claims it will be.

I have tried find . -name "bitcoin.conf" in the ~/.bitcoin directory as well as user ~/ and in /etc all return empty. Where else could this file possibly hide? If it doesn't exists why would I still be downloading blocks and able to issue cli commands?

I am aware this question has been asked countless times but i cant find any answers relating to the fact the node is working and cli commands are working.

4
  • 1
    With the user where bitcoin-cli does work, you can try running strace bitcoin-cli getblockchaininfo and read the output to see which path it is reading bitcoin.conf from. For example, I can see openat(AT_FDCWD, "/home/ubuntu/.bitcoin/bitcoin.conf", O_RDONLY) = 3 in my local output. Nov 3, 2019 at 6:49
  • well now i am super confused as that returns open("/home/admin/.bitcoin/bitcoin.conf", O_RDONLY) = -1 ENOENT (No such file or directory) and yet i can still issue commands like bitcoin-cli getnetworkhashps and bitcoin-cli getblockchaininfo without any errors.
    – Bruce
    Nov 3, 2019 at 7:01
  • Do you have a /home/admin/.bitcoin/.cookie file? Nov 3, 2019 at 7:23
  • yes i do have ha file, i has a single line in it
    – Bruce
    Nov 3, 2019 at 7:29

1 Answer 1

4

When you don't explicitly specify any RPC credentials, bitcoind will autogenerate them for you and store the password in the $DATADIR/.cookie file.

You can then use the username __cookie__ along with the password from that file.

1
  • 2
    Note that the contents of that file will change every time you restart Bitcoin Core. If you have a need for accessing your bitcoind in any setting other than the local user with bitcoin-cli, you should really create a bitcoin.conf file with a static username/password (look up rpcauth). Nov 3, 2019 at 17:11

Your Answer

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

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