Bitcoin Forum
May 05, 2024, 09:11:05 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: having problems running bitcoind -testnet  (Read 2222 times)
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 10: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?
1714900265
Hero Member
*
Offline Offline

Posts: 1714900265

View Profile Personal Message (Offline)

Ignore
1714900265
Reply with quote  #2

1714900265
Report to moderator
1714900265
Hero Member
*
Offline Offline

Posts: 1714900265

View Profile Personal Message (Offline)

Ignore
1714900265
Reply with quote  #2

1714900265
Report to moderator
The Bitcoin network protocol was designed to be extremely flexible. It can be used to create timed transactions, escrow transactions, multi-signature transactions, etc. The current features of the client only hint at what will be possible in the future.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714900265
Hero Member
*
Offline Offline

Posts: 1714900265

View Profile Personal Message (Offline)

Ignore
1714900265
Reply with quote  #2

1714900265
Report to moderator
1714900265
Hero Member
*
Offline Offline

Posts: 1714900265

View Profile Personal Message (Offline)

Ignore
1714900265
Reply with quote  #2

1714900265
Report to moderator
1714900265
Hero Member
*
Offline Offline

Posts: 1714900265

View Profile Personal Message (Offline)

Ignore
1714900265
Reply with quote  #2

1714900265
Report to moderator
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1028



View Profile WWW
September 10, 2014, 10: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
        }
    ]
}
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 10: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
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1028



View Profile WWW
September 10, 2014, 10: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

CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 11: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
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1028



View Profile WWW
September 10, 2014, 11: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.
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 11: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....
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1028



View Profile WWW
September 10, 2014, 11: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.
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 11: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
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1028



View Profile WWW
September 10, 2014, 12:13:05 PM
 #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.
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 12:20:16 PM
 #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
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1028



View Profile WWW
September 10, 2014, 12:49:10 PM
Last edit: September 10, 2014, 01:01:37 PM by deepceleron
 #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" admin@foo.com


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.
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 12:51:03 PM
 #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
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 12:56:28 PM
 #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
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
September 10, 2014, 06: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://bitcointalk.org/index.php?topic=93845.0


And big thanks for deepceleron for sharing so much time to troubleshoot this with me! It's really appreciated!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!