<p>In my wallet that I use for testing, have <code>testnet=1</code> before the <code>[test]</code> heading in the <code>bitcoin.conf</code> file.</p>
<p>This forces both <code>bitcoind</code> and <code>bitcoin-cli</code> to look into the <code>[test]</code> section.</p>

CC BY-SA 4.0
2023-11-16T12:02:19.200Z
2023-11-16T12:02:19.200Z
alexg
<p>You need to pass <code>-testnet</code> to both the <code>bitcoind</code> and <code>bitcoin-cli</code> calls, so they know to even look into the <code>[testnet]</code> section of the config file.</p>

CC BY-SA 4.0
2023-11-03T19:21:59.687Z
2023-11-03T19:21:59.687Z
Pieter Wuille
<p>I'm trying to get Bitcoin Core to sync the testnet, but it keeps syncing the mainnet instead.</p>
<p>Here is my bitcoin.conf file:</p>
<pre><code>[test]
addnode=104.237.131.138
addnode=151.80.205.132
addnode=192.155.82.123
addnode=74.220.255.190
addnode=80.100.203.151
rpcbind=127.0.0.1
rpcport=18332
chain=test
testnet=1

debug=net

txindex=1
listen=1
listenonion=1
daemon=1

proxy=127.0.0.1:9050

server=1
rpcallowip=127.0.0.1
rpcuser=user
rpcpassword=pw

zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
</code></pre>
<p>I'm calling it like this:</p>
<pre><code>$ bitcoind -conf=./bitcoin.conf -datadir=./bitcoin-testnet/
</code></pre>
<p>But the command line tool tells me it is connected to the mainnet:</p>
<pre><code>$ bitcoin-cli -conf=./bitcoin.conf -datadir=./bitcoin-testnet/ -getinfo
Chain: main
Blocks: 0
Headers: 0
Verification progress: ▒░░░░░░░░░░░░░░░░░░░░ 0.0000%
Difficulty: 1

Network: in 0, out 3, total 3
Version: 250000
Time offset (s): 0
Proxies: n/a
Min tx relay fee rate (BTC/kvB): 0.00001000

Warnings: (none)
</code></pre>
<p>What do I need to do to sync the testnet?</p>

<bitcoin-core><testnet><bitcoin.conf>
Bitcoin Core configured for testnet, syncs mainnet
Zephyrus
# Bitcoin Core configured for testnet, syncs mainnet

(Asked by: username_0 on 2023-11-03)

I'm trying to get Bitcoin Core to sync the testnet, but it keeps syncing the mainnet instead.
Here is my bitcoin.conf file:
[test]
addnode=104.237.131.138
addnode=151.80.205.132
addnode=192.155.82.123
addnode=74.220.255.190
addnode=80.100.203.151
rpcbind=127.0.0.1
rpcport=18332
chain=test
testnet=1

debug=net

txindex=1
listen=1
listenonion=1
daemon=1

proxy=127.0.0.1:9050

server=1
rpcallowip=127.0.0.1
rpcuser=user
rpcpassword=pw

zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333

I'm calling it like this:
$ bitcoind -conf=./bitcoin.conf -datadir=./bitcoin-testnet/

But the command line tool tells me it is connected to the mainnet:
$ bitcoin-cli -conf=./bitcoin.conf -datadir=./bitcoin-testnet/ -getinfo
Chain: main
Blocks: 0
Headers: 0
Verification progress: ▒░░░░░░░░░░░░░░░░░░░░ 0.0000%
Difficulty: 1

Network: in 0, out 3, total 3
Version: 250000
Time offset (s): 0
Proxies: n/a
Min tx relay fee rate (BTC/kvB): 0.00001000

Warnings: (none)

What do I need to do to sync the testnet?

**Tags:** bitcoin-core, testnet, bitcoin.conf


---

## 2 answers

### Answer by username_2 on 2023-11-03. Score: 4 | Accepted answer

You need to pass `-testnet` to both the `bitcoind` and `bitcoin-cli` calls, so they know to even look into the `[testnet]` section of the config file.


---

### Answer by username_1 on 2023-11-16. Score: 1

In my wallet that I use for testing, have `testnet=1` before the `[test]` heading in the `bitcoin.conf` file.

This forces both `bitcoind` and `bitcoin-cli` to look into the `[test]` section.


---

