<p>Before version 0.16.0:</p>

<pre>
$ bitcoin-cli getinfo
{
  "version": 120100,
  "protocolversion": 70012,
  "walletversion": 60000,
  "balance": 0.00000000,
  "blocks": 414105,
  "timeoffset": -165,
  "connections": 9,
  "proxy": "",
  "difficulty": 199312067531.243,
  <strong>"testnet": false,</strong>
  "keypoololdest": 1466689642,
  "keypoolsize": 101,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}
</pre>

CC BY-SA 4.0
2019-11-11T06:37:09.143Z
the `getinfo` command deprecated in Bitcoin Core 0.16 onwards. you'll get the message `the method not found` on later versions.
inherithandle
CC BY-SA 4.0
2019-11-11T08:16:30.927Z
good to know, any replacement?
knocte
CC BY-SA 4.0
2019-11-12T11:29:33.047Z
as @Kerem atam said, you can use `getblockchaininfo` as well as `getnetworkinfo` and `getwalletinfo` for some more information.
inherithandle
CC BY-SA 4.0
2016-06-28T06:34:38.317Z
2020-01-09T08:16:35.813Z
2020-01-09T08:16:35.813Z
knocte
<p>Since version 0.16.0</p>
<pre><code>$ bitcoin-cli getblockchaininfo

{
  &quot;chain&quot;: &quot;main&quot;,
  &quot;blocks&quot;: 525663,
  &quot;headers&quot;: 525663, 
  .
  .
  .

}
</code></pre>
<p>Reference:
<a href="https://developer.bitcoin.org/reference/rpc/getblockchaininfo.html" rel="nofollow noreferrer">https://developer.bitcoin.org/reference/rpc/getblockchaininfo.html</a></p>

CC BY-SA 4.0
2018-06-02T20:20:37.847Z
2021-06-16T16:07:59.127Z
2021-06-16T16:07:59.127Z
Kerem atam
<p>Is there a way, by using <code>bitcoin-cli</code> using RPC querying, if the node I'm querying is running on MainNet or TestNet?</p>

<p>Thanks</p>

<json-rpc><testnet><bitcoin-cli>
How to check if node is on TestNet or MainNet via `bitcoin-cli`?
knocte
# How to check if node is on TestNet or MainNet via `bitcoin-cli`?

(Asked by: username_0 on 2016-06-28)

Is there a way, by using `bitcoin-cli` using RPC querying, if the node I'm querying is running on MainNet or TestNet?

Thanks

**Tags:** json-rpc, testnet, bitcoin-cli


---

## 2 answers

### Answer by username_2 on 2018-06-02. Score: 6 | Accepted answer

Since version 0.16.0
$ bitcoin-cli getblockchaininfo

{
  "chain": "main",
  "blocks": 525663,
  "headers": 525663, 
  .
  .
  .

}

Reference:
https://developer.bitcoin.org/reference/rpc/getblockchaininfo.html


---

### Answer by username_0 on 2016-06-28. Score: 9

Before version 0.16.0:

$ bitcoin-cli getinfo
{
  "version": 120100,
  "protocolversion": 70012,
  "walletversion": 60000,
  "balance": 0.00000000,
  "blocks": 414105,
  "timeoffset": -165,
  "connections": 9,
  "proxy": "",
  "difficulty": 199312067531.243,
  "testnet": false,
  "keypoololdest": 1466689642,
  "keypoolsize": 101,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}

> **Comments:**
> **username_1**: the `getinfo` command deprecated in Bitcoin Core 0.16 onwards. you'll get the message `the method not found` on later versions.  
> **username_0**: good to know, any replacement?  
> **username_1**: as @username_2 said, you can use `getblockchaininfo` as well as `getnetworkinfo` and `getwalletinfo` for some more information.  

---

