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

user82291: Since version 0.16.0
$ bitcoin-cli getblockchaininfo

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

}

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

user2751: 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": ""
}


2751: <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>
 82291: <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>
 2751: <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>
