I would like to store my Bitcoin RPC passwords and usernames in environment variables, like:


Is this supported in bitcoin core? Can environmental variables be parsed from my bitcoin.conf file?

  • Very bad idea! Why should you do such a thing? – o0'. May 24 '13 at 17:47
  • Why is it a bad idea? – alfetopito May 24 '13 at 17:52
  • I don't think this is a bad idea, but I do think that this is an XY Problem. – Nick ODell Jan 13 '16 at 23:27
  • This would be great to have. I use docker to host my bitcoin node and I would like to be able to have docker inject environment variables depending on production/dev etc. Have you found how to do this yet? – Mr_E Mar 19 '17 at 20:29
  • It's been awhile. At the time, I ended up generating the config file with the values rather than using envvars, as I found no other way to do it. – alfetopito Apr 17 '17 at 18:10

No, bitcoin core does not expand environment variables in bitcoin.conf.

See here to see how options are parsed.

You can expand environment variables as arguments for bitcoind:

$ bitcoind -rpcuser="$RPC_USERNAME" -rpcpassword="$RPC_PASSWORD"

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.