<p>just do this... </p>

<p>To use bitcoind and bitcoin-cli, you will need to add a RPC password to your bitcoin.conf file. Both programs will read from the same file if both run on the same system as the same user, so any long random password will work:</p>

<pre><code>  rpcpassword=change_this_to_a_long_random_password
</code></pre>

<p>in the future I'll be sure to <a href="https://bitcoin.org/en/developer-examples#testing-applications" rel="nofollow noreferrer">RTFM</a></p>

CC BY-SA 3.0
2017-04-27T18:18:44.427Z
2017-04-27T18:18:44.427Z
smatthewenglish
<p>This is what happens after I run this command <code>bitcoind --regtest --printtoconsole</code>, my guess is that it's something to do with bitcoin.conf</p>

<p><a href="https://i.sstatic.net/b1cTr.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/b1cTr.jpg" alt="enter image description here"></a></p>

<p>My bitcoin.conf file looks like this: </p>

<pre><code>server=1
rpcuser=root
rpcpassword=password
rpcconnect=127.0.0.1
rpcport=8332
</code></pre>

<p>If you need more context, these are my other questions: <a href="https://bitcoin.stackexchange.com/questions/52857/trouble-with-bitcoin-cli-regtest">trouble with bitcoin cli regtest</a> and <a href="https://bitcoin.stackexchange.com/questions/52832/interacting-with-bitcoin-over-docker?noredirect=1&amp;lq=1">interacting with bitcoin over docker</a></p>

CC BY-SA 3.0
2017-04-19T15:33:15.253Z
I don't see anything wrong.
Pieter Wuille
CC BY-SA 3.0
2017-04-19T15:33:48.780Z
but- I get this- `bitcoin-cli -regtest getinfo
error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)`
smatthewenglish
CC BY-SA 3.0
2017-04-19T15:48:14.917Z
Try removing the rpcconnect line. rpcconnect is an option to bitcoin-cli, not bitcoind.
Pieter Wuille
CC BY-SA 3.0
2017-04-19T15:49:55.637Z
ah- I removed it but- same error :/
smatthewenglish
CC BY-SA 3.0
2017-04-19T15:52:05.420Z
In fact, you can delete your bitcoin.conf entirely. bitcoind will create its own password if you don't set one (cookie), and bitcoin-cli can find it. All the other options are default. So I suggest just delete bitcoin.conf, restart bitcoind, and then try again.
Pieter Wuille
CC BY-SA 3.0
2017-04-19T15:59:53.557Z
when I delete it I get the error `bitcoin-cli -regtest getinfo` >>
`error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/root/.bitcoin/bitcoin.conf)`
smatthewenglish
CC BY-SA 3.0
2017-04-19T16:20:01.707Z
What version of bitcoind is running? It's in the first line of debug.log.
Pieter Wuille
CC BY-SA 3.0
2017-04-20T08:02:43.540Z
Bitcoin version v0.14.99.0-c91ca0a
smatthewenglish
CC BY-SA 3.0
2017-04-20T14:24:05.910Z
I think I need to do something like [described here](https://bitcoin.stackexchange.com/questions/28107/bitcoin-is-not-connected-in-regtest-mode), do you think it's right?
smatthewenglish
CC BY-SA 3.0
2017-04-20T14:26:45.680Z
I don't understand what the problem is for you. But no, that link doesn't help. bitcoin-cli fails to connect to your bitcoind entirely. That answer is about needing multiple nodes in your network before you can have all functionality.
Pieter Wuille
CC BY-SA 3.0
2017-04-20T19:44:05.473Z
I'm trying to run it on this docker image https://hub.docker.com/r/smatthewenglish/oakcoin/tags/ it's just an ubuntu image with the latest version of bitcoin cloned from github
smatthewenglish
<regtest>
running regtest network, bitcoin.conf incorrectly configured?
smatthewenglish
# running regtest network, bitcoin.conf incorrectly configured?

(Asked by: username_0 on 2017-04-19)

This is what happens after I run this command bitcoind --regtest --printtoconsole, my guess is that it's something to do with bitcoin.conf

My bitcoin.conf file looks like this: 
server=1
rpcuser=root
rpcpassword=password
rpcconnect=127.0.0.1
rpcport=8332

If you need more context, these are my other questions: trouble with bitcoin cli regtest and interacting with bitcoin over docker

**Tags:** regtest

> **Comments:**
> **username_1**: I don't see anything wrong.  
> **username_0**: but- I get this- `bitcoin-cli -regtest getinfo error: couldn't connect to server: unknown (code -1) (make sure server is running and you are connecting to the correct RPC port)`  
> **username_1**: Try removing the rpcconnect line. rpcconnect is an option to bitcoin-cli, not bitcoind.  
> **username_0**: ah- I removed it but- same error :/  
> **username_1**: In fact, you can delete your bitcoin.conf entirely. bitcoind will create its own password if you don't set one (cookie), and bitcoin-cli can find it. All the other options are default. So I suggest just delete bitcoin.conf, restart bitcoind, and then try again.  
> **username_0**: when I delete it I get the error `bitcoin-cli -regtest getinfo` >> `error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/root/.bitcoin/bitcoin.conf)`  
> **username_1**: What version of bitcoind is running? It's in the first line of debug.log.  
> **username_0**: Bitcoin version v0.14.99.0-c91ca0a  
> **username_0**: I think I need to do something like [described here](https://bitcoin.stackexchange.com/questions/28107/bitcoin-is-not-connected-in-regtest-mode), do you think it's right?  
> **username_1**: I don't understand what the problem is for you. But no, that link doesn't help. bitcoin-cli fails to connect to your bitcoind entirely. That answer is about needing multiple nodes in your network before you can have all functionality.  
> **username_0**: I'm trying to run it on this docker image https://hub.docker.com/r/username_0/oakcoin/tags/ it's just an ubuntu image with the latest version of bitcoin cloned from github  

---

## 1 answers

### Answer by username_0 on 2017-04-27. Score: 0 | Accepted answer

just do this... 
To use bitcoind and bitcoin-cli, you will need to add a RPC password to your bitcoin.conf file. Both programs will read from the same file if both run on the same system as the same user, so any long random password will work:
  rpcpassword=change_this_to_a_long_random_password

in the future I'll be sure to RTFM


---

