Is there a way, by using bitcoin-cli
using RPC querying, if the node I'm querying is running on MainNet or TestNet?
Thanks
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communitySince version 0.16.0
$ bitcoin-cli getblockchaininfo
{
"chain": "main",
"blocks": 525663,
"headers": 525663,
.
.
.
}
Reference: https://developer.bitcoin.org/reference/rpc/getblockchaininfo.html
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": "" }
getinfo
command deprecated in Bitcoin Core 0.16 onwards. you'll get the message the method not found
on later versions.
Nov 11, 2019 at 6:37
getblockchaininfo
as well as getnetworkinfo
and getwalletinfo
for some more information.
Nov 12, 2019 at 11:29