The Bitcoin Core RPC interface is implicitly versioned on the major version of Bitcoin Core. Some downstream RPC consumers and clients, for example rust-bitcoincore-rpc, need to know about the underlying node version to determine the available RPC calls and how to interpret the RPC responses (e.g. https://github.com/rust-bitcoin/rust-bitcoincore-rpc/issues/355).
The current recommendation is to use the version field from the getnetworkinfo RPC call. However, this RPC call also returns, for example, the IP addresses of the node, which makes it unsuitable for 'public' access to a semi-trusted RPC consumer. With the current recommendation, getnetworkinfo needs to be whitelisted for all RPC users.
To allow RPC consumers to determine the node version and the available RPC commands and fields, a getversion RPC is introduced.
$ bitcoin-cli getversion
{
"short": "27.99.0",
"long": "v27.99.0-7adfdfca190b",
"numeric": 279900,
"client": "Satoshi",
"release_candidate": 0,
"is_release": false
}
<details> <summary>with v27.0</summary>
{
"short": "27.0.0",
"long": "v27.0.0",
"numeric": 270000,
"client": "Satoshi",
"release_candidate": 0,
"is_release": true
}
</details>
<details> <summary>with v27.0rc1</summary>
{
"short": "27.0.0",
"long": "v27.0.0rc1",
"numeric": 270000,
"client": "Satoshi",
"release_candidate": 1,
"is_release": true
}
</details>