Author

Topic: having problems running bitcoind -testnet (Read 2236 times)

sr. member
Activity: 910
Merit: 302
September 10, 2014, 01:15:35 PM
#15
ok turns out the only problem is something that I believe is undocumented
In order for testnet to work when you have ssl enabled, you have to copy the certificate file in the testnet3 dir as well.
I just did that and it all worked instantly!

source: https://bitcointalksearch.org/topic/ssl-rpc-with-bitcoind-93845


And big thanks for deepceleron for sharing so much time to troubleshoot this with me! It's really appreciated!
sr. member
Activity: 910
Merit: 302
September 10, 2014, 07:56:28 AM
#14
well I'm with bitcoind 90201 on the server and was using the same and main .conf file in ~./bitcoin
didn't have any conf file in testnet3, because nowhere was mentioned i need separate one (i was reading the wiki, i guess it refers to the latest version....)

so, i'll be updating it now and test again Smiley
sr. member
Activity: 910
Merit: 302
September 10, 2014, 07:51:03 AM
#13
- ok just to make sure i went back and commented out the testnet=1 in the config file
- first i ran just ./bitcoind and all commands were working fine as usual
- then I ran ./bitcoind -testnet in terminal #1
- did  this in terminal #2 "./bitcoind -testnet help" and got again "error: no response from server"

conclusion, as soon as i start it with -testnet, either as parameter or set in the config file, it doesn't work?!


