Specify rpc user and password at runtime

+5 votes

I know that the RPC username and password for the node are generated upon runtime of the blockchain in the specific node, but is it not possible to provide them as runtime parameters or something?

I haven't seen the user and password as runtime params in the official docs. I also tried specifying 

-rpcuser=foo and -rpcpassword=bar but it didn't work. Still random password was generated.

My last try would be to manually replace the content of the multichain.conf file, but if I want to connect a service to the node, that means that I have to start the blockchain (in order to generate the file), then stop it, replace the content with my username and password and then start it again?

asked Apr 4, 2018 by milkncookiez

1 Answer

+3 votes
 
Best answer

A random password may still be generated in the multichain.conf file, but if you pass the -rpcuser and -rpcpassword parameters on the command line, these will override whatever is in the multichain.conf file, in terms of the credentials required by the API endpoint.

answered Apr 5, 2018 by MultiChain
selected Apr 6, 2018 by milkncookiez
Okay, so it does work with custom set -rpcuser and -rpcpassword runtime params, but they have to be set every time I run the blockchain, because they are not saved anywhere. If I run the blockchain w/o them the 2nd time, it will use the credentials from the config file.
And for accessing the DB of the blockchain, I have to use the config file credentials again. (just self-explaining, I guess... :D )
OK, so in that case you need to just update the contents of the multichain.conf file one time, and it will stick.
...