edit: just saw your post above, this was written before i saw it, reading it now Smiley
legendary
Activity: 1512
Merit: 1036
September 10, 2014, 07:49:10 AM
#12
I discovered that behaviour has changed in the latest version of Bitcoin core; the bitcoin.conf in the testnet3 directory is now ignored, your main bitcoin.conf file is used for testnet also (which could give problems if you don't swap a testnet version for the mainnet version correctly). Disregard that advice.

If it is a remote machine, I would remove that factor first. Download bitcoin to your own desktop and get familiar with its operation there. I just renamed my %appdata%\bitcoin directory on my windows machine to simulate a fresh install with the latest version.

1. with no data files whatsoever I get the expected error that server mode is not configured yet:

C:\Program Files\Bitcoin\daemon>bitcoind -testnet
Error: To use the "-server" option, you must set a rpcpassword in the configurat
ion file:
C:\Users\USERNAME\AppData\Roaming\Bitcoin\bitcoin.conf
It is recommended you use the following random password:
rpcuser=bitcoinrpc
rpcpassword=7CUwmPZURcPQbFYbi42cAH1EbZrxF6NLYTTWpWpzF6wJ
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.

It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %s | mail -s "Bitcoin Alert" [email protected]


2. I therefore made the recommended minimum %appdata%\bitcoin\bitcoin.conf file:
Code:
server=1
rpcuser=bitcoinrpc
rpcpassword=7CUwmPZURcPQbFYbi42cAH1EbZrxF6NLYTTWpWpzF6wJ

3. Ran again, works as expected, the command window sits there after running:
C:\Program Files\Bitcoin\daemon>bitcoind -testnet

4. In a new command window, lets watch the blocks get downloaded with some example commands:

C:\Program Files\Bitcoin\daemon>bitcoind -testnet getblockcount
79908

C:\Program Files\Bitcoin\daemon>bitcoind -testnet getblockcount
79969

5. Shut the Bitcoin server down the right way through a remote command:
bitcoind -testnet stop

6. Then I also add testnet=1 to bitcoin.conf, and all the above work the same when I remove "-testnet" from all command lines above.

If following this example to-the-letter works on your local computer, duplicate on the remote computer: rename the .bitcoin directory and make a new one, create the four-line config file, and run your bitcoin commands with the latest version of bitcoin. For remote testing, don't try to put the first bitcoind in daemon mode or in the background, just open another ssh terminal to run the second copy. The only thing remaining would be that the ISP is interfering with ports on the remote machine or bitcoin isn't able to run correctly on that box for technical or software library reasons.
sr. member
Activity: 910
Merit: 302
September 10, 2014, 07:20:16 AM
#11
well i was starting it like ./bitcoind -daemon to have the terminal back and still getting those errors.

However I just tried like you said, starting with just ./bitcoind (since I have testnet=1 in the conf now) and trying to give commands from another terminal, still giving that same error

bitcoin-qt i can't run, since this is just a server I ssh to

i didn't have luck with -testnet parameter and no conf file setting either, I started with this first actually

So, seems like it's pretty much unknown what else might be? Sad
legendary
Activity: 1512
Merit: 1036
September 10, 2014, 07:13:05 AM
#10
I see from the first comment where you say "it's just hanging at the terminal". Just to clarify: You need to run one instance of ./bitcoind -testnet which will look like a hung terminal - it just sits there and runs. That is the 'server' part, the d stands for daemon.

You need to leave that first bitcoind running, then use another terminal to issue the RPC commands to communicate with Bitcoin. Open another console window or tab and then you can run the commands I outline in my first response where I say "shell #2".


If you have the testnet and server options in bitcoin.conf, you can also start bitcoin-qt (confirm it has the green logo for testnet when it starts) and communicate with it using bitcoind the same way as if you were communicating with bitcoind as the server.

Just so you can see it running correctly before you get too advanced - use the -testnet command-line option for every command like I show in the first reply and see that all those commands work. Then you can move to the bitcoin.conf option.

You can leave rpcallowip commented out; it is only needed if you are communicating from another computer. The IP address in rpcconnect=127.0.0.1 means localhost so leave that line there set to that IP address.

When the .bitcoind -testnet command line option is used to start Bitcoin in testnet mode, a different bitcoin.conf file is used, ~/.bitcoin/testnet3/bitcoin.conf - if you are starting with the -testnet command line option, then this is where you need to make the changes. A misconfigured config file in testnet3 (where there is another wallet.dat for testnet) could be messing up things.
sr. member
Activity: 910
Merit: 302
September 10, 2014, 06:39:11 AM
#9
I had the server=1 but also rpcport=8332 which wasn't commented
so here is my conf file now (EDITED OUT i just placed, it has the actual values in the file)

Code:
testnet=1
server=1
#rpcport=8332
rpcuser=EDITED OUT
rpcpassword=EDITED OUT
rpcssl=1
rpcallowip=EDITED OUT
rpcsslciphers=EDITED OUT
rpcsslcertificatechainfile=sEDITED OUT
rpcsslprivatekeyfile=EDITED OUT


unfortunately i still get
./bitcoind getblockcount
error: no response from server

Sad
legendary
Activity: 1512
Merit: 1036
September 10, 2014, 06:22:30 AM
#8
yes, i placed bitcoin.conf in ~./bitcoin
I play with it quite often, so that should be done right
just tried again, killed it, checked the file has the new setting, started again and again
./bitcoind getblockcount
error: no response from server


Sad

when bitcoind is killed it says "error: couldn't connect to server" so it's started, just not quite....
or you don't have the server=1 option turned on or such. Here's an example file: http://we.lovebitco.in/bitcoin.conf.example
remove example from the file name, and go through all the options, uncommenting and changing the ones appropriate for you. The port option in bitcoin.conf may force the testnet bitcoin to be on the mainnet port if you forgot to comment that out.
sr. member
Activity: 910
Merit: 302
September 10, 2014, 06:12:27 AM
#7
yes, i placed bitcoin.conf in ~./bitcoin
I play with it quite often, so that should be done right
just tried again, killed it, checked the file has the new setting, started again and again
./bitcoind getblockcount
error: no response from server


Sad

when bitcoind is killed it says "error: couldn't connect to server" so it's started, just not quite....
legendary
Activity: 1512
Merit: 1036
September 10, 2014, 06:06:12 AM
#6
ok it has been started as a -daemon like 10 mins ago and still i get (the testnet=1 is in the conf file now)
 ./bitcoind getinfo
error: no response from server

./bitcoind getblockcount
error: no response from server

The bitcoin.conf file has to be placed in the bitcoin data directory (likely the hidden .bitcoin directory in your home directory; try cd ~/.bitcoin to get there). There isn't one by default, you have to make one.

Just putting -testnet in all the commands will be less ambiguous.
sr. member
Activity: 910
Merit: 302
September 10, 2014, 06:00:43 AM
#5
ok it has been started as a -daemon like 10 mins ago and still i get (the testnet=1 is in the conf file now)
 ./bitcoind getinfo
error: no response from server

./bitcoind getblockcount
error: no response from server
legendary
Activity: 1512
Merit: 1036
September 10, 2014, 05:59:16 AM
#4
ah!
So, actually both are running if started with just ./bitcoind -testnet and not with the testnet=1 option in the conf file?

ok, just added it to the conf file and started with ./bitcoind
still waiting, but lets see


You don't have to wait to see, you can immediately start polling with commands like I demonstrated above to watch the block count increasing as blocks are downloaded or see network details.

You can also have some free coins:

>.bitcoind -testnet importprivkey 92GaZxWBnoNw1dtARu6Uge7YS8NYGLvkSbt5vEqHxsMJpDPzia5 fromdc

sr. member
Activity: 910
Merit: 302
September 10, 2014, 05:44:49 AM
#3
ah!
So, actually both are running if started with just ./bitcoind -testnet and not with the testnet=1 option in the conf file?

ok, just added it to the conf file and started with ./bitcoind
still waiting, but lets see
legendary
Activity: 1512
Merit: 1036
September 10, 2014, 05:22:59 AM
#2
The most likely mistake you are making is that every command you issue has to include the -testnet parameter, unless you have put a testnet=1 option in the bitcoin.conf config file - replacing your normal Bitcoin options. Likewise, if you specify a datadir at the command line, every RPC command has to include the same datadir option.

Example usage:

(in shell #1, to run Bitcoin)
>.bitcoind -testnet

(in shell #2, to talk to Bitcoin)
>.bitcoind -testnet help
addmultisigaddress nrequired ["key",...] ( "account" )
addnode "node" "add|remove|onetry"
backupwallet "destination"
....

>.bitcoind -testnet getblockcount
279565

>.bitcoind -testnet getnetworkinfo
{
    "version" : 90201,
    "protocolversion" : 70002,
    "timeoffset" : 0,
    "connections" : 8,
    "proxy" : "",
    "relayfee" : 0.00001000,
    "localaddresses" : [
        {
            "address" : "10.0.0.10",
            "port" : 18333,
            "score" : 4
        }
    ]
}
sr. member
Activity: 910
Merit: 302
September 10, 2014, 05:01:56 AM
#1
Well the first time I ran ./bitcoind -testnet it needed few hours to download the blockchain which is normal.
Then i needed to restart it, just to find that it takes few hours again. (I checked the blockchain and all is  donwloaded in the testnet3 sub-folder)
I left it overnight, and just found that it's running but listening only to 8332 and 8333, instead of the testnet ones of 18332 and 18333

so i started it for 3rd time and it's hanging there in the terminal and god knows how long it will be this time.

So, what i'm doing wrong and how to actually run it so i can connect to it using the testnet blockchain?
Jump to